Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNitin Dahyabhai2017-11-07 13:23:00 -0500
committerNitin Dahyabhai2017-11-07 16:03:32 -0500
commit6229816b8972e4500ddf32b5aea3c50f576b838f (patch)
tree0758d71bada8e1b8cd984bcfffd729e3edc8be26
parent47f7671080c4a4dbd0a352f0fb1627b664d43919 (diff)
downloadwebtools.sourceediting-6229816b8972e4500ddf32b5aea3c50f576b838f.tar.gz
webtools.sourceediting-6229816b8972e4500ddf32b5aea3c50f576b838f.tar.xz
webtools.sourceediting-6229816b8972e4500ddf32b5aea3c50f576b838f.zip
[nobug] better guard against NPEs from broken jsp:useBean elements
-rw-r--r--bundles/org.eclipse.jst.jsp.core/src/org/eclipse/jst/jsp/core/internal/java/XMLJSPRegionHelper.java14
1 files changed, 7 insertions, 7 deletions
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 7fff05c55..fa2b13d43 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, 2011 IBM Corporation and others.
+ * Copyright (c) 2004, 2017 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
@@ -389,14 +389,14 @@ class XMLJSPRegionHelper implements StructuredDocumentRegionHandler {
protected void processUseBean(IStructuredDocumentRegion sdRegion) {
if (fTagname != null && isUseBean(fTagname)) {
- String beanClass, beanType, beanId, beanDecl = ""; //$NON-NLS-1$
- beanClass = getAttributeValue("class", sdRegion); //$NON-NLS-1$
- beanType = getAttributeValue("type", sdRegion); //$NON-NLS-1$
- beanId = getAttributeValue("id", sdRegion); //$NON-NLS-1$
+ String beanDecl = null;
+ String beanClass = getAttributeValue("class", sdRegion); //$NON-NLS-1$
+ String beanType = getAttributeValue("type", sdRegion); //$NON-NLS-1$
+ String beanId = getAttributeValue("id", sdRegion); //$NON-NLS-1$
if (beanId != null && (beanType != null || beanClass != null)) {
String prefix = null;
- if (beanType.length() != 0) {
+ if (beanType != null && beanType.length() > 0) {
/* a type was specified */
prefix = beanType + " " + beanId + " = "; //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -410,7 +410,7 @@ class XMLJSPRegionHelper implements StructuredDocumentRegionHandler {
*/
String suffix = "null;\n"; //$NON-NLS-1$
// 186771 - JSP Validator problem with included useBean
- if (beanClass.length() > 0) {
+ if (beanClass != null && beanClass.length() > 0) {
suffix = "new " + beanClass + "();\n"; //$NON-NLS-1$ //$NON-NLS-2$
}
beanDecl = prefix + suffix;

Back to the top