EEN-3001 [#Email-5008] – Batch.xml file not always zipped

 

In the older version 4.0.5.0, it was identified that the Batch.xml file generated during Export were not always zipped.

 

Solution:

This issue has been fixed in the Ephesoft Version 4.0.6.0.

A ZipSwitch is added within the function writetoXML() in all the Batch Class Scripts to make sure that the batch.xml files generated are always zipped.

If you are using an older version and facing this issue, it is recommended to upgrade your application to the Ephesoft Version 4.0.6.0 or above. By doing this, all the scripts are updated with the Zip Switch.

If you do not wish to upgrade right now due to the ongoing activities and need to fix this issue, then you have to manually update all the Scripts in your Ephesoft installation directory.

 

Update the writetoXML() function in all the Script files at the following path:

<Ephesoft Installation Dir>\SharedFolders\BC1\scripts

 

You can replace the complete writetoXML() function or add the Zip switch in the function as shown in the below code.

 

writetoXML()

 

private void writeToXML(Document document) {

String batchLocalPath = null;

List<?>batchLocalPathList = document.getRootElement().getChildren(BATCH_LOCAL_PATH);

if (null != batchLocalPathList) {

batchLocalPath = ((Element) batchLocalPathList.get(0)).getText();

}

if (null == batchLocalPath) {

LOGGER.error(“Unable to find the local folder path in batch xml file.”);

return;

}

String batchInstanceID = null;

List<?>batchInstanceIDList = document.getRootElement().getChildren(BATCH_INSTANCE_ID);

if (null != batchInstanceIDList) {

batchInstanceID = ((Element) batchInstanceIDList.get(0)).getText();

}

if (null == batchInstanceID) {

LOGGER.error(“Unable to find the batch instance ID in batch xml file.”);

return;

}

String batchXMLPath = batchLocalPath.trim() + File.separator + batchInstanceID + File.separator + batchInstanceID

+ EXT_BATCH_XML_FILE;

/*Zip Switch starts here*/

booleanisZipSwitchOn = true;

try {

ApplicationConfigProperties prop = ApplicationConfigProperties.getApplicationConfigProperties();

isZipSwitchOn = Boolean.parseBoolean(prop.getProperty(ICommonConstants.ZIP_SWITCH));

} catch (IOExceptionioe) {

LOGGER.error(“Unable to read the zip switch value. Taking default value as true. Exception thrown is:” + ioe.getMessage(),

ioe);

}

LOGGER.info(“isZipSwitchOn************” + isZipSwitchOn);

OutputStreamoutputStream = null;

FileWriter writer = null;

XMLOutputter out = new com.ephesoft.dcma.batch.encryption.util.BatchInstanceXmlOutputter(batchInstanceID);

try {

if (isZipSwitchOn) {

LOGGER.info(“Found the batch xml zip file.”);

outputStream = getOutputStreamFromZip(batchXMLPath, batchInstanceID + EXT_BATCH_XML_FILE);

out.output(document, outputStream);

} else {

writer = new java.io.FileWriter(batchXMLPath);

out.output(document, writer);

writer.flush();

writer.close();

}

} catch (Exception e) {

LOGGER.error(e.getMessage());

} finally {

if (outputStream != null) {

try {

outputStream.close();

} catch (IOException e) {

}

}

}

}

 

 

 

Was this article helpful to you?

Engineering

Comments are closed.