You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by jo...@apache.org on 2011/03/30 02:27:15 UTC
svn commit: r1086813 -
/shindig/trunk/java/gadgets/src/main/java16/org/apache/shindig/gadgets/rewrite/js/ClosureJsCompiler.java
Author: johnh
Date: Wed Mar 30 00:27:14 2011
New Revision: 1086813
URL: http://svn.apache.org/viewvc?rev=1086813&view=rev
Log:
sourceMapping NPE fixes to ClosureJsCompiler.
Modified:
shindig/trunk/java/gadgets/src/main/java16/org/apache/shindig/gadgets/rewrite/js/ClosureJsCompiler.java
Modified: shindig/trunk/java/gadgets/src/main/java16/org/apache/shindig/gadgets/rewrite/js/ClosureJsCompiler.java
URL: http://svn.apache.org/viewvc/shindig/trunk/java/gadgets/src/main/java16/org/apache/shindig/gadgets/rewrite/js/ClosureJsCompiler.java?rev=1086813&r1=1086812&r2=1086813&view=diff
==============================================================================
--- shindig/trunk/java/gadgets/src/main/java16/org/apache/shindig/gadgets/rewrite/js/ClosureJsCompiler.java (original)
+++ shindig/trunk/java/gadgets/src/main/java16/org/apache/shindig/gadgets/rewrite/js/ClosureJsCompiler.java Wed Mar 30 00:27:14 2011
@@ -317,9 +317,7 @@ public class ClosureJsCompiler implement
int nextMapping = lines[line][col];
codePos++;
if (nextMapping != curMapping && curMapping != -1) {
- JsContent sourceJs = orig.get(getRootSrc(mappings[curMapping]));
- compiledOut.add(JsContent.fromFeature(compiled.substring(codeStart, codePos),
- sourceJs.getSource(), sourceJs.getFeature(), null));
+ appendJsContent(compiledOut, codeStart, codePos, compiled, curMapping);
codeStart = codePos;
}
curMapping = nextMapping;
@@ -332,8 +330,14 @@ public class ClosureJsCompiler implement
private void appendJsContent(List<JsContent> out, int startPos, int codePos,
String compiled, int mapping) {
JsContent sourceJs = orig.get(getRootSrc(mappings[mapping]));
+ String sourceName = "[closure-compiler-synthesized]";
+ String featureName = "[closure-compiler]";
+ if (sourceJs != null) {
+ sourceName = sourceJs.getSource() != null ? sourceJs.getSource() : "";
+ featureName = sourceJs.getFeature() != null ? sourceJs.getFeature() : "";
+ }
out.add(JsContent.fromFeature(compiled.substring(startPos, codePos),
- sourceJs.getSource(), sourceJs.getFeature(), null));
+ sourceName, featureName, null));
}
private static final String BEGIN_COMMENT = "/*";