Exception Chaining: Added support for java 1.4 style exception chaining. Believe that POI is targeted at 1.4 nowdays so this should not cause an issue.

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@425026 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jason Height 2006-07-24 12:40:25 +00:00
parent f20d43c9b3
commit 4aea586fe5
7 changed files with 15 additions and 12 deletions

View File

@ -111,7 +111,7 @@ public class BiffViewer {
} }
activeRecord.dump(); activeRecord.dump();
} catch (IOException e) { } catch (IOException e) {
throw new RecordFormatException("Error reading bytes"); throw new RecordFormatException("Error reading bytes", e);
} }
Record[] retval = new Record[records.size()]; Record[] retval = new Record[records.size()];

View File

@ -332,9 +332,7 @@ public class EventRecordFactory
} }
catch (Exception introspectionException) catch (Exception introspectionException)
{ {
introspectionException.printStackTrace(); throw new RecordFormatException("Unable to construct record instance" , introspectionException);
throw new RecordFormatException(
"Unable to construct record instance, the following exception occured: " + introspectionException.getMessage());
} }
if (retval instanceof RKRecord) if (retval instanceof RKRecord)
{ {

View File

@ -102,7 +102,7 @@ public class FormulaRecord
field_7_expression_len = in.readShort(); field_7_expression_len = in.readShort();
field_8_parsed_expr = Ptg.createParsedExpressionTokens(field_7_expression_len, in); field_8_parsed_expr = Ptg.createParsedExpressionTokens(field_7_expression_len, in);
} catch (java.lang.UnsupportedOperationException uoe) { } catch (java.lang.UnsupportedOperationException uoe) {
throw new RecordFormatException(uoe.toString()); throw new RecordFormatException(uoe);
} }
} }

View File

@ -222,9 +222,7 @@ public class RecordFactory
} }
catch (Exception introspectionException) catch (Exception introspectionException)
{ {
introspectionException.printStackTrace(); throw new RecordFormatException("Unable to construct record instance",introspectionException);
throw new RecordFormatException(
"Unable to construct record instance, the following exception occured: " + introspectionException.getMessage());
} }
if (retval instanceof RKRecord) if (retval instanceof RKRecord)
{ {
@ -316,9 +314,8 @@ public class RecordFactory
} }
catch (Exception illegalArgumentException) catch (Exception illegalArgumentException)
{ {
illegalArgumentException.printStackTrace();
throw new RecordFormatException( throw new RecordFormatException(
"Unable to determine record types"); "Unable to determine record types", illegalArgumentException);
} }
result.put(new Short(sid), constructor); result.put(new Short(sid), constructor);
} }

View File

@ -30,4 +30,12 @@ public class RecordFormatException
{ {
super(exception); super(exception);
} }
public RecordFormatException(String exception, Throwable thr) {
super(exception, thr);
}
public RecordFormatException(Throwable thr) {
super(thr);
}
} }

View File

@ -54,7 +54,7 @@ public class RecordInputStream extends InputStream
//Dont increment the pos just yet (technically we are at the start of //Dont increment the pos just yet (technically we are at the start of
//the record stream until nextRecord is called). //the record stream until nextRecord is called).
} catch (IOException ex) { } catch (IOException ex) {
throw new RecordFormatException("Error reading bytes"); throw new RecordFormatException("Error reading bytes", ex);
} }
} }

View File

@ -327,7 +327,7 @@ public abstract class Ptg
default : default :
//retval = new UnknownPtg(); //retval = new UnknownPtg();
throw new java.lang.UnsupportedOperationException( throw new java.lang.UnsupportedOperationException(" Unknown Ptg in Formula: 0x"+
Integer.toHexString(( int ) id) + " (" + ( int ) id + ")"); Integer.toHexString(( int ) id) + " (" + ( int ) id + ")");
} }