details:   https://code.openbravo.com/erp/devel/pi/rev/ac7af24d4f0b
changeset: 20654:ac7af24d4f0b
user:      Shankar Balachandran <shankar.balachandran <at> openbravo.com>
date:      Thu Jun 27 08:40:41 2013 +0530
summary:   Fixes Issue 0024174: Little problem with Oracle messages in the ERP

The first line of the oracle error stack contains meaningful error message.
Added delimiter to the indexOf method to get the first line.
Also there are unwanted backslashes because the new line is rendered as \\\n, 
removed them.

diffstat:

 src/org/openbravo/erpCommon/utility/ErrorTextParserORACLE.java |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (20 lines):

diff -r ae900525a10a -r ac7af24d4f0b 
src/org/openbravo/erpCommon/utility/ErrorTextParserORACLE.java
--- a/src/org/openbravo/erpCommon/utility/ErrorTextParserORACLE.java    Wed Jun 
26 17:17:50 2013 +0200
+++ b/src/org/openbravo/erpCommon/utility/ErrorTextParserORACLE.java    Thu Jun 
27 08:40:41 2013 +0530
@@ -117,13 +117,15 @@
 
           String toTranslate = myMessage.replace(errorCodeText + ": ", "");
           // assumption incoming error message useful part is completely 
contained in the first line
-          pos = toTranslate.indexOf("\n");
+          pos = toTranslate.indexOf("\\n");
           if (pos != -1) {
             toTranslate = toTranslate.substring(0, pos);
           }
 
           String messageAux = Utility.parseTranslation(getConnection(), 
getVars(), getLanguage(),
               toTranslate);
+          // in case some backward slashes are not properly removed, remove 
them
+          messageAux = messageAux.replaceAll("\\\\", "");
           if (log4j.isDebugEnabled())
             log4j.debug("Message parsed: " + messageAux);
           myError.setMessage(messageAux);

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Openbravo-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbravo-commits

Reply via email to