@@ -16,7 +16,7 @@ public BSONObject readObject( byte[] b ){
16
16
return readObject ( new ByteArrayInputStream ( b ) );
17
17
}
18
18
catch ( IOException ioe ){
19
- throw new RuntimeException ( "should be impossible" , ioe );
19
+ throw new BSONException ( "should be impossible" , ioe );
20
20
}
21
21
}
22
22
@@ -32,7 +32,7 @@ public int decode( byte[] b , BSONCallback callback ){
32
32
return _decode ( new Input ( new ByteArrayInputStream (b ) ) , callback );
33
33
}
34
34
catch ( IOException ioe ){
35
- throw new RuntimeException ( "should be impossible" , ioe );
35
+ throw new BSONException ( "should be impossible" , ioe );
36
36
}
37
37
}
38
38
@@ -419,7 +419,7 @@ String readCStr()
419
419
out = _stringBuffer .asString ( "UTF-8" );
420
420
}
421
421
catch ( UnsupportedOperationException e ){
422
- throw new RuntimeException ( "impossible" , e );
422
+ throw new BSONException ( "impossible" , e );
423
423
}
424
424
}
425
425
_stringBuffer .reset ();
@@ -430,7 +430,7 @@ String readUTF8String()
430
430
throws IOException {
431
431
int size = readInt ();
432
432
if ( size <= 0 || size > ( 3 * 1024 * 1024 ) )
433
- throw new RuntimeException ( "bad string size: " + size );
433
+ throw new BSONException ( "bad string size: " + size );
434
434
435
435
if ( size < _inputBuffer .length / 2 ){
436
436
if ( size == 1 ){
@@ -449,7 +449,7 @@ String readUTF8String()
449
449
return new String ( b , 0 , size - 1 , "UTF-8" );
450
450
}
451
451
catch ( java .io .UnsupportedEncodingException uee ){
452
- throw new RuntimeException ( "impossible" , uee );
452
+ throw new BSONException ( "impossible" , uee );
453
453
}
454
454
}
455
455
0 commit comments