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 0b28687  GoogDepsWriter: prevent NullReferenceException caused by 
missing dependency, and add a compiler problem instead
0b28687 is described below

commit 0b28687e40304eaba3185331a170225c16307b2e
Author: Josh Tynjala <[email protected]>
AuthorDate: Mon Sep 10 10:37:03 2018 -0700

    GoogDepsWriter: prevent NullReferenceException caused by missing 
dependency, and add a compiler problem instead
---
 compiler-jx/.classpath                             | 55 ++++++++++++++++++++--
 compiler-jx/.project                               | 10 ++--
 .../compiler/internal/graph/GoogDepsWriter.java    |  7 +++
 3 files changed, 64 insertions(+), 8 deletions(-)

diff --git a/compiler-jx/.classpath b/compiler-jx/.classpath
index 31d0100..a66643a 100644
--- a/compiler-jx/.classpath
+++ b/compiler-jx/.classpath
@@ -1,9 +1,28 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-       <classpathentry kind="src" path="src/main/java"/>
-       <classpathentry kind="src" path="src/test/java"/>
-       <classpathentry kind="src" path="src/main/resources"/>
-       <classpathentry kind="con" 
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+       <classpathentry kind="src" output="target/classes" path="src/main/java">
+               <attributes>
+                       <attribute name="optional" value="true"/>
+                       <attribute name="maven.pomderived" value="true"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry kind="src" output="target/test-classes" 
path="src/test/java">
+               <attributes>
+                       <attribute name="optional" value="true"/>
+                       <attribute name="maven.pomderived" value="true"/>
+                       <attribute name="test" value="true"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry excluding="**" kind="src" output="target/classes" 
path="src/main/resources">
+               <attributes>
+                       <attribute name="maven.pomderived" value="true"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry kind="con" 
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
+               <attributes>
+                       <attribute name="maven.pomderived" value="true"/>
+               </attributes>
+       </classpathentry>
        <classpathentry combineaccessrules="false" kind="src" path="/compiler"/>
        <classpathentry kind="lib" 
path="lib/google/closure-compiler/compiler.jar"/>
        <classpathentry kind="lib" path="lib/commons-io.jar"/>
@@ -17,5 +36,33 @@
        <classpathentry combineaccessrules="false" kind="src" 
path="/compiler-common"/>
        <classpathentry combineaccessrules="false" kind="src" 
path="/compiler-externc"/>
        <classpathentry combineaccessrules="false" kind="src" 
path="/compiler-test-utils"/>
+       <classpathentry excluding="**" kind="src" output="target/test-classes" 
path="src/test/resources">
+               <attributes>
+                       <attribute name="maven.pomderived" value="true"/>
+                       <attribute name="test" value="true"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry kind="con" 
path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
+               <attributes>
+                       <attribute name="maven.pomderived" value="true"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry kind="src" path="target/generated-sources/annotations">
+               <attributes>
+                       <attribute name="optional" value="true"/>
+                       <attribute name="maven.pomderived" value="true"/>
+                       <attribute name="ignore_optional_problems" 
value="true"/>
+                       <attribute name="m2e-apt" value="true"/>
+               </attributes>
+       </classpathentry>
+       <classpathentry kind="src" output="target/test-classes" 
path="target/generated-test-sources/test-annotations">
+               <attributes>
+                       <attribute name="optional" value="true"/>
+                       <attribute name="maven.pomderived" value="true"/>
+                       <attribute name="ignore_optional_problems" 
value="true"/>
+                       <attribute name="m2e-apt" value="true"/>
+                       <attribute name="test" value="true"/>
+               </attributes>
+       </classpathentry>
        <classpathentry kind="output" path="target/classes"/>
 </classpath>
diff --git a/compiler-jx/.project b/compiler-jx/.project
index ce368b3..e0b0be8 100644
--- a/compiler-jx/.project
+++ b/compiler-jx/.project
@@ -10,12 +10,14 @@
                        <arguments>
                        </arguments>
                </buildCommand>
+               <buildCommand>
+                       <name>org.eclipse.m2e.core.maven2Builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
        </buildSpec>
        <natures>
+               <nature>org.eclipse.m2e.core.maven2Nature</nature>
                <nature>org.eclipse.jdt.core.javanature</nature>
        </natures>
-       <linkedResources>
-       </linkedResources>
-       <variableList>
-       </variableList>
 </projectDescription>
diff --git 
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/graph/GoogDepsWriter.java
 
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/graph/GoogDepsWriter.java
index 23d6568..950e46b 100644
--- 
a/compiler-jx/src/main/java/org/apache/royale/compiler/internal/graph/GoogDepsWriter.java
+++ 
b/compiler-jx/src/main/java/org/apache/royale/compiler/internal/graph/GoogDepsWriter.java
@@ -211,6 +211,13 @@ public class GoogDepsWriter {
                        for (String dep : restOfDeps)
                        {
                                GoogDep gd = depMap.get(dep);
+                               if (gd == null)
+                               {
+                                       //added this to prevent a 
NullPointerException when the
+                                       //GoogDep is null. -JT
+                                       problems.add(new 
FileNotFoundProblem(dep));
+                                       continue;
+                               }
                                
sb.append("goog.addDependency('").append(relativePath(gd.filePath)).append("', 
['")
                                .append(gd.className).append("'], [")
                                .append((gd.fileInfo.impls != null) ? 
getDependencies(gd.fileInfo.impls) : "")

Reply via email to