Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 150685 Details for
Bug 293503
[validation] JSP syntax validator requires brackets after IF statement
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Fix Patch
293503_JSPTranslator_if_statement.txt (text/plain), 3.99 KB, created by
Ian Tewksbury
on 2009-10-27 16:50:17 EDT
(
hide
)
Description:
Fix Patch
Filename:
MIME Type:
Creator:
Ian Tewksbury
Created:
2009-10-27 16:50:17 EDT
Size:
3.99 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jst.jsp.core >Index: src/org/eclipse/jst/jsp/core/internal/java/JSPTranslator.java >=================================================================== >RCS file: /cvsroot/webtools/sourceediting/plugins/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslator.java,v >retrieving revision 1.51.2.3.2.6 >diff -u -r1.51.2.3.2.6 JSPTranslator.java >--- src/org/eclipse/jst/jsp/core/internal/java/JSPTranslator.java 18 Sep 2009 04:12:40 -0000 1.51.2.3.2.6 >+++ src/org/eclipse/jst/jsp/core/internal/java/JSPTranslator.java 27 Oct 2009 20:50:22 -0000 >@@ -244,6 +244,17 @@ > * EL Translator ID > */ > private String fELTranslatorID; >+ >+ /** >+ * A buffer to store non translated code such as plain XML >+ */ >+ private StringBuffer fCollectedNonTranslatedCode; >+ >+ /** >+ * <code>true</code> if code has been appended to a buffer for the current region, >+ * <code>false</code> otherwise >+ */ >+ private boolean fCodeAppended; > > /** > * A structure for holding a region collection marker and list of variable >@@ -488,6 +499,8 @@ > > fELProblems = new ArrayList(); > >+ fCollectedNonTranslatedCode = new StringBuffer(); >+ fCodeAppended = false; > } > > /** >@@ -916,7 +929,9 @@ > setCurrentNode(fStructuredDocument.getFirstStructuredDocumentRegion()); > > while (getCurrentNode() != null && !isCanceled()) { >- >+ //no code has been append for this region yet >+ fCodeAppended = false; >+ > // intercept HTML comment flat node > // also handles UNDEFINED (which is what CDATA comes in as) > // basically this part will handle any "embedded" JSP containers >@@ -927,10 +942,18 @@ > // iterate through each region in the flat node > translateRegionContainer(getCurrentNode(), STANDARD_JSP); > } >+ >+ //if no code was appended for this region collect it as not translated >+ if(!fCodeAppended) { >+ collectNonTranslatedCode(getCurrentNode()); >+ } >+ > if (getCurrentNode() != null) > advanceNextNode(); > } > >+ writeCollectedNonTranslatedCode(); >+ > /* > * Any contents left in the map indicate start tags that never had end > * tags. While the '{' that is present without the matching '}' would >@@ -2113,6 +2136,11 @@ > if (!nonl && !newText.endsWith(ENDL)) > newText += ENDL; > >+ //dump any non translated code before writing translated code >+ writeCollectedNonTranslatedCode(); >+ fCodeAppended = true; >+ >+ > if (buffer == fUserCode) { > buffer.append(newText); > if (addToMap) { >@@ -2370,6 +2398,44 @@ > } > > /** >+ * Adds the given {@link ITextRegion} to the collection of non translated code. >+ * >+ * @param region >+ */ >+ private void collectNonTranslatedCode(ITextRegion region) { >+ String s = ""; //$NON-NLS-1$ >+ if (region instanceof ITextRegionContainer) { >+ Iterator it = ((ITextRegionContainer) region).getRegions().iterator(); >+ ITextRegion temp = null; >+ while (it.hasNext()) { >+ temp = (ITextRegion) it.next(); >+ fCollectedNonTranslatedCode.append(getCurrentNode().getFullText(temp)); >+ } >+ } >+ else { >+ s = EscapedTextUtil.getUnescapedText(getCurrentNode(), region); >+ fCollectedNonTranslatedCode.append(s.trim()); >+ } >+ } >+ >+ /** >+ * Writes the non translated code to the {@link #fUserCode} buffer. >+ * This should be done before appending any new translated code. >+ */ >+ private void writeCollectedNonTranslatedCode() { >+ if(fCollectedNonTranslatedCode.length() > 0) { >+ String dump = fCollectedNonTranslatedCode.toString(); >+ dump = dump.replaceAll("[\n\t\r\" ]*", ""); >+ >+ dump = EXPRESSION_PREFIX + "\"" + dump + "\"" + EXPRESSION_SUFFIX + ENDL; >+ fUserCode.append(dump); >+ fOffsetInUserCode += dump.length(); >+ >+ fCollectedNonTranslatedCode = new StringBuffer(); >+ } >+ } >+ >+ /** > * Set the buffer to the current JSPType: STANDARD_JSP, EMBEDDED_JSP, > * DECLARATION, EXPRESSION, SCRIPTLET (for keepting track of cursor > * position when the final document is built)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 293503
:
150685
|
150721
|
154716