Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage')
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java5
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/url/reference/ReferenceInputStream.java10
-rw-r--r--bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/url/reference/ReferenceURLConnection.java24
3 files changed, 22 insertions, 17 deletions
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java
index 578581f19..6e097c601 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/Storage.java
@@ -1013,10 +1013,7 @@ public class Storage {
File outFile = null;
try {
if (in instanceof ReferenceInputStream) {
- URL reference = ((ReferenceInputStream) in).getReference();
- if (!"file".equals(reference.getProtocol())) //$NON-NLS-1$
- throw new BundleException(NLS.bind(Msg.ADAPTOR_URL_CREATE_EXCEPTION, reference));
- return new File(reference.getPath());
+ return ((ReferenceInputStream) in).getReference();
}
outFile = File.createTempFile(BUNDLE_FILE_NAME, ".tmp", childRoot); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/url/reference/ReferenceInputStream.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/url/reference/ReferenceInputStream.java
index fdd95770b..ef2026e47 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/url/reference/ReferenceInputStream.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/url/reference/ReferenceInputStream.java
@@ -11,18 +11,18 @@
package org.eclipse.osgi.storage.url.reference;
+import java.io.File;
import java.io.IOException;
import java.io.InputStream;
-import java.net.URL;
/**
- * InputStream subclass which provides a reference (via URL) to the data
+ * InputStream subclass which provides a reference (via File) to the data
* rather than allowing the input stream to be directly read.
*/
public class ReferenceInputStream extends InputStream {
- protected URL reference;
+ private final File reference;
- public ReferenceInputStream(URL reference) {
+ public ReferenceInputStream(File reference) {
this.reference = reference;
}
@@ -32,7 +32,7 @@ public class ReferenceInputStream extends InputStream {
throw new IOException();
}
- public URL getReference() {
+ public File getReference() {
return reference;
}
}
diff --git a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/url/reference/ReferenceURLConnection.java b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/url/reference/ReferenceURLConnection.java
index c776c8b0b..b1819841d 100644
--- a/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/url/reference/ReferenceURLConnection.java
+++ b/bundles/org.eclipse.osgi/container/src/org/eclipse/osgi/storage/url/reference/ReferenceURLConnection.java
@@ -11,11 +11,17 @@
package org.eclipse.osgi.storage.url.reference;
-import java.io.*;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import org.eclipse.osgi.framework.util.FilePath;
import org.eclipse.osgi.internal.location.LocationHelper;
+import org.eclipse.osgi.internal.messages.Msg;
+import org.eclipse.osgi.util.NLS;
/**
* URLConnection for the reference protocol.
@@ -23,23 +29,25 @@ import org.eclipse.osgi.internal.location.LocationHelper;
public class ReferenceURLConnection extends URLConnection {
private final String installPath;
- private URL reference;
+ private volatile File reference;
protected ReferenceURLConnection(URL url, String installPath) {
super(url);
this.installPath = installPath;
}
- @SuppressWarnings("deprecation")
public synchronized void connect() throws IOException {
if (!connected) {
// TODO assumes that reference URLs are always based on file: URLs.
// There are not solid usecases to the contrary. Yet.
- // Construct the ref URL carefully so as to preserve UNC paths etc.
- String path = url.getPath().substring(5);
+ // Construct the ref File carefully so as to preserve UNC paths etc.
+ String path = url.getPath();
+ if (!path.startsWith("file:")) { //$NON-NLS-1$
+ throw new IOException(NLS.bind(Msg.ADAPTOR_URL_CREATE_EXCEPTION, path));
+ }
+ path = url.getPath().substring(5);
File file = new File(path);
- URL ref;
if (!file.isAbsolute()) {
if (installPath != null)
file = makeAbsolute(installPath, file);
@@ -47,10 +55,10 @@ public class ReferenceURLConnection extends URLConnection {
file = LocationHelper.decodePath(file);
- ref = file.toURL();
checkRead(file);
- reference = ref;
+ reference = file;
+ connected = true;
}
}

Back to the top