[293503] [validation] JSP syntax validator requires brackets after IF statement [297203] Validation of runtime expressions in custom tags should not include deferred expressions [304722] JSP include directives do not handle non-JSP content types
diff --git a/bundles/org.eclipse.jst.jsp.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.jst.jsp.core/META-INF/MANIFEST.MF index 4776b60..4c9c504 100644 --- a/bundles/org.eclipse.jst.jsp.core/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.jst.jsp.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.jst.jsp.core; singleton:=true -Bundle-Version: 1.1.109.qualifier +Bundle-Version: 1.1.110.qualifier Bundle-Activator: org.eclipse.jst.jsp.core.internal.JSPCorePlugin Bundle-Vendor: %providerName Bundle-Localization: plugin
diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslator.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslator.java index 1ae3f32..e31c359 100644 --- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslator.java +++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/JSPTranslator.java
@@ -246,6 +246,19 @@ private String fELTranslatorID; /** + * <code>true</code> if code has been found, such as HTML tags, that is not translated + * <code>false</code> otherwise. Useful for deciding if a place holder needs to be + * written to translation + */ + private boolean fFoundNonTranslatedCode; + + /** + * <code>true</code> if code has been translated for the current region, + * <code>false</code> otherwise + */ + private boolean fCodeTranslated; + + /** * A structure for holding a region collection marker and list of variable * information. The region can be used later for positioning validation * messages. @@ -488,6 +501,9 @@ fELProblems = new ArrayList(); + fFoundNonTranslatedCode = false; + fCodeTranslated = false; + } /** @@ -916,7 +932,9 @@ setCurrentNode(fStructuredDocument.getFirstStructuredDocumentRegion()); while (getCurrentNode() != null && !isCanceled()) { - + //no code has been translated for this region yet + fCodeTranslated = 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 +945,18 @@ // iterate through each region in the flat node translateRegionContainer(getCurrentNode(), STANDARD_JSP); } + + //if no code was translated for this region then found "non translated code" + if(!fCodeTranslated) { + fFoundNonTranslatedCode = true; + } + if (getCurrentNode() != null) advanceNextNode(); } + writePlaceHolderForNonTranslatedCode(); + /* * Any contents left in the map indicate start tags that never had end * tags. While the '{' that is present without the matching '}' would @@ -1066,6 +1092,11 @@ else if (type != null && (type == DOMRegionContext.XML_TAG_OPEN || type == DOMRegionContext.XML_END_TAG_OPEN)) { translateXMLNode(containerRegion, regions); } + //the end tags of these regions are "translated" in a sense + else if(type == DOMJSPRegionContexts.JSP_DIRECTIVE_CLOSE || + type == DOMJSPRegionContexts.JSP_CLOSE) { + this.fCodeTranslated = true; + } } // } } @@ -2112,6 +2143,12 @@ // add a newline so translation looks cleaner if (!nonl && !newText.endsWith(ENDL)) newText += ENDL; + + //dump any non translated code before writing translated code + writePlaceHolderForNonTranslatedCode(); + + //if appending to the buffer can assume something got translated + fCodeTranslated = true; if (buffer == fUserCode) { buffer.append(newText); @@ -2645,4 +2682,19 @@ public IStructuredDocument getStructuredDocument() { return fStructuredDocument; } + + /** + * <p>Writes an empty expression to {@link #fUserCode} if previously + * found non translated code</p> + * <p>This should be done before appending any newly translated code.</p> + */ + private void writePlaceHolderForNonTranslatedCode() { + if(fFoundNonTranslatedCode) { + String text = (EXPRESSION_PREFIX + "\"\"" + EXPRESSION_SUFFIX + + " //non translated code placeholder"+ ENDL); + fUserCode.append(text); + fOffsetInUserCode += text.length(); + fFoundNonTranslatedCode = false; + } + } } \ No newline at end of file
diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/XMLJSPRegionHelper.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/XMLJSPRegionHelper.java index 99866c7..cf47ed5 100644 --- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/XMLJSPRegionHelper.java +++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/XMLJSPRegionHelper.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2009 IBM Corporation and others. + * Copyright (c) 2004, 2010 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -22,6 +22,7 @@ import org.eclipse.jst.jsp.core.internal.encoding.JSPDocumentLoader; import org.eclipse.jst.jsp.core.internal.parser.JSPSourceParser; import org.eclipse.jst.jsp.core.internal.provisional.JSP11Namespace; +import org.eclipse.jst.jsp.core.internal.provisional.contenttype.ContentTypeIdForJSP; import org.eclipse.jst.jsp.core.internal.regions.DOMJSPRegionContexts; import org.eclipse.jst.jsp.core.internal.util.FileContentCache; import org.eclipse.wst.sse.core.internal.ltk.modelhandler.IModelHandler; @@ -133,7 +134,9 @@ } if (f != null && f.isAccessible()) { try { - IModelHandler handler = ModelHandlerRegistry.getInstance().getHandlerFor(f); + IModelHandler handler = ModelHandlerRegistry.getInstance().getHandlerFor(f, false); + if (handler == null) + handler = ModelHandlerRegistry.getInstance().getHandlerForContentTypeId(ContentTypeIdForJSP.ContentTypeID_JSPFRAGMENT); document = (IStructuredDocument) handler.getDocumentLoader().createNewStructuredDocument(); contents = getContents(f); }
diff --git a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/validation/JSPActionValidator.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/validation/JSPActionValidator.java index 6b0c133..4f320d1 100644 --- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/validation/JSPActionValidator.java +++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/validation/JSPActionValidator.java
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. + * Copyright (c) 2007, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -89,7 +89,7 @@ Iterator it = ((ITextRegionContainer) value).getRegions().iterator(); while (it.hasNext()) { String type = ((ITextRegion) it.next()).getType(); - if (type == DOMJSPRegionContexts.JSP_EL_OPEN || type == DOMJSPRegionContexts.JSP_VBL_OPEN) + if (type == DOMJSPRegionContexts.JSP_EL_OPEN) return true; } }