You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by xu...@apache.org on 2011/01/22 09:54:12 UTC
svn commit: r1062121 -
/geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundle.java
Author: xuhaihong
Date: Sat Jan 22 08:54:12 2011
New Revision: 1062121
URL: http://svn.apache.org/viewvc?rev=1062121&view=rev
Log:
Return the correct URL in the MockBundle
Modified:
geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundle.java
Modified: geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundle.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundle.java?rev=1062121&r1=1062120&r2=1062121&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundle.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-kernel/src/test/java/org/apache/geronimo/kernel/osgi/MockBundle.java Sat Jan 22 08:54:12 2011
@@ -140,16 +140,20 @@ public class MockBundle implements Bundl
public URL getEntry(String s) {
if (s.startsWith("/")) {
- s = s.substring(1);
+ s = s.substring(1);
}
try {
return new URL(location + "/" + s);
} catch (MalformedURLException e) {
- throw new RuntimeException(e);
+ try {
+ return new File(location + File.separator + s).toURI().toURL();
+ } catch (MalformedURLException e1) {
+ throw new RuntimeException(e1);
+ }
}
}
-
+
public long getLastModified() {
return 0;
}
@@ -158,8 +162,8 @@ public class MockBundle implements Bundl
File base = getLocationFile();
if (base == null) {
return null;
- }
- String filePattern = path;
+ }
+ String filePattern = path;
if (!filePattern.endsWith("/")) {
filePattern += "/";
}
@@ -185,13 +189,13 @@ public class MockBundle implements Bundl
file = new File( (new URI(location)).getPath() );
} catch (URISyntaxException e) {
// ignore
- }
+ }
} else {
file = new File(location);
}
return file;
}
-
+
public BundleContext getBundleContext() {
// if no bundle context was provided, just give an empty Mock one
if (bundleContext == null) {