Bug 501935: Fixed NPE thrown if bundle fragment introduces new packages
Signed-off-by: Matt Magoffin <eclipse.org@msqr.us>
diff --git a/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/bundleresources/BundleWebResource.java b/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/bundleresources/BundleWebResource.java
index 6d3cf71..532a40c 100644
--- a/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/bundleresources/BundleWebResource.java
+++ b/org.eclipse.gemini.web.tomcat/src/main/java/org/eclipse/gemini/web/tomcat/internal/bundleresources/BundleWebResource.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2015 SAP SE
+ * Copyright (c) 2015, 2016 SAP SE
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -182,7 +182,18 @@
}
if (path.endsWith(PATH_SEPARATOR) || path.length() == 0) {
- return this.bundle.getEntry(path);
+ URL url = this.bundle.getEntry(path);
+ if (url == null) {
+ // try fragments
+ for (int i = 0; i < this.fragments.size(); i++) {
+ Bundle b = this.fragments.get(i);
+ url = b.getEntry(path);
+ if (url != null) {
+ break;
+ }
+ }
+ }
+ return url;
}
String searchPath;