Return-Path: X-Original-To: apmail-maven-commits-archive@www.apache.org Delivered-To: apmail-maven-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 26AD217FFE for ; Fri, 17 Oct 2014 15:37:20 +0000 (UTC) Received: (qmail 41256 invoked by uid 500); 17 Oct 2014 15:37:19 -0000 Delivered-To: apmail-maven-commits-archive@maven.apache.org Received: (qmail 41194 invoked by uid 500); 17 Oct 2014 15:37:19 -0000 Mailing-List: contact commits-help@maven.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@maven.apache.org Delivered-To: mailing list commits@maven.apache.org Received: (qmail 41184 invoked by uid 99); 17 Oct 2014 15:37:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Oct 2014 15:37:19 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Oct 2014 15:37:14 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B82C82388993; Fri, 17 Oct 2014 15:36:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1632611 [1/2] - in /maven/shared/trunk/maven-filtering/src: main/java/org/apache/maven/shared/filtering/ test/java/org/apache/maven/shared/filtering/ Date: Fri, 17 Oct 2014 15:36:53 -0000 To: commits@maven.apache.org From: khmarbaise@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20141017153654.B82C82388993@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: khmarbaise Date: Fri Oct 17 15:36:52 2014 New Revision: 1632611 URL: http://svn.apache.org/r1632611 Log: [MSHARED-367] - Fixed serveral checkstyle reported problems. Modified: maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/AbstractMavenFilteringRequest.java maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/BaseFilter.java maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/BoundedReader.java maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/DefaultFilterInfo.java maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/DefaultMavenReaderFilter.java 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/MavenFileFilter.java maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenFileFilterRequest.java maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenFilteringException.java maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenReaderFilter.java maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenReaderFilterRequest.java maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenResourcesExecution.java maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.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/AbstractInterpolatorFilterReaderLineEndingTest.java maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/BoundedReaderTest.java maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenFileFilterTest.java maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/DefaultMavenReaderFilterTest.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/FilteringUtilsTest.java maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/InterpolatorFilterReaderLineEndingTest.java maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/InvalidMarkTest.java maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/MuliLinesMavenResourcesFilteringTest.java maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/MultiDelimiterInterpolatorFilterReaderLineEndingTest.java maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/StubMavenProject.java maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/StubMavenSession.java maven/shared/trunk/maven-filtering/src/test/java/org/apache/maven/shared/filtering/TestReflectionProperties.java Modified: maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/AbstractMavenFilteringRequest.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/AbstractMavenFilteringRequest.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/AbstractMavenFilteringRequest.java (original) +++ maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/AbstractMavenFilteringRequest.java Fri Oct 17 15:36:52 2014 @@ -43,7 +43,7 @@ public class AbstractMavenFilteringReque private MavenSession mavenSession; - /** + /** * List of Strings considered as expressions which contains values in the project/pom: * pom project * Default value will be pom and project. @@ -51,7 +51,7 @@ public class AbstractMavenFilteringReque * @since 1.0-beta-2 */ private List projectStartExpressions = new ArrayList(); - + /** * String which will escape interpolation mechanism: * foo \${foo.bar} -> foo ${foo.bar} @@ -59,17 +59,17 @@ public class AbstractMavenFilteringReque * @since 1.0-beta-2 */ private String escapeString; - + /** * @since 1.0-beta-3 */ private Properties additionalProperties; - + /** * @since 1.0-beta-3 */ private boolean injectProjectBuildFilters = false; - + /** * Set of expression delimiter specifications to use during filtering. Delimiter specifications are * given in the form 'BEGIN*END' or, for symmetrical delimiters, simply 'TOKEN'. The default @@ -78,21 +78,24 @@ public class AbstractMavenFilteringReque * @since 1.0-beta-3 */ private LinkedHashSet delimiters = new LinkedHashSet(); - + /** * Do not stop trying to filter tokens when reaching EOL. * * @since 1.0 */ private boolean supportMultiLineFiltering; - + protected AbstractMavenFilteringRequest() { initDefaults(); } - protected AbstractMavenFilteringRequest( MavenProject mavenProject, List filters, - String encoding, MavenSession mavenSession ) + protected AbstractMavenFilteringRequest( + MavenProject mavenProject, + List filters, + String encoding, + MavenSession mavenSession ) { initDefaults(); this.mavenProject = mavenProject; @@ -105,7 +108,7 @@ public class AbstractMavenFilteringReque { projectStartExpressions.add( "pom" ); projectStartExpressions.add( "project" ); - + delimiters.add( "${*}" ); delimiters.add( "@" ); } @@ -155,12 +158,12 @@ public class AbstractMavenFilteringReque { this.escapeWindowsPaths = escapedBackslashesInFilePath; } - + public boolean isEscapedBackslashesInFilePath() { return isEscapeWindowsPaths(); } - + public void setEscapedBackslashesInFilePath( boolean escape ) { setEscapeWindowsPaths( escape ); @@ -234,7 +237,7 @@ public class AbstractMavenFilteringReque { this.escapeString = escapeString; } - + /** * @since 1.0-beta-2 */ Modified: maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/BaseFilter.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/BaseFilter.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/BaseFilter.java (original) +++ maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/BaseFilter.java Fri Oct 17 15:36:52 2014 @@ -22,289 +22,309 @@ package org.apache.maven.shared.filterin import java.io.File; import java.io.IOException; import java.io.Reader; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Properties; + +import javax.annotation.Nonnull; import org.apache.maven.execution.MavenSession; import org.apache.maven.project.MavenProject; import org.apache.maven.settings.Settings; import org.apache.maven.shared.utils.StringUtils; import org.apache.maven.shared.utils.io.FileUtils; -import org.codehaus.plexus.interpolation.*; +import org.codehaus.plexus.interpolation.InterpolationPostProcessor; +import org.codehaus.plexus.interpolation.PrefixAwareRecursionInterceptor; +import org.codehaus.plexus.interpolation.PrefixedObjectValueSource; +import org.codehaus.plexus.interpolation.PropertiesBasedValueSource; +import org.codehaus.plexus.interpolation.RecursionInterceptor; +import org.codehaus.plexus.interpolation.SimpleRecursionInterceptor; +import org.codehaus.plexus.interpolation.SingleResponseValueSource; +import org.codehaus.plexus.interpolation.ValueSource; import org.codehaus.plexus.interpolation.multi.MultiDelimiterStringSearchInterpolator; import org.codehaus.plexus.logging.AbstractLogEnabled; -import javax.annotation.Nonnull; - -class BaseFilter extends AbstractLogEnabled implements DefaultFilterInfo { - - - /** - * @see org.apache.maven.shared.filtering.MavenFileFilter#getDefaultFilterWrappers(org.apache.maven.project.MavenProject, java.util.List, boolean, org.apache.maven.execution.MavenSession) - * @deprecated - */ - public List getDefaultFilterWrappers( final MavenProject mavenProject, - List filters, - final boolean escapedBackslashesInFilePath, - MavenSession mavenSession ) - throws MavenFilteringException - { - return getDefaultFilterWrappers( mavenProject, filters, escapedBackslashesInFilePath, mavenSession, null ); - } - - - @Nonnull public List getDefaultFilterWrappers( final MavenProject mavenProject, List filters, - final boolean escapedBackslashesInFilePath, - MavenSession mavenSession, - MavenResourcesExecution mavenResourcesExecution ) - throws MavenFilteringException - { - - MavenResourcesExecution mre = - mavenResourcesExecution == null ? new MavenResourcesExecution() : mavenResourcesExecution.copyOf(); - - mre.setMavenProject( mavenProject ); - mre.setMavenSession( mavenSession ); - mre.setFilters( filters ); - mre.setEscapedBackslashesInFilePath( escapedBackslashesInFilePath ); - - return getDefaultFilterWrappers( mre ); - - } - - @Nonnull public List getDefaultFilterWrappers( final AbstractMavenFilteringRequest req ) - throws MavenFilteringException - { - // backup values - boolean supportMultiLineFiltering = req.isSupportMultiLineFiltering(); - - // compensate for null parameter value. - final AbstractMavenFilteringRequest request = req == null ? new MavenFileFilterRequest() : req; - - request.setSupportMultiLineFiltering( supportMultiLineFiltering ); - - // Here we build some properties which will be used to read some properties files - // to interpolate the expression ${ } in this properties file - - // Take a copy of filterProperties to ensure that evaluated filterTokens are not propagated - // to subsequent filter files. Note: this replicates current behaviour and seems to make sense. - - final Properties baseProps = new Properties(); - - // Project properties - if ( request.getMavenProject() != null ) - { - baseProps.putAll( request.getMavenProject().getProperties() == null - ? Collections.emptyMap() - : request.getMavenProject().getProperties() ); - } - // TODO this is NPE free but do we consider this as normal - // or do we have to throw an MavenFilteringException with mavenSession cannot be null - if ( request.getMavenSession() != null ) - { - // execution properties wins - baseProps.putAll( request.getMavenSession().getExecutionProperties() ); - } - - // now we build properties to use for resources interpolation - - final Properties filterProperties = new Properties(); - - File basedir = request.getMavenProject() != null ? request.getMavenProject().getBasedir() : new File( "." ); - - loadProperties( filterProperties, basedir, request.getFileFilters(), baseProps ); - if ( filterProperties.size() < 1 ) - { - filterProperties.putAll( baseProps ); - } - - if ( request.getMavenProject() != null ) - { - if ( request.isInjectProjectBuildFilters() ) - { - @SuppressWarnings( "unchecked" ) - List buildFilters = new ArrayList( request.getMavenProject().getBuild().getFilters() ); - - // JDK-8015656: (coll) unexpected NPE from removeAll - if ( request.getFileFilters() != null ) - { - buildFilters.removeAll( request.getFileFilters() ); - } - - loadProperties( filterProperties, basedir, buildFilters, baseProps ); - } - - // Project properties - filterProperties.putAll( request.getMavenProject().getProperties() == null - ? Collections.emptyMap() - : request.getMavenProject().getProperties() ); - } - if ( request.getMavenSession() != null ) - { - // execution properties wins - filterProperties.putAll( request.getMavenSession().getExecutionProperties() ); - } - - if ( request.getAdditionalProperties() != null ) - { - // additional properties wins - filterProperties.putAll( request.getAdditionalProperties() ); - } - - List defaultFilterWrappers = request == null - ? new ArrayList( 1 ) - : new ArrayList( request.getDelimiters().size() + 1 ); - - if ( getLogger().isDebugEnabled() ) - { - getLogger().debug( "properties used " + filterProperties ); - } - - final ValueSource propertiesValueSource = new PropertiesBasedValueSource( filterProperties ); - - if ( request != null ) - { - FileUtils.FilterWrapper wrapper = - new Wrapper( request.getDelimiters(), request.getMavenProject(), request.getMavenSession(), - propertiesValueSource, request.getProjectStartExpressions(), request.getEscapeString(), - request.isEscapeWindowsPaths(), request.isSupportMultiLineFiltering() ); - - defaultFilterWrappers.add( wrapper ); - } - - return defaultFilterWrappers; - } - - /** - * default visibility only for testing reason ! - */ - void loadProperties( Properties filterProperties, File basedir, List propertiesFilePaths, Properties baseProps ) - throws MavenFilteringException - { - if ( propertiesFilePaths != null ) - { - Properties workProperties = new Properties(); - workProperties.putAll( baseProps ); - - for ( String filterFile : propertiesFilePaths ) - { - if ( StringUtils.isEmpty(filterFile) ) - { - // skip empty file name - continue; - } - try - { - File propFile = FileUtils.resolveFile( basedir, filterFile ); - Properties properties = PropertyUtils.loadPropertyFile( propFile, workProperties ); - filterProperties.putAll( properties ); - workProperties.putAll( properties ); - } - catch ( IOException e ) - { - throw new MavenFilteringException( "Error loading property file '" + filterFile + "'", e ); - } - } - } - } - - private static final class Wrapper - extends FileUtils.FilterWrapper - { - - private LinkedHashSet delimiters; - - private MavenProject project; - - private ValueSource propertiesValueSource; - - private List projectStartExpressions; - - private String escapeString; - - private boolean escapeWindowsPaths; - - private final MavenSession mavenSession; - - private boolean supportMultiLineFiltering; - - Wrapper( LinkedHashSet delimiters, MavenProject project, MavenSession mavenSession, - ValueSource propertiesValueSource, List projectStartExpressions, String escapeString, - boolean escapeWindowsPaths, boolean supportMultiLineFiltering ) - { - super(); - this.delimiters = delimiters; - this.project = project; - this.mavenSession = mavenSession; - this.propertiesValueSource = propertiesValueSource; - this.projectStartExpressions = projectStartExpressions; - this.escapeString = escapeString; - this.escapeWindowsPaths = escapeWindowsPaths; - this.supportMultiLineFiltering = supportMultiLineFiltering; - } - - public Reader getReader( Reader reader ) - { - MultiDelimiterStringSearchInterpolator interpolator = new MultiDelimiterStringSearchInterpolator(); - interpolator.setDelimiterSpecs( delimiters ); - - RecursionInterceptor ri = null; - if ( projectStartExpressions != null && !projectStartExpressions.isEmpty() ) - { - ri = new PrefixAwareRecursionInterceptor( projectStartExpressions, true ); - } - else - { - ri = new SimpleRecursionInterceptor(); - } - - interpolator.addValueSource( propertiesValueSource ); - - if ( project != null ) - { - interpolator.addValueSource( new PrefixedObjectValueSource( projectStartExpressions, project, true ) ); - } - - if ( mavenSession != null ) - { - interpolator.addValueSource( new PrefixedObjectValueSource( "session", mavenSession ) ); - - final Settings settings = mavenSession.getSettings(); - if ( settings != null ) - { - interpolator.addValueSource( new PrefixedObjectValueSource( "settings", settings ) ); - interpolator.addValueSource( - new SingleResponseValueSource( "localRepository", settings.getLocalRepository() ) ); - } - } - - interpolator.setEscapeString( escapeString ); - - if ( escapeWindowsPaths ) - { - interpolator.addPostProcessor( new InterpolationPostProcessor() - { - public Object execute( String expression, Object value ) - { - if ( value instanceof String ) - { - return FilteringUtils.escapeWindowsPath( (String) value ); - } - - return value; - } - } ); - } - - MultiDelimiterInterpolatorFilterReaderLineEnding filterReader = - new MultiDelimiterInterpolatorFilterReaderLineEnding( reader, interpolator, supportMultiLineFiltering ); - filterReader.setRecursionInterceptor( ri ); - filterReader.setDelimiterSpecs( delimiters ); +class BaseFilter + extends AbstractLogEnabled + implements DefaultFilterInfo +{ + + /** + * @see org.apache.maven.shared.filtering.MavenFileFilter#getDefaultFilterWrappers(org.apache.maven.project.MavenProject, + * java.util.List, boolean, org.apache.maven.execution.MavenSession) + * @deprecated + */ + public List getDefaultFilterWrappers( final MavenProject mavenProject, + List filters, + final boolean escapedBackslashesInFilePath, + MavenSession mavenSession ) + throws MavenFilteringException + { + return getDefaultFilterWrappers( mavenProject, filters, escapedBackslashesInFilePath, mavenSession, null ); + } + + @Nonnull + public List getDefaultFilterWrappers( final MavenProject mavenProject, + List filters, + final boolean escapedBackslashesInFilePath, + MavenSession mavenSession, + MavenResourcesExecution mavenResourcesExecution ) + throws MavenFilteringException + { + + MavenResourcesExecution mre = + mavenResourcesExecution == null ? new MavenResourcesExecution() : mavenResourcesExecution.copyOf(); + + mre.setMavenProject( mavenProject ); + mre.setMavenSession( mavenSession ); + mre.setFilters( filters ); + mre.setEscapedBackslashesInFilePath( escapedBackslashesInFilePath ); + + return getDefaultFilterWrappers( mre ); + + } + + @Nonnull + public List getDefaultFilterWrappers( final AbstractMavenFilteringRequest req ) + throws MavenFilteringException + { + // backup values + boolean supportMultiLineFiltering = req.isSupportMultiLineFiltering(); + + // compensate for null parameter value. + final AbstractMavenFilteringRequest request = req == null ? new MavenFileFilterRequest() : req; + + request.setSupportMultiLineFiltering( supportMultiLineFiltering ); + + // Here we build some properties which will be used to read some properties files + // to interpolate the expression ${ } in this properties file + + // Take a copy of filterProperties to ensure that evaluated filterTokens are not propagated + // to subsequent filter files. Note: this replicates current behaviour and seems to make sense. + + final Properties baseProps = new Properties(); + + // Project properties + if ( request.getMavenProject() != null ) + { + baseProps.putAll( request.getMavenProject().getProperties() == null ? Collections.emptyMap() + : request.getMavenProject().getProperties() ); + } + // TODO this is NPE free but do we consider this as normal + // or do we have to throw an MavenFilteringException with mavenSession cannot be null + if ( request.getMavenSession() != null ) + { + // execution properties wins + baseProps.putAll( request.getMavenSession().getExecutionProperties() ); + } + + // now we build properties to use for resources interpolation + + final Properties filterProperties = new Properties(); + + File basedir = request.getMavenProject() != null ? request.getMavenProject().getBasedir() : new File( "." ); + + loadProperties( filterProperties, basedir, request.getFileFilters(), baseProps ); + if ( filterProperties.size() < 1 ) + { + filterProperties.putAll( baseProps ); + } + + if ( request.getMavenProject() != null ) + { + if ( request.isInjectProjectBuildFilters() ) + { + List buildFilters = new ArrayList( request.getMavenProject().getBuild().getFilters() ); + + // JDK-8015656: (coll) unexpected NPE from removeAll + if ( request.getFileFilters() != null ) + { + buildFilters.removeAll( request.getFileFilters() ); + } + + loadProperties( filterProperties, basedir, buildFilters, baseProps ); + } + + // Project properties + filterProperties.putAll( request.getMavenProject().getProperties() == null ? Collections.emptyMap() + : request.getMavenProject().getProperties() ); + } + if ( request.getMavenSession() != null ) + { + // execution properties wins + filterProperties.putAll( request.getMavenSession().getExecutionProperties() ); + } + + if ( request.getAdditionalProperties() != null ) + { + // additional properties wins + filterProperties.putAll( request.getAdditionalProperties() ); + } + + List defaultFilterWrappers = + request == null ? new ArrayList( 1 ) + : new ArrayList( request.getDelimiters().size() + 1 ); + + if ( getLogger().isDebugEnabled() ) + { + getLogger().debug( "properties used " + filterProperties ); + } + + final ValueSource propertiesValueSource = new PropertiesBasedValueSource( filterProperties ); + + if ( request != null ) + { + FileUtils.FilterWrapper wrapper = + new Wrapper( request.getDelimiters(), request.getMavenProject(), request.getMavenSession(), + propertiesValueSource, request.getProjectStartExpressions(), request.getEscapeString(), + request.isEscapeWindowsPaths(), request.isSupportMultiLineFiltering() ); + + defaultFilterWrappers.add( wrapper ); + } + + return defaultFilterWrappers; + } + + /** + * default visibility only for testing reason ! + */ + void loadProperties( Properties filterProperties, File basedir, List propertiesFilePaths, + Properties baseProps ) + throws MavenFilteringException + { + if ( propertiesFilePaths != null ) + { + Properties workProperties = new Properties(); + workProperties.putAll( baseProps ); + + for ( String filterFile : propertiesFilePaths ) + { + if ( StringUtils.isEmpty( filterFile ) ) + { + // skip empty file name + continue; + } + try + { + File propFile = FileUtils.resolveFile( basedir, filterFile ); + Properties properties = PropertyUtils.loadPropertyFile( propFile, workProperties ); + filterProperties.putAll( properties ); + workProperties.putAll( properties ); + } + catch ( IOException e ) + { + throw new MavenFilteringException( "Error loading property file '" + filterFile + "'", e ); + } + } + } + } + + private static final class Wrapper + extends FileUtils.FilterWrapper + { + + private LinkedHashSet delimiters; + + private MavenProject project; + + private ValueSource propertiesValueSource; + + private List projectStartExpressions; + + private String escapeString; + + private boolean escapeWindowsPaths; + + private final MavenSession mavenSession; + + private boolean supportMultiLineFiltering; + + Wrapper( + LinkedHashSet delimiters, + MavenProject project, + MavenSession mavenSession, + ValueSource propertiesValueSource, + List projectStartExpressions, + String escapeString, + boolean escapeWindowsPaths, + boolean supportMultiLineFiltering ) + { + super(); + this.delimiters = delimiters; + this.project = project; + this.mavenSession = mavenSession; + this.propertiesValueSource = propertiesValueSource; + this.projectStartExpressions = projectStartExpressions; + this.escapeString = escapeString; + this.escapeWindowsPaths = escapeWindowsPaths; + this.supportMultiLineFiltering = supportMultiLineFiltering; + } + + public Reader getReader( Reader reader ) + { + MultiDelimiterStringSearchInterpolator interpolator = new MultiDelimiterStringSearchInterpolator(); + interpolator.setDelimiterSpecs( delimiters ); + + RecursionInterceptor ri = null; + if ( projectStartExpressions != null && !projectStartExpressions.isEmpty() ) + { + ri = new PrefixAwareRecursionInterceptor( projectStartExpressions, true ); + } + else + { + ri = new SimpleRecursionInterceptor(); + } + + interpolator.addValueSource( propertiesValueSource ); + + if ( project != null ) + { + interpolator.addValueSource( new PrefixedObjectValueSource( projectStartExpressions, project, true ) ); + } + + if ( mavenSession != null ) + { + interpolator.addValueSource( new PrefixedObjectValueSource( "session", mavenSession ) ); + + final Settings settings = mavenSession.getSettings(); + if ( settings != null ) + { + interpolator.addValueSource( new PrefixedObjectValueSource( "settings", settings ) ); + interpolator.addValueSource( new SingleResponseValueSource( "localRepository", + settings.getLocalRepository() ) ); + } + } + + interpolator.setEscapeString( escapeString ); + + if ( escapeWindowsPaths ) + { + interpolator.addPostProcessor( new InterpolationPostProcessor() + { + public Object execute( String expression, Object value ) + { + if ( value instanceof String ) + { + return FilteringUtils.escapeWindowsPath( (String) value ); + } + + return value; + } + } ); + } + + MultiDelimiterInterpolatorFilterReaderLineEnding filterReader = + new MultiDelimiterInterpolatorFilterReaderLineEnding( reader, interpolator, supportMultiLineFiltering ); + filterReader.setRecursionInterceptor( ri ); + filterReader.setDelimiterSpecs( delimiters ); - filterReader.setInterpolateWithPrefixPattern( false ); - filterReader.setEscapeString( escapeString ); + filterReader.setInterpolateWithPrefixPattern( false ); + filterReader.setEscapeString( escapeString ); - return filterReader; - } + return filterReader; + } - } + } } Modified: maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/BoundedReader.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/BoundedReader.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/BoundedReader.java (original) +++ maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/BoundedReader.java Fri Oct 17 15:36:52 2014 @@ -1,3 +1,5 @@ +package org.apache.maven.shared.filtering; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -16,7 +18,6 @@ * specific language governing permissions and limitations * under the License. */ -package org.apache.maven.shared.filtering; import java.io.IOException; import java.io.Reader; @@ -24,53 +25,77 @@ import java.io.Reader; /** * A reader that imposes a limit to the number of bytes that can be read from * an underlying reader, simulating eof when this limit is reached. - * * This stream can typically be used to constrain a client with regard to a readAheadLimit * of an underlying stream, to avoid overrunning this limit and hence * lose the opportunity do to reset. */ -public class BoundedReader extends Reader { - - private final Reader target; - - int pos = 0; - - int readAheadLimit; - - public BoundedReader(Reader target, int readAheadLimit) throws IOException { - this.target = target; - target.mark(readAheadLimit); - this.readAheadLimit = readAheadLimit; - } - - - @Override public void close() throws IOException { - target.close(); - } - - @Override public void reset() throws IOException { - pos = 0; - target.reset(); - } - - @Override public void mark(int readAheadLimit) throws IOException { - this.readAheadLimit = readAheadLimit; - target.mark(readAheadLimit); - } - - @Override public int read() throws IOException { - if (pos >= readAheadLimit) return -1; - pos++; - return target.read(); - } - - @Override public int read(char[] cbuf, int off, int len) throws IOException{ - int c; - for (int i = 0; i < len; i++){ - c = read(); - if (c == -1) return i; - cbuf[off + i] = (char) c; - } - return len; - } +public class BoundedReader + extends Reader +{ + + private final Reader target; + + int pos = 0; + + int readAheadLimit; + + public BoundedReader( Reader target, int readAheadLimit ) + throws IOException + { + this.target = target; + target.mark( readAheadLimit ); + this.readAheadLimit = readAheadLimit; + } + + @Override + public void close() + throws IOException + { + target.close(); + } + + @Override + public void reset() + throws IOException + { + pos = 0; + target.reset(); + } + + @Override + public void mark( int readAheadLimit ) + throws IOException + { + this.readAheadLimit = readAheadLimit; + target.mark( readAheadLimit ); + } + + @Override + public int read() + throws IOException + { + if ( pos >= readAheadLimit ) + { + return -1; + } + pos++; + return target.read(); + } + + @Override + public int read( char[] cbuf, int off, int len ) + throws IOException + { + int c; + for ( int i = 0; i < len; i++ ) + { + c = read(); + if ( c == -1 ) + { + return i; + } + cbuf[off + i] = (char) c; + } + return len; + } } Modified: maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/DefaultFilterInfo.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/DefaultFilterInfo.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/DefaultFilterInfo.java (original) +++ maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/DefaultFilterInfo.java Fri Oct 17 15:36:52 2014 @@ -1,6 +1,5 @@ package org.apache.maven.shared.filtering; - /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -22,56 +21,61 @@ package org.apache.maven.shared.filterin import java.util.List; +import javax.annotation.Nonnull; + import org.apache.maven.execution.MavenSession; import org.apache.maven.project.MavenProject; import org.apache.maven.shared.utils.io.FileUtils; -import javax.annotation.Nonnull; - -public interface DefaultFilterInfo { - /** - * Will return the default FileUtils.FilterWrappers. - *

