Hello,
I have a question related to Aspose.Diagram lib.
I started a project that was using aspose Diagram lib version 18.6.
This project aims to check Office file types before to send them to a rendition solution (based on AEM Forms).
We built a jar file to manage each Office file type based - for each - on aspose’s corresponding lib (aspose.Word for Word, …).
That works fine!
Because I worked on version 18.6 I detected that Visio file with extension VSDX was not so well managed by the version. The autorefresh of data connection was not detected.
I took the oportunity to updated them to 19.5 and aspose.Diagram with 19.6 (latest version).
After several tests, I remarked a strange behavior:
- the .vsd file can be processed by my check activity, then AEM Forms can process it.
- the .vsdx file can be processed by my check activity (better with 19.6 than 18.6 :)), then AEM can process it… BUT, AEM cannot clean up the stage (temporary folder) because of a file lock.
I made a test on my local machine with Eclipse debug mode.
I have the same behavior (see attached pictures).
VSDX file processed:file_lock_active.PNG (154.7 KB)
VSD file processed: file_lock_not_active.PNG (148.6 KB)
How can I prevent my environment of this lock? Is it a bug? Do we have a method to clear that at all?
Thank you for your help!
My CheckVisio class :
public class CheckVisio extends Check {
private final String ASPOSE_ERR_WRONGFORMAT = "java.lang.IllegalStateException";
private final String ASPOSE_ERR_CORRUPTED_VSDX = "java.util.zip.ZipException";
private final String ASPOSE_ERR_CORRUPTED_VSD1 = "Error in element VisioDocument in \\VisioDocument. Error in element DocumentSettings in \\VisioDocument\\DocumentSettings";
public CheckVisio(String filepath, StringBuffer logs) {
super(filepath, logs);
}
@Override
public void check() throws EmptyFileException, AutoRefreshException, WrongFormatException, CorruptedFileException, Exception {
//
super.check();
//
try{
// create diagram object for visio document
Diagram document = new Diagram(filepath);
//
String extension = Utils.getExtension(filepath);
//
if (document.getDocumentSheet().getName().equals("") && document.getPages().getCount()==0) throw new CorruptedFileException();
//
//
DataRecordSetCollection records = document.getDataRecordSets();
addLog("Document Sheet Name : " + document.getDocumentProps().getTitle());
//Number of pages
addLog("Number of pages: "+ document.getPages().getCount());
addLog("Number of data connection: "+ document.getDataConnections().getCount());
document=null;
addLog("Number of record: "+ records.getCount());
//
// test if the data recordset is higher than 1 (then, if this is active) to avoid a popup during opening phase from AEM server
for (int i=0;i<records.getCount();i++) {
addLog("Record found with Name : "+ records.get(i).getName() +
" and interval set to: "+ +records.get(i).getRefreshInterval()
);
if (records.get(i).getRefreshInterval()>=1) throw new AutoRefreshException();
}
records=null;
}catch (Exception e) {
switch (e.getClass().getName()) {
case ASPOSE_ERR_WRONGFORMAT:
throw new WrongFormatException();
case ASPOSE_ERR_CORRUPTED_VSDX:
throw new CorruptedFileException();
case ASPOSE_ERR_CORRUPTED_VSD1:
throw new CorruptedFileException();
default:
throw e;
}
}
}
}