AnsweredAssumed Answered

Groovy Error : Embedded message: Error executing data process; Caused by: Could not find matching constructor  for: java.io.File(com.boomi.store.impl.CacheStore$ResettableGZIPInputStream) (in groovy2 script);  Caused by: Could not find matching constructo

Question asked by venkatesh.rupanagudi080702 on May 10, 2018
Latest reply on May 13, 2018 by venkatesh.rupanagudi080702

Hi, 

 

I have a groovy script below. The script is supposed to read a xml node ED1EDK02 from Input and output particular value from XML node "BELNR" under "E1EDK02".  I get the following error while executing the script but the same script was Tested successfully in eclipse for Java.

 

Embedded message: Error executing data process; Caused by: Could not find matching constructor
for: java.io.File(com.boomi.store.impl.CacheStore$ResettableGZIPInputStream) (in groovy2 script);
Caused by: Could not find matching constructor
for: java.io.File(com.boomi.store.impl.CacheStore$ResettableGZIPInputStream)

 

Script : 

 

// Import the ExecutionUtil class
import java.io.*;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.DocumentBuilder;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.w3c.dom.Node;
import org.w3c.dom.Element;
import java.util.*;
//import org.jdom.input.SAXBuilder;
import com.boomi.execution.ExecutionUtil;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.output.XMLOutputter;
import java.util.Properties;
import java.io.InputStream;


for ( int i = 0; i < dataContext.getDataCount(); i++ ) {
InputStream is = dataContext.getStream(i);
Properties props = dataContext.getProperties(i);
File inputfile = new File(is);
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(inputfile);
// NodeList nList = doc.getElementsByTagName("E1EDK02");


propName = "PRIORITY_COUNT";

// Retrieve current Process Property value
propValue = ExecutionUtil.getDynamicProcessProperty(propName);

// Convert string value to int to do math
//int intValue = Integer.parseInt(propValue);

NodeList nList = doc.getElementsByTagName("E1EDK02");
//System.out.println(nList);

for (int j = 0; j < nList.getLength(); j++) {
Node nNode = nList.item(j);
Node qnode = getNamedChildNode(nNode,"QUALF");
Node bnode = getNamedChildNode(nNode,"BELNR");
Hashtable<String, String> pon = new Hashtable<String, String>();

String qnode1=null;
String bnode1=null;
if (qnode != null) qnode1 = qnode.getTextContent();
if (bnode != null) bnode1 = bnode.getTextContent();
// System.out.println(qnode1);
// System.out.println(bnode1);
if (qnode1 != null && bnode1 != null) {
pon.put(qnode1, bnode1);
}
String ponum = null;
String ponumf = null;
ponum = pon.get("001");
if (ponum != null) {
ponumf = ponum;
}
}


// def static Node getNamedChildNode(Node nNode, String nodeName) {
// NodeList nlist2 = nNode.getChildNodes();
// for (int k =0; k < nlist2.getLength(); k++) {
//String Noden = nlist2.item(k).getNodeName();
//if (Noden.equals(nodeName)) {
// return nlist2.item(k);
// }
// }
// return null;
// }

// Increment value by 1 if priorityFlag is "true"
//if (priorityFlag == "true") {
// intValue = intValue + 1;
//}

// Convert int value back to String before storing in property
propValue = ponumf;

// Set the new property value. The 3rd parameter indicates if the property should be persisted (true) or not (false).
ExecutionUtil.setDynamicProcessProperty(propName, propValue, false);

XMLOutputter outputter = new XMLOutputter();
is = new ByteArrayInputStream(outputter.outputString(doc).getBytes("UTF-8"));
//dataContext.storeStream(is, props);
}
def static Node getNamedChildNode(Node nNode, String nodeName) {
NodeList nlist2 = nNode.getChildNodes();
for (int k =0; k < nlist2.getLength(); k++) {
String Noden = nlist2.item(k).getNodeName();
if (Noden.equals(nodeName)) {
return nlist2.item(k);
}
}
return null;
}#

Outcomes