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