| Summary: | Error in java source when EGL string literal uses escape character | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Kathy Carroll <carrollk> | ||||||
| Component: | EDT | Assignee: | Project Inbox <edt.mofmodel-inbox> | ||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | mheitz, pharmon | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Kathy Carroll
Resolving with Kathy's consent. The problem doesn't happen for me, but she's seen it come and go. verified no longer happens for me Created attachment 201800 [details]
test program
Created attachment 201801 [details]
ET used by test program
This is happening to me now, intermittently. It seems to happen when generation happens because of a clean, but not when generation happens because I modified the file.
I've attached my testcase (two files).
I set a conditional breakpoint in the generator, at line 21 of org.eclipse.edt.gen.java.templates.StringLiteralTemplate . The condition is expr.toString().indexOf("\\") > -1
When the problem happens, the value of "expr" in the variables view looks like this:
Instance of: org.eclipse.edt.mof.egl.StringLiteral
eClass -> Instance of: org.eclipse.edt.mof.EClass - org.eclipse.edt.mof.egl.StringLiteral
annotations -> [Instance of: EGL_Location]
value -> c:\temp\test2\this2\stuff2
isHex -> false
Notice the single backslashes in the value slot. When the problem doesn't happen the value slot looks like this:
value -> c:\\temp\\test2\\this2\\stuff2
The IR file always looks good. For example
<arguments ID="39" eClass="org.eclipse.edt.mof.egl.StringLiteral" value="c:\\temp\\test2\\this2\\stuff2" isHex="false" >
Meant to reopen. Duh. I found that the root of this problem was that the XMLSeralizer was adding an extra \ whenever it found a \ in a string attribute value. However, since xml does not escape the \ character, this had the effect of adding extra slashes to the string. Because of this, java and javascript generation had removed the code to escape the \ character when it found it in a string literal. Soooo everything worked fine, as long as the generators were invoked from a deserialized copy of the IR (this would happen during an incremental build). However, during a clean build, the generators use the cached IRs that were built during by EDT builder. These IRs do not contain the extra \ characters. Because of this, the java and javascript were generated with insufficient \ characters. I have updated XMLSerializer to remove the addition of the extraneous \, and have updated StringLiteralTemplate (for both java and js) to escape the \ character. works correctly in 201109161325 Closing this defect. |