*** empty log message ***
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/ContentReference.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/ContentReference.java
index 4e77416..6431eca 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/ContentReference.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/ContentReference.java
@@ -9,6 +9,7 @@
import java.net.URL;
import java.net.URLConnection;
+import org.eclipse.update.internal.core.*;
import org.eclipse.update.internal.core.Policy;
import org.eclipse.update.internal.core.URLEncoder;
@@ -108,14 +109,7 @@
if (connection == null) {
URL resolvedURL = URLEncoder.encode(url);
connection = resolvedURL.openConnection();
- // did the server return an error code ?
- if (connection instanceof HttpURLConnection) {
- int result =
- ((HttpURLConnection) connection).getResponseCode();
- if (result != HttpURLConnection.HTTP_OK) {
- throw new IOException(Policy.bind("ContentReference.HttpNok", new Object[] { this.toString(), new Integer(result)})); //$NON-NLS-1$
- }
- }
+ checkConnectionResult();
}
return connection.getInputStream();
} else
@@ -139,14 +133,7 @@
} catch (IOException e) {
return ContentReference.UNKNOWN_SIZE;
}
- // did the server return an error code ?
- if (connection instanceof HttpURLConnection) {
- int result =
- ((HttpURLConnection) connection).getResponseCode();
- if (result != HttpURLConnection.HTTP_OK) {
- throw new IOException(Policy.bind("ContentReference.HttpNok", new Object[] { this.toString(), new Integer(result)})); //$NON-NLS-1$
- }
- }
+ checkConnectionResult();
}
long size = connection.getContentLength();
return size == -1 ? ContentReference.UNKNOWN_SIZE : size;
@@ -223,4 +210,27 @@
else
return url.toExternalForm();
}
+
+ /*
+ *
+ */
+ private void checkConnectionResult()throws IOException {
+ // did the server return an error code ?
+ if (connection instanceof HttpURLConnection) {
+ int result = HttpURLConnection.HTTP_OK;
+ HttpURLConnection httpConnection = null;
+ try {
+ httpConnection = (HttpURLConnection) connection;
+ result = httpConnection.getResponseCode();
+ } catch (IOException e){
+ // if an error occured, try again
+ result = httpConnection.getResponseCode();
+ }
+
+ if (result != HttpURLConnection.HTTP_OK){
+ String serverMsg = httpConnection.getResponseMessage();
+ throw new IOException(Policy.bind("ContentReference.HttpNok", new Object[] {new Integer(result), serverMsg})); //$NON-NLS-1$
+ }
+ }
+ }
}
\ No newline at end of file
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/FeatureContentProvider.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/FeatureContentProvider.java
index 0fc35d7..e9ed056 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/FeatureContentProvider.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/FeatureContentProvider.java
@@ -125,7 +125,8 @@
throw e;
} catch (Exception e){
Utilities.removeLocalFile(key);
- throw Utilities.newCoreException(Policy.bind("FeatureContentProvider.UnableToCreate",new Object[]{localFile}),e);
+ UpdateManagerPlugin.warn("Unable to create file "+localFile);
+ throw Utilities.newCoreException(Policy.bind("FeatureContentProvider.UnableToCreate",new Object[]{ref}),e);
} finally {
//Do not close IS if user cancel,
//closing IS will read the entire Stream until the end
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/core/Utilities.java b/update/org.eclipse.update.core/src/org/eclipse/update/core/Utilities.java
index e253a18..8d2f302 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/core/Utilities.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/core/Utilities.java
@@ -189,7 +189,7 @@
if (s!=null)
completeString.append(s);
if (e!=null){
- completeString.append("[");
+ completeString.append(" [");
completeString.append(e.toString());
completeString.append("]");
}
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/FeaturePackagedContentProvider.java b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/FeaturePackagedContentProvider.java
index 24d442a..8bcd106 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/FeaturePackagedContentProvider.java
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/FeaturePackagedContentProvider.java
@@ -79,13 +79,7 @@
null,
monitor);
} catch (IOException e) {
- Object[] values =
- new Object[] { Feature.FEATURE_XML, getURL(), featureJarReference};
- throw Utilities.newCoreException(
- Policy.bind(
- "FeaturePackagedContentProvider.ErrorRetrieving",
- values),
- e);
+ throw errorRetrieving(Feature.FEATURE_XML, featureJarReference, getURL(), e);
//$NON-NLS-1$
}
@@ -174,22 +168,7 @@
currentReference = asLocalReference(currentReference, monitor);
references[0] = currentReference;
} catch (IOException e) {
- String urlString =
- (getFeature() == null)
- ? Policy.bind("FeaturePackagedContentProvider.NoFeature")
- : "" + getFeature().getURL();
- //$NON-NLS-1$ //$NON-NLS-2$
- String refString =
- (currentReference == null)
- ? Policy.bind("FeaturePackagedContentProvider.NoReference")
- : currentReference.getIdentifier();
- //$NON-NLS-1$
- String[] values = new String[] { archiveID, refString, urlString };
- throw Utilities.newCoreException(
- Policy.bind(
- "FeaturePackagedContentProvider.ErrorRetrieving",
- values),
- e);
+ throw errorRetrieving(archiveID,currentReference,getFeature().getURL(),e);
//$NON-NLS-1$
}
return references;
@@ -221,22 +200,7 @@
new JarContentReference(archiveID, url),
monitor);
} catch (IOException e) {
- String urlString =
- (getFeature() == null)
- ? Policy.bind("FeaturePackagedContentProvider.NoFeature")
- : "" + getFeature().getURL();
- //$NON-NLS-1$ //$NON-NLS-2$
- String refString =
- (references[0] == null)
- ? Policy.bind("FeaturePackagedContentProvider.NoReference")
- : references[0].getIdentifier();
- //$NON-NLS-1$
- String[] values = new String[] { archiveID, refString, urlString };
- throw Utilities.newCoreException(
- Policy.bind(
- "FeaturePackagedContentProvider.ErrorRetrieving",
- values),
- e);
+ throw errorRetrieving(archiveID,references[0],getFeature().getURL(),e);
//$NON-NLS-1$
}
return references;
@@ -277,22 +241,7 @@
references[0] = currentReference;
} catch (IOException e) {
- String urlString =
- (getFeature() == null)
- ? Policy.bind("FeaturePackagedContentProvider.NoFeature")
- : "" + getFeature().getURL();
- //$NON-NLS-1$ //$NON-NLS-2$
- String refString =
- (currentReference == null)
- ? Policy.bind("FeaturePackagedContentProvider.NoReference")
- : currentReference.getIdentifier();
- //$NON-NLS-1$
- String[] values = new String[] { archiveID, refString, urlString };
- throw Utilities.newCoreException(
- Policy.bind(
- "FeaturePackagedContentProvider.ErrorRetrieving",
- values),
- e);
+ throw errorRetrieving(archiveID,currentReference,getFeature().getURL(),e);
//$NON-NLS-1$
}
@@ -341,26 +290,7 @@
};
} catch (IOException e) {
- String urlString =
- (getFeature() == null)
- ? Policy.bind("FeaturePackagedContentProvider.NoFeature")
- : "" + getFeature().getURL();
- //$NON-NLS-1$ //$NON-NLS-2$
- String refString =
- (references[0] == null)
- ? Policy.bind("FeaturePackagedContentProvider.NoReference")
- : references[0].getIdentifier();
- //$NON-NLS-1$
- String[] values =
- new String[] {
- pluginEntry.getVersionedIdentifier().toString(),
- refString,
- urlString };
- throw Utilities.newCoreException(
- Policy.bind(
- "FeaturePackagedContentProvider.ErrorRetrieving",
- values),
- e);
+ throw errorRetrieving(pluginEntry.getVersionedIdentifier().toString(),references[0],getFeature().getURL(),e);
//$NON-NLS-1$
}
return pluginReferences;
@@ -391,4 +321,28 @@
return result;
}
+ /*
+ *
+ */
+ private CoreException errorRetrieving(String obj, ContentReference archive, URL url, Exception e){
+
+ String urlString = "";
+ String refString = "";
+
+ if (url != null){
+ urlString = Policy.bind("FeaturePackagedContentProvider.URLString",url.toExternalForm()); //$NON-NLS-1$
+ }
+
+ if(archive == null) {
+ refString = Policy.bind("FeaturePackagedContentProvider.ContentReferenceString",archive.getIdentifier());//$NON-NLS-1$
+ }
+
+ String[] values = new String[] {obj,refString,urlString };
+
+ return Utilities.newCoreException(
+ Policy.bind("FeaturePackagedContentProvider.ErrorRetrieving",values),e);
+ //$NON-NLS-1$
+
+ }
+
}
\ No newline at end of file
diff --git a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/messages.properties b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/messages.properties
index e5cb75e..95613f0 100644
--- a/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/messages.properties
+++ b/update/org.eclipse.update.core/src/org/eclipse/update/internal/core/messages.properties
@@ -7,7 +7,7 @@
ContentReference.UnableToCreateInputStream= Unable to create an input stream for the reference \"{0}\".
ContentReference.UnableToReturnReferenceAsFile= Unable to return reference \"{0}\" as File.
ContentReference.UnableToReturnReferenceAsURL= Unable to return reference \"{0}\" as URL.
-ContentReference.HttpNok= Error accessing remote reference \"{0}\": Return code: {1}
+ContentReference.HttpNok= Return Code: {0} {1}
ContentReference.FileDoesNotExist=The file \"{0}\" does not exist on the filesystem.
Feature.SiteAlreadySet= Internal Error: Site already set for the feature \"{0}\".
@@ -22,7 +22,7 @@
Feature.UnableToInitializeFeatureReference= Unable to initialize Feature Reference for versioned identifier \"{0}\".
FeatureContentProvider.Downloading= Downloading:
-FeatureContentProvider.UnableToCreate= Unable to create file \"{0}\".
+FeatureContentProvider.UnableToCreate= Unable to create local file for reference \"{0}\".
InstallHandler.unableToCreateHandler = Unable to create custom install handler for feature \"{0}\".
InstallHandler.notFound = Custom install handler required by feature \"{0}\" was not found.
@@ -105,7 +105,7 @@
FeatureExecutableContentProvider.FileDoesNotExist= The file \"{0}\" does not exist.
FeatureExecutableContentProvider.InvalidDirectory= The path \"{0}\" is not a valid directory.
FeatureExecutableContentProvider.UnableToCreateURLFor=Unable to create a URL for \"{0}\".
-FeatureExecutableContentProvider.UnableToRetrieveArchive=Error retrieving the arcive entry: \"{0}\".
+FeatureExecutableContentProvider.UnableToRetrieveArchive=Error retrieving the archive entry: \"{0}\".
FeatureExecutableContentProvider.UnableToRetrieveNonPluginEntry=Error retrieving the non-plugin entry: \"{0}\".
FeatureExecutableContentProvider.UnableToRetrieveFeatureEntry=Error retrieving feature entry content reference: \"{0}\".
FeatureExecutableContentProvider.UnableToRetrievePluginEntry =Error retrieving the plugin entry: \"{0}\".
@@ -134,12 +134,13 @@
FeatureExecutableFactory.NullURL= Error creating Feature. The URL used to create the feature is null.
FeatureExecutableFactory.CannotCreateURL= Error creating Feature. Unable to create URL for \"{0}\".
-FeaturePackagedContentProvider.NoManifestFile= Unable to retrieve \"{0}\" in feature located at \"{1}\". \"{0}\" does not exist.
-FeaturePackagedContentProvider.ErrorRetrieving= Error retrieving \"{0}\" in Archive Reference \"{1}\" at location \"{2}\". Unable to access \"{0}\".
+FeaturePackagedContentProvider.NoManifestFile= Unable to retrieve \"{0}\" in feature located at \"{1}\".
FeaturePackagedContentProvider.NoFeature= No Feature
FeaturePackagedContentProvider.FileDoesNotExist= The File \"{0}\" does not exist.
FeaturePackagedContentProvider.InvalidDirectory= The directory \"{0}\" is not a valid directory.
-FeaturePackagedContentProvider.NoReference= No Reference
+FeaturePackagedContentProvider.ErrorRetrieving= Error retrieving \"{0}\"{1}{2}.
+FeaturePackagedContentProvider.ContentReferenceString= from \"{0}\"
+FeaturePackagedContentProvider.URLString= located at \"{0}\"
FeatureReference.UnableToResolveURL= Internal Error: Unable to resolve model using URL: \"{0}\".