本文整理了Java中com.quinsoft.zeidon.ZeidonException.wrapException()
方法的一些代码示例,展示了ZeidonException.wrapException()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZeidonException.wrapException()
方法的具体详情如下:
包路径:com.quinsoft.zeidon.ZeidonException
类名称:ZeidonException
方法名:wrapException
[英]Wraps 't' with a ZeidonException and changes the call stack for the ZeidonException to match 't'. This is mostly used to re-throw checked exceptions as unchecked ones.
[中]用ZeidonException包装“t”,并更改ZeidonException的调用堆栈以匹配“t”。这主要用于将已检查的异常作为未检查的异常重新抛出。
代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe
/**
* Waits for the future to finish and come back.
*/
private void waitForFuture()
{
try
{
future.get();
future = null; // Let GC clean up the future.
}
catch ( ExecutionException e )
{
throw ZeidonException.wrapException( e.getCause() );
}
catch ( Exception e )
{
throw ZeidonException.wrapException( e );
}
}
代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe
/**
* Convert the .scala View to a .java View. We'll do this dynamically so we don't require
* the zeidon-scala .jar file be included in the classpath.
*
*/
private View convertScalaViewToJavaView( Object base )
{
try
{
Method method = base.getClass().getMethod("jview");
return (View) method.invoke( base );
}
catch ( Exception e )
{
throw ZeidonException.wrapException( e );
}
}
代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe
private void write( String string )
{
try
{
writer.write( string );
}
catch ( IOException e )
{
throw ZeidonException.wrapException( e )
.appendMessage( "Attempting to write: %s", StringUtils.substring( string, 0, 100 ) );
}
}
代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe
CloseableHttpResponse callPost( HttpPost httpPost )
{
try
{
httpPost.setConfig( requestConfig );
return httpClient.execute(httpPost);
}
catch ( Exception e )
{
throw ZeidonException.wrapException( e );
}
}
}
代码示例来源:origin: com.quinsoft.zeidon/object-browser
private void createBrowserDir( String dir )
{
File theDir = new File( dir );
// if the directory does not exist, create it
if ( theDir.exists() )
return;
try
{
theDir.mkdir();
}
catch ( Exception e )
{
throw ZeidonException.wrapException( e ).prependFilename( dir );
}
}
代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe
private Object getSqlObject( ResultSet rs, Integer idx, DataField dataField, Map<Integer,Object> loadedObjects )
{
try
{
Object o = loadedObjects.get( idx );
if ( o == null )
{
o = rs.getObject( idx );
loadedObjects.put( idx, o );
}
return o;
}
catch ( SQLException e )
{
throw ZeidonException.wrapException( e ).appendMessage( "DataField: %s, column idx: %d", dataField, idx );
}
}
代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe
CloseableHttpResponse callGet( String url )
{
try
{
URI urlObject = new URI( url );
HttpGet httpGet = new HttpGet( urlObject );
httpGet.setConfig( requestConfig );
return httpClient.execute(httpGet);
}
catch ( Exception e )
{
throw ZeidonException.wrapException( e ).appendMessage( "URL = %s", url );
}
}
代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe
private int executeScalaConstraint( View view, ObjectConstraintType type )
{
try
{
return view.getTask().getScalaHelper().executeObjectConstraint( view, type );
}
catch ( Exception e )
{
if ( e instanceof InvocationTargetException )
throw ZeidonException.wrapException( ((InvocationTargetException) e).getTargetException() );
else
throw ZeidonException.wrapException( e );
}
}
代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe
private int executeScalaConstraint( View view, EntityConstraintType type )
{
try
{
return view.getTask().getScalaHelper().executeEntityConstraint( view, this, type );
}
catch ( Exception e )
{
if ( e instanceof InvocationTargetException )
throw ZeidonException.wrapException( ((InvocationTargetException) e).getTargetException() );
else
throw ZeidonException.wrapException( e );
}
}
代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe
/**
* Set the input stream by opening the file.
*
* @param file the file
*
* @return this
*/
public DeserializeOi fromFile( File file )
{
try
{
resourceName = file.getAbsolutePath();
inputStream = new FileInputStream( file );
setFormatFromFilename( resourceName, true );
return this;
}
catch ( FileNotFoundException e )
{
throw ZeidonException.wrapException( e ).prependFilename( resourceName );
}
}
代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe
@Override
public Integer convertToInteger(Task task, AttributeDef attributeDef, Object internalValue, String contextName)
{
try
{
return Integer.parseInt( (String) internalValue );
}
catch ( Exception e )
{
throw ZeidonException.wrapException( e )
.prependAttributeDef( attributeDef )
.appendMessage( "Value = %s", internalValue )
.appendMessage( "contextName = %s", contextName );
}
}
代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe
@Override
public Double convertToDouble(Task task, AttributeDef attributeDef, Object internalValue, String contextName)
{
try
{
return Double.parseDouble( (String) internalValue );
}
catch ( Exception e )
{
throw ZeidonException.wrapException( e )
.prependAttributeDef( attributeDef )
.appendMessage( "Value = %s", internalValue )
.appendMessage( "contextName = %s", contextName );
}
}
代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe
int compare(TaskImpl task, AttributeInstance attributeInstance, AttributeDef attributeDef, Object o)
{
try
{
return domain.compare( task, attributeInstance, attributeDef, this.getInternalValue(), o );
}
catch ( Throwable t )
{
throw ZeidonException.wrapException( t ).prependAttributeDef( attributeDef );
}
}
代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe
public static void ReadPortableFile( Task task, String filename, ZeidonLogger logger, PortableFileEntityHandler entityHandler )
{
try
{
logger.debug( "Reading portable file %s", filename );
InputStream is = JoeUtils.getInputStream(task, filename, entityHandler.getClass().getClassLoader());
if ( is == null )
throw new ZeidonException( "Couldn't find file %s", filename );
ReadPortableFile( is, logger, entityHandler );
}
catch ( Exception e )
{
// Add filename to exception.
throw ZeidonException.wrapException( e ).prependFilename( filename );
}
}
代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe
@Override
public void viewDropped( View view )
{
if ( closed )
return;
try
{
view.dblog().debug( "Closing JDBC transaction" );
close();
}
catch ( Exception e )
{
ZeidonException.wrapException( e );
}
}
}
代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe
/**
* This is called when a task is dropped and will close the connection
* if it hasn't been already.
*/
@Override
public void taskDropped( Task task )
{
if ( closed )
return;
try
{
task.log().warn( "Task has open JDBC connection. Commit/rollback may not have been called. Closing now." );
close();
}
catch ( Exception e )
{
ZeidonException.wrapException( e );
}
}
代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe
private Connection getConnection( String url, Task task, JdbcHandler handler, Application application )
{
Connection connection;
try
{
BasicDataSource pool = getPool( url, task, handler, application );
connection = pool.getConnection();
connection.setAutoCommit( false );
}
catch ( SQLException e )
{
throw ZeidonException.wrapException( e )
.appendMessage( "Connection String = %s", url )
.appendMessage( "Username: %s", handler.getUserName() );
}
return connection;
}
代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe
@Override
protected void getSqlValue(SqlStatement stmt, Domain domain, AttributeDef attributeDef, StringBuilder buffer, Object value)
{
try
{
if ( getTranslator().appendSqlValue( stmt, buffer, domain, attributeDef, value ) )
return;
throw new ZeidonException("JdbcDomainTranslator did not correctly translate an attribute value" );
}
catch ( Exception e )
{
throw ZeidonException.wrapException( e ).prependAttributeDef( attributeDef ).appendMessage( "Value = %s", value );
}
}
代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe
private void loadLodDef( Task task, InputStream file )
{
try
{
PortableFileReader.ReadPortableFile( file, task.log(), new LodDefHandler( this ) );
task.log().info( "LodDef %s loaded from: %s", this, filename );
}
catch ( Exception e )
{
throw ZeidonException.wrapException( e ).prependFilename( filename );
}
}
代码示例来源:origin: com.quinsoft.zeidon/zeidon-joe
@Override
public int compare(Task task, AttributeInstance attributeInstance, AttributeDef attributeDef, Object internalValue, Object externalValue)
{
try
{
Object value = convertExternalValue( task, attributeInstance, attributeDef, null, externalValue );
Integer rc = compareNull( task, attributeDef, internalValue, value);
if ( rc != null )
return rc;
assert internalValue instanceof DateTime;
assert value instanceof DateTime;
return DateTimeComparator.getTimeOnlyInstance().compare( internalValue, value );
}
catch ( Throwable t )
{
throw ZeidonException.wrapException( t ).prependAttributeDef( attributeDef );
}
}
内容来源于网络,如有侵权,请联系作者删除!