You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ol...@apache.org on 2018/12/08 09:59:24 UTC
[maven-assembly-plugin] branch master updated: fix it directory
test... and use try-resources
This is an automated email from the ASF dual-hosted git repository.
olamy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-assembly-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 6b3b67a fix it directory test... and use try-resources
6b3b67a is described below
commit 6b3b67ab112fdf650c5dc4a3183806946ccf7a3e
Author: olivier lamy <ol...@apache.org>
AuthorDate: Sat Dec 8 19:59:11 2018 +1000
fix it directory test... and use try-resources
Signed-off-by: olivier lamy <ol...@apache.org>
---
.../custom-handler-withMixedEntries/verify.bsh | 4 ++--
.../filter/SimpleAggregatingDescriptorHandler.java | 25 ++++------------------
2 files changed, 6 insertions(+), 23 deletions(-)
diff --git a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/verify.bsh b/src/it/projects/container-descriptors/custom-handler-withMixedEntries/verify.bsh
index b531e33..d380581 100644
--- a/src/it/projects/container-descriptors/custom-handler-withMixedEntries/verify.bsh
+++ b/src/it/projects/container-descriptors/custom-handler-withMixedEntries/verify.bsh
@@ -23,8 +23,8 @@ boolean result = true;
try
{
- File a = new File( basedir, "target/its/target/assembly-1-bin/file.txt");
- File b = new File( basedir, "target/its/target/assembly-1-bin/b/file.txt");
+ File a = new File( basedir, "assembly/target/assembly-1-bin/file.txt");
+ File b = new File( basedir, "assembly/target/assembly-1-bin/b/file.txt");
if(result && !a.exists() ) {
System.out.println( "File: " + a + " should have been generated, but was not." );
diff --git a/src/main/java/org/apache/maven/plugins/assembly/filter/SimpleAggregatingDescriptorHandler.java b/src/main/java/org/apache/maven/plugins/assembly/filter/SimpleAggregatingDescriptorHandler.java
index 3f7bc38..ff39122 100644
--- a/src/main/java/org/apache/maven/plugins/assembly/filter/SimpleAggregatingDescriptorHandler.java
+++ b/src/main/java/org/apache/maven/plugins/assembly/filter/SimpleAggregatingDescriptorHandler.java
@@ -190,33 +190,16 @@ public class SimpleAggregatingDescriptorHandler
private void readProperties( final FileInfo fileInfo )
throws IOException
{
- Reader reader = null;
- StringWriter writer = null;
- try
+ try ( StringWriter writer = new StringWriter();
+ Reader reader = AssemblyFileUtils.isPropertyFile( fileInfo.getName() )
+ ? new InputStreamReader( fileInfo.getContents(), StandardCharsets.ISO_8859_1 )
+ : new InputStreamReader( fileInfo.getContents() ) ) // platform encoding
{
- writer = new StringWriter();
-
- reader = AssemblyFileUtils.isPropertyFile( fileInfo.getName() )
- ? new InputStreamReader( fileInfo.getContents(), StandardCharsets.ISO_8859_1 )
- : new InputStreamReader( fileInfo.getContents() ); // platform encoding
-
IOUtil.copy( reader, writer );
-
- writer.close();
final String content = writer.toString();
- writer = null;
-
- reader.close();
- reader = null;
-
aggregateWriter.write( "\n" );
aggregateWriter.write( content );
}
- finally
- {
- IOUtil.close( writer );
- IOUtil.close( reader );
- }
}
protected final Logger getLogger()