Author: jleroux
Date: Fri Sep 2 10:47:30 2016 New Revision: 1758935 URL: http://svn.apache.org/viewvc?rev=1758935&view=rev Log: Reverts r1758927 to check issues reported by Jacopo on dev ML Modified: ofbiz/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/thirdparty/gosoftware/PcChargeApi.java ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java ofbiz/trunk/applications/marketing/src/main/java/org/apache/ofbiz/sfa/vcard/VCard.java ofbiz/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/Debug.java ofbiz/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.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=1758935&r1=1758934&r2=1758935&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 10:47:30 2016 @@ -18,17 +18,18 @@ *******************************************************************************/ package org.apache.ofbiz.accounting.thirdparty.gosoftware; -import java.io.DataInputStream; import java.io.IOException; import java.io.PrintStream; +import java.io.DataInputStream; import java.net.Socket; import javax.xml.parsers.ParserConfigurationException; -import org.apache.ofbiz.base.util.Debug; -import org.apache.ofbiz.base.util.GeneralException; -import org.apache.ofbiz.base.util.ObjectType; import org.apache.ofbiz.base.util.UtilXml; +import org.apache.ofbiz.base.util.ObjectType; +import org.apache.ofbiz.base.util.GeneralException; +import org.apache.ofbiz.base.util.Debug; + import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.SAXException; @@ -188,7 +189,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(); Modified: ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java?rev=1758935&r1=1758934&r2=1758935&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java (original) +++ ofbiz/trunk/applications/content/src/main/java/org/apache/ofbiz/content/survey/PdfSurveyServices.java Fri Sep 2 10:47:30 2016 @@ -585,7 +585,6 @@ public class PdfSurveyServices { ByteArrayOutputStream baos = new ByteArrayOutputStream(); while ((c = fis.read()) != -1) baos.write(c); inputByteBuffer = ByteBuffer.wrap(baos.toByteArray()); - fis.close(); } catch (FileNotFoundException e) { throw(new GeneralException(e.getMessage())); } catch (IOException e) { Modified: ofbiz/trunk/applications/marketing/src/main/java/org/apache/ofbiz/sfa/vcard/VCard.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/src/main/java/org/apache/ofbiz/sfa/vcard/VCard.java?rev=1758935&r1=1758934&r2=1758935&view=diff ============================================================================== --- ofbiz/trunk/applications/marketing/src/main/java/org/apache/ofbiz/sfa/vcard/VCard.java (original) +++ ofbiz/trunk/applications/marketing/src/main/java/org/apache/ofbiz/sfa/vcard/VCard.java Fri Sep 2 10:47:30 2016 @@ -31,6 +31,16 @@ import java.util.List; import java.util.Locale; import java.util.Map; +import ezvcard.Ezvcard; +import ezvcard.io.text.VCardReader; +import ezvcard.parameter.AddressType; +import ezvcard.parameter.TelephoneType; +import ezvcard.parameter.EmailType; +import ezvcard.property.Address; +import ezvcard.property.Email; +import ezvcard.property.FormattedName; +import ezvcard.property.StructuredName; +import ezvcard.property.Telephone; import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.FileUtil; import org.apache.ofbiz.base.util.StringUtil; @@ -52,17 +62,6 @@ import org.apache.ofbiz.service.GenericS import org.apache.ofbiz.service.LocalDispatcher; import org.apache.ofbiz.service.ServiceUtil; -import ezvcard.Ezvcard; -import ezvcard.io.text.VCardReader; -import ezvcard.parameter.AddressType; -import ezvcard.parameter.EmailType; -import ezvcard.parameter.TelephoneType; -import ezvcard.property.Address; -import ezvcard.property.Email; -import ezvcard.property.FormattedName; -import ezvcard.property.StructuredName; -import ezvcard.property.Telephone; - public class VCard { public static final String module = VCard.class.getName(); public static final String resourceError = "MarketingUiLabels"; @@ -72,9 +71,8 @@ public class VCard { * @param dctx * @param context * @return - * @throws IOException */ - public static Map<String, Object> importVCard(DispatchContext dctx, Map<String, ? extends Object> context) throws IOException { + public static Map<String, Object> importVCard(DispatchContext dctx, Map<String, ? extends Object> context) { LocalDispatcher dispatcher = dctx.getDispatcher(); Delegator delegator = dctx.getDelegator(); Locale locale = (Locale) context.get("locale"); @@ -86,10 +84,10 @@ public class VCard { boolean isGroup = false; List<Map<String, String>> partiesCreated = new ArrayList<Map<String,String>>(); List<Map<String, String>> partiesExist = new ArrayList<Map<String,String>>(); - String partyName = ""; // TODO this is not used yet - VCardReader vCardReader = new VCardReader(in); + String partyName = ""; try { + VCardReader vCardReader = new VCardReader(in); ezvcard.VCard vcard = null; while ((vcard = vCardReader.readNext()) != null) { @@ -164,7 +162,6 @@ public class VCard { } else { //TODO change uncorrect labellisation String emailFormatErrMsg = UtilProperties.getMessage(resourceError, "SfaImportVCardEmailFormatError", locale); - vCardReader.close(); return ServiceUtil.returnError(structuredName.getGiven() + " " + structuredName.getFamily() + " has " + emailFormatErrMsg); } } @@ -218,13 +215,12 @@ public class VCard { resp = dispatcher.runSync("createPartyIdentification", createPartyIdentificationMap); } } + vCardReader.close(); } catch (IOException | GenericEntityException | GenericServiceException e) { Debug.logError(e, module); - vCardReader.close(); return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, "SfaImportVCardError", UtilMisc.toMap("errorString", e.getMessage()), locale)); } - vCardReader.close(); result.put("partiesCreated", partiesCreated); result.put("partiesExist", partiesExist); return result; Modified: ofbiz/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/Debug.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/Debug.java?rev=1758935&r1=1758934&r2=1758935&view=diff ============================================================================== --- ofbiz/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/Debug.java (original) +++ ofbiz/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/Debug.java Fri Sep 2 10:47:30 2016 @@ -108,7 +108,6 @@ public final class Debug { Formatter formatter = new Formatter(sb); formatter.format(msg, params); msg = sb.toString(); - formatter.close(); } // log Modified: ofbiz/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java?rev=1758935&r1=1758934&r2=1758935&view=diff ============================================================================== --- ofbiz/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java (original) +++ ofbiz/trunk/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java Fri Sep 2 10:47:30 2016 @@ -1883,7 +1883,6 @@ public class DatabaseUtil { try { stmt = connection.createStatement(); stmt.executeUpdate(sql2); - stmt.close(); } catch (SQLException e2) { // if this also fails report original error, not this error... return "SQL Exception while executing the following:\n" + sql + "\nError was: " + e.toString(); |
Free forum by Nabble | Edit this page |