怎么会这样?看起来像白天一样简单,第三方库的异常正在跳过我的 catch 块。不知道从哪里开始解决这个问题。要么我真的很愚蠢,要么我不了解异常和 Java 的一些微妙之处。
我的控制台:
Exception: org.apache.james.mime4j.io.MaxLineLimitException: Maximum line length limit exceeded; stack: org.apache.james.mime4j.stream.MimeEntity.readRawField(MimeEntity.java:242);
org.apache.james.mime4j.stream.MimeEntity.nextField(MimeEntity.java:258);
org.apache.james.mime4j.stream.MimeEntity.advance(MimeEntity.java:296);
org.apache.james.mime4j.stream.MimeTokenStream.next(MimeTokenStream.java:360);
me.unroll.scanner.Scanner.<init>(Scanner.java:206);
me.unroll.scanner.ScannerThread.run(ScannerThread.java:205);
java.lang.Thread.run(Thread.java:722)
问题是我的代码如下所示:
try {
//...
for(EntityState token = messageStream.getState();
token != EntityState.T_END_OF_STREAM;
token = messageStream.next()) { //this is Scanner.java:206
//...
catch(ScanComplete exc) { }
catch(MaxLineLimitException exc) { //line 282, matches "try" above
debug("Am I getting caught?"); //no, it's not
我更