diff options
Diffstat (limited to 'branches/sca-java-1.x/modules/assembly-xml/src/main')
2 files changed, 15 insertions, 5 deletions
diff --git a/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java b/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java index b8e5330007..6abc28adde 100644 --- a/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java +++ b/branches/sca-java-1.x/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeDocumentProcessor.java @@ -23,6 +23,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; +import java.net.HttpURLConnection; import java.net.URI; import java.net.URL; import java.net.URLConnection; @@ -119,10 +120,18 @@ public class CompositeDocumentProcessor extends BaseAssemblyProcessor implements try { URLConnection connection = url.openConnection(); connection.setUseCaches(false); - scdlStream = connection.getInputStream(); + try { + scdlStream = connection.getInputStream(); + } catch (IOException e) { + if (e.getClass() == IOException.class && connection instanceof HttpURLConnection + && ((HttpURLConnection)connection).getResponseCode() == HttpURLConnection.HTTP_INTERNAL_ERROR) { + error("HttpServerError", url, ((HttpURLConnection)connection).getResponseMessage()); + } + throw e; + } } catch (IOException e) { ContributionReadException ce = new ContributionReadException(e); - error("ContributionReadException", url, ce); + error("ContributionReadException", url, e); throw ce; } return read(uri, scdlStream); @@ -161,11 +170,11 @@ public class CompositeDocumentProcessor extends BaseAssemblyProcessor implements } } catch ( IOException e ) { ContributionReadException ce = new ContributionReadException(e); - error("ContributionReadException", scdlStream, ce); + error("ContributionReadException", scdlStream, e); throw ce; } catch ( Exception e ) { ContributionReadException ce = new ContributionReadException(e); - error("ContributionReadException", scdlStream, ce); + error("ContributionReadException", scdlStream, e); //throw ce; } @@ -203,7 +212,7 @@ public class CompositeDocumentProcessor extends BaseAssemblyProcessor implements } catch (XMLStreamException e) { ContributionReadException ce = new ContributionReadException(e); - error("ContributionReadException", inputFactory, ce); + error("ContributionReadException", inputFactory, e); throw ce; } finally { try { diff --git a/branches/sca-java-1.x/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties b/branches/sca-java-1.x/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties index f68925c6f4..f0d5b0a201 100644 --- a/branches/sca-java-1.x/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties +++ b/branches/sca-java-1.x/modules/assembly-xml/src/main/resources/assembly-xml-validation-messages.properties @@ -28,3 +28,4 @@ ContributionReadException = ContributionReadException occured due to : {0} ContributionResolveException = ContributionResolveException occured due to : {0} ContributionWriteException = ContributionWriteException occured due to : {0} XMLStreamException = XMLStreamException occured due to : {0} +HttpServerError = HTTP Server Error : {0} |