IDEMPIERE-2767 Web Services not working with UUID / peer review

This commit is contained in:
Carlos Ruiz 2020-04-17 19:48:38 +02:00
parent a88ef127d4
commit b719e45c8f
1 changed files with 9 additions and 8 deletions

View File

@ -414,8 +414,11 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
try { try {
modelRunProcess.setADProcessID(validateParameter("AD_Process_ID", modelRunProcess.getADProcessID())); modelRunProcess.setADProcessID(validateParameter("AD_Process_ID", modelRunProcess.getADProcessID()));
} catch(XmlValueOutOfRangeException e) { // Catch the exception when the Process ID is not an Integer } catch(XmlValueOutOfRangeException e) { // Catch the exception when the Process ID is not an Integer
log.warning(e.getMessage() + " -- " + " trying to parse string as the UUID"); String processUU = getUUIDValue(modelRunProcess.xgetADProcessID());
modelRunProcess.setADProcessID(validateParameter("AD_Process_ID", 0, getUUIDValue(modelRunProcess.xgetADProcessID()))); if (processUU == null) {
throw e;
}
modelRunProcess.setADProcessID(validateParameter("AD_Process_ID", 0, processUU));
} }
modelRunProcess.setADRecordID(validateParameter("AD_Record_ID", modelRunProcess.getADRecordID())); modelRunProcess.setADRecordID(validateParameter("AD_Record_ID", modelRunProcess.getADRecordID()));
modelRunProcess.setDocAction(validateParameter("DocAction", modelRunProcess.getDocAction())); modelRunProcess.setDocAction(validateParameter("DocAction", modelRunProcess.getDocAction()));
@ -440,15 +443,13 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
private String getUUIDValue(XmlInt xmlInt) { private String getUUIDValue(XmlInt xmlInt) {
if (xmlInt != null) { if (xmlInt != null) {
//Get the content between <xml-fragment> and </xml-fragment> // String xml <...> blocks
String content = xmlInt.toString().substring( String content = xmlInt.toString().replaceAll("<[^>]*>", "");
"<xml-fragment>".length(), xmlInt.toString().indexOf("</xml-fragment>")); if (! Util.isEmpty(content, true) && ADLookup.isUUID(content))
if (content != null && !content.isEmpty())
return content; return content;
} }
//No string value //No UUID value
return null; return null;
} }