Merge pull request #22 from yankee42/dont-catch-ioexception
Don't catch IOException
This commit is contained in:
@@ -355,7 +355,7 @@ public class ZUGFeRDExporter implements Closeable {
|
|||||||
ignoreA1Errors = true;
|
ignoreA1Errors = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean getA1ParserValidationResult(PreflightParser parser) {
|
private boolean getA1ParserValidationResult(PreflightParser parser) throws IOException {
|
||||||
ValidationResult result = null;
|
ValidationResult result = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -387,27 +387,14 @@ public class ZUGFeRDExporter implements Closeable {
|
|||||||
* instance of ValidationResult
|
* instance of ValidationResult
|
||||||
*/
|
*/
|
||||||
return false;
|
return false;
|
||||||
} catch (IOException e) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// display validation result
|
// display validation result
|
||||||
return result.isValid();
|
return result.isValid();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isValidA1(String filename) {
|
public boolean isValidA1(String filename) throws IOException {
|
||||||
FileDataSource fd = new FileDataSource(filename);
|
return getA1ParserValidationResult(new PreflightParser(new FileDataSource(filename)));
|
||||||
PreflightParser parser;
|
|
||||||
try {
|
|
||||||
parser = new PreflightParser(fd);
|
|
||||||
} catch (IOException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return getA1ParserValidationResult(parser);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***
|
/***
|
||||||
@@ -415,43 +402,16 @@ public class ZUGFeRDExporter implements Closeable {
|
|||||||
* @param file
|
* @param file
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public boolean isValidA1(InputStream file) {
|
public boolean isValidA1(InputStream file) throws IOException {
|
||||||
|
return getA1ParserValidationResult(new PreflightParser(new ByteArrayDataSource(file)));
|
||||||
ByteArrayDataSource fd;
|
|
||||||
try {
|
|
||||||
fd = new ByteArrayDataSource(file);
|
|
||||||
PreflightParser parser = new PreflightParser(fd);
|
|
||||||
return getA1ParserValidationResult(parser);
|
|
||||||
} catch (IOException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadPDFA3(String filename) {
|
public void loadPDFA3(String filename) throws IOException {
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
doc = PDDocument.load(new File(filename));
|
doc = PDDocument.load(new File(filename));
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
public void loadPDFA3(InputStream file) throws IOException {
|
||||||
|
|
||||||
public void loadPDFA3(InputStream file) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
doc = PDDocument.load(file);
|
doc = PDDocument.load(file);
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
// TODO Auto-generated catch block
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1450,12 +1410,8 @@ public class ZUGFeRDExporter implements Closeable {
|
|||||||
"text/xml", zugferdData);
|
"text/xml", zugferdData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void export(String ZUGFeRDfilename) {
|
public void export(String ZUGFeRDfilename) throws IOException {
|
||||||
try {
|
|
||||||
doc.save(ZUGFeRDfilename);
|
doc.save(ZUGFeRDfilename);
|
||||||
} catch (IOException ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user