diff options
author | nitind | 2011-07-22 02:31:22 +0000 |
---|---|---|
committer | nitind | 2011-07-22 02:31:22 +0000 |
commit | dcee7edd172e4811144185ef99bfd6adc0f14ae6 (patch) | |
tree | e4db51f12964aee2c115435963586654598bc658 | |
parent | 56b6a31d62e0afa087d0bac284f7151d18b02213 (diff) | |
download | webtools.sourceediting-R3_0_5_patches.tar.gz webtools.sourceediting-R3_0_5_patches.tar.xz webtools.sourceediting-R3_0_5_patches.zip |
[352148] JSP Validator will not allow use of default namespaceR3_0_5_patches
8 files changed, 33 insertions, 35 deletions
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 98a565c050..69ba8bac7e 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 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.jst.jsp.core; singleton:=true -Bundle-Version: 1.2.127.qualifier +Bundle-Version: 1.2.128.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/validation/JSPContentValidator.java b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/validation/JSPContentValidator.java index eb309031ef..523db2b4ed 100644 --- a/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/validation/JSPContentValidator.java +++ b/bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/validation/JSPContentValidator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 IBM Corporation and others. + * Copyright (c) 2007, 2011 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 @@ -28,12 +28,16 @@ import org.eclipse.wst.validation.internal.provisional.core.IReporter; import org.eclipse.wst.xml.core.internal.document.DocumentTypeAdapter; import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument; import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel; +import org.w3c.dom.Element; /** * This validator validates the contents of the content type of the JSP, like * the HTML regions in a JSP with content type="text/html" */ public class JSPContentValidator extends JSPValidator { + private static final String HTTP_JAVA_SUN_COM_JSP_PAGE = "http://java.sun.com/JSP/Page"; //$NON-NLS-1$ + private static final String XMLNS = "xmlns"; //$NON-NLS-1$ + private static final String XMLNS_JSP = "xmlns:jsp"; //$NON-NLS-1$ private IContentType fJSPFContentType; /* @@ -46,6 +50,11 @@ public class JSPContentValidator extends JSPValidator { return adapter.hasFeature(HTMLDocumentTypeConstants.HTML); } + private boolean isXMLJSP(IDOMDocument document) { + Element root = document.getDocumentElement(); + return root != null && (root.hasAttribute(XMLNS_JSP) || HTTP_JAVA_SUN_COM_JSP_PAGE.equals(root.getAttribute(XMLNS))); + } + /** * Returns JSP fragment content type * @@ -88,7 +97,7 @@ public class JSPContentValidator extends JSPValidator { // This validator currently only handles validating HTML content in // JSP - if (hasHTMLFeature(document)) { + if (hasHTMLFeature(document) && !isXMLJSP(document)) { INodeAdapterFactory factory = HTMLValidationAdapterFactory.getInstance(); ValidationAdapter adapter = (ValidationAdapter) factory.adapt(document); if (adapter == null) diff --git a/bundles/org.eclipse.jst.jsp.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.jst.jsp.ui/META-INF/MANIFEST.MF index 76a98c76fa..c2f857a0cf 100644 --- a/bundles/org.eclipse.jst.jsp.ui/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.jst.jsp.ui/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.jst.jsp.ui; singleton:=true -Bundle-Version: 1.1.317.qualifier +Bundle-Version: 1.1.318.qualifier Bundle-Activator: org.eclipse.jst.jsp.ui.internal.JSPUIPlugin Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/validation/JSPContentSourceValidator.java b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/validation/JSPContentSourceValidator.java index 6f6dbccc1f..8d450eae50 100644 --- a/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/validation/JSPContentSourceValidator.java +++ b/bundles/org.eclipse.jst.jsp.ui/src/org/eclipse/jst/jsp/ui/internal/validation/JSPContentSourceValidator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. + * Copyright (c) 2007, 2011 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 @@ -107,28 +107,6 @@ public class JSPContentSourceValidator extends JSPContentValidator implements IS fDocument = null; } - protected void validate(IReporter reporter, IFile file, IDOMModel model) { - if (file == null || model == null) - return; // error - IDOMDocument document = model.getDocument(); - if (document == null) - return; // error - - // This validator currently only handles validating HTML content in - // JSP - if (hasHTMLFeature(document)) { - INodeAdapterFactory factory = HTMLValidationAdapterFactory.getInstance(); - ValidationAdapter adapter = (ValidationAdapter) factory.adapt(document); - if (adapter == null) - return; // error - - HTMLValidationReporter rep = getReporter(reporter, file, model); - rep.clear(); - adapter.setReporter(rep); - adapter.validate(document); - } - } - /** * This validate call is for the ISourceValidator partial document * validation approach diff --git a/bundles/org.eclipse.wst.xml.core/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.xml.core/META-INF/MANIFEST.MF index 7053a0c361..e9b7c4bf67 100644 --- a/bundles/org.eclipse.wst.xml.core/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.wst.xml.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.wst.xml.core; singleton:=true -Bundle-Version: 1.1.313.qualifier +Bundle-Version: 1.1.314.qualifier Bundle-Activator: org.eclipse.wst.xml.core.internal.XMLCorePlugin Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/XMLModelParser.java b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/XMLModelParser.java index 9d81dfe99a..40ece0ab71 100644 --- a/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/XMLModelParser.java +++ b/bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/document/XMLModelParser.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2001, 2010 IBM Corporation and others. + * Copyright (c) 2001, 2011 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 @@ -1291,15 +1291,24 @@ public class XMLModelParser { Node parent = this.context.getParentNode(); if(parent != null) { Node next = this.context.getNextNode(); - ModelParserAdapter parserAdapter = getParserAdapter(); - if (parserAdapter != null && parserAdapter instanceof ModelParserAdapterExtension) { - ModelParserAdapterExtension adapter = (ModelParserAdapterExtension) parserAdapter; - // Make sure to check that parent is an Element - while (parent.getNodeType() == Node.ELEMENT_NODE && !parserAdapter.canContain( (Element) parent, node) && adapter.isEndTagOmissible((Element) parent)) { + // Reset parents which are closed container elements; should not be parents + if(parent.getNodeType() == Node.ELEMENT_NODE) { + String type = ((ElementImpl)parent).getStartStructuredDocumentRegion().getLastRegion().getType(); + if(((ElementImpl)parent).isContainer() && type == DOMRegionContext.XML_EMPTY_TAG_CLOSE) { next = parent.getNextSibling(); parent = parent.getParentNode(); } - } + else { + ModelParserAdapter parserAdapter = getParserAdapter(); + if (parserAdapter instanceof ModelParserAdapterExtension) { + ModelParserAdapterExtension adapter = (ModelParserAdapterExtension) parserAdapter; + while (parent.getNodeType() == Node.ELEMENT_NODE && !parserAdapter.canContain( (Element) parent, node) && adapter.isEndTagOmissible((Element) parent)) { + next = parent.getNextSibling(); + parent = parent.getParentNode(); + } + } + } + } insertNode(parent, node, next); next = node.getNextSibling(); if (next != null) { diff --git a/features/org.eclipse.wst.xml_core.feature.patch/buildnotes_org.eclipse.wst.xml_core.feature.patch.html b/features/org.eclipse.wst.xml_core.feature.patch/buildnotes_org.eclipse.wst.xml_core.feature.patch.html index 6a9fb2a41b..b4c695c644 100644 --- a/features/org.eclipse.wst.xml_core.feature.patch/buildnotes_org.eclipse.wst.xml_core.feature.patch.html +++ b/features/org.eclipse.wst.xml_core.feature.patch/buildnotes_org.eclipse.wst.xml_core.feature.patch.html @@ -36,5 +36,6 @@ <p>Bug <a href='https://bugs.eclipse.org/335340'>335340</a>. ModelManager deadlock due to exception while loading filebuffer</p> <p>Bug <a href='https://bugs.eclipse.org/340582'>340582</a>. Add http://schemas.xmlsoap.org/soap/envelope/ to XML catalog</p> <p>Bug <a href='https://bugs.eclipse.org/345217'>345217</a>. Add soap envelop schema as schemaLocation to XML catalog</p> +<p>Bug <a href='https://bugs.eclipse.org/352148'>352148</a>. XML JSP can create unbalanced DOM.</p> </body> </head>
\ No newline at end of file diff --git a/features/org.eclipse.wst.xml_core.feature.patch/feature.properties b/features/org.eclipse.wst.xml_core.feature.patch/feature.properties index 1dd251487f..85174143e1 100644 --- a/features/org.eclipse.wst.xml_core.feature.patch/feature.properties +++ b/features/org.eclipse.wst.xml_core.feature.patch/feature.properties @@ -54,6 +54,7 @@ Bug https://bugs.eclipse.org/330335 Wrong error shown by JspMarkupValidator for Bug https://bugs.eclipse.org/335340 ModelManager deadlock due to exception while loading filebuffer \n\ Bug https://bugs.eclipse.org/340582 Add http://schemas.xmlsoap.org/soap/envelope/ to XML catalog\n\ Bug https://bugs.eclipse.org/345217 Add soap envelop schema as schemaLocation to XML catalog\n\ +Bug https://bugs.eclipse.org/352148 XML JSP can create unbalanced DOM.\n\ \n\ # "copyright" property - text of the "Feature Update Copyright" |