Author: olamy Date: Sun Jan 9 18:09:41 2011 New Revision: 1056992 URL: http://svn.apache.org/viewvc?rev=1056992&view=rev Log: [SCM-591] Move to Java 1.5 : fix some generics warning in bazaar provider
Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/main/java/org/apache/maven/scm/provider/bazaar/BazaarScmProvider.java maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/main/java/org/apache/maven/scm/provider/bazaar/BazaarUtils.java maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/main/java/org/apache/maven/scm/provider/bazaar/command/BazaarConsumer.java maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/BazaarRepoUtils.java maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/command/blame/BazaarBlameCommandTckTest.java maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/command/changelog/BazaarChangeLogConsumerTest.java maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/pom.xml Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/main/java/org/apache/maven/scm/provider/bazaar/BazaarScmProvider.java URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/main/java/org/apache/maven/scm/provider/bazaar/BazaarScmProvider.java?rev=1056992&r1=1056991&r2=1056992&view=diff ============================================================================== --- maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/main/java/org/apache/maven/scm/provider/bazaar/BazaarScmProvider.java (original) +++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/main/java/org/apache/maven/scm/provider/bazaar/BazaarScmProvider.java Sun Jan 9 18:09:41 2011 @@ -97,10 +97,10 @@ public class BazaarScmProvider } /** {...@inheritdoc} */ - public List validateScmUrl( String scmSpecificUrl, char delimiter ) + public List<String> validateScmUrl( String scmSpecificUrl, char delimiter ) { - List errorMessages = new ArrayList(); + List<String> errorMessages = new ArrayList<String>(); String[] checkCmd = new String[]{BazaarConstants.CHECK, scmSpecificUrl}; ScmResult result; Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/main/java/org/apache/maven/scm/provider/bazaar/BazaarUtils.java URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/main/java/org/apache/maven/scm/provider/bazaar/BazaarUtils.java?rev=1056992&r1=1056991&r2=1056992&view=diff ============================================================================== --- maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/main/java/org/apache/maven/scm/provider/bazaar/BazaarUtils.java (original) +++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/main/java/org/apache/maven/scm/provider/bazaar/BazaarUtils.java Sun Jan 9 18:09:41 2011 @@ -48,12 +48,12 @@ public class BazaarUtils /** * Map between command and its valid exit codes */ - private static final Map EXITCODEMAP = new HashMap(); + private static final Map<String,List<Integer>> EXITCODEMAP = new HashMap<String,List<Integer>>(); /** * Default exit codes for entries not in exitCodeMap */ - private static final List DEFAULTEEXITCODES = new ArrayList(); + private static final List<Integer> DEFAULTEEXITCODES = new ArrayList<Integer>(); /** Setup exit codes*/ static @@ -61,10 +61,10 @@ public class BazaarUtils DEFAULTEEXITCODES.add( new Integer( 0 ) ); //Diff is different - List diffExitCodes = new ArrayList(); - diffExitCodes.add( new Integer( 0 ) ); //No difference - diffExitCodes.add( new Integer( 1 ) ); //Conflicts in merge-like or changes in diff-like - diffExitCodes.add( new Integer( 2 ) ); //Unrepresentable diff changes + List<Integer> diffExitCodes = new ArrayList<Integer>(); + diffExitCodes.add( Integer.valueOf( 0 ) ); //No difference + diffExitCodes.add( Integer.valueOf( 1 ) ); //Conflicts in merge-like or changes in diff-like + diffExitCodes.add( Integer.valueOf( 2 ) ); //Unrepresentable diff changes EXITCODEMAP.put( BazaarConstants.DIFF_CMD, diffExitCodes ); } @@ -84,10 +84,10 @@ public class BazaarUtils int exitCode = executeCmd( consumer, cmd ); //Return result - List exitCodes = DEFAULTEEXITCODES; + List<Integer> exitCodes = DEFAULTEEXITCODES; if ( EXITCODEMAP.containsKey( cmdAndArgs[0] ) ) { - exitCodes = (List) EXITCODEMAP.get( cmdAndArgs[0] ); + exitCodes = EXITCODEMAP.get( cmdAndArgs[0] ); } boolean success = exitCodes.contains( new Integer( exitCode ) ); @@ -172,16 +172,16 @@ public class BazaarUtils public static String[] expandCommandLine( String[] cmdAndArgs, ScmFileSet additionalFiles ) { - File[] files = additionalFiles.getFiles(); - String[] cmd = new String[files.length + cmdAndArgs.length]; + List<File> files = additionalFiles.getFileList(); + String[] cmd = new String[files.size() + cmdAndArgs.length]; // Copy command into array System.arraycopy( cmdAndArgs, 0, cmd, 0, cmdAndArgs.length ); // Add files as additional parameter into the array - for ( int i = 0; i < files.length; i++ ) + for ( int i = 0; i < files.size(); i++ ) { - String file = files[i].getPath().replace( '\\', File.separatorChar ); + String file = files.get( i ).getPath().replace( '\\', File.separatorChar ); cmd[i + cmdAndArgs.length] = file; } Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/main/java/org/apache/maven/scm/provider/bazaar/command/BazaarConsumer.java URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/main/java/org/apache/maven/scm/provider/bazaar/command/BazaarConsumer.java?rev=1056992&r1=1056991&r2=1056992&view=diff ============================================================================== --- maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/main/java/org/apache/maven/scm/provider/bazaar/command/BazaarConsumer.java (original) +++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/main/java/org/apache/maven/scm/provider/bazaar/command/BazaarConsumer.java Sun Jan 9 18:09:41 2011 @@ -45,12 +45,12 @@ public class BazaarConsumer /** * A list of known keywords from bazaar */ - private static final Map IDENTIFIERS = new HashMap(); + private static final Map<String,ScmFileStatus> IDENTIFIERS = new HashMap<String,ScmFileStatus>(); /** * A list of known message prefixes from bazaar */ - private static final Map MESSAGES = new HashMap(); + private static final Map<String,String> MESSAGES = new HashMap<String,String>(); /** * Number of lines to keep from Std.Err @@ -62,7 +62,7 @@ public class BazaarConsumer /** * A list of the MAX_STDERR_SIZE last errors or warnings. */ - private final List stderr = new ArrayList(); + private final List<String> stderr = new ArrayList<String>(); static { @@ -127,19 +127,19 @@ public class BazaarConsumer */ public String getStdErr() { - String str = ""; - for ( Iterator it = stderr.iterator(); it.hasNext(); ) + StringBuilder str = new StringBuilder(); + for ( Iterator<String> it = stderr.iterator(); it.hasNext(); ) { - str += it.next(); + str.append( it.next() ); } - return str; + return str.toString(); } private static String processInputForKnownIdentifiers( String line ) { - for ( Iterator it = IDENTIFIERS.keySet().iterator(); it.hasNext(); ) + for ( Iterator<String> it = IDENTIFIERS.keySet().iterator(); it.hasNext(); ) { - String id = (String) it.next(); + String id = it.next(); if ( line.startsWith( id ) ) { return id; @@ -150,9 +150,9 @@ public class BazaarConsumer private boolean processInputForKnownMessages( String line ) { - for ( Iterator it = MESSAGES.keySet().iterator(); it.hasNext(); ) + for ( Iterator<String> it = MESSAGES.keySet().iterator(); it.hasNext(); ) { - String prefix = (String) it.next(); + String prefix = it.next(); if ( line.startsWith( prefix ) ) { stderr.add( line ); //Add line Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/BazaarRepoUtils.java URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/BazaarRepoUtils.java?rev=1056992&r1=1056991&r2=1056992&view=diff ============================================================================== --- maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/BazaarRepoUtils.java (original) +++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/BazaarRepoUtils.java Sun Jan 9 18:09:41 2011 @@ -33,7 +33,7 @@ import java.util.List; /** * Common code used in all tests. * - * @author <a href="mailto:torbj...@smorgrav.org">Torbjørn Eikli Smørgrav</a> + * @author <a href="mailto:torbj...@smorgrav.org">Torbj�rn Eikli Sm�rgrav</a> */ public class BazaarRepoUtils extends PlexusTestCase @@ -82,7 +82,7 @@ public class BazaarRepoUtils BazaarUtils.execute( WORKING_DIR, init_cmd ); // Create and add files to repository - List files = new ArrayList(); + List<File> files = new ArrayList<File>(); for ( int i = 0; i < filesInTestBranch.length; i++ ) { File file = new File( WORKING_DIR.getAbsolutePath(), filesInTestBranch[i] ); Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/command/blame/BazaarBlameCommandTckTest.java URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/command/blame/BazaarBlameCommandTckTest.java?rev=1056992&r1=1056991&r2=1056992&view=diff ============================================================================== --- maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/command/blame/BazaarBlameCommandTckTest.java (original) +++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/command/blame/BazaarBlameCommandTckTest.java Sun Jan 9 18:09:41 2011 @@ -51,9 +51,9 @@ public class BazaarBlameCommandTckTest protected void verifyResult( BlameScmResult result ) { - List lines = result.getLines(); + List<BlameLine> lines = result.getLines(); assertEquals( "Expected 1 line in blame", 1, lines.size() ); - BlameLine line = (BlameLine) lines.get( 0 ); + BlameLine line = lines.get( 0 ); assertEquals( "1", line.getRevision() ); } } Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/command/changelog/BazaarChangeLogConsumerTest.java URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/command/changelog/BazaarChangeLogConsumerTest.java?rev=1056992&r1=1056991&r2=1056992&view=diff ============================================================================== --- maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/command/changelog/BazaarChangeLogConsumerTest.java (original) +++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-bazaar/src/test/java/org/apache/maven/scm/provider/bazaar/command/changelog/BazaarChangeLogConsumerTest.java Sun Jan 9 18:09:41 2011 @@ -19,9 +19,6 @@ package org.apache.maven.scm.provider.ba * under the License. */ -import org.apache.maven.scm.ScmTestCase; -import org.apache.maven.scm.log.DefaultLog; - import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -29,6 +26,10 @@ import java.io.IOException; import java.io.InputStreamReader; import java.util.List; +import org.apache.maven.scm.ChangeSet; +import org.apache.maven.scm.ScmTestCase; +import org.apache.maven.scm.log.DefaultLog; + public class BazaarChangeLogConsumerTest extends ScmTestCase { @@ -48,7 +49,7 @@ public class BazaarChangeLogConsumerTest s = in.readLine(); } - List mods = consumer.getModifications(); + List<ChangeSet> mods = consumer.getModifications(); assertEquals( 4, mods.size() ); } } Modified: maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/pom.xml URL: http://svn.apache.org/viewvc/maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/pom.xml?rev=1056992&r1=1056991&r2=1056992&view=diff ============================================================================== --- maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/pom.xml (original) +++ maven/scm/trunk/maven-scm-providers/maven-scm-provider-clearcase/pom.xml Sun Jan 9 18:09:41 2011 @@ -70,6 +70,7 @@ </executions> <configuration> <version>1.1.0</version> + <useJava5>true</useJava5> <models> <model>src/main/mdo/clearcase-settings.mdo</model> </models>