Merge branch 'master' into master
This commit is contained in:
@@ -63,6 +63,7 @@ public class PDFValidator extends Validator {
|
||||
private String Signature;
|
||||
|
||||
private String zfXML = null;
|
||||
protected boolean autoload=true;
|
||||
|
||||
protected static boolean stringArrayContains(String[] arr, String targetValue) {
|
||||
return Arrays.asList(arr).contains(targetValue);
|
||||
@@ -311,10 +312,12 @@ public class PDFValidator extends Validator {
|
||||
@Override
|
||||
public void setFilename(String filename) throws IrrecoverableValidationError {
|
||||
this.pdfFilename = filename;
|
||||
try {
|
||||
fileContents=Files.readAllBytes(Paths.get(pdfFilename));
|
||||
} catch (IOException ex) {
|
||||
throw new IrrecoverableValidationError("Could not read file");
|
||||
if(autoload) {
|
||||
try {
|
||||
fileContents=Files.readAllBytes(Paths.get(pdfFilename));
|
||||
} catch (IOException ex) {
|
||||
throw new IrrecoverableValidationError("Could not read file");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ public abstract class Validator {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(Validator.class.getCanonicalName()); // log output
|
||||
|
||||
protected ValidationContext context;
|
||||
protected boolean autoload=true;
|
||||
|
||||
public Validator(ValidationContext ctx){
|
||||
this.context=ctx;
|
||||
@@ -77,6 +78,10 @@ public abstract class Validator {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setAutoload(boolean autoload) {
|
||||
this.autoload = autoload;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -42,7 +42,6 @@ public class XMLValidator extends Validator {
|
||||
|
||||
protected String zfXML = "";
|
||||
protected String filename = "";
|
||||
protected boolean autoload=true;
|
||||
int firedRules = 0;
|
||||
int failedRules = 0;
|
||||
boolean disableNotices = false;
|
||||
@@ -85,11 +84,6 @@ public class XMLValidator extends Validator {
|
||||
|
||||
}
|
||||
|
||||
public void disableAutoload() {
|
||||
// for streaming, which sets a fake filename
|
||||
autoload=false;
|
||||
}
|
||||
|
||||
/***
|
||||
* manually set the xml content
|
||||
* @param xml the xml to be checked
|
||||
|
||||
Reference in New Issue
Block a user