本文整理了Java中org.boon.Exceptions.handle()
方法的一些代码示例,展示了Exceptions.handle()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Exceptions.handle()
方法的具体详情如下:
包路径:org.boon.Exceptions
类名称:Exceptions
方法名:handle
暂无
代码示例来源:origin: boonproject/boon
@Override
public Object invokeStatic(Object... args) {
try {
return method.invoke(null, args);
} catch ( Throwable ex ) {
return handle( Object.class, ex, "unable to invoke method", method,
" with arguments", args );
}
}
代码示例来源:origin: boonproject/boon
public static void write( Path file, byte[] contents ) {
try {
Files.write( file, contents );
} catch ( Exception ex ) {
Exceptions.handle( ex );
}
}
代码示例来源:origin: boonproject/boon
public static void write( OutputStream out, String content, Charset charset ) {
try ( OutputStream o = out ) {
o.write( content.getBytes( charset ) );
} catch ( Exception ex ) {
Exceptions.handle( ex );
}
}
代码示例来源:origin: boonproject/boon
public static void _idx( final byte[] array, int startIndex, byte[] input ) {
try {
System.arraycopy( input, 0, array, startIndex, input.length );
} catch ( Exception ex ) {
Exceptions.handle( String.format( "array size %d, startIndex %d, input length %d",
array.length, startIndex, input.length ), ex );
}
}
代码示例来源:origin: boonproject/boon
public static void _idx( final byte[] array, int startIndex, byte[] input, int length ) {
try {
System.arraycopy( input, 0, array, startIndex, length );
} catch ( Exception ex ) {
Exceptions.handle( String.format( "array size %d, startIndex %d, input length %d",
array.length, startIndex, input.length ), ex );
}
}
代码示例来源:origin: boonproject/boon
public static Date fromJsonDate_( String string ) {
try {
return new SimpleDateFormat( "yyyy-MM-dd'T'HH:mm:ss.SSSXXX" ).parse( string );
} catch ( ParseException e ) {
return Exceptions.handle( Date.class, "Not a valid JSON date", e );
}
}
代码示例来源:origin: boonproject/boon
public static List<String> readLines( BufferedReader reader ) {
List<String> lines = new ArrayList<>( 80 );
try ( BufferedReader bufferedReader = reader ) {
String line;
while ( ( line = bufferedReader.readLine() ) != null ) {
lines.add( line );
}
} catch ( Exception ex ) {
return Exceptions.handle( List.class, ex );
}
return lines;
}
代码示例来源:origin: boonproject/boon
@Override
public T create(Object... args) {
try {
return constructor.newInstance( args );
} catch ( Exception ex ) {
return handle(constructor.getDeclaringClass(), ex,
"\nunable to invoke constructor", constructor,
"\n on object ", constructor.getDeclaringClass(),
"\nwith arguments", args,
"\nparams", constructor.getParameterTypes());
}
}
代码示例来源:origin: boonproject/boon
public static InputStream inputStream( String resource ) {
Path path = path( resource );
try {
return Files.newInputStream( path );
} catch ( IOException e ) {
return Exceptions.handle( InputStream.class, "unable to open " + resource, e );
}
}
代码示例来源:origin: boonproject/boon
private static byte[] readResponseBodyAsBytes( HttpURLConnection http ) {
try {
return IO.input( http.getInputStream() );
} catch ( IOException e ) {
return Exceptions.handle( byte[].class, e );
}
}
代码示例来源:origin: boonproject/boon
public static List<String> readLines( InputStream is ) {
try ( Reader reader = new InputStreamReader( is, DEFAULT_CHARSET ) ) {
return readLines( reader );
} catch ( Exception ex ) {
return Exceptions.handle( List.class, ex );
}
}
代码示例来源:origin: boonproject/boon
public static void eachLine( BufferedReader reader, EachLine eachLine ) {
try ( BufferedReader bufferedReader = reader ) {
String line;
int lineNumber = 0;
while ( ( line = bufferedReader.readLine() ) != null &&
eachLine.line( line, lineNumber++ ) ) { //
// no op
}
} catch ( Exception ex ) {
Exceptions.handle( ex );
}
}
代码示例来源:origin: boonproject/boon
public static InputStream inputStream( String resource ) {
Path path = path( resource );
try {
return Files.newInputStream( path );
} catch ( IOException e ) {
return Exceptions.handle( InputStream.class, "unable to open " + resource, e );
}
}
代码示例来源:origin: boonproject/boon
private void closeIterator(DBIterator iterator) {
try {
iterator.close();
} catch (IOException e) {
Exceptions.handle(e);
}
}
代码示例来源:origin: boonproject/boon
public static byte[] input( String fileName ) {
try {
return input( Files.newInputStream( IO.path( fileName ) ) );
} catch ( IOException e ) {
return Exceptions.handle( byte[].class, e );
}
}
代码示例来源:origin: boonproject/boon
public CharBuf serialize( Object obj ) {
level=0;
builder.readForRecycle ();
try {
serializeObject( obj, builder );
} catch ( Exception ex ) {
return handle(CharBuf.class, "unable to serializeObject", ex);
}
return builder;
}
代码示例来源:origin: boonproject/boon
public final boolean getBoolean( Object obj ) {
try {
return ( Boolean ) this.getObject ( obj );
} catch ( Exception e ) {
return Exceptions.handle( boolean.class, sputs( "unable to call getObject for property", this.name ), e );
}
}
代码示例来源:origin: boonproject/boon
@Override
public final int getInt( Object obj ) {
try {
return ( Integer ) this.getObject ( obj );
} catch ( Exception e ) {
return Exceptions.handle( int.class, sputs( "unable to call getObject for property", this.name ), e );
}
}
代码示例来源:origin: boonproject/boon
/**
* Close the database connection.
*/
@Override
public void close() {
try {
flush();
database.close();
} catch (Exception e) {
Exceptions.handle(e);
}
}
代码示例来源:origin: boonproject/boon
protected void handle(String message, SQLException sqlException) {
totalErrors++;
if (debug) handleSQLException(sqlException);
try {
close();
} catch (Exception ex) {
logger.warn(ex, "Problem closing connection after sql exception\n", sqlException);
}
Exceptions.handle(message, sqlException);
}
内容来源于网络,如有侵权,请联系作者删除!