PD4ML v4 Forums PD4ML v3 Archived Forums (Read Only) Troubleshooting Out of memory error while converting a dxl file Re: Re: Out of memory error while converting a dxl file

#29218

So it seems extractAttachments() method call takes no effect.

Make sure the method code is in the most actual state (and invoked from your code):

[language=java:1wluxbkf]public static final String extractAttachments( String body ) throws IOException {
if (body != null) {
int index01 = body.indexOf( “” );

index02 = body.indexOf( ““, index01 + 1 );

String fileName = “bin”;
int name01 = body.lastIndexOf(“name='”, index02);
if ( name01 > 0 ) {
name01 += 6;
int name02 = body.indexOf(''', name01);
if ( name02 > 0 ) {
fileName = body.substring(name01,name02);
}
}

int endtag = body.indexOf( “>”, index01 + 1 );
String fileContent = body.substring( endtag + 1, index02 );
byte[] bytes = Base64.decode( fileContent );

File file = File.createTempFile(“attachment”, “.” + fileName);
FileOutputStream fos = new FileOutputStream(file);
fos.write(bytes);

String tmpFileName = file.toURI().toString();

sb.append( tmpFileName );
sb.append( “” );

index02 += 11;
index01 = body.indexOf( “