- Made the BaseProblemGeneratorMojo delete previously generated enums

Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/ad943571
Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/ad943571
Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/ad943571

Branch: refs/heads/feature/maven-migration
Commit: ad943571149c51c1063165a5bfe5ae4ae33bfce4
Parents: b8c7c15
Author: Christofer Dutz <[email protected]>
Authored: Tue Apr 12 15:33:24 2016 +0200
Committer: Christofer Dutz <[email protected]>
Committed: Tue Apr 12 15:33:24 2016 +0200

----------------------------------------------------------------------
 .../compiler/tools/problems/BaseProblemGeneratorMojo.java     | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/ad943571/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/problems/BaseProblemGeneratorMojo.java
----------------------------------------------------------------------
diff --git 
a/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/problems/BaseProblemGeneratorMojo.java
 
b/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/problems/BaseProblemGeneratorMojo.java
index 903ca55..04929a5 100644
--- 
a/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/problems/BaseProblemGeneratorMojo.java
+++ 
b/compiler-build-tools/src/main/java/org/apache/flex/compiler/tools/problems/BaseProblemGeneratorMojo.java
@@ -61,6 +61,13 @@ public abstract class BaseProblemGeneratorMojo extends 
AbstractMojo
             }
         }
 
+        // If the file already exists, delete it before generating output.
+        if(generatedFile.exists()) {
+            if(!generatedFile.delete()) {
+                throw new MojoExecutionException("Could not clear previously 
created file: " + generatedFile.getPath());
+            }
+        }
+
         try {
             PrintWriter writer = new PrintWriter(new FileWriter(generatedFile, 
true));
             try {

Reply via email to