Revision: 1997
Author: [email protected]
Date: Tue Aug 10 06:22:01 2010
Log: Log problems with processing REST requests and return more details
about nature of the error.
http://code.google.com/p/simal/source/detail?r=1997
Modified:
/trunk/uk.ac.osswatch.simal.rest/src/main/java/uk/ac/osswatch/simal/rest/RESTServlet.java
=======================================
---
/trunk/uk.ac.osswatch.simal.rest/src/main/java/uk/ac/osswatch/simal/rest/RESTServlet.java
Fri Jul 23 15:48:15 2010
+++
/trunk/uk.ac.osswatch.simal.rest/src/main/java/uk/ac/osswatch/simal/rest/RESTServlet.java
Tue Aug 10 06:22:01 2010
@@ -76,10 +76,12 @@
IAPIHandler handler = handlerFactory.get(cmd);
response = handler.execute();
} catch (SimalAPIException e) {
- response = errorResponse(e);
+ response = errorResponse(response, e);
} catch (SimalRepositoryException e) {
- response = errorResponse(new SimalAPIException(
+ response = errorResponse(response, new SimalAPIException(
"Unable to connect to repository", e));
+ } catch (Exception e) {
+ response = errorResponse(response, e);
} finally {
if (cmd.isXML()) {
res.setContentType("text/xml; charset=UTF-8");
@@ -124,10 +126,12 @@
res.setStatus(HttpStatus.SC_CREATED);
}
} catch (SimalAPIException e) {
- response = errorResponse(e);
+ response = errorResponse(response, e);
} catch (SimalRepositoryException e) {
- response = errorResponse(new SimalAPIException(
+ response = errorResponse(response, new SimalAPIException(
"Unable to connect to repository", e));
+ } catch (Exception e) {
+ response = errorResponse(response, e);
} finally {
if (cmd.isXML()) {
res.setContentType("text/xml; charset=UTF-8");
@@ -180,9 +184,9 @@
* @param e
* @return
*/
- private String errorResponse(SimalAPIException e) {
- String response;
- response = "ERROR: " + e.getMessage();
+ private String errorResponse(String response, Exception e) {
+ response += " - ERROR: " + e.getMessage();
+ logger.warn(response);
return response;
}
}
--
You received this message because you are subscribed to the Google Groups "Simal
Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/simal-commits?hl=en.