No functional refactoring changes while reviewing r1819730

Removes useless exceptions handling. 
Uses try-w/-ress for ByteArrayInputStream

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1819764 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacques Le Roux
2018-01-01 12:23:18 +00:00
parent 297371b526
commit 587e656831
@@ -43,7 +43,6 @@ import org.apache.ofbiz.entity.util.EntityQuery;
import org.apache.ofbiz.service.GenericServiceException;
import org.apache.ofbiz.service.LocalDispatcher;
import org.apache.ofbiz.service.ModelService;
import org.apache.ofbiz.service.ServiceAuthException;
import org.apache.ofbiz.service.ServiceUtil;
import org.apache.ofbiz.webapp.event.CoreEvents;
import org.apache.ofbiz.webapp.website.WebSiteWorker;
@@ -176,15 +175,9 @@ public class CompDocEvents {
Debug.logError(errorMessage, module);
return "error";
}
} catch (ServiceAuthException e) {
request.setAttribute("_ERROR_MESSAGE_", e.toString());
return "error";
} catch (GenericServiceException e) {
request.setAttribute("_ERROR_MESSAGE_", e.toString());
return "error";
} catch (Exception e) {
request.setAttribute("_ERROR_MESSAGE_", e.toString());
return "error";
}
ByteBuffer outByteBuffer = (ByteBuffer) results.get("outByteBuffer");
@@ -192,9 +185,7 @@ public class CompDocEvents {
// setup content type
String contentType = "application/pdf; charset=ISO-8859-1";
ByteArrayInputStream bais = new ByteArrayInputStream(outByteBuffer.array());
try {
try (ByteArrayInputStream bais = new ByteArrayInputStream(outByteBuffer.array())) {
UtilHttp.streamContentToBrowser(response, bais, outByteBuffer.limit(), contentType);
} catch (IOException e) {
request.setAttribute("_ERROR_MESSAGE_", e.toString());
@@ -233,15 +224,9 @@ public class CompDocEvents {
Debug.logError(errorMessage, module);
return "error";
}
} catch (ServiceAuthException e) {
request.setAttribute("_ERROR_MESSAGE_", e.toString());
return "error";
} catch (GenericServiceException e) {
request.setAttribute("_ERROR_MESSAGE_", e.toString());
return "error";
} catch (Exception e) {
request.setAttribute("_ERROR_MESSAGE_", e.toString());
return "error";
}
ByteBuffer outByteBuffer = (ByteBuffer) results.get("outByteBuffer");
@@ -249,9 +234,7 @@ public class CompDocEvents {
// setup content type
String contentType = "application/pdf; charset=ISO-8859-1";
ByteArrayInputStream bais = new ByteArrayInputStream(outByteBuffer.array());
try {
try (ByteArrayInputStream bais = new ByteArrayInputStream(outByteBuffer.array())) {
UtilHttp.streamContentToBrowser(response, bais, outByteBuffer.limit(), contentType);
} catch (IOException e) {
request.setAttribute("_ERROR_MESSAGE_", e.toString());