Author: jleroux
Date: Fri Sep 2 17:06:51 2016
New Revision: 1758990
URL:
http://svn.apache.org/viewvc?rev=1758990&view=revLog:
Fixes a possible issue with a Socker being close too early, as reported by Jacopo on dev ML
Modified:
ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java
Modified: ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java?rev=1758990&r1=1758989&r2=1758990&view=diff==============================================================================
--- ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java (original)
+++ ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java Fri Sep 2 17:06:51 2016
@@ -188,7 +188,6 @@ public class PcChargeApi {
Socket sock = new Socket(host, port);
PrintStream ps = new PrintStream(sock.getOutputStream());
DataInputStream dis = new DataInputStream(sock.getInputStream());
- sock.close();
ps.print(this.toString());
ps.flush();
@@ -201,16 +200,20 @@ public class PcChargeApi {
try {
outDoc = UtilXml.readXmlDocument(buf.toString(), false);
} catch (ParserConfigurationException e) {
+ sock.close();
throw new GeneralException(e);
} catch (SAXException e) {
+ sock.close();
throw new GeneralException(e);
}
PcChargeApi out = new PcChargeApi(outDoc);
+ sock.close();
return out;
} else {
throw new IllegalStateException("Cannot send output object");
}
+
}
private boolean checkIn(String name) {