pulibrary/loris — pull request #139 by jpstroop (2014-11-19 20:06:30+00:00)
Title: Adds a corrupt jp2 for testing and handles it as best as it can

@schwemmer

Could you have a look at this branch? Because the shell out to kakadu is in a subprocess, my options are fairly limited. However, I wasn't cleaning up in the event that _something_ goes wrong during the transformation, and I've [added a generic exception handling block](https://github.com/pulibrary/loris/compare/handle_corrupt_jp2?expand=1#diff-05d372ac8868d6959ce12ba84449ee34R423) per your suggestion. Additionally, you should see, e.g.:

```
2014-11-19 15:01:04,986 (transforms) [ERROR]: Kakadu Core Error:
2014-11-19 15:01:04,986 (transforms) [ERROR]: Missing or out-of-sequence tile-parts for tile number 38 in code-stream!
```

in your logs and something along the lines of:

```
Server Side Error: image was incomplete

This is likely a permissions problem, though it's
possible that there was a problem with the source file
(/home/jstroop/workspace/loris/tests/img/corrupt.jp2). (500)
```

On your screen. Hopefully this keeps you machine from being overwhelmed--I haven't been able to reproduce it.