You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kr...@apache.org on 2014/10/17 18:25:19 UTC
svn commit: r1632627 - in /maven/shared/trunk/maven-filtering/src:
main/java/org/apache/maven/shared/filtering/
test/java/org/apache/maven/shared/filtering/
Author: krosenvold
Date: Fri Oct 17 16:25:19 2014
New Revision: 1632627
URL: http://svn.apache.org/r1632627
Log:
Fixed style issues
Modified:
maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/FilteringUtils.java
maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/InterpolatorFilterReaderLineEnding.java
maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEnding.java
maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java
maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/EscapeStringTest.java
maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/IncrementalResourceFilteringTest.java
Modified: maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java?rev=1632627&r1=1632626&r2=1632627&view=diff
==============================================================================
--- maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java (original)
+++ maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFiltering.java Fri Oct 17 16:25:19 2014
@@ -182,8 +182,8 @@ public class DefaultMavenResourcesFilter
if ( getLogger().isDebugEnabled() )
{
String ls = System.getProperty( "line.separator" );
- StringBuffer debugMessage =
- new StringBuffer( "resource with targetPath " ).append( resource.getTargetPath() ).append( ls );
+ StringBuilder debugMessage =
+ new StringBuilder( "resource with targetPath " ).append( resource.getTargetPath() ).append( ls );
debugMessage.append( "directory " ).append( resource.getDirectory() ).append( ls );
debugMessage.append( "excludes " ).append( resource.getExcludes() == null ? " empty "
: resource.getExcludes().toString() ).append( ls );
Modified: maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/FilteringUtils.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/FilteringUtils.java?rev=1632627&r1=1632626&r2=1632627&view=diff
==============================================================================
--- maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/FilteringUtils.java (original)
+++ maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/FilteringUtils.java Fri Oct 17 16:25:19 2014
@@ -48,7 +48,7 @@ public final class FilteringUtils
if ( !StringUtils.isEmpty( val ) && PATTERN.matcher( val ).matches() )
{
// Adapted from StringUtils.replace in plexus-utils to accommodate pre-escaped backslashes.
- StringBuffer buf = new StringBuffer( val.length() );
+ StringBuilder buf = new StringBuilder( val.length() );
int start = 0, end = 0;
while ( ( end = val.indexOf( '\\', start ) ) != -1 )
{
Modified: maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/InterpolatorFilterReaderLineEnding.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/InterpolatorFilterReaderLineEnding.java?rev=1632627&r1=1632626&r2=1632627&view=diff
==============================================================================
--- maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/InterpolatorFilterReaderLineEnding.java (original)
+++ maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/InterpolatorFilterReaderLineEnding.java Fri Oct 17 16:25:19 2014
@@ -232,7 +232,7 @@ public class InterpolatorFilterReaderLin
boolean inEscape = ( useEscape && ch == escapeString.charAt( 0 ) );
- StringBuffer key = new StringBuffer();
+ StringBuilder key = new StringBuilder();
// have we found an escape string?
if ( inEscape )
Modified: maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEnding.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEnding.java?rev=1632627&r1=1632626&r2=1632627&view=diff
==============================================================================
--- maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEnding.java (original)
+++ maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEnding.java Fri Oct 17 16:25:19 2014
@@ -251,7 +251,7 @@ public class MultiDelimiterInterpolatorF
boolean inEscape = ( useEscape && ch == escapeString.charAt( 0 ) );
- StringBuffer key = new StringBuffer();
+ StringBuilder key = new StringBuilder();
// have we found an escape string?
if ( inEscape )
Modified: maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java?rev=1632627&r1=1632626&r2=1632627&view=diff
==============================================================================
--- maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java (original)
+++ maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/PropertyUtils.java Fri Oct 17 16:25:19 2014
@@ -87,9 +87,9 @@ public final class PropertyUtils
// as can be verified by replacing the implementation of #loadPropertyFile(File, boolean, boolean)
// with the commented variant I have provided that reuses this method.
- for ( Iterator<Object> iter = fileProps.keySet().iterator(); iter.hasNext(); )
+ for ( Object o : fileProps.keySet() )
{
- final String k = (String) iter.next();
+ final String k = (String) o;
final String propValue = getPropertyValue( k, combinedProps );
fileProps.setProperty( k, propValue );
}
Modified: maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java?rev=1632627&r1=1632626&r2=1632627&view=diff
==============================================================================
--- maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java (original)
+++ maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenResourcesFilteringTest.java Fri Oct 17 16:25:19 2014
@@ -48,6 +48,7 @@ public class DefaultMavenResourcesFilter
File outputDirectory = new File( getBasedir(), "target/DefaultMavenResourcesFilteringTest" );
+ @SuppressWarnings( "ResultOfMethodCallIgnored" )
protected void setUp()
throws Exception
{
@@ -221,6 +222,7 @@ public class DefaultMavenResourcesFilter
assertFiltering( baseDir, initialImageFile, true, true );
}
+ @SuppressWarnings( "ConstantConditions" )
private void assertFiltering( File baseDir, File initialImageFile, boolean escapeTest, boolean additionnalProperties )
throws Exception
{
@@ -484,6 +486,7 @@ public class DefaultMavenResourcesFilter
mavenResourcesFiltering.filterResources( mavenResourcesExecution );
File[] files = outputDirectory.listFiles();
+ assertNotNull( files);
assertEquals( 2, files.length );
File includeFile = new File( outputDirectory, "includefile.txt" );
assertTrue( includeFile.exists() );
@@ -650,11 +653,11 @@ public class DefaultMavenResourcesFilter
mavenResourcesFiltering.filterResources( mavenResourcesExecution );
File[] childs = outputDirectory.listFiles();
+ assertNotNull( childs );
assertEquals( 3, childs.length );
- for ( int i = 0, size = childs.length; i < size; i++ )
+ for ( File file : childs )
{
- File file = childs[i];
if ( file.getName().endsWith( "dir1" ) || file.getName().endsWith( "empty-directory" )
|| file.getName().endsWith( "empty-directory-child" ) )
{
Modified: maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/EscapeStringTest.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/EscapeStringTest.java?rev=1632627&r1=1632626&r2=1632627&view=diff
==============================================================================
--- maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/EscapeStringTest.java (original)
+++ maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/EscapeStringTest.java Fri Oct 17 16:25:19 2014
@@ -95,8 +95,10 @@ public class EscapeStringTest
String content = IOUtil.toString( new FileInputStream( new File( outputDirectory, "content.xml" ) ) );
System.out.println( "content " + content );
- assertTrue( content.indexOf( "<broken-tag>Content with replacement: I am the replacement !</broken-tag>" ) >= 0 );
- assertTrue( content.indexOf( "<broken-tag>Content with escaped replacement: Do not ${replaceThis} !</broken-tag>" ) >= 0 );
+ assertTrue(
+ content.contains( "<broken-tag>Content with replacement: I am the replacement !</broken-tag>" ) );
+ assertTrue( content.contains(
+ "<broken-tag>Content with escaped replacement: Do not ${replaceThis} !</broken-tag>" ) );
}
finally
{
Modified: maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/IncrementalResourceFilteringTest.java
URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/IncrementalResourceFilteringTest.java?rev=1632627&r1=1632626&r2=1632627&view=diff
==============================================================================
--- maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/IncrementalResourceFilteringTest.java (original)
+++ maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/IncrementalResourceFilteringTest.java Fri Oct 17 16:25:19 2014
@@ -45,7 +45,7 @@ public class IncrementalResourceFilterin
File unitDirectory = new File( getBasedir(), "src/test/units-files/incremental" );
- protected void setUp()
+ @SuppressWarnings( "ResultOfMethodCallIgnored" ) protected void setUp()
throws Exception
{
super.setUp();
@@ -78,10 +78,6 @@ public class IncrementalResourceFilterin
assertTrue( ctx.getRefreshFiles().contains( new File( outputDirectory, "file01.txt" ) ) );
- // one file is expected to be deleted
- Set<String> deletedFiles = new HashSet<String>();
- deletedFiles.add( "file01.txt" );
-
ctx = new TestIncrementalBuildContext( unitDirectory, new HashSet(), changedFiles, new HashMap() );
ThreadBuildContext.setThreadBuildContext( ctx );
@@ -175,7 +171,7 @@ public class IncrementalResourceFilterin
}
private void filter( String time )
- throws Exception, MavenFilteringException
+ throws Exception
{
File baseDir = new File( getBasedir() );
StubMavenProject mavenProject = new StubMavenProject( baseDir );
@@ -202,7 +198,7 @@ public class IncrementalResourceFilterin
filtersFile.add( new File( unitDirectory, "filters.txt" ).getPath() );
mavenResourcesFiltering.filterResources( resources, outputDirectory, mavenProject, "UTF-8", filtersFile,
- new ArrayList(), new StubMavenSession() );
+ new ArrayList<String>(), new StubMavenSession() );
}
}