svn commit: r562836 - /ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r562836 - /ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java

jonesde
Author: jonesde
Date: Sat Aug  4 22:48:11 2007
New Revision: 562836

URL: http://svn.apache.org/viewvc?view=rev&rev=562836
Log:
Added temporary log message to show incoming message text, just in case it blows up somewhere (quite a few bugs in processing so far); also added check for empty verb/noun to avoid NPEs

Modified:
    ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java

Modified: ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java?view=diff&rev=562836&r1=562835&r2=562836
==============================================================================
--- ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java (original)
+++ ofbiz/trunk/specialpurpose/oagis/src/org/ofbiz/oagis/OagisServices.java Sat Aug  4 22:48:11 2007
@@ -342,6 +342,9 @@
                 xmlTextBuf.append('\n');
             }
             xmlText = xmlTextBuf.toString();
+            
+            // DEJ20070804 adding this temporarily for debugging, should be changed to verbose at some point in the future
+            Debug.logInfo("Received OAGIS XML message, here is the text: \n" + xmlText, module);
 
             ByteArrayInputStream bis = new ByteArrayInputStream(xmlText.getBytes("UTF-8"));
             doc = UtilXml.readXmlDocument(bis, true, "OagisMessage");
@@ -369,6 +372,10 @@
         Element bsrElement = UtilXml.firstChildElement(controlAreaElement, "os:BSR");
         String bsrVerb = UtilXml.childElementValue(bsrElement, "of:VERB");
         String bsrNoun = UtilXml.childElementValue(bsrElement, "of:NOUN");
+        
+        if (UtilValidate.isEmpty(bsrVerb) || UtilValidate.isEmpty(bsrNoun)) {
+            return ServiceUtil.returnError("Was able to receive and parse the XML message, but BSR->NOUN [" + bsrNoun + "] and/or BSR->VERB [" + bsrVerb + "] are empty");
+        }
         
         // TODO: before dispatching the message, make sure the combined ID (primary of OagisMessageInfo entity) is not in the database, ie hasn't been received already