Author: marrs
Date: Fri Aug 16 19:30:11 2013
New Revision: 1514861
URL: http://svn.apache.org/r1514861
Log:
ACE-342 Bugfix.
Modified:
ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java
Modified:
ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java
URL:
http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java?rev=1514861&r1=1514860&r2=1514861&view=diff
==============================================================================
---
ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java
(original)
+++
ace/trunk/org.apache.ace.deployment/src/org/apache/ace/deployment/servlet/AgentDeploymentServlet.java
Fri Aug 16 19:30:11 2013
@@ -265,11 +265,6 @@ public class AgentDeploymentServlet exte
catch (XPathExpressionException e) {
throw (AceRestException) new
AceRestException(HttpServletResponse.SC_NOT_FOUND, "Agent not found: error
parsing OBR").initCause(e);
}
- finally {
- if (inputStream != null) {
- inputStream.close();
- }
- }
response.setContentType(BUNDLE_MIMETYPE);
output = response.getOutputStream();
byte[] buffer = new byte[BUFFER_SIZE];
@@ -277,6 +272,8 @@ public class AgentDeploymentServlet exte
while ((bytes = inputStream.read(buffer)) != -1) {
output.write(buffer, 0, bytes);
}
+ output.flush();
+ inputStream.close();
}
catch (IllegalArgumentException e) {
throw (AceRestException) new
AceRestException(HttpServletResponse.SC_BAD_REQUEST, "Request URI is
invalid").initCause(e);
@@ -284,9 +281,6 @@ public class AgentDeploymentServlet exte
catch (IOException e) {
throw (AceRestException) new
AceRestException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Could not
deliver package").initCause(e);
}
- finally {
- tryClose(output);
- }
}
private void tryClose(OutputStream output) {