Skip to content

Commit 6125995

Browse files
author
Ryan
committed
converted RuntimeException to BSONException - JAVA-265
1 parent 256a9c8 commit 6125995

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/main/org/bson/BSONDecoder.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public BSONObject readObject( byte[] b ){
1616
return readObject( new ByteArrayInputStream( b ) );
1717
}
1818
catch ( IOException ioe ){
19-
throw new RuntimeException( "should be impossible" , ioe );
19+
throw new BSONException( "should be impossible" , ioe );
2020
}
2121
}
2222

@@ -32,7 +32,7 @@ public int decode( byte[] b , BSONCallback callback ){
3232
return _decode( new Input( new ByteArrayInputStream(b) ) , callback );
3333
}
3434
catch ( IOException ioe ){
35-
throw new RuntimeException( "should be impossible" , ioe );
35+
throw new BSONException( "should be impossible" , ioe );
3636
}
3737
}
3838

@@ -419,7 +419,7 @@ String readCStr()
419419
out = _stringBuffer.asString( "UTF-8" );
420420
}
421421
catch ( UnsupportedOperationException e ){
422-
throw new RuntimeException( "impossible" , e );
422+
throw new BSONException( "impossible" , e );
423423
}
424424
}
425425
_stringBuffer.reset();
@@ -430,7 +430,7 @@ String readUTF8String()
430430
throws IOException {
431431
int size = readInt();
432432
if ( size <= 0 || size > ( 3 * 1024 * 1024 ) )
433-
throw new RuntimeException( "bad string size: " + size );
433+
throw new BSONException( "bad string size: " + size );
434434

435435
if ( size < _inputBuffer.length / 2 ){
436436
if ( size == 1 ){
@@ -449,7 +449,7 @@ String readUTF8String()
449449
return new String( b , 0 , size - 1 , "UTF-8" );
450450
}
451451
catch ( java.io.UnsupportedEncodingException uee ){
452-
throw new RuntimeException( "impossible" , uee );
452+
throw new BSONException( "impossible" , uee );
453453
}
454454
}
455455

0 commit comments

Comments
 (0)