Reverts r1758927 to check issues reported by Jacopo on dev ML

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1758935 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jacques Le Roux
2016-09-02 10:47:30 +00:00
parent 6636d4ae01
commit 8bf34869da
5 changed files with 19 additions and 26 deletions
@@ -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();
@@ -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) {
@@ -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.GenericServiceException;
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;
@@ -108,7 +108,6 @@ public final class Debug {
Formatter formatter = new Formatter(sb);
formatter.format(msg, params);
msg = sb.toString();
formatter.close();
}
// log
@@ -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();