Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNitin Dahyabhai2020-05-18 01:47:47 +0000
committerNitin Dahyabhai2020-05-18 01:47:47 +0000
commit9f79409a5e531be79b49aafd4387192e1f080398 (patch)
tree67310b337224b840156259556c15074da720d90a
parent410ea7dbca0c40ce6fd8f2727cfc7042ffe80aa1 (diff)
downloadwebtools.sourceediting-9f79409a5e531be79b49aafd4387192e1f080398.tar.gz
webtools.sourceediting-9f79409a5e531be79b49aafd4387192e1f080398.tar.xz
webtools.sourceediting-9f79409a5e531be79b49aafd4387192e1f080398.zip
[541596] Unsupported attribute "omit" on jsp:attribute
-rw-r--r--web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/HTMLCMDocumentFactory.java17
-rw-r--r--web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/JSP20ElementCollection.java4
-rw-r--r--web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/JSP21ElementCollection.java26
-rw-r--r--web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/JSP21Namespace.java3
-rw-r--r--web/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/contentmodels/TestFixedCMDocuments.java11
5 files changed, 45 insertions, 16 deletions
diff --git a/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/HTMLCMDocumentFactory.java b/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/HTMLCMDocumentFactory.java
index 2a365ff11c..e66fa75914 100644
--- a/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/HTMLCMDocumentFactory.java
+++ b/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/HTMLCMDocumentFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2011 IBM Corporation and others.
+ * Copyright (c) 2004, 2020 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -12,11 +12,10 @@
*******************************************************************************/
package org.eclipse.wst.html.core.internal.contentmodel;
-
-
import java.util.Arrays;
-import java.util.Hashtable;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.eclipse.wst.html.core.internal.contentmodel.chtml.CHCMDocImpl;
import org.eclipse.wst.html.core.internal.provisional.HTML40Namespace;
@@ -29,8 +28,8 @@ import org.eclipse.wst.xml.core.internal.provisional.contentmodel.CMDocType;
*/
public final class HTMLCMDocumentFactory {
- private static Hashtable cmdocs = new Hashtable();
- private static List supportedCMtypes = Arrays.asList(new Object[]{CMDocType.HTML_DOC_TYPE, CMDocType.CHTML_DOC_TYPE, CMDocType.JSP11_DOC_TYPE, CMDocType.JSP12_DOC_TYPE, CMDocType.JSP20_DOC_TYPE, CMDocType.TAG20_DOC_TYPE, CMDocType.TAG21_DOC_TYPE, CMDocType.JSP21_DOC_TYPE, CMDocType.HTML5_DOC_TYPE});
+ private static Map<String, CMDocument> cmdocs = new HashMap<>();
+ private static List<String> supportedCMtypes = Arrays.asList(new String[]{CMDocType.HTML_DOC_TYPE, CMDocType.CHTML_DOC_TYPE, CMDocType.JSP11_DOC_TYPE, CMDocType.JSP12_DOC_TYPE, CMDocType.JSP20_DOC_TYPE, CMDocType.TAG20_DOC_TYPE, CMDocType.TAG21_DOC_TYPE, CMDocType.JSP21_DOC_TYPE, CMDocType.HTML5_DOC_TYPE});
private static JCMDocImpl jsp11doc = null;
@@ -47,7 +46,7 @@ public final class HTMLCMDocumentFactory {
* java.lang.String
*/
public static CMDocument getCMDocument(String cmtype) {
- Object obj = cmdocs.get(cmtype);
+ CMDocument obj = cmdocs.get(cmtype);
if (obj == null && cmtype != null) {
if (supportedCMtypes.contains(cmtype)) {
obj = doCreateCMDocument(cmtype);
@@ -55,10 +54,10 @@ public final class HTMLCMDocumentFactory {
}
}
- return (CMDocument) obj;
+ return obj;
}
- private static Object doCreateCMDocument(String cmtype) {
+ private static CMDocument doCreateCMDocument(String cmtype) {
if (CMDocType.HTML_DOC_TYPE.equals(cmtype)) {
CMNamespaceImpl h40ns = new CMNamespaceImpl(HTML40Namespace.HTML40_URI, HTML40Namespace.HTML40_TAG_PREFIX);
HCMDocImpl html40doc = new HCMDocImpl(CMDocType.HTML_DOC_TYPE, h40ns);
diff --git a/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/JSP20ElementCollection.java b/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/JSP20ElementCollection.java
index 312caf2b11..38bb8d58e7 100644
--- a/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/JSP20ElementCollection.java
+++ b/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/JSP20ElementCollection.java
@@ -41,7 +41,7 @@ class JSP20ElementCollection extends JSPElementCollection implements JSP20Namesp
// NOTE: If the reflection is too slow, this method should
// just return the literal value, like 105.
// -- 5/25/2001
- Class clazz = Ids20.class;
+ Class<Ids20> clazz = Ids20.class;
Field[] fields = clazz.getFields();
numofids = 0;
for (int i = 0; i < fields.length; i++) {
@@ -228,7 +228,7 @@ class JSP20ElementCollection extends JSPElementCollection implements JSP20Namesp
declarations.putNamedItem(ATTR_NAME_NAME, adec);
}
- private void createForAttribute() {
+ void createForAttribute() {
AttrDecl adec = new AttrDecl(ATTR_NAME_NAME);
adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
adec.usage = CMAttributeDeclaration.REQUIRED;
diff --git a/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/JSP21ElementCollection.java b/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/JSP21ElementCollection.java
index f00bcf6566..94791e76a0 100644
--- a/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/JSP21ElementCollection.java
+++ b/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/JSP21ElementCollection.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2020 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -13,6 +13,7 @@
package org.eclipse.wst.html.core.internal.contentmodel;
import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration;
+import org.eclipse.wst.xml.core.internal.contentmodel.CMDataType;
class JSP21ElementCollection extends JSP20ElementCollection {
@@ -33,6 +34,29 @@ class JSP21ElementCollection extends JSP20ElementCollection {
declarations.putNamedItem(JSP21Namespace.ATTR_NAME_DEFERRED_SYNTAX_ALLOWED_AS_LITERAL, adec);
}
}
+
+ void createForAttribute() {
+ AttrDecl adec = new AttrDecl(ATTR_NAME_NAME);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.CDATA);
+ adec.usage = CMAttributeDeclaration.REQUIRED;
+ declarations.putNamedItem(ATTR_NAME_NAME, adec);
+
+ adec = new AttrDecl(JSP20Namespace.ATTR_NAME_TRIM);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ String[] values = {ATTR_VALUE_TRUE, ATTR_VALUE_FALSE};
+ adec.type.setEnumValues(values);
+ adec.type.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_TRUE);
+ adec.usage = CMAttributeDeclaration.OPTIONAL;
+ declarations.putNamedItem(JSP20Namespace.ATTR_NAME_TRIM, adec);
+
+ adec = new AttrDecl(JSP21Namespace.ATTR_NAME_OMIT);
+ adec.type = new HTMLCMDataTypeImpl(CMDataType.ENUM);
+ values = new String[] {ATTR_VALUE_TRUE, ATTR_VALUE_FALSE};
+ adec.type.setEnumValues(values);
+ adec.type.setImpliedValue(CMDataType.IMPLIED_VALUE_DEFAULT, ATTR_VALUE_FALSE);
+ adec.usage = CMAttributeDeclaration.OPTIONAL;
+ declarations.putNamedItem(JSP21Namespace.ATTR_NAME_OMIT, adec);
+ }
}
protected JACreater20 getAttributeCreator() {
diff --git a/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/JSP21Namespace.java b/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/JSP21Namespace.java
index 3171da49be..57777b618d 100644
--- a/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/JSP21Namespace.java
+++ b/web/bundles/org.eclipse.wst.html.core/src/org/eclipse/wst/html/core/internal/contentmodel/JSP21Namespace.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
+ * Copyright (c) 2009, 2020 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -16,4 +16,5 @@ public interface JSP21Namespace extends JSP20Namespace {
String JSP21_URI = "";//$NON-NLS-1$
String ATTR_NAME_TRIM_DIRECTIVE_WHITESPACES = "trimDirectiveWhitespaces"; //$NON-NLS-1$
String ATTR_NAME_DEFERRED_SYNTAX_ALLOWED_AS_LITERAL = "deferredSyntaxAllowedAsLiteral"; //$NON-NLS-1$
+ String ATTR_NAME_OMIT = "omit"; //$NON-NLS-1$
}
diff --git a/web/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/contentmodels/TestFixedCMDocuments.java b/web/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/contentmodels/TestFixedCMDocuments.java
index 38281ca1ac..60401318e3 100644
--- a/web/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/contentmodels/TestFixedCMDocuments.java
+++ b/web/tests/org.eclipse.jst.jsp.core.tests/src/org/eclipse/jst/jsp/core/tests/contentmodels/TestFixedCMDocuments.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2017 IBM Corporation and others.
+ * Copyright (c) 2007, 2020 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -12,11 +12,10 @@
*******************************************************************************/
package org.eclipse.jst.jsp.core.tests.contentmodels;
-import junit.framework.TestCase;
-
import org.eclipse.jst.jsp.core.internal.contentmodel.JSPCMDocumentFactory;
import org.eclipse.wst.html.core.internal.contentmodel.JSP11Namespace;
import org.eclipse.wst.html.core.internal.contentmodel.JSP20Namespace;
+import org.eclipse.wst.html.core.internal.contentmodel.JSP21Namespace;
import org.eclipse.wst.xml.core.internal.contentmodel.CMAttributeDeclaration;
import org.eclipse.wst.xml.core.internal.contentmodel.CMDocument;
import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
@@ -24,6 +23,8 @@ import org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap;
import org.eclipse.wst.xml.core.internal.contentmodel.CMNode;
import org.eclipse.wst.xml.core.internal.provisional.contentmodel.CMDocType;
+import junit.framework.TestCase;
+
public class TestFixedCMDocuments extends TestCase {
public TestFixedCMDocuments(String name) {
@@ -169,6 +170,10 @@ public class TestFixedCMDocuments extends TestCase {
checkAttrNames(CMDocType.JSP20_DOC_TYPE, JSP11Namespace.ElementName.USEBEAN, new String[]{JSP11Namespace.ATTR_NAME_ID, JSP11Namespace.ATTR_NAME_SCOPE, JSP11Namespace.ATTR_NAME_CLASS, JSP11Namespace.ATTR_NAME_TYPE, JSP11Namespace.ATTR_NAME_BEAN_NAME});
}
+ public void testAttributesOnJSP21Attribute() {
+ checkAttrNames(CMDocType.JSP21_DOC_TYPE, JSP21Namespace.ElementName.ATTRIBUTE, new String[]{JSP11Namespace.ATTR_NAME_NAME, JSP20Namespace.ATTR_NAME_TRIM, JSP21Namespace.ATTR_NAME_OMIT});
+ }
+
public void testAttributesOnTAG20Attribute() {
checkAttrNames(CMDocType.TAG20_DOC_TYPE, JSP20Namespace.ElementName.ATTRIBUTE, new String[]{JSP11Namespace.ATTR_NAME_NAME, JSP20Namespace.ATTR_NAME_TRIM});
}

Back to the top