This is an automated email from the ASF dual-hosted git repository.

joshtynjala pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-compiler.git


The following commit(s) were added to refs/heads/develop by this push:
     new e65ffae  royale-maven-plugin: just some better FileWriter management
e65ffae is described below

commit e65ffae870392b53de3fc57e6827206cbd05ac43
Author: Josh Tynjala <[email protected]>
AuthorDate: Tue Dec 10 09:51:34 2019 -0800

    royale-maven-plugin: just some better FileWriter management
---
 .../main/java/org/apache/royale/maven/BaseMojo.java   | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git 
a/royale-maven-plugin/src/main/java/org/apache/royale/maven/BaseMojo.java 
b/royale-maven-plugin/src/main/java/org/apache/royale/maven/BaseMojo.java
index 1322f89..24346ac 100644
--- a/royale-maven-plugin/src/main/java/org/apache/royale/maven/BaseMojo.java
+++ b/royale-maven-plugin/src/main/java/org/apache/royale/maven/BaseMojo.java
@@ -302,16 +302,16 @@ public abstract class BaseMojo
                 throw new MojoExecutionException("Could not create output 
directory: " + configFile.getParent());
             }
         }
-        FileWriter writer = null;
+        FileWriter configWriter = null;
         try {
-            writer = new FileWriter(configFile);
-            configTemplate.merge(context, writer);
+            configWriter = new FileWriter(configFile);
+            configTemplate.merge(context, configWriter);
         } catch (IOException e) {
             throw new MojoExecutionException("Error creating config file at " 
+ configFile.getPath());
         } finally {
-            if(writer != null) {
+            if(configWriter != null) {
                 try {
-                    writer.close();
+                    configWriter.close();
                 } catch (IOException e) {
                     throw new MojoExecutionException("Error creating config 
file at " + configFile.getPath());
                 }
@@ -327,15 +327,16 @@ public abstract class BaseMojo
                 throw new MojoExecutionException("Could not create output 
directory: " + manifestFile.getParent());
             }
         }
+        FileWriter manifestWriter = null;
         try {
-            writer = new FileWriter(manifestFile);
-            manifestTemplate.merge(context, writer);
+            manifestWriter = new FileWriter(manifestFile);
+            manifestTemplate.merge(context, manifestWriter);
         } catch (IOException e) {
             throw new MojoExecutionException("Error creating manifest file at 
" + manifestFile.getPath());
         } finally {
-            if(writer != null) {
+            if(manifestWriter != null) {
                 try {
-                    writer.close();
+                    manifestWriter.close();
                 } catch (IOException e) {
                     throw new MojoExecutionException("Error creating manifest 
file at " + manifestFile.getPath());
                 }

Reply via email to