Author: hboutemy Date: Thu Oct 30 08:16:19 2014 New Revision: 1635424 URL: http://svn.apache.org/r1635424 Log: fixed a lot of Checkstyle violations reported when trying updating parent pom
Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/PropertyUtils.java maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/cli/CommandLineUtils.java maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/introspection/ReflectionValueExtractor.java maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/DirectoryScanner.java maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/DirectoryWalker.java maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/FileUtils.java maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/IOUtil.java maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/Java7Support.java maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/MatchPattern.java maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/ScanConductor.java maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/SelectorUtils.java maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/WalkCollector.java maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/XmlReaderException.java maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/Xpp3DomUtils.java Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/PropertyUtils.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/PropertyUtils.java?rev=1635424&r1=1635423&r2=1635424&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/PropertyUtils.java (original) +++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/PropertyUtils.java Thu Oct 30 08:16:19 2014 @@ -19,7 +19,6 @@ package org.apache.maven.shared.utils; * under the License. */ - import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; @@ -28,6 +27,9 @@ import org.apache.maven.shared.utils.io. import javax.annotation.Nonnull; import javax.annotation.Nullable; +/** + * + */ public class PropertyUtils { Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/cli/CommandLineUtils.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/cli/CommandLineUtils.java?rev=1635424&r1=1635423&r2=1635424&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/cli/CommandLineUtils.java (original) +++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/cli/CommandLineUtils.java Thu Oct 30 08:16:19 2014 @@ -40,7 +40,6 @@ import javax.annotation.Nullable; public abstract class CommandLineUtils { - @SuppressWarnings( "UnusedDeclaration" ) public static class StringStreamConsumer implements StreamConsumer @@ -137,7 +136,8 @@ public abstract class CommandLineUtils throws CommandLineException { final CommandLineCallable future = - executeCommandLineAsCallable( cl, systemIn, systemOut, systemErr, timeoutInSeconds, runAfterProcessTermination ); + executeCommandLineAsCallable( cl, systemIn, systemOut, systemErr, timeoutInSeconds, + runAfterProcessTermination ); return future.call(); } @@ -150,8 +150,8 @@ public abstract class CommandLineUtils * @param systemErr A consumer that receives system error stream output, must be thread safe * @param timeoutInSeconds Positive integer to specify timeout, zero and negative integers for no timeout. * @param runAfterProcessTermination Optional callback to run after the process terminated or the the timeout was - * @return A CommandLineCallable that provides the process return value, see {@link Process#exitValue()}. "call" must be called on - * this to be sure the forked process has terminated, no guarantees is made about + * @return A CommandLineCallable that provides the process return value, see {@link Process#exitValue()}. "call" + * must be called on this to be sure the forked process has terminated, no guarantees is made about * any internal state before after the completion of the call statements * @throws CommandLineException or CommandLineTimeOutException if time out occurs * @noinspection ThrowableResultOfMethodCallIgnored Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/introspection/ReflectionValueExtractor.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/introspection/ReflectionValueExtractor.java?rev=1635424&r1=1635423&r2=1635424&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/introspection/ReflectionValueExtractor.java (original) +++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/introspection/ReflectionValueExtractor.java Thu Oct 30 08:16:19 2014 @@ -22,13 +22,9 @@ package org.apache.maven.shared.utils.in import java.lang.reflect.Array; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.util.Arrays; import java.util.List; import java.util.Map; -import java.util.StringTokenizer; import java.util.WeakHashMap; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import org.apache.maven.shared.utils.StringUtils; import org.apache.maven.shared.utils.introspection.MethodMap.AmbiguousException; @@ -46,295 +42,356 @@ import javax.annotation.Nullable; * @author <a href="mailto:ja...@maven.org">Jason van Zyl </a> * @author <a href="mailto:vincent.sive...@gmail.com">Vincent Siveton</a> * @version $Id$ - * @see <a href="http://struts.apache.org/1.x/struts-taglib/indexedprops.html">http://struts.apache.org/1.x/struts-taglib/indexedprops.html</a> + * @see <a href="http://struts.apache.org/1.x/struts-taglib/indexedprops.html"> + * http://struts.apache.org/1.x/struts-taglib/indexedprops.html</a> */ -public class ReflectionValueExtractor { - private static final Class<?>[] CLASS_ARGS = new Class[0]; +public class ReflectionValueExtractor +{ + private static final Class<?>[] CLASS_ARGS = new Class[0]; - private static final Object[] OBJECT_ARGS = new Object[0]; + private static final Object[] OBJECT_ARGS = new Object[0]; - /** - * Use a WeakHashMap here, so the keys (Class objects) can be garbage collected. - * This approach prevents permgen space overflows due to retention of discarded - * classloaders. - */ - private static final Map<Class<?>, ClassMap> classMaps = new WeakHashMap<Class<?>, ClassMap>(); - - - static final int EOF = -1; - - static final char PROPERTY_START = '.'; - - static final char INDEXED_START = '['; - - static final char INDEXED_END = ']'; - - static final char MAPPED_START = '('; - - static final char MAPPED_END = ')'; - - static class Tokenizer { - final String expression; - - int idx; - - public Tokenizer(String expression) { - this.expression = expression; - } - - public int peekChar() { - return idx < expression.length() ? expression.charAt(idx) : EOF; - } - - public int skipChar() { - return idx < expression.length() ? expression.charAt(idx++) : EOF; - } - - public String nextToken(char delimiter) { - int start = idx; - - while (idx < expression.length() && delimiter != expression.charAt(idx)) { - idx++; - } - - // delimiter MUST be present - if (idx <= start || idx >= expression.length()) { - return null; - } - - return expression.substring(start, idx++); - } - - public String nextPropertyName() { - final int start = idx; - - while (idx < expression.length() && Character.isJavaIdentifierPart(expression.charAt(idx))) { - idx++; - } - - // property name does not require delimiter - if (idx <= start || idx > expression.length()) { - return null; - } - - return expression.substring(start, idx); - } - - public int getPosition() { - return idx < expression.length() ? idx : EOF; - } - - // to make tokenizer look pretty in debugger - @Override - public String toString() { - return idx < expression.length() ? expression.substring(idx) : "<EOF>"; - } - } - - private ReflectionValueExtractor() { - } - - /** - * <p>The implementation supports indexed, nested and mapped properties.</p> - * <p/> - * <ul> - * <li>nested properties should be defined by a dot, i.e. "user.address.street"</li> - * <li>indexed properties (java.util.List or array instance) should be contains <code>(\\w+)\\[(\\d+)\\]</code> - * pattern, i.e. "user.addresses[1].street"</li> - * <li>mapped properties should be contains <code>(\\w+)\\((.+)\\)</code> pattern, i.e. "user.addresses(myAddress).street"</li> - * <ul> - * - * @param expression not null expression - * @param root not null object - * @return the object defined by the expression - * @throws IntrospectionException if any - */ - public static Object evaluate(@Nonnull String expression, @Nullable Object root) - throws IntrospectionException { - return evaluate(expression, root, true); - } - - /** - * <p>The implementation supports indexed, nested and mapped properties.</p> - * <p/> - * <ul> - * <li>nested properties should be defined by a dot, i.e. "user.address.street"</li> - * <li>indexed properties (java.util.List or array instance) should be contains <code>(\\w+)\\[(\\d+)\\]</code> - * pattern, i.e. "user.addresses[1].street"</li> - * <li>mapped properties should be contains <code>(\\w+)\\((.+)\\)</code> pattern, i.e. "user.addresses(myAddress).street"</li> - * <ul> - * - * @param expression not null expression - * @param root not null object - * @return the object defined by the expression - * @throws IntrospectionException if any - */ - public static Object evaluate(@Nonnull String expression, @Nullable Object root, boolean trimRootToken) - throws IntrospectionException { - Object value = root; - - // ---------------------------------------------------------------------- - // Walk the dots and retrieve the ultimate value desired from the - // MavenProject instance. - // ---------------------------------------------------------------------- - - if (StringUtils.isEmpty(expression) || !Character.isJavaIdentifierStart(expression.charAt(0))) { - return null; - } + /** + * Use a WeakHashMap here, so the keys (Class objects) can be garbage collected. + * This approach prevents permgen space overflows due to retention of discarded + * classloaders. + */ + private static final Map<Class<?>, ClassMap> classMaps = new WeakHashMap<Class<?>, ClassMap>(); + + static final int EOF = -1; + + static final char PROPERTY_START = '.'; + + static final char INDEXED_START = '['; + + static final char INDEXED_END = ']'; + + static final char MAPPED_START = '('; + + static final char MAPPED_END = ')'; + + static class Tokenizer + { + final String expression; + + int idx; + + public Tokenizer( String expression ) + { + this.expression = expression; + } + + public int peekChar() + { + return idx < expression.length() ? expression.charAt( idx ) : EOF; + } + + public int skipChar() + { + return idx < expression.length() ? expression.charAt( idx++ ) : EOF; + } + + public String nextToken( char delimiter ) + { + int start = idx; + + while ( idx < expression.length() && delimiter != expression.charAt( idx ) ) + { + idx++; + } + + // delimiter MUST be present + if ( idx <= start || idx >= expression.length() ) + { + return null; + } + + return expression.substring( start, idx++ ); + } + + public String nextPropertyName() + { + final int start = idx; + + while ( idx < expression.length() && Character.isJavaIdentifierPart( expression.charAt( idx ) ) ) + { + idx++; + } + + // property name does not require delimiter + if ( idx <= start || idx > expression.length() ) + { + return null; + } + + return expression.substring( start, idx ); + } + + public int getPosition() + { + return idx < expression.length() ? idx : EOF; + } + + // to make tokenizer look pretty in debugger + @Override + public String toString() + { + return idx < expression.length() ? expression.substring( idx ) : "<EOF>"; + } + } + + private ReflectionValueExtractor() + { + } + + /** + * <p>The implementation supports indexed, nested and mapped properties.</p> + * <p/> + * <ul> + * <li>nested properties should be defined by a dot, i.e. "user.address.street"</li> + * <li>indexed properties (java.util.List or array instance) should be contains <code>(\\w+)\\[(\\d+)\\]</code> + * pattern, i.e. "user.addresses[1].street"</li> + * <li>mapped properties should be contains <code>(\\w+)\\((.+)\\)</code> pattern, + * i.e. "user.addresses(myAddress).street"</li> + * <ul> + * + * @param expression not null expression + * @param root not null object + * @return the object defined by the expression + * @throws IntrospectionException if any + */ + public static Object evaluate( @Nonnull String expression, @Nullable Object root ) + throws IntrospectionException + { + return evaluate( expression, root, true ); + } + + /** + * <p>The implementation supports indexed, nested and mapped properties.</p> + * <p/> + * <ul> + * <li>nested properties should be defined by a dot, i.e. "user.address.street"</li> + * <li>indexed properties (java.util.List or array instance) should be contains <code>(\\w+)\\[(\\d+)\\]</code> + * pattern, i.e. "user.addresses[1].street"</li> + * <li>mapped properties should be contains <code>(\\w+)\\((.+)\\)</code> pattern, i.e. "user.addresses(myAddress).street"</li> + * <ul> + * + * @param expression not null expression + * @param root not null object + * @return the object defined by the expression + * @throws IntrospectionException if any + */ + public static Object evaluate( @Nonnull String expression, @Nullable Object root, boolean trimRootToken ) + throws IntrospectionException + { + Object value = root; + + // ---------------------------------------------------------------------- + // Walk the dots and retrieve the ultimate value desired from the + // MavenProject instance. + // ---------------------------------------------------------------------- + + if ( StringUtils.isEmpty( expression ) || !Character.isJavaIdentifierStart( expression.charAt( 0 ) ) ) + { + return null; + } boolean hasDots = expression.indexOf( PROPERTY_START ) >= 0; final Tokenizer tokenizer; - if (trimRootToken && hasDots) { - tokenizer = new Tokenizer(expression); - tokenizer.nextPropertyName(); - if (tokenizer.getPosition() == EOF) { - return null; - } - } else { - tokenizer = new Tokenizer("." + expression); - } - - int propertyPosition = tokenizer.getPosition(); - while (value != null && tokenizer.peekChar() != EOF) { - switch (tokenizer.skipChar()) { - case INDEXED_START: - value = - getIndexedValue(expression, propertyPosition, tokenizer.getPosition(), value, - tokenizer.nextToken(INDEXED_END)); - break; - case MAPPED_START: - value = - getMappedValue(expression, propertyPosition, tokenizer.getPosition(), value, - tokenizer.nextToken(MAPPED_END)); - break; - case PROPERTY_START: - propertyPosition = tokenizer.getPosition(); - value = getPropertyValue(value, tokenizer.nextPropertyName()); - break; - default: - // could not parse expression - return null; - } - } - - return value; - } - - private static Object getMappedValue(final String expression, final int from, final int to, final Object value, - final String key) - throws IntrospectionException { - if (value == null || key == null) { - return null; - } - - if (value instanceof Map) { - Object[] localParams = new Object[] { key }; - ClassMap classMap = getClassMap(value.getClass()); - try { - Method method = classMap.findMethod("get", localParams); - return method.invoke(value, localParams); - } catch (AmbiguousException e) { - throw new IntrospectionException(e); - } catch (IllegalAccessException e) { - throw new IntrospectionException(e); - } catch (InvocationTargetException e) { - throw new IntrospectionException(e.getTargetException()); - } - - } - - final String message = - String.format("The token '%s' at position '%d' refers to a java.util.Map, but the value seems is an instance of '%s'", - expression.subSequence(from, to), from, value.getClass()); - - throw new IntrospectionException(message); - } - - private static Object getIndexedValue(final String expression, final int from, final int to, final Object value, - final String indexStr) - throws IntrospectionException { - try { - int index = Integer.parseInt(indexStr); - - if (value.getClass().isArray()) { - return Array.get(value, index); - } - - if (value instanceof List) { - ClassMap classMap = getClassMap(value.getClass()); - // use get method on List interface - Object[] localParams = new Object[] { index }; - Method method = null; - try { - method = classMap.findMethod("get", localParams); - return method.invoke(value, localParams); - } catch (AmbiguousException e) { - throw new IntrospectionException(e); - } catch (IllegalAccessException e) { - throw new IntrospectionException(e); - } - } - } catch (NumberFormatException e) { - return null; - } catch (InvocationTargetException e) { - // catch array index issues gracefully, otherwise release - if (e.getCause() instanceof IndexOutOfBoundsException) { - return null; - } - - throw new IntrospectionException(e.getTargetException()); - } - - final String message = - String.format("The token '%s' at position '%d' refers to a java.util.List or an array, but the value seems is an instance of '%s'", - expression.subSequence(from, to), from, value.getClass()); - - throw new IntrospectionException(message); - } - - private static Object getPropertyValue(Object value, String property) - throws IntrospectionException { - if (value == null || property == null) { - return null; - } - - ClassMap classMap = getClassMap(value.getClass()); - String methodBase = StringUtils.capitalizeFirstLetter(property); - String methodName = "get" + methodBase; - try { - Method method = classMap.findMethod(methodName, CLASS_ARGS); - - if (method == null) { - // perhaps this is a boolean property?? - methodName = "is" + methodBase; - - method = classMap.findMethod(methodName, CLASS_ARGS); - } - - if (method == null) { - return null; - } - - return method.invoke(value, OBJECT_ARGS); - } catch (InvocationTargetException e) { - throw new IntrospectionException(e.getTargetException()); - } catch (AmbiguousException e) { - throw new IntrospectionException(e); - } catch (IllegalAccessException e) { - throw new IntrospectionException(e); + if ( trimRootToken && hasDots ) + { + tokenizer = new Tokenizer( expression ); + tokenizer.nextPropertyName(); + if ( tokenizer.getPosition() == EOF ) + { + return null; + } } + else + { + tokenizer = new Tokenizer( "." + expression ); + } + + int propertyPosition = tokenizer.getPosition(); + while ( value != null && tokenizer.peekChar() != EOF ) + { + switch ( tokenizer.skipChar() ) + { + case INDEXED_START: + value = + getIndexedValue( expression, propertyPosition, tokenizer.getPosition(), value, + tokenizer.nextToken( INDEXED_END ) ); + break; + case MAPPED_START: + value = + getMappedValue( expression, propertyPosition, tokenizer.getPosition(), value, + tokenizer.nextToken( MAPPED_END ) ); + break; + case PROPERTY_START: + propertyPosition = tokenizer.getPosition(); + value = getPropertyValue( value, tokenizer.nextPropertyName() ); + break; + default: + // could not parse expression + return null; + } + } + + return value; + } + + private static Object getMappedValue( final String expression, final int from, final int to, final Object value, + final String key ) + throws IntrospectionException + { + if ( value == null || key == null ) + { + return null; + } + + if ( value instanceof Map ) + { + Object[] localParams = new Object[] { key }; + ClassMap classMap = getClassMap( value.getClass() ); + try + { + Method method = classMap.findMethod( "get", localParams ); + return method.invoke( value, localParams ); + } + catch ( AmbiguousException e ) + { + throw new IntrospectionException( e ); + } + catch ( IllegalAccessException e ) + { + throw new IntrospectionException( e ); + } + catch ( InvocationTargetException e ) + { + throw new IntrospectionException( e.getTargetException() ); + } + + } + + final String message = + String.format( "The token '%s' at position '%d' refers to a java.util.Map, but the value " + + "seems is an instance of '%s'", expression.subSequence( from, to ), from, value.getClass() ); + + throw new IntrospectionException( message ); + } + + private static Object getIndexedValue( final String expression, final int from, final int to, final Object value, + final String indexStr ) + throws IntrospectionException + { + try + { + int index = Integer.parseInt( indexStr ); + + if ( value.getClass().isArray() ) + { + return Array.get( value, index ); + } + + if ( value instanceof List ) + { + ClassMap classMap = getClassMap( value.getClass() ); + // use get method on List interface + Object[] localParams = new Object[] { index }; + Method method = null; + try + { + method = classMap.findMethod( "get", localParams ); + return method.invoke( value, localParams ); + } + catch ( AmbiguousException e ) + { + throw new IntrospectionException( e ); + } + catch ( IllegalAccessException e ) + { + throw new IntrospectionException( e ); + } + } + } + catch ( NumberFormatException e ) + { + return null; + } + catch ( InvocationTargetException e ) + { + // catch array index issues gracefully, otherwise release + if ( e.getCause() instanceof IndexOutOfBoundsException ) + { + return null; + } + + throw new IntrospectionException( e.getTargetException() ); + } + + final String message = + String.format( "The token '%s' at position '%d' refers to a java.util.List or an array, but the value " + + "seems is an instance of '%s'", expression.subSequence( from, to ), from, value.getClass() ); + + throw new IntrospectionException( message ); } - private static ClassMap getClassMap(Class<?> clazz) { - ClassMap classMap = classMaps.get(clazz); + private static Object getPropertyValue( Object value, String property ) + throws IntrospectionException + { + if ( value == null || property == null ) + { + return null; + } - if (classMap == null) { - classMap = new ClassMap(clazz); + ClassMap classMap = getClassMap( value.getClass() ); + String methodBase = StringUtils.capitalizeFirstLetter( property ); + String methodName = "get" + methodBase; + try + { + Method method = classMap.findMethod( methodName, CLASS_ARGS ); + + if ( method == null ) + { + // perhaps this is a boolean property?? + methodName = "is" + methodBase; + + method = classMap.findMethod( methodName, CLASS_ARGS ); + } + + if ( method == null ) + { + return null; + } - classMaps.put(clazz, classMap); - } + return method.invoke( value, OBJECT_ARGS ); + } + catch ( InvocationTargetException e ) + { + throw new IntrospectionException( e.getTargetException() ); + } + catch ( AmbiguousException e ) + { + throw new IntrospectionException( e ); + } + catch ( IllegalAccessException e ) + { + throw new IntrospectionException( e ); + } + } + + private static ClassMap getClassMap( Class<?> clazz ) + { + ClassMap classMap = classMaps.get( clazz ); + + if ( classMap == null ) + { + classMap = new ClassMap( clazz ); - return classMap; - } + classMaps.put( clazz, classMap ); + } + + return classMap; + } } Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/DirectoryScanner.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/DirectoryScanner.java?rev=1635424&r1=1635423&r2=1635424&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/DirectoryScanner.java (original) +++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/DirectoryScanner.java Thu Oct 30 08:16:19 2014 @@ -407,7 +407,8 @@ public class DirectoryScanner { scanAction = scanConductor.visitDirectory( "", basedir ); - if ( ScanConductor.ScanAction.ABORT.equals( scanAction ) || ScanConductor.ScanAction.ABORT_DIRECTORY.equals( scanAction ) + if ( ScanConductor.ScanAction.ABORT.equals( scanAction ) + || ScanConductor.ScanAction.ABORT_DIRECTORY.equals( scanAction ) || ScanConductor.ScanAction.NO_RECURSE.equals( scanAction ) ) { return; @@ -631,7 +632,8 @@ public class DirectoryScanner { scanAction = scanConductor.visitDirectory( name, file ); - if ( ScanConductor.ScanAction.ABORT.equals( scanAction ) || ScanConductor.ScanAction.ABORT_DIRECTORY.equals( scanAction ) ) + if ( ScanConductor.ScanAction.ABORT.equals( scanAction ) + || ScanConductor.ScanAction.ABORT_DIRECTORY.equals( scanAction ) ) { return; } Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/DirectoryWalker.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/DirectoryWalker.java?rev=1635424&r1=1635423&r2=1635424&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/DirectoryWalker.java (original) +++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/DirectoryWalker.java Thu Oct 30 08:16:19 2014 @@ -39,27 +39,27 @@ class DirectoryWalker /** * Count of files in the directory. */ - public final int count; + private final int count; /** * Current Directory. */ - public final File dir; + private final File dir; /** * Index (or offset) within the directory count. */ - public int index; + private int index; /** * Offset for percentage calculations. Based on parent DirStackEntry. */ - public double percentageOffset; + private double percentageOffset; /** * Size of percentage space to work with. */ - public double percentageSize; + private double percentageSize; /** * Create a DirStackEntry. Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/FileUtils.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/FileUtils.java?rev=1635424&r1=1635423&r2=1635424&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/FileUtils.java (original) +++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/FileUtils.java Thu Oct 30 08:16:19 2014 @@ -752,7 +752,8 @@ public class FileUtils * @throws java.io.FileNotFoundException if <code>source</code> isn't a normal file. * @throws IllegalArgumentException if <code>destinationDirectory</code> isn't a directory. * @throws IOException if <code>source</code> does not exist, the file in - * <code>destinationDirectory</code> cannot be written to, or an IO error occurs during copying. + * <code>destinationDirectory</code> cannot be written to, or an IO error + * occurs during copying. */ public static void copyFileToDirectory( @Nonnull final File source, @Nonnull final File destinationDirectory ) throws IOException @@ -776,7 +777,8 @@ public class FileUtils * @throws java.io.FileNotFoundException if <code>source</code> isn't a normal file. * @throws IllegalArgumentException if <code>destinationDirectory</code> isn't a directory. * @throws IOException if <code>source</code> does not exist, the file in - * <code>destinationDirectory</code> cannot be written to, or an IO error occurs during copying. + * <code>destinationDirectory</code> cannot be written to, or an IO error + * occurs during copying. */ private static void copyFileToDirectoryIfModified( @Nonnull final File source, @Nonnull final File destinationDirectory ) @@ -1299,7 +1301,7 @@ public class FileUtils /* try delete the directory before its contents, which will take * care of any directories that are really symbolic links. */ - if ( deleteLegacyStyle( directory) ) + if ( deleteLegacyStyle( directory ) ) { return; } @@ -1853,7 +1855,7 @@ public class FileUtils copyFile( from, to, encoding, wrappers, false ); } - public static abstract class FilterWrapper + public abstract static class FilterWrapper { public abstract Reader getReader( Reader fileReader ); } Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/IOUtil.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/IOUtil.java?rev=1635424&r1=1635423&r2=1635424&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/IOUtil.java (original) +++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/IOUtil.java Thu Oct 30 08:16:19 2014 @@ -147,7 +147,8 @@ public final class IOUtil * * @param bufferSize Size of internal buffer to use. */ - public static void copy( @Nonnull final InputStream input, @Nonnull final OutputStream output, final int bufferSize ) + public static void copy( @Nonnull final InputStream input, @Nonnull final OutputStream output, + final int bufferSize ) throws IOException { final byte[] buffer = new byte[bufferSize]; @@ -225,7 +226,8 @@ public final class IOUtil * <a href="http://www.iana.org/assignments/character-sets">IANA * Charset Registry</a> for a list of valid encoding types. */ - public static void copy( @Nonnull final InputStream input, @Nonnull final Writer output, @Nonnull final String encoding ) + public static void copy( @Nonnull final InputStream input, @Nonnull final Writer output, + @Nonnull final String encoding ) throws IOException { final InputStreamReader in = new InputStreamReader( input, encoding ); @@ -241,7 +243,8 @@ public final class IOUtil * Charset Registry</a> for a list of valid encoding types. * @param bufferSize Size of internal buffer to use. */ - public static void copy( @Nonnull final InputStream input, @Nonnull final Writer output, @Nonnull final String encoding, final int bufferSize ) + public static void copy( @Nonnull final InputStream input, @Nonnull final Writer output, + @Nonnull final String encoding, final int bufferSize ) throws IOException { final InputStreamReader in = new InputStreamReader( input, encoding ); @@ -296,7 +299,8 @@ public final class IOUtil * Charset Registry</a> for a list of valid encoding types. * @param bufferSize Size of internal buffer to use. */ - @Nonnull public static String toString( @Nonnull final InputStream input, @Nonnull final String encoding, final int bufferSize ) + @Nonnull public static String toString( @Nonnull final InputStream input, @Nonnull final String encoding, + final int bufferSize ) throws IOException { final StringWriter sw = new StringWriter(); @@ -542,7 +546,8 @@ public final class IOUtil * Charset Registry</a> for a list of valid encoding types. * @param bufferSize Size of internal buffer to use. */ - public static void copy( @Nonnull final byte[] input, @Nonnull final Writer output, @Nonnull final String encoding, final int bufferSize ) + public static void copy( @Nonnull final byte[] input, @Nonnull final Writer output, @Nonnull final String encoding, + final int bufferSize ) throws IOException { final ByteArrayInputStream in = new ByteArrayInputStream( input ); @@ -597,7 +602,8 @@ public final class IOUtil * Charset Registry</a> for a list of valid encoding types. * @param bufferSize Size of internal buffer to use. */ - @Nonnull public static String toString( @Nonnull final byte[] input, @Nonnull final String encoding, final int bufferSize ) + @Nonnull public static String toString( @Nonnull final byte[] input, @Nonnull final String encoding, + final int bufferSize ) throws IOException { final StringWriter sw = new StringWriter(); Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/Java7Support.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/Java7Support.java?rev=1635424&r1=1635423&r2=1635424&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/Java7Support.java (original) +++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/Java7Support.java Thu Oct 30 08:16:19 2014 @@ -59,17 +59,18 @@ public class Java7Support boolean isJava7x = true; try { - Class<?> files = Thread.currentThread().getContextClassLoader().loadClass( "java.nio.file.Files" ); - Class<?> path = Thread.currentThread().getContextClassLoader().loadClass( "java.nio.file.Path" ); - Class<?> fa = Thread.currentThread().getContextClassLoader().loadClass( "java.nio.file.attribute.FileAttribute" ); - Class<?> linkOption = Thread.currentThread().getContextClassLoader().loadClass( "java.nio.file.LinkOption" ); + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + Class<?> files = cl.loadClass( "java.nio.file.Files" ); + Class<?> path = cl.loadClass( "java.nio.file.Path" ); + Class<?> fa = cl.loadClass( "java.nio.file.attribute.FileAttribute" ); + Class<?> linkOption = cl.loadClass( "java.nio.file.LinkOption" ); isSymbolicLink = files.getMethod( "isSymbolicLink", path ); delete = files.getMethod( "delete", path ); readSymlink = files.getMethod( "readSymbolicLink", path ); emptyFileAttributes = Array.newInstance( fa, 0 ); final Object o = emptyFileAttributes; - createSymlink = files.getMethod( "createSymbolicLink", path,path, o.getClass() ); + createSymlink = files.getMethod( "createSymbolicLink", path, path, o.getClass() ); emptyLinkOpts = Array.newInstance( linkOption, 0 ); exists = files.getMethod( "exists", path, emptyLinkOpts.getClass() ); toPath = File.class.getMethod( "toPath" ); @@ -149,7 +150,8 @@ public class Java7Support { try { - if (!exists( symlink )){ + if ( !exists( symlink ) ) + { Object link = toPath.invoke( symlink ); Object path = createSymlink.invoke( null, link, toPath.invoke( target ), emptyFileAttributes ); return (File) toFile.invoke( path ); @@ -163,7 +165,7 @@ public class Java7Support catch ( InvocationTargetException e ) { final Throwable targetException = e.getTargetException(); - throw (IOException)targetException; + throw (IOException) targetException; } } @@ -172,8 +174,8 @@ public class Java7Support * @param file the file to delete * @throws IOException */ - - public static void delete( @Nonnull File file ) throws IOException + public static void delete( @Nonnull File file ) + throws IOException { try { Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/MatchPattern.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/MatchPattern.java?rev=1635424&r1=1635423&r2=1635424&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/MatchPattern.java (original) +++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/MatchPattern.java Thu Oct 30 08:16:19 2014 @@ -51,12 +51,10 @@ public class MatchPattern regexPattern = SelectorUtils.isRegexPrefixedPattern( source ) ? source.substring( SelectorUtils.REGEX_HANDLER_PREFIX.length(), source.length() - SelectorUtils.PATTERN_HANDLER_SUFFIX.length() ) : null; - regexPatternRegex = regexPattern != null ? Pattern.compile( regexPattern ) : null; - this.source = - SelectorUtils.isAntPrefixedPattern( source ) ? source.substring( SelectorUtils.ANT_HANDLER_PREFIX.length(), - source.length() - - SelectorUtils.PATTERN_HANDLER_SUFFIX.length() ) - : source; + regexPatternRegex = regexPattern != null ? Pattern.compile( regexPattern ) : null; + this.source = SelectorUtils.isAntPrefixedPattern( source ) ? source.substring( + SelectorUtils.ANT_HANDLER_PREFIX.length(), + source.length() - SelectorUtils.PATTERN_HANDLER_SUFFIX.length() ) : source; this.separator = separator; tokenized = tokenizePathToString( this.source, separator ); } Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/ScanConductor.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/ScanConductor.java?rev=1635424&r1=1635423&r2=1635424&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/ScanConductor.java (original) +++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/ScanConductor.java Thu Oct 30 08:16:19 2014 @@ -19,7 +19,6 @@ package org.apache.maven.shared.utils.io * under the License. */ - import java.io.File; /** @@ -37,6 +36,9 @@ import java.io.File; */ public interface ScanConductor { + /** + * + */ public enum ScanAction { /** Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/SelectorUtils.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/SelectorUtils.java?rev=1635424&r1=1635423&r2=1635424&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/SelectorUtils.java (original) +++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/SelectorUtils.java Thu Oct 30 08:16:19 2014 @@ -787,8 +787,8 @@ public final class SelectorUtils && pattern.startsWith( ANT_HANDLER_PREFIX ) && pattern.endsWith( PATTERN_HANDLER_SUFFIX ); } - static boolean matchAntPathPattern( @Nonnull MatchPattern matchPattern, @Nonnull String str, @Nonnull String separator, - boolean isCaseSensitive ) + static boolean matchAntPathPattern( @Nonnull MatchPattern matchPattern, @Nonnull String str, + @Nonnull String separator, boolean isCaseSensitive ) { if ( separatorPatternStartSlashMismatch( matchPattern, str, separator ) ) { Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/WalkCollector.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/WalkCollector.java?rev=1635424&r1=1635423&r2=1635424&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/WalkCollector.java (original) +++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/io/WalkCollector.java Thu Oct 30 08:16:19 2014 @@ -23,6 +23,9 @@ import java.io.File; import java.util.ArrayList; import java.util.List; +/** + * + */ public class WalkCollector implements DirectoryWalkListener { Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/XmlReaderException.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/XmlReaderException.java?rev=1635424&r1=1635423&r2=1635424&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/XmlReaderException.java (original) +++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/XmlReaderException.java Thu Oct 30 08:16:19 2014 @@ -36,17 +36,17 @@ import java.io.InputStream; class XmlReaderException extends IOException { - private final String _bomEncoding; + private final String bomEncoding; - private final String _xmlGuessEncoding; + private final String xmlGuessEncoding; - private final String _xmlEncoding; + private final String xmlEncoding; - private final String _contentTypeMime; + private final String contentTypeMime; - private final String _contentTypeEncoding; + private final String contentTypeEncoding; - private final InputStream _is; + private final InputStream is; /** * Creates an exception instance if the charset encoding could not be determined. @@ -83,12 +83,12 @@ class XmlReaderException String xmlEnc, InputStream is ) { super( msg ); - _contentTypeMime = ctMime; - _contentTypeEncoding = ctEnc; - _bomEncoding = bomEnc; - _xmlGuessEncoding = xmlGuessEnc; - _xmlEncoding = xmlEnc; - _is = is; + contentTypeMime = ctMime; + contentTypeEncoding = ctEnc; + bomEncoding = bomEnc; + xmlGuessEncoding = xmlGuessEnc; + xmlEncoding = xmlEnc; + this.is = is; } /** @@ -99,7 +99,7 @@ class XmlReaderException */ public String getBomEncoding() { - return _bomEncoding; + return bomEncoding; } /** @@ -110,7 +110,7 @@ class XmlReaderException */ public String getXmlGuessEncoding() { - return _xmlGuessEncoding; + return xmlGuessEncoding; } /** @@ -121,7 +121,7 @@ class XmlReaderException */ public String getXmlEncoding() { - return _xmlEncoding; + return xmlEncoding; } /** @@ -133,7 +133,7 @@ class XmlReaderException */ public String getContentTypeMime() { - return _contentTypeMime; + return contentTypeMime; } /** @@ -145,7 +145,7 @@ class XmlReaderException */ public String getContentTypeEncoding() { - return _contentTypeEncoding; + return contentTypeEncoding; } /** @@ -157,6 +157,6 @@ class XmlReaderException */ public InputStream getInputStream() { - return _is; + return is; } } Modified: maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/Xpp3DomUtils.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/Xpp3DomUtils.java?rev=1635424&r1=1635423&r2=1635424&view=diff ============================================================================== --- maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/Xpp3DomUtils.java (original) +++ maven/shared/trunk/maven-shared-utils/src/main/java/org/apache/maven/shared/utils/xml/Xpp3DomUtils.java Thu Oct 30 08:16:19 2014 @@ -24,6 +24,9 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +/** + * + */ public class Xpp3DomUtils { public static Xpp3Dom mergeXpp3Dom( Xpp3Dom dominant, Xpp3Dom recessive, Boolean childMergeOverride )