You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2018/09/14 22:00:35 UTC

[royale-compiler] 02/05: close buffers and remove unused vars

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

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

commit 71b048e63c07dbba2386836e31db7814ded6cea8
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Fri Sep 14 17:26:04 2018 +0200

    close buffers and remove unused vars
---
 .../compiler/tools/annotate/AnnotateClass.java     |  4 +
 .../ProblemResourceBundleGeneratorMojo.java        |  1 +
 .../java/org/apache/royale/utils/FileUtils.java    |  3 +-
 .../apache/royale/maven/GenerateManifestsMojo.java |  3 +-
 swfutils/src/main/java/flash/swf/TagDecoder.java   | 93 +++++++++++-----------
 .../src/main/java/flash/swf/tags/DefineFont3.java  |  2 +-
 6 files changed, 57 insertions(+), 49 deletions(-)

diff --git a/compiler-build-tools/src/main/java/org/apache/royale/compiler/tools/annotate/AnnotateClass.java b/compiler-build-tools/src/main/java/org/apache/royale/compiler/tools/annotate/AnnotateClass.java
index a7eac1f..9d0e9e5 100644
--- a/compiler-build-tools/src/main/java/org/apache/royale/compiler/tools/annotate/AnnotateClass.java
+++ b/compiler-build-tools/src/main/java/org/apache/royale/compiler/tools/annotate/AnnotateClass.java
@@ -20,6 +20,8 @@ public class AnnotateClass
 {
     public static class AnnotateClassDeleteException extends Exception
     {
+        private static final long serialVersionUID = 1L;
+
         public AnnotateClassDeleteException(String s)
         {
             super(s);
@@ -28,6 +30,8 @@ public class AnnotateClass
     
     public static class AnnotateClassRenameException extends Exception
     {
+        private static final long serialVersionUID = 1L;
+
         public AnnotateClassRenameException(String s)
         {
             super(s);
diff --git a/compiler-build-tools/src/main/java/org/apache/royale/compiler/tools/problems/ProblemResourceBundleGeneratorMojo.java b/compiler-build-tools/src/main/java/org/apache/royale/compiler/tools/problems/ProblemResourceBundleGeneratorMojo.java
index 0a9b5a9..b8a3193 100644
--- a/compiler-build-tools/src/main/java/org/apache/royale/compiler/tools/problems/ProblemResourceBundleGeneratorMojo.java
+++ b/compiler-build-tools/src/main/java/org/apache/royale/compiler/tools/problems/ProblemResourceBundleGeneratorMojo.java
@@ -85,6 +85,7 @@ public class ProblemResourceBundleGeneratorMojo
                     }
                 }
             }
+            sourceFileReader.close();
             if(sb != null) {
                 line = sb.toString();
                 return line.substring(line.indexOf("\"") + 1, line.lastIndexOf("\""));
diff --git a/compiler-common/src/main/java/org/apache/royale/utils/FileUtils.java b/compiler-common/src/main/java/org/apache/royale/utils/FileUtils.java
index 824ab6d..2a40b60 100644
--- a/compiler-common/src/main/java/org/apache/royale/utils/FileUtils.java
+++ b/compiler-common/src/main/java/org/apache/royale/utils/FileUtils.java
@@ -167,7 +167,8 @@ public final class FileUtils
             }
         	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.DA_BYTEARRAY) == CompilerDiagnosticsConstants.DA_BYTEARRAY)
         		System.out.println("FileUtils waiting for lock in toByteArray");
-            byte[] b = baos.getDirectByteArray();
+            //byte[] b = 
+            baos.getDirectByteArray();
         	if ((CompilerDiagnosticsConstants.diagnostics & CompilerDiagnosticsConstants.DA_BYTEARRAY) == CompilerDiagnosticsConstants.DA_BYTEARRAY)
         		System.out.println("FileUtils waiting for lock in toByteArray");
         }
diff --git a/royale-maven-plugin/src/main/java/org/apache/royale/maven/GenerateManifestsMojo.java b/royale-maven-plugin/src/main/java/org/apache/royale/maven/GenerateManifestsMojo.java
index 01d626f..80f63ed 100644
--- a/royale-maven-plugin/src/main/java/org/apache/royale/maven/GenerateManifestsMojo.java
+++ b/royale-maven-plugin/src/main/java/org/apache/royale/maven/GenerateManifestsMojo.java
@@ -123,7 +123,8 @@ public class GenerateManifestsMojo
                     break;
                 }
             }
