Skip to content
This repository has been archived by the owner on Jul 21, 2020. It is now read-only.

Ignored error doesn't let me log it properly #27

Open
i30817 opened this issue Mar 10, 2014 · 1 comment
Open

Ignored error doesn't let me log it properly #27

i30817 opened this issue Mar 10, 2014 · 1 comment

Comments

@i30817
Copy link

i30817 commented Mar 10, 2014

I'm a noob with log4j so if there is a way... well.

The archive constructors call readheaders eventually. There there is a log of alll exceptions:
WARNING: exception in archive constructor maybe file is encrypted or currupt

and a comment on that catch:
//ignore exceptions to allow exraction of working files in
//corrupt archive

In my data, there is one or two files that are corrupt/encrypted: that catch logs a NullPointerException (i didn't pass null). However, as it is a nullpointer, not a IOException, i don't have a file name (or indeed, i don't have anything to report to the user, because that the exception triggered is opaque to the code).

I'd prefer if this corner case was configurable, maybe by throwing a exception at the end of the constructor, documenting on it that you can still try using the archive for the non-corrupted parts, or a 'getError' or a similar scheme.

@i30817
Copy link
Author

i30817 commented Mar 10, 2014

The reason it is throwing NullPointerException is that UnrarHeadertype.findType is returning null for the byte marker it is sent. I'm handling this by installing a handler for the specific logger of the Archive class which wraps given throwables in a runtimeexception and throws them again, then they're caught on my libraray boundary and wrapped on a domain specific exception.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant