You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2011/06/08 23:07:43 UTC
svn commit: r1133557 -
/cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServletServiceSerializer.java
Author: reinhard
Date: Wed Jun 8 21:07:43 2011
New Revision: 1133557
URL: http://svn.apache.org/viewvc?rev=1133557&view=rev
Log:
improve exception message
Modified:
cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServletServiceSerializer.java
Modified: cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServletServiceSerializer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServletServiceSerializer.java?rev=1133557&r1=1133556&r2=1133557&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServletServiceSerializer.java (original)
+++ cocoon/cocoon3/trunk/cocoon-servlet/src/main/java/org/apache/cocoon/servlet/ssf/ServletServiceSerializer.java Wed Jun 8 21:07:43 2011
@@ -39,14 +39,10 @@ public class ServletServiceSerializer ex
private SAXBuffer saxBuffer = new SAXBuffer();
private URLConnection servletConnection;
- public void init() {
- this.setContentHandler(this.saxBuffer);
- }
-
@Override
public void endDocument() throws SAXException {
if (this.service == null) {
- throw new IllegalArgumentException("ServletServiceSerialzer has no service set.");
+ throw new IllegalArgumentException("ServletServiceSerializer has no service set.");
}
this.saxBuffer.endDocument();
@@ -63,29 +59,21 @@ public class ServletServiceSerializer ex
ResponseHeaderCollector.setStatusCode(statusCode);
}
} catch (IOException e) {
- throw new SAXException("Can't copy result of servlet service to the output stream", e);
+ throw new SAXException("Can't copy the result of the servlet service to the output stream", e);
} finally {
URLConnectionUtils.closeQuietly(this.getUrlConnection());
}
}
- private URLConnection getUrlConnection() {
- if (this.servletConnection == null) {
- try {
- this.servletConnection = this.service.openConnection();
- } catch (IOException e) {
- throw new ProcessingException("Can't use connected servlet service: " + this.service, e);
- }
- }
-
- return this.servletConnection;
- }
-
@Override
public String getContentType() {
return this.getUrlConnection().getContentType();
}
+ public void init() {
+ this.setContentHandler(this.saxBuffer);
+ }
+
@Override
public void setConfiguration(Map<String, ? extends Object> configuration) {
try {
@@ -94,4 +82,16 @@ public class ServletServiceSerializer ex
throw new SetupException(("Can't create an URL for " + configuration.get("service") + "."), e);
}
}
+
+ private URLConnection getUrlConnection() {
+ if (this.servletConnection == null) {
+ try {
+ this.servletConnection = this.service.openConnection();
+ } catch (IOException e) {
+ throw new ProcessingException("Can't use connected servlet service: " + this.service, e);
+ }
+ }
+
+ return this.servletConnection;
+ }
}
\ No newline at end of file