-
+            zin.close();
+            
             // Read the catalog.xml file inside.
             if(catalogBytes != null) {
                 try {
diff --git a/swfutils/src/main/java/flash/swf/TagDecoder.java b/swfutils/src/main/java/flash/swf/TagDecoder.java
index 45b7326..25c8ddb 100644
--- a/swfutils/src/main/java/flash/swf/TagDecoder.java
+++ b/swfutils/src/main/java/flash/swf/TagDecoder.java
@@ -1325,6 +1325,7 @@ public final class TagDecoder
         System.arraycopy(alphaData, 0, t.alphaData, 0, i);
 
         dict.add(id, t);
+        r1.close();
         return t;
     }
 
@@ -1627,52 +1628,52 @@ public final class TagDecoder
         return t;
     }
 
-    private Tag decodePlaceObject2(int length) throws IOException
-    {
-        PlaceObject t;
-        t = new PlaceObject(stagPlaceObject2);
-        r.syncBits();
-
-        int pos = r.getOffset();
-
-        t.flags = r.readUI8();
-        t.depth = r.readUI16();
-
-        if (t.hasCharID())
-        {
-            int idref = r.readUI16();
-            t.ref = dict.getTag(idref);
-        }
-        if (t.hasMatrix())
-        {
-            t.matrix = decodeMatrix();
-        }
-        if (t.hasCxform())
-        {
-            // ed 5/22/03 the SWF 6 file format spec says this will be a CXFORM, but
-            // the spec is wrong.  the player expects a CXFORMA.
-            t.colorTransform = decodeCxforma();
-        }
-        if (t.hasRatio())
-        {
-            t.ratio = r.readUI16();
-        }
-        if (t.hasName())
-        {
-            t.name = r.readString();
-        }
-        if (t.hasClipDepth())
-        {
-            t.clipDepth = r.readUI16();
-        }
-        if (t.hasClipAction())
-        {
-            ActionDecoder actionDecoder = new ActionDecoder(r,swd);
-            actionDecoder.setKeepOffsets(keepOffsets);
-            t.clipActions = actionDecoder.decodeClipActions(length - (r.getOffset() - pos));
-        }
-        return t;
-    }
+    // private Tag decodePlaceObject2(int length) throws IOException
+    // {
+    //     PlaceObject t;
+    //     t = new PlaceObject(stagPlaceObject2);
+    //     r.syncBits();
+
+    //     int pos = r.getOffset();
+
+    //     t.flags = r.readUI8();
+    //     t.depth = r.readUI16();
+
+    //     if (t.hasCharID())
+    //     {
+    //         int idref = r.readUI16();
+    //         t.ref = dict.getTag(idref);
+    //     }
+    //     if (t.hasMatrix())
+    //     {
+    //         t.matrix = decodeMatrix();
+    //     }
+    //     if (t.hasCxform())
+    //     {
+    //         // ed 5/22/03 the SWF 6 file format spec says this will be a CXFORM, but
+    //         // the spec is wrong.  the player expects a CXFORMA.
+    //         t.colorTransform = decodeCxforma();
+    //     }
+    //     if (t.hasRatio())
+    //     {
+    //         t.ratio = r.readUI16();
+    //     }
+    //     if (t.hasName())
+    //     {
+    //         t.name = r.readString();
+    //     }
+    //     if (t.hasClipDepth())
+    //     {
+    //         t.clipDepth = r.readUI16();
+    //     }
+    //     if (t.hasClipAction())
+    //     {
+    //         ActionDecoder actionDecoder = new ActionDecoder(r,swd);
+    //         actionDecoder.setKeepOffsets(keepOffsets);
+    //         t.clipActions = actionDecoder.decodeClipActions(length - (r.getOffset() - pos));
+    //     }
+    //     return t;
+    // }
 
 
     private CXFormWithAlpha decodeCxforma() throws IOException
diff --git a/swfutils/src/main/java/flash/swf/tags/DefineFont3.java b/swfutils/src/main/java/flash/swf/tags/DefineFont3.java
index c1ce80a..588eb31 100644
--- a/swfutils/src/main/java/flash/swf/tags/DefineFont3.java
+++ b/swfutils/src/main/java/flash/swf/tags/DefineFont3.java
@@ -82,7 +82,7 @@ public class DefineFont3 extends DefineFont2
 
         if (object instanceof DefineFont3 && super.equals(object))
         {
-            DefineFont3 defineFont = (DefineFont3)object;
+            // DefineFont3 defineFont = (DefineFont3)object;
 
             // DefineFontAlignZones already checks if its font is equal, so we
             // don't check here to avoid circular equality checking...