Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgkessler2007-07-27 18:06:20 +0000
committergkessler2007-07-27 18:06:20 +0000
commitd6dd3ddf0dee4d91e90ce2bd0c2181a254e10edf (patch)
tree41ae158eaa845899cd14b7abde26962ff6d0a371
parentb061b1c88c8ba38b17a690a22e00790dcd3a4c83 (diff)
downloadwebtools.jsf-d6dd3ddf0dee4d91e90ce2bd0c2181a254e10edf.tar.gz
webtools.jsf-d6dd3ddf0dee4d91e90ce2bd0c2181a254e10edf.tar.xz
webtools.jsf-d6dd3ddf0dee4d91e90ce2bd0c2181a254e10edf.zip
[195116] Adding JSF-Facet to existing project throws NPE.
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils11.java43
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils12.java15
2 files changed, 39 insertions, 19 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils11.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils11.java
index 4e432f589..3bb373b5c 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils11.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils11.java
@@ -80,15 +80,18 @@ public class JSFUtils11 extends JSFUtils {
while (it.hasNext()) {
Servlet servlet = (Servlet) it.next();
- if (servlet.getWebType().isServletType()) {
- if (((ServletType) servlet.getWebType()).getClassName().equals(
- JSF_SERVLET_CLASS)) {
- return servlet;
- }
- } else if (servlet.getWebType().isJspType()) {
- if (((JSPType) servlet.getWebType()).getJspFile().equals(
- JSF_SERVLET_CLASS)) {
- return servlet;
+ if (servlet != null && servlet.getWebType() != null) {
+
+ if( servlet.getWebType().isServletType()) {
+ if (((ServletType) servlet.getWebType()).getClassName().equals(
+ JSF_SERVLET_CLASS)) {
+ return servlet;
+ }
+ } else if (servlet.getWebType().isJspType()) {
+ if (((JSPType) servlet.getWebType()).getJspFile().equals(
+ JSF_SERVLET_CLASS)) {
+ return servlet;
+ }
}
}
}
@@ -232,8 +235,11 @@ public class JSFUtils11 extends JSFUtils {
if (servletName != null) {
for (int i=mappings.size()-1;i>=0;--i){
ServletMapping mapping = (ServletMapping)mappings.get(i);
- if (mapping.getServlet().getServletName()
- .equals(servletName)) {
+ if (mapping != null &&
+ mapping.getServlet() != null &&
+ mapping.getServlet().getServletName() != null &&
+ mapping.getServlet().getServletName()
+ .equals(servletName)) {
mappings.remove(mapping);
}
}
@@ -256,7 +262,9 @@ public class JSFUtils11 extends JSFUtils {
Iterator it = webApp.getContexts().iterator();
while (it.hasNext()) {
cp = (ContextParam) it.next();
- if (cp.getParamName().equals(JSF_CONFIG_CONTEXT_PARAM)) {
+ if (cp != null &&
+ cp.getParamName() != null &&
+ cp.getParamName().equals(JSF_CONFIG_CONTEXT_PARAM)) {
foundCP = cp;
found = true;
}
@@ -295,7 +303,9 @@ public class JSFUtils11 extends JSFUtils {
Iterator it = webApp.getContextParams().iterator();
while (it.hasNext()) {
cp = (ParamValue) it.next();
- if (cp.getName().equals(JSF_CONFIG_CONTEXT_PARAM)) {
+ if (cp != null &&
+ cp.getName() != null &&
+ cp.getName().equals(JSF_CONFIG_CONTEXT_PARAM)) {
foundCP = cp;
found = true;
}
@@ -349,7 +359,9 @@ public class JSFUtils11 extends JSFUtils {
String defaultSuffix = "jsp"; //$NON-NLS-1$
for (Iterator it = webApp.getContexts().iterator();it.hasNext();) {
ContextParam cp = (ContextParam) it.next();
- if (cp.getParamName().equals(JSF_DEFAULT_SUFFIX_CONTEXT_PARAM)){
+ if (cp != null &&
+ cp.getParamName() != null &&
+ cp.getParamName().equals(JSF_DEFAULT_SUFFIX_CONTEXT_PARAM)){
String defSuffix = cp.getParamValue();
if (defSuffix.startsWith(".")) //$NON-NLS-1$
defSuffix = defSuffix.substring(1);
@@ -370,7 +382,8 @@ public class JSFUtils11 extends JSFUtils {
String ext = extPath.getFileExtension();
if (ext == null){
String lastSeg = extPath.lastSegment();
- if (lastSeg.equals("*")) //$NON-NLS-1$
+ if (lastSeg != null &&
+ lastSeg.equals("*")) //$NON-NLS-1$
{
return extPath.removeLastSegments(1).toString();
}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils12.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils12.java
index 5915622d0..f28872978 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils12.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/project/facet/JSFUtils12.java
@@ -52,7 +52,8 @@ public class JSFUtils12 extends JSFUtils{
while (it.hasNext()) {
Servlet servlet = (Servlet) it.next();
- if (servlet.getServletClass().equals (JSF_SERVLET_CLASS)) {
+ if (servlet.getServletClass() != null &&
+ servlet.getServletClass().equals (JSF_SERVLET_CLASS)) {
return servlet;
}
}
@@ -199,7 +200,9 @@ public class JSFUtils12 extends JSFUtils{
if (servletName != null) {
for (int i=mappings.size()-1;i>=0;--i){
ServletMapping mapping = (ServletMapping)mappings.get(i);
- if (mapping.getServletName()
+ if (mapping != null &&
+ mapping.getServletName() != null &&
+ mapping.getServletName()
.equals(servletName)) {
mappings.remove(mapping);
}
@@ -223,7 +226,9 @@ public class JSFUtils12 extends JSFUtils{
Iterator it = webApp.getContextParams().iterator();
while (it.hasNext()) {
cp = (org.eclipse.jst.javaee.core.ParamValue) it.next();
- if (cp.getParamName().equals(JSF_CONFIG_CONTEXT_PARAM)) {
+ if (cp != null &&
+ cp.getParamName()!= null &&
+ cp.getParamName().equals(JSF_CONFIG_CONTEXT_PARAM)) {
foundCP = cp;
found = true;
}
@@ -255,7 +260,9 @@ public class JSFUtils12 extends JSFUtils{
String defaultSuffix = "jsp"; //$NON-NLS-1$
for (Iterator it = webApp.getContextParams().iterator();it.hasNext();) {
ParamValue cp = (ParamValue) it.next();
- if (cp.getParamName().equals(JSF_DEFAULT_SUFFIX_CONTEXT_PARAM)){
+ if (cp != null &&
+ cp.getParamName() != null &&
+ cp.getParamName().equals(JSF_DEFAULT_SUFFIX_CONTEXT_PARAM)){
String defSuffix = cp.getParamValue();
if (defSuffix.startsWith(".")) //$NON-NLS-1$
defSuffix = defSuffix.substring(1);

Back to the top