jahaziel17 / wro4j

Automatically exported from code.google.com/p/wro4j
0 stars 0 forks source link

UnterminatedStringLiteralException minimizing multi line javascript string #904

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Javascript string could use backslash for concatenation like this:

var string = 'first line\
second line';

wro4j works fine only if after backslash only LF (line feed), if also carriage 
return (\CRLF), then UnterminatedStringLiteralException is thrown. 

Interpreting backslash concatenation makes no problem in browser, with or 
without carriage return.

What steps will reproduce the problem?
1. Make any js file with string above in example
2. make sure first line ends with CRLF
3. minifying throws UnterminatedStringLiteralException 

What is the expected output? What do you see instead?
File should be minified without exception. Proposal - setting to wro4j to 
remove \ concatenation in minified files at all (make one long string).

What version of the product are you using? On what operating system?
wro4j maven plugin 1.7.7, Windows 7

Please provide any additional information below.

Original issue reported on code.google.com by alex.dob...@gmail.com on 1 Oct 2014 at 3:13

GoogleCodeExporter commented 8 years ago
What processor your using for minimization? 

Original comment by alex.obj...@gmail.com on 1 Oct 2014 at 3:15

GoogleCodeExporter commented 8 years ago

Original comment by alex.obj...@gmail.com on 1 Oct 2014 at 3:15

GoogleCodeExporter commented 8 years ago

Original comment by alex.obj...@gmail.com on 1 Oct 2014 at 3:15

GoogleCodeExporter commented 8 years ago
preProcessors=cssImport,semicolonAppender,jsMin,cssMinJawr
postProcessors=cssVariables

Original comment by alex.dob...@gmail.com on 1 Oct 2014 at 3:18

GoogleCodeExporter commented 8 years ago
Ok. The jsMin is not the most efficient and reliable processor. I would 
recommend using googleClosure. This issue is related to jsMin processor only.

Original comment by alex.obj...@gmail.com on 1 Oct 2014 at 3:22

GoogleCodeExporter commented 8 years ago
OK, thanks for fast answer. I changed jsMin to googleClosureAdvanced, also 
tried googleClosureSimple, always have an error message:

Failed to execute goal ro.isdc.wro4j:wro4j-maven-plugin:1.7.7:run (default) on 
project zfs-mest-webapp: Execution default of goal 
ro.isdc.wro4j:wro4j-maven-plugin:1.7.7:run failed: An API incompatibility was 
encountered while executing ro.isdc.wro4j:wro4j-maven-plugin:1.7.7:run: 
java.lang.UnsupportedClassVersionError: 
com/google/javascript/jscomp/CodingConvention : Unsupported major.minor version 
51.0

What I am doing wrong?

Original comment by alex.dob...@gmail.com on 1 Oct 2014 at 3:34

GoogleCodeExporter commented 8 years ago
Apparently the google closure was built using jdk7. Are you using jdk6? 
You can either use jdk7 or later, or explicitly use an older version of google 
closure dependency which was built using jdk6.

Original comment by alex.obj...@gmail.com on 1 Oct 2014 at 3:40