I'm having problems, completing a try catch finally, I get through everything ok until the catches. My code errors on both saying "syntax error on "catch", for expected" and I've done a google search and haven't found something that worked. I've attached my code, is this simply a placement error, or am I not throwing the right type of error? thanks in advance.
public void setOrder(String field, String value) {
File dir = new File(finished);
if (!dir.exists())
{
try{
doc = PDDocument.load(file);
PDDocumentCatalog docCatalog = doc.getDocumentCatalog();
PDAcroForm acroForm = docCatalog.getAcroForm();
PDField acrofield = acroForm.getField( field );
if(value == null){
acrofield.setValue("");
}
else{
acrofield.setValue(value);
}
doc.save(finished);
}
finally{
if( doc != null ){
doc.close();
}
}
catch(Exception eer){
eer.printStackTrace();
}
}
else{
try{
doc = PDDocument.load(finished);
PDDocumentCatalog docCatalog = doc.getDocumentCatalog();
PDAcroForm acroForm = docCatalog.getAcroForm();
PDField acrofield = acroForm.getField( field );
if(value == null){
acrofield.setValue("");
}
else{
acrofield.setValue(value);
}
doc.save(finished);
}
finally{
if( doc != null ){
doc.close();
}
}
catch(Exception eer){
eer.printStackTrace();
}
}
}