- *

    - *
  • interpolate with token ${} and values from sysProps, project.properties, filters and project filters.
  • - *
  • interpolate with token @ @ and values from sysProps, project.properties, filters and project filters.
  • - *
  • interpolate with token ${} and values from mavenProject interpolation.
  • - *
  • interpolation with token @ @ and values from mavenProject interpolation
  • - *
- * This method is now deprecated and no escape mechanism will be used. - * - * @param mavenProject - * @param filters {@link java.util.List} of properties file - * @return {@link java.util.List} of FileUtils.FilterWrapper - * @deprecated use {@link #getDefaultFilterWrappers(org.apache.maven.project.MavenProject, java.util.List, boolean, org.apache.maven.execution.MavenSession, org.apache.maven.shared.filtering.MavenResourcesExecution)} - */ - @Nonnull List getDefaultFilterWrappers(MavenProject mavenProject, List filters, - boolean escapedBackslashesInFilePath, - MavenSession mavenSession) - throws MavenFilteringException; - - /** - * @param mavenProject - * @param filters - * @param escapedBackslashesInFilePath - * @param mavenSession - * @param mavenResourcesExecution - * @return {@link java.util.List} of FileUtils.FilterWrapper - * @throws org.apache.maven.shared.filtering.MavenFilteringException - * @since 1.0-beta-2 - */ - @Nonnull List getDefaultFilterWrappers(MavenProject mavenProject, List filters, - boolean escapedBackslashesInFilePath, - MavenSession mavenSession, - MavenResourcesExecution mavenResourcesExecution) - throws MavenFilteringException; - - /** - * @param request - * @return {@link java.util.List} of FileUtils.FilterWrapper - * @throws org.apache.maven.shared.filtering.MavenFilteringException - * @since 1.0-beta-3 - */ - @Nonnull List getDefaultFilterWrappers(AbstractMavenFilteringRequest request) - throws MavenFilteringException; +public interface DefaultFilterInfo +{ + /** + * Will return the default FileUtils.FilterWrappers. + *

+ *

    + *
  • interpolate with token ${} and values from sysProps, project.properties, filters and project filters.
  • + *
  • interpolate with token @ @ and values from sysProps, project.properties, filters and project filters.
  • + *
  • interpolate with token ${} and values from mavenProject interpolation.
  • + *
  • interpolation with token @ @ and values from mavenProject interpolation
  • + *
+ * This method is now deprecated and no escape mechanism will be used. + * + * @param mavenProject + * @param filters {@link java.util.List} of properties file + * @return {@link java.util.List} of FileUtils.FilterWrapper + * @deprecated use + * {@link #getDefaultFilterWrappers(org.apache.maven.project.MavenProject, java.util.List, boolean, org.apache.maven.execution.MavenSession, org.apache.maven.shared.filtering.MavenResourcesExecution)} + */ + @Nonnull + List getDefaultFilterWrappers( MavenProject mavenProject, List filters, + boolean escapedBackslashesInFilePath, + MavenSession mavenSession ) + throws MavenFilteringException; + + /** + * @param mavenProject + * @param filters + * @param escapedBackslashesInFilePath + * @param mavenSession + * @param mavenResourcesExecution + * @return {@link java.util.List} of FileUtils.FilterWrapper + * @throws org.apache.maven.shared.filtering.MavenFilteringException + * @since 1.0-beta-2 + */ + @Nonnull + List getDefaultFilterWrappers( MavenProject mavenProject, List filters, + boolean escapedBackslashesInFilePath, + MavenSession mavenSession, + MavenResourcesExecution mavenResourcesExecution ) + throws MavenFilteringException; + + /** + * @param request + * @return {@link java.util.List} of FileUtils.FilterWrapper + * @throws org.apache.maven.shared.filtering.MavenFilteringException + * @since 1.0-beta-3 + */ + @Nonnull + List getDefaultFilterWrappers( AbstractMavenFilteringRequest request ) + throws MavenFilteringException; } Modified: maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java (original) +++ maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/DefaultMavenFileFilter.java Fri Oct 17 15:36:52 2014 @@ -19,16 +19,6 @@ package org.apache.maven.shared.filterin * under the License. */ -import org.apache.maven.execution.MavenSession; -import org.apache.maven.project.MavenProject; -import org.apache.maven.shared.utils.StringUtils; -import org.apache.maven.shared.utils.io.FileUtils; -import org.apache.maven.shared.utils.io.FileUtils.FilterWrapper; -import org.apache.maven.shared.utils.io.IOUtil; -import org.sonatype.plexus.build.incremental.BuildContext; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -42,13 +32,23 @@ import java.io.OutputStreamWriter; import java.io.Reader; import java.io.UnsupportedEncodingException; import java.io.Writer; -import java.util.Arrays; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + +import org.apache.maven.execution.MavenSession; +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.utils.StringUtils; +import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.utils.io.FileUtils.FilterWrapper; +import org.apache.maven.shared.utils.io.IOUtil; +import org.sonatype.plexus.build.incremental.BuildContext; + /** * @author Olivier Lamy * @plexus.component role="org.apache.maven.shared.filtering.MavenFileFilter" - * role-hint="default" + * role-hint="default" */ public class DefaultMavenFileFilter extends BaseFilter @@ -80,7 +80,6 @@ public class DefaultMavenFileFilter copyFile( from, to, filtering, filterWrappers, encoding ); } - public void copyFile( MavenFileFilterRequest mavenFileFilterRequest ) throws MavenFilteringException { @@ -90,7 +89,6 @@ public class DefaultMavenFileFilter mavenFileFilterRequest.isFiltering(), filterWrappers, mavenFileFilterRequest.getEncoding() ); } - public void copyFile( File from, File to, boolean filtering, List filterWrappers, String encoding ) throws MavenFilteringException @@ -99,7 +97,6 @@ public class DefaultMavenFileFilter copyFile( from, to, filtering, filterWrappers, encoding, false ); } - public void copyFile( File from, File to, boolean filtering, List filterWrappers, String encoding, boolean overwrite ) throws MavenFilteringException @@ -156,7 +153,7 @@ public class DefaultMavenFileFilter } else { - if ( to.lastModified() < from.lastModified() ) + if ( to.lastModified() < from.lastModified() ) { FileUtils.copyFile( from, to ); } @@ -193,5 +190,4 @@ public class DefaultMavenFileFilter } } - } Modified: maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/DefaultMavenReaderFilter.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/DefaultMavenReaderFilter.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/DefaultMavenReaderFilter.java (original) +++ maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/DefaultMavenReaderFilter.java Fri Oct 17 15:36:52 2014 @@ -19,19 +19,20 @@ package org.apache.maven.shared.filterin * under the License. */ -import org.apache.maven.execution.MavenSession; -import org.apache.maven.project.MavenProject; -import org.apache.maven.shared.utils.io.FileUtils.FilterWrapper; - -import javax.annotation.Nonnull; import java.io.Reader; import java.util.Collections; import java.util.List; +import javax.annotation.Nonnull; + +import org.apache.maven.execution.MavenSession; +import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.utils.io.FileUtils.FilterWrapper; + /** * @author Kristian Rosenvold * @plexus.component role="org.apache.maven.shared.filtering.MavenReaderFilter" - * role-hint="default" + * role-hint="default" */ public class DefaultMavenReaderFilter extends BaseFilter @@ -53,22 +54,19 @@ public class DefaultMavenReaderFilter return filter( from, filtering, filterWrappers ); } - - @Nonnull public Reader filter( @Nonnull MavenReaderFilterRequest mavenFileFilterRequest ) + @Nonnull + public Reader filter( @Nonnull MavenReaderFilterRequest mavenFileFilterRequest ) throws MavenFilteringException { List filterWrappers = getDefaultFilterWrappers( mavenFileFilterRequest ); return filter( mavenFileFilterRequest.getFrom(), mavenFileFilterRequest.isFiltering(), filterWrappers ); } - - @SuppressWarnings( "unchecked" ) public @Nonnull Reader filter( @Nonnull Reader from, boolean filtering, @Nonnull List filterWrappers ) { - return filterWrap( from, filtering ? filterWrappers : Collections.emptyList() ); + return filterWrap( from, filtering ? filterWrappers : Collections. emptyList() ); } - private static @Nonnull Reader filterWrap( @Nonnull Reader from, @Nonnull Iterable wrappers ) { Reader reader = from; @@ -79,5 +77,4 @@ public class DefaultMavenReaderFilter return reader; } - } 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=1632611&r1=1632610&r2=1632611&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 15:36:52 2014 @@ -46,14 +46,14 @@ import org.sonatype.plexus.build.increme /** * @author Olivier Lamy * @plexus.component role="org.apache.maven.shared.filtering.MavenResourcesFiltering" - * role-hint="default" + * role-hint="default" */ public class DefaultMavenResourcesFiltering extends AbstractLogEnabled implements MavenResourcesFiltering, Initializable { - private static final String[] EMPTY_STRING_ARRAY = { }; + private static final String[] EMPTY_STRING_ARRAY = {}; private static final String[] DEFAULT_INCLUDES = { "**/**" }; @@ -65,7 +65,7 @@ public class DefaultMavenResourcesFilter private BuildContext buildContext; // ------------------------------------------------ - // Plexus lifecycle + // Plexus lifecycle // ------------------------------------------------ public void initialize() throws InitializationException @@ -79,7 +79,6 @@ public class DefaultMavenResourcesFilter this.defaultNonFilteredFileExtensions.add( "png" ); } - /** * @plexus.requirement role-hint="default" */ @@ -94,7 +93,7 @@ public class DefaultMavenResourcesFilter new MavenResourcesExecution( resources, outputDirectory, mavenProject, encoding, fileFilters, nonFilteredFileExtensions, mavenSession ); mavenResourcesExecution.setUseDefaultFilterWrappers( true ); -// mavenResourcesExecution.setEscapeWindowsPaths( false ); + // mavenResourcesExecution.setEscapeWindowsPaths( false ); filterResources( mavenResourcesExecution ); } @@ -110,7 +109,6 @@ public class DefaultMavenResourcesFilter filterResources( mavenResourcesExecution ); } - public boolean filteredFileExtension( String fileName, List userNonFilteredFileExtensions ) { List nonFilteredFileExtensions = new ArrayList( getDefaultNonFilteredFileExtensions() ); @@ -122,8 +120,8 @@ public class DefaultMavenResourcesFilter !nonFilteredFileExtensions.contains( StringUtils.lowerCase( FileUtils.extension( fileName ) ) ); if ( getLogger().isDebugEnabled() ) { - getLogger().debug( - "file " + fileName + " has a" + ( filteredFileExtension ? " " : " non " ) + "filtered file extension" ); + getLogger().debug( "file " + fileName + " has a" + ( filteredFileExtension ? " " : " non " ) + + "filtered file extension" ); } return filteredFileExtension; } @@ -174,8 +172,8 @@ public class DefaultMavenResourcesFilter } else { - getLogger().info( - "Using '" + mavenResourcesExecution.getEncoding() + "' encoding to copy filtered resources." ); + getLogger().info( "Using '" + mavenResourcesExecution.getEncoding() + + "' encoding to copy filtered resources." ); } for ( Resource resource : mavenResourcesExecution.getResources() ) @@ -219,8 +217,9 @@ public class DefaultMavenResourcesFilter throw new MavenFilteringException( "Cannot create resource output directory: " + outputDirectory ); } - boolean ignoreDelta = !outputExists || buildContext.hasDelta( mavenResourcesExecution.getFileFilters() ) - || buildContext.hasDelta( getRelativeOutputDirectory( mavenResourcesExecution ) ); + boolean ignoreDelta = + !outputExists || buildContext.hasDelta( mavenResourcesExecution.getFileFilters() ) + || buildContext.hasDelta( getRelativeOutputDirectory( mavenResourcesExecution ) ); getLogger().debug( "ignoreDelta " + ignoreDelta ); Scanner scanner = buildContext.newScanner( resourceDirectory, ignoreDelta ); @@ -238,33 +237,29 @@ public class DefaultMavenResourcesFilter } catch ( IOException e ) { - throw new MavenFilteringException( - "Cannot copy directory structure from " + resourceDirectory.getPath() + " to " - + outputDirectory.getPath() ); + throw new MavenFilteringException( "Cannot copy directory structure from " + + resourceDirectory.getPath() + " to " + outputDirectory.getPath() ); } } List includedFiles = Arrays.asList( scanner.getIncludedFiles() ); - getLogger().info( - "Copying " + includedFiles.size() + " resource" + ( includedFiles.size() > 1 ? "s" : "" ) + ( - targetPath == null ? "" : " to " + targetPath ) ); + getLogger().info( "Copying " + includedFiles.size() + " resource" + ( includedFiles.size() > 1 ? "s" : "" ) + + ( targetPath == null ? "" : " to " + targetPath ) ); for ( String name : includedFiles ) { File source = new File( resourceDirectory, name ); - File destinationFile = - getDestinationFile( outputDirectory, targetPath, name, mavenResourcesExecution ); + File destinationFile = getDestinationFile( outputDirectory, targetPath, name, mavenResourcesExecution ); boolean filteredExt = filteredFileExtension( source.getName(), mavenResourcesExecution.getNonFilteredFileExtensions() ); mavenFileFilter.copyFile( source, destinationFile, resource.isFiltering() && filteredExt, mavenResourcesExecution.getFilterWrappers(), - mavenResourcesExecution.getEncoding(), - mavenResourcesExecution.isOverwrite() ); + mavenResourcesExecution.getEncoding(), mavenResourcesExecution.isOverwrite() ); } // deal with deleted source files @@ -279,8 +274,7 @@ public class DefaultMavenResourcesFilter for ( String name : deletedFiles ) { - File destinationFile = - getDestinationFile( outputDirectory, targetPath, name, mavenResourcesExecution ); + File destinationFile = getDestinationFile( outputDirectory, targetPath, name, mavenResourcesExecution ); destinationFile.delete(); @@ -291,11 +285,12 @@ public class DefaultMavenResourcesFilter } - private File getDestinationFile( File outputDirectory, String targetPath, String name, MavenResourcesExecution mavenResourcesExecution ) + private File getDestinationFile( File outputDirectory, String targetPath, String name, + MavenResourcesExecution mavenResourcesExecution ) throws MavenFilteringException { String destination = name; - + if ( mavenResourcesExecution.isFilterFilenames() && mavenResourcesExecution.getFilterWrappers().size() > 0 ) { destination = filterFileName( destination, mavenResourcesExecution.getFilterWrappers() ); @@ -402,7 +397,7 @@ public class DefaultMavenResourcesFilter return relOutDir; } - + /* * Filter the name of a file using the same mechanism for filtering the content of the file. */ 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=1632611&r1=1632610&r2=1632611&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 15:36:52 2014 @@ -20,18 +20,18 @@ package org.apache.maven.shared.filterin */ import java.util.regex.Pattern; + import org.apache.maven.shared.utils.StringUtils; /** * @author Olivier Lamy * @author Dennis Lundberg - * */ public final class FilteringUtils { private static final String WINDOWS_PATH_PATTERN = "^(.*)[a-zA-Z]:\\\\(.*)"; - private static final Pattern PATTERN = Pattern.compile( WINDOWS_PATH_PATTERN ) ; + private static final Pattern PATTERN = Pattern.compile( WINDOWS_PATH_PATTERN ); /** * @@ -40,7 +40,7 @@ public final class FilteringUtils { // nothing just an util class } - + // TODO: Correct to handle relative windows paths. (http://jira.codehaus.org/browse/MSHARED-121) // How do we distinguish a relative windows path from some other value that happens to contain backslashes?? public static String escapeWindowsPath( String val ) @@ -54,15 +54,15 @@ public final class FilteringUtils { buf.append( val.substring( start, end ) ).append( "\\\\" ); start = end + 1; - + if ( val.indexOf( '\\', end + 1 ) == end + 1 ) { start++; } } - + buf.append( val.substring( start ) ); - + return buf.toString(); } return val; 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=1632611&r1=1632610&r2=1632611&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 15:36:52 2014 @@ -19,23 +19,22 @@ package org.apache.maven.shared.filterin * under the License. */ -import org.codehaus.plexus.interpolation.InterpolationException; -import org.codehaus.plexus.interpolation.Interpolator; -import org.codehaus.plexus.interpolation.RecursionInterceptor; -import org.codehaus.plexus.interpolation.SimpleRecursionInterceptor; - import java.io.BufferedReader; import java.io.FilterReader; import java.io.IOException; import java.io.Reader; +import org.codehaus.plexus.interpolation.InterpolationException; +import org.codehaus.plexus.interpolation.Interpolator; +import org.codehaus.plexus.interpolation.RecursionInterceptor; +import org.codehaus.plexus.interpolation.SimpleRecursionInterceptor; + /** * A FilterReader implementation, that works with Interpolator interface instead of it's own interpolation * implementation. This implementation is heavily based on org.codehaus.plexus.util.InterpolationFilterReader. * * @author cstamas * @author Olivier Lamy - * * @since 1.0 */ public class InterpolatorFilterReaderLineEnding @@ -97,28 +96,36 @@ public class InterpolatorFilterReaderLin private boolean eof = false; /** - * @param in reader to use - * @param interpolator interpolator instance to use - * @param beginToken start token to use - * @param endToken end token to use + * @param in reader to use + * @param interpolator interpolator instance to use + * @param beginToken start token to use + * @param endToken end token to use * @param supportMultiLineFiltering If multi line filtering is allowed */ - public InterpolatorFilterReaderLineEnding( Reader in, Interpolator interpolator, String beginToken, String endToken, + public InterpolatorFilterReaderLineEnding( + Reader in, + Interpolator interpolator, + String beginToken, + String endToken, boolean supportMultiLineFiltering ) { this( in, interpolator, beginToken, endToken, new SimpleRecursionInterceptor(), supportMultiLineFiltering ); } /** - * @param in reader to use - * @param interpolator interpolator instance to use - * @param beginToken start token to use - * @param endToken end token to use - * @param ri The {@link RecursionInterceptor} to use to prevent recursive expressions. + * @param in reader to use + * @param interpolator interpolator instance to use + * @param beginToken start token to use + * @param endToken end token to use + * @param ri The {@link RecursionInterceptor} to use to prevent recursive expressions. * @param supportMultiLineFiltering If multi line filtering is allowed */ - private InterpolatorFilterReaderLineEnding( Reader in, Interpolator interpolator, String beginToken, - String endToken, RecursionInterceptor ri, + private InterpolatorFilterReaderLineEnding( + Reader in, + Interpolator interpolator, + String beginToken, + String endToken, + RecursionInterceptor ri, boolean supportMultiLineFiltering ) { // wrap our own buffer, so we can use mark/reset safely. @@ -145,7 +152,7 @@ public class InterpolatorFilterReaderLin * @param n The number of characters to skip * @return the number of characters actually skipped * @throws IllegalArgumentException If n is negative. - * @throws IOException If an I/O error occurs + * @throws IOException If an I/O error occurs */ public long skip( long n ) throws IOException @@ -170,8 +177,8 @@ public class InterpolatorFilterReaderLin * occurs, or the end of the stream is reached. * * @param cbuf Destination buffer to write characters to. Must not be null. - * @param off Offset at which to start storing characters. - * @param len Maximum number of characters to read. + * @param off Offset at which to start storing characters. + * @param len Maximum number of characters to read. * @return the number of characters read, or -1 if the end of the stream has been reached * @throws IOException If an I/O error occurs */ Modified: maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java (original) +++ maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenFileFilter.java Fri Oct 17 15:36:52 2014 @@ -19,28 +19,28 @@ package org.apache.maven.shared.filterin * under the License. */ +import java.io.File; +import java.util.List; + import org.apache.maven.execution.MavenSession; import org.apache.maven.project.MavenProject; import org.apache.maven.shared.utils.io.FileUtils; -import java.io.File; -import java.util.List; - /** * @author Olivier Lamy - * */ -public interface MavenFileFilter extends DefaultFilterInfo +public interface MavenFileFilter + extends DefaultFilterInfo { /** * Will copy a file with some filtering using defaultFilterWrappers. * - * @param from file to copy/filter - * @param to destination file - * @param filtering enable or not filering + * @param from file to copy/filter + * @param to destination file + * @param filtering enable or not filering * @param mavenProject the mavenproject - * @param filters {@link List} of String which are path to a Property file + * @param filters {@link List} of String which are path to a Property file * @throws MavenFilteringException * @see #getDefaultFilterWrappers(MavenProject, List, boolean, MavenSession) */ @@ -67,7 +67,6 @@ public interface MavenFileFilter extends String encoding ) throws MavenFilteringException; - /** * @param from * @param to Modified: maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenFileFilterRequest.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenFileFilterRequest.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenFileFilterRequest.java (original) +++ maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenFileFilterRequest.java Fri Oct 17 15:36:52 2014 @@ -33,11 +33,11 @@ import org.apache.maven.project.MavenPro public class MavenFileFilterRequest extends AbstractMavenFilteringRequest { - + private File from; private File to; - + private boolean filtering; public MavenFileFilterRequest() @@ -45,8 +45,15 @@ public class MavenFileFilterRequest // nothing } - public MavenFileFilterRequest( File from, File to, boolean filtering, MavenProject mavenProject, List filters, - boolean escapedBackslashesInFilePath, String encoding, MavenSession mavenSession, + public MavenFileFilterRequest( + File from, + File to, + boolean filtering, + MavenProject mavenProject, + List filters, + boolean escapedBackslashesInFilePath, + String encoding, + MavenSession mavenSession, Properties additionalProperties ) { super( mavenProject, filters, encoding, mavenSession ); @@ -57,7 +64,6 @@ public class MavenFileFilterRequest setEscapeWindowsPaths( escapedBackslashesInFilePath ); } - public File getFrom() { return from; Modified: maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenFilteringException.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenFilteringException.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenFilteringException.java (original) +++ maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenFilteringException.java Fri Oct 17 15:36:52 2014 @@ -21,7 +21,6 @@ package org.apache.maven.shared.filterin /** * @author Olivier Lamy - * */ public class MavenFilteringException extends Exception Modified: maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenReaderFilter.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenReaderFilter.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenReaderFilter.java (original) +++ maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenReaderFilter.java Fri Oct 17 15:36:52 2014 @@ -22,13 +22,13 @@ package org.apache.maven.shared.filterin import java.io.Reader; import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import org.apache.maven.execution.MavenSession; import org.apache.maven.project.MavenProject; import org.apache.maven.shared.utils.io.FileUtils; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - /** * @author Olivier Lamy * @author Kristian Rosenvold @@ -40,15 +40,17 @@ public interface MavenReaderFilter /** * Provides a new reader that applies filtering using defaultFilterWrappers. * - * @param from the source reader - * @param filtering enable or not filering + * @param from the source reader + * @param filtering enable or not filering * @param mavenProject the mavenproject - * @param filters {@link java.util.List} of String which are path to a Property file + * @param filters {@link java.util.List} of String which are path to a Property file * @return an input stream that applies the filter * @throws org.apache.maven.shared.filtering.MavenFilteringException - * @see #getDefaultFilterWrappers(org.apache.maven.project.MavenProject, java.util.List, boolean, org.apache.maven.execution.MavenSession) + * @see #getDefaultFilterWrappers(org.apache.maven.project.MavenProject, java.util.List, boolean, + * org.apache.maven.execution.MavenSession) */ - @Nonnull Reader filter( @Nonnull Reader from, boolean filtering, @Nullable MavenProject mavenProject, List filters, + @Nonnull + Reader filter( @Nonnull Reader from, boolean filtering, @Nullable MavenProject mavenProject, List filters, boolean escapedBackslashesInFilePath, MavenSession mavenSession ) throws MavenFilteringException; @@ -60,16 +62,18 @@ public interface MavenReaderFilter * @return an input stream that applies the filter * @since 1.0-beta-3 */ - @Nonnull Reader filter( @Nonnull MavenReaderFilterRequest mavenFileFilterRequest ) + @Nonnull + Reader filter( @Nonnull MavenReaderFilterRequest mavenFileFilterRequest ) throws MavenFilteringException; /** * Provides a new reader that applies filtering using defaultFilterWrappers. * - * @param from the source reader + * @param from the source reader * @param filtering true to apply filtering * @param filterWrappers {@link java.util.List} of FileUtils.FilterWrapper * @return an input stream that applies the filter */ - @Nonnull Reader filter( @Nonnull Reader from, boolean filtering, @Nonnull List filterWrappers ); + @Nonnull + Reader filter( @Nonnull Reader from, boolean filtering, @Nonnull List filterWrappers ); } Modified: maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenReaderFilterRequest.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenReaderFilterRequest.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenReaderFilterRequest.java (original) +++ maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenReaderFilterRequest.java Fri Oct 17 15:36:52 2014 @@ -19,8 +19,6 @@ package org.apache.maven.shared.filterin * under the License. */ -import java.io.File; -import java.io.InputStream; import java.io.Reader; import java.util.List; import java.util.Properties; @@ -46,8 +44,14 @@ public class MavenReaderFilterRequest // nothing } - public MavenReaderFilterRequest( Reader from, boolean filtering, MavenProject mavenProject, List filters, - boolean escapedBackslashesInFilePath, String encoding, MavenSession mavenSession, + public MavenReaderFilterRequest( + Reader from, + boolean filtering, + MavenProject mavenProject, + List filters, + boolean escapedBackslashesInFilePath, + String encoding, + MavenSession mavenSession, Properties additionalProperties ) { super( mavenProject, filters, encoding, mavenSession ); @@ -57,7 +61,6 @@ public class MavenReaderFilterRequest setEscapeWindowsPaths( escapedBackslashesInFilePath ); } - public Reader getFrom() { return from; Modified: maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenResourcesExecution.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenResourcesExecution.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenResourcesExecution.java (original) +++ maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenResourcesExecution.java Fri Oct 17 15:36:52 2014 @@ -19,26 +19,25 @@ package org.apache.maven.shared.filterin * under the License. */ +import java.io.File; +import java.io.Reader; +import java.util.ArrayList; +import java.util.List; + import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Resource; import org.apache.maven.project.MavenProject; +import org.apache.maven.shared.utils.io.FileUtils; +import org.apache.maven.shared.utils.io.FileUtils.FilterWrapper; import org.codehaus.plexus.interpolation.Interpolator; import org.codehaus.plexus.interpolation.RegexBasedInterpolator; import org.codehaus.plexus.interpolation.StringSearchInterpolator; import org.codehaus.plexus.interpolation.ValueSource; -import org.apache.maven.shared.utils.io.FileUtils; -import org.apache.maven.shared.utils.io.FileUtils.FilterWrapper; - -import java.io.File; -import java.io.Reader; -import java.util.ArrayList; -import java.util.List; /** * A bean to configure a resources filtering execution. * * @author Olivier Lamy - * */ public class MavenResourcesExecution extends AbstractMavenFilteringRequest @@ -59,8 +58,7 @@ public class MavenResourcesExecution private boolean filterFilenames = false; /** - * Overwrite existing files even if the destination files are newer. - * false by default. + * Overwrite existing files even if the destination files are newer. false by default. * * @since 1.0-beta-2 */ @@ -96,8 +94,13 @@ public class MavenResourcesExecution * @param nonFilteredFileExtensions * @param mavenSession */ - public MavenResourcesExecution( List resources, File outputDirectory, MavenProject mavenProject, - String encoding, List fileFilters, List nonFilteredFileExtensions, + public MavenResourcesExecution( + List resources, + File outputDirectory, + MavenProject mavenProject, + String encoding, + List fileFilters, + List nonFilteredFileExtensions, MavenSession mavenSession ) { super( mavenProject, fileFilters, encoding, mavenSession ); @@ -108,8 +111,12 @@ public class MavenResourcesExecution this.resourcesBaseDirectory = mavenProject.getBasedir(); } - public MavenResourcesExecution( List resources, File outputDirectory, String encoding, - List filterWrappers, File resourcesBaseDirectory, + public MavenResourcesExecution( + List resources, + File outputDirectory, + String encoding, + List filterWrappers, + File resourcesBaseDirectory, List nonFilteredFileExtensions ) { this(); @@ -122,7 +129,6 @@ public class MavenResourcesExecution setEncoding( encoding ); } - /** * @return List of {@link org.apache.maven.model.Resource} */ @@ -195,7 +201,8 @@ public class MavenResourcesExecution * and InterpolatorFilterReaderLineEnding with defaultTokens ${ }. * * @param valueSource - * @deprecated This doesn't support escaping use {@link #addFilerWrapperWithEscaping(ValueSource, String, String, String, boolean)} + * @deprecated This doesn't support escaping use + * {@link #addFilerWrapperWithEscaping(ValueSource, String, String, String, boolean)} */ public void addFilerWrapper( final ValueSource valueSource ) { @@ -219,7 +226,8 @@ public class MavenResourcesExecution * @param endRegExp * @param startToken * @param endToken - * @deprecated This doesn't support escaping use {@link #addFilerWrapperWithEscaping(ValueSource, String, String, String, boolean)} + * @deprecated This doesn't support escaping use + * {@link #addFilerWrapperWithEscaping(ValueSource, String, String, String, boolean)} */ public void addFilerWrapper( final ValueSource valueSource, final String startRegExp, final String endRegExp, final String startToken, final String endToken ) @@ -238,11 +246,12 @@ public class MavenResourcesExecution /** * @param valueSource - * @param startExp start token like ${ - * @param endExp endToken } + * @param startExp start token like ${ + * @param endExp endToken } * @param escapeString * @since 1.0-beta-2 - * @deprecated This doesn't support escaping use {@link #addFilerWrapperWithEscaping(ValueSource, String, String, String, boolean)} + * @deprecated This doesn't support escaping use + * {@link #addFilerWrapperWithEscaping(ValueSource, String, String, String, boolean)} */ public void addFilerWrapperWithEscaping( final ValueSource valueSource, final String startExp, final String endExp, final String escapeString ) @@ -264,10 +273,11 @@ public class MavenResourcesExecution /** * @param valueSource - * @param startExp start token like ${ - * @param endExp endToken } + * @param startExp start token like ${ + * @param endExp endToken } * @param escapeString - * @param supportMultiLineFiltering do we support or use filtering on multi lines with start and endtoken on multi lines + * @param supportMultiLineFiltering do we support or use filtering on multi lines with start and endtoken on multi + * lines * @since 1.0 */ public void addFilerWrapperWithEscaping( final ValueSource valueSource, final String startExp, final String endExp, @@ -289,7 +299,6 @@ public class MavenResourcesExecution } ); } - public File getResourcesBaseDirectory() { return resourcesBaseDirectory; @@ -353,7 +362,6 @@ public class MavenResourcesExecution } /** - * * @return {@code true} if filenames are filtered, otherwise {@code false} * @since 1.2 */ @@ -363,7 +371,6 @@ public class MavenResourcesExecution } /** - * * @param filterFilenames {@code true} if filenames should be filtered, otherwise {@code false} * @since 1.2 */ Modified: maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java URL: http://svn.apache.org/viewvc/maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java?rev=1632611&r1=1632610&r2=1632611&view=diff ============================================================================== --- maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java (original) +++ maven/shared/trunk/maven-filtering/src/main/java/org/apache/maven/shared/filtering/MavenResourcesFiltering.java Fri Oct 17 15:36:52 2014 @@ -19,29 +19,28 @@ package org.apache.maven.shared.filterin * under the License. */ +import java.io.File; +import java.util.List; + import org.apache.maven.execution.MavenSession; import org.apache.maven.model.Resource; import org.apache.maven.project.MavenProject; import org.apache.maven.shared.utils.io.FileUtils; -import java.io.File; -import java.util.List; - /** * @author Olivier Lamy - * */ public interface MavenResourcesFiltering { /** - * @param resources {@link List} of {@link org.apache.maven.model.Resource} - * @param outputDirectory parent destination directory - * @param mavenProject the maven project - * @param encoding encoding to use for writing files - * @param fileFilters {@link List} of String which are path to a Property file + * @param resources {@link List} of {@link org.apache.maven.model.Resource} + * @param outputDirectory parent destination directory + * @param mavenProject the maven project + * @param encoding encoding to use for writing files + * @param fileFilters {@link List} of String which are path to a Property file * @param nonFilteredFileExtensions {@link List} of String for non filtered file extensions - * @param mavenSession Can include executionProperties that will be used for filtering + * @param mavenSession Can include executionProperties that will be used for filtering * @throws MavenFilteringException * @deprecated use {@link #filterResources(MavenResourcesExecution)} */ @@ -50,11 +49,11 @@ public interface MavenResourcesFiltering throws MavenFilteringException; /** - * @param resources {@link List} of {@link org.apache.maven.model.Resource} - * @param outputDirectory parent destination directory - * @param encoding encoding to use for writing files - * @param filterWrappers {@link List} of FileUtils.FilterWrapper - * @param resourcesBaseDirectory baseDirectory of resources + * @param resources {@link List} of {@link org.apache.maven.model.Resource} + * @param outputDirectory parent destination directory + * @param encoding encoding to use for writing files + * @param filterWrappers {@link List} of FileUtils.FilterWrapper + * @param resourcesBaseDirectory baseDirectory of resources * @param nonFilteredFileExtensions {@link List} of String for non filtered file extensions * @throws MavenFilteringException * @deprecated use {@link #filterResources(MavenResourcesExecution)} @@ -72,7 +71,7 @@ public interface MavenResourcesFiltering List getDefaultNonFilteredFileExtensions(); /** - * @param fileName the file name + * @param fileName the file name * @param userNonFilteredFileExtensions an extra list of file extensions * @return true if filtering can be applied to the file (means extensions.lowerCase is in the * default List or in the user defined extension List) 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=1632611&r1=1632610&r2=1632611&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 15:36:52 2014 @@ -38,7 +38,6 @@ import org.codehaus.plexus.interpolation * * @author cstamas * @author Olivier Lamy - * * @since 1.0 */ public class MultiDelimiterInterpolatorFilterReaderLineEnding @@ -106,23 +105,27 @@ public class MultiDelimiterInterpolatorF /** * This constructor uses default begin token ${ and default end token }. * - * @param in reader to use - * @param interpolator interpolator instance to use + * @param in reader to use + * @param interpolator interpolator instance to use * @param supportMultiLineFiltering If multi line filtering is allowed */ - public MultiDelimiterInterpolatorFilterReaderLineEnding( Reader in, Interpolator interpolator, + public MultiDelimiterInterpolatorFilterReaderLineEnding( + Reader in, + Interpolator interpolator, boolean supportMultiLineFiltering ) { this( in, interpolator, new SimpleRecursionInterceptor(), supportMultiLineFiltering ); } /** - * @param in reader to use - * @param interpolator interpolator instance to use - * @param ri The {@link RecursionInterceptor} to use to prevent recursive expressions. + * @param in reader to use + * @param interpolator interpolator instance to use + * @param ri The {@link RecursionInterceptor} to use to prevent recursive expressions. * @param supportMultiLineFiltering If multi line filtering is allowed */ - public MultiDelimiterInterpolatorFilterReaderLineEnding( Reader in, Interpolator interpolator, + public MultiDelimiterInterpolatorFilterReaderLineEnding( + Reader in, + Interpolator interpolator, RecursionInterceptor ri, boolean supportMultiLineFiltering ) { @@ -168,7 +171,7 @@ public class MultiDelimiterInterpolatorF * @param n The number of characters to skip * @return the number of characters actually skipped * @throws IllegalArgumentException If n is negative. - * @throws IOException If an I/O error occurs + * @throws IOException If an I/O error occurs */ public long skip( long n ) throws IOException @@ -193,8 +196,8 @@ public class MultiDelimiterInterpolatorF * occurs, or the end of the stream is reached. * * @param cbuf Destination buffer to write characters to. Must not be null. - * @param off Offset at which to start storing characters. - * @param len Maximum number of characters to read. + * @param off Offset at which to start storing characters. + * @param len Maximum number of characters to read. * @return the number of characters read, or -1 if the end of the stream has been reached * @throws IOException If an I/O error occurs */ @@ -238,7 +241,7 @@ public class MultiDelimiterInterpolatorF return -1; } - BoundedReader in = new BoundedReader(this.in, markLength); + BoundedReader in = new BoundedReader( this.in, markLength ); int ch = in.read(); if ( ( ch == -1 ) || ( ch == '\n' && !supportMultiLineFiltering ) ) @@ -345,7 +348,7 @@ public class MultiDelimiterInterpolatorF // we're committed, find the end token, EOL or EOF - key.append(beginToken); + key.append( beginToken ); in.reset(); in.skip( beginToken.length() ); ch = in.read(); @@ -479,8 +482,7 @@ public class MultiDelimiterInterpolatorF return recursionInterceptor; } - public MultiDelimiterInterpolatorFilterReaderLineEnding setRecursionInterceptor( - RecursionInterceptor recursionInterceptor ) + public MultiDelimiterInterpolatorFilterReaderLineEnding setRecursionInterceptor( RecursionInterceptor recursionInterceptor ) { this.recursionInterceptor = recursionInterceptor; return this;