afpdev / alpheusafpparser

Library & parser for IBM Advanced Function Presentation (AFP) document/print stream format
GNU General Public License v3.0
16 stars 11 forks source link

Exceptions are swallowed #12

Closed michaelknigge closed 7 years ago

michaelknigge commented 8 years ago

At various places Alpheus just cathes Exceptions and ignores (swallows) them. IMHO this is bad because from the users perspective, everything is all right, but indeed it is not.

I've noticed that at some locations:

StructuredFieldIntroducer,toBytes() Okay, it is very unlikely that an IOException occurs here, but if it does, it is catched and suppressed - so the user will never notice that the returned byte array is probably incomplete. If the returned byte array is written to file, this results in a corrupted AFP output file.

AFPParser.reload() The current implementation cathes Throwable - and ignores it. So it seems to me that if an faulty AFP recored is parsed, the user will never notice. Even more, due to catching Throwable and not Exception, even things like an OutOfMemory will be catched and... ignored.

afpdev commented 8 years ago

ack. It will be fixed soon Great Job, Michael!

afpdev commented 7 years ago

done.