Community
Participate
Working Groups
Created attachment 146992 [details] Fix Patch +++ This bug was initially created as a clone of Bug #289257 for the 3.2 stream +++ Currently if a JSP document contains something along the lines of: <% String foo %> <%= foo = "Hello World!" %> It gets translated to: String foo; out.print(""+ foo = "Hello!" ); Which has an error on the = saying "Syntax error on token "=". != expected" which is then displayed to the user in their JSP document. To fix this issue my patch makes it so the JSP is translated to: String foo; out.print(""+( foo = "Hello!" )); Thus eliminating the error. It is worth noting that this does bring up another smaller issue in that with this case "foo" would be marked with a warning saying "The local variable foo is never read" because it seems the Java compiler is not smart enough to realize that foo is being read in this case. This is really a Java compiler issue and not our issue but we may want to consider opening another bug to make it so this doesn't happen in JSP page.
(In reply to comment #0) I'm sure this will break some JUnits (or it should), but while you're in there, can you remove the extraneous line delimiters that are inserted around the expressions? At least for 3.2? And foo really is never being read, it's only being _written_ to.
(In reply to comment #1) > (In reply to comment #0) > I'm sure this will break some JUnits (or it should) Oops, forgot to check that. There a couple of failures. Updates to JUnits will be included with updated patch. > but while you're in there, > can you remove the extraneous line delimiters that are inserted around the > expressions? At least for 3.2? Patch to follow. > And foo really is never being read, it's only being _written_ to. Hrm, I thought the order of operations here was something like: 1. wright "hello world" to 'foo'. 2. read 'foo' and print it
Created attachment 147099 [details] Fix Patch with JUnit Updates This patch removes the extra new lines as requested and updates JUnits for the change.
Created attachment 147366 [details] Fix Patch Update 1 with JUnit Updates As per Nick's comment on Bug 289257 we do not need to be concatenating an empty string onto jsp expressions when translating them to java because of override versions of out.print. This patch updates the translator to not use parentheses or "" + and updates the JUnits appropriately.
Thanks for the patch.
Verified in I-3.2.0-20091017071807