Skip to content
Snippets Groups Projects
Commit cdafb292 authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- added truncated getErrors() to workaround Rosetta Issue...

- added truncated getErrors() to workaround Rosetta Issue https://support.proquest.com/500Do0000083LJkIAM, closes #19
parent 65edf558
No related branches found
No related tags found
No related merge requests found
Pipeline #5310 failed
......@@ -56,7 +56,7 @@
</fr:x_form>
</pl:initParameters>
<pl:description>SLUB Formatvalidation Plugin for XML</pl:description>
<pl:version>0.01</pl:version>
<pl:version>0.02</pl:version>
<pl:materialType>DIGITAL</pl:materialType>
<pl:module>Preservation</pl:module>
<pl:generalType>TASK</pl:generalType>
......
......@@ -36,6 +36,7 @@ import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
......@@ -396,7 +397,23 @@ public class XmlFormatValidationPlugin implements FormatValidationPlugin {
@Override
public List<String> getErrors() {
return resultHandle.getErrors();
List<String> truncated = new ArrayList<String>();
int chars=0;
/* workaround for Rosetta Issue https://support.proquest.com/500Do0000083LJkIAM
* truncate to ensure not more than 2000 chars used, to
*/
for (String e: resultHandle.getErrors()) {
if ( (chars+ e.length()) < 1900 ) {
truncated.add( e );
chars+=e.length()+1; // +1 for line ending
} else {
truncated.add ("... (the full error is truncated, because Rosetta limits, see Rosetta log for detailed output)");
log.info("truncated errors in getError");
break;
}
}
return truncated;
}
@Override
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment