You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by et...@apache.org on 2008/05/03 00:29:55 UTC
svn commit: r652932 -
/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/GadgetServer.java
Author: etnu
Date: Fri May 2 15:29:55 2008
New Revision: 652932
URL: http://svn.apache.org/viewvc?rev=652932&view=rev
Log:
Made error handling in GadgetServer more robust. Previously when an http error occured the user received an xml parsing error instead of a message indicating the real problem.
Modified:
incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/GadgetServer.java
Modified: incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/GadgetServer.java
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/GadgetServer.java?rev=652932&r1=652931&r2=652932&view=diff
==============================================================================
--- incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/GadgetServer.java (original)
+++ incubator/shindig/trunk/java/gadgets/src/main/java/org/apache/shindig/gadgets/GadgetServer.java Fri May 2 15:29:55 2008
@@ -80,6 +80,12 @@
RemoteContentRequest request = RemoteContentRequest.getRequest(
context.getUrl(), context.getIgnoreCache());
RemoteContent response = gadgetSpecFetcher.fetch(request);
+ if (response.getHttpStatusCode() != RemoteContent.SC_OK) {
+ throw new GadgetException(
+ GadgetException.Code.FAILED_TO_RETRIEVE_CONTENT,
+ "Unable to retrieve gadget xml. HTTP error " +
+ response.getHttpStatusCode());
+ }
GadgetSpec spec
= new GadgetSpec(context.getUrl(), response.getResponseAsString());
return createGadgetFromSpec(spec, context);
@@ -97,6 +103,12 @@
RemoteContentRequest request = RemoteContentRequest.getRequest(
localeSpec.getMessages(), context.getIgnoreCache());
RemoteContent response = messageBundleFetcher.fetch(request);
+ if (response.getHttpStatusCode() != RemoteContent.SC_OK) {
+ throw new GadgetException(
+ GadgetException.Code.FAILED_TO_RETRIEVE_CONTENT,
+ "Unable to retrieve message bundle xml. HTTP error " +
+ response.getHttpStatusCode());
+ }
MessageBundle bundle = new MessageBundle(response.getResponseAsString());
return bundle;
}