OdaAdapterException.java from BIRT at Krugle
Show OdaAdapterException.java syntax highlighted
/*
*************************************************************************
* Copyright (c) 2004, 2005 Actuate Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - initial API and implementation
*
*************************************************************************
*/
package org.eclipse.birt.data.oda.adapter.dtp;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.eclipse.datatools.connectivity.oda.OdaException;
/**
* OdaAdapterException is a DTP OdaException, meant for converting BIRT OdaException.
*/
public class OdaAdapterException extends OdaException
{
private static final String sm_packageName = OdaAdapterException.class.getPackage().getName();
private static Logger sm_logger = Logger.getLogger( sm_packageName );
/**
* Creates an OdaException adapter for the specified object.
* @param birtException BIRT OdaException.
*/
public OdaAdapterException( org.eclipse.birt.data.oda.OdaException birtException )
{
super( birtException.getMessage(),
birtException.getSQLState(),
birtException.getErrorCode() );
initCause( birtException.getCause() );
// log a message in the adapter's logger
StackTraceElement[] trace = birtException.getStackTrace();
if ( trace.length > 0 )
{
StackTraceElement lastCalled = trace[0];
sm_logger.logp( Level.WARNING, lastCalled.getClassName(),
lastCalled.getMethodName(), lastCalled.toString() );
}
org.eclipse.birt.data.oda.OdaException nextEx = birtException.getNextException();
if ( nextEx != null )
setNextException( new OdaAdapterException( nextEx ) );
}
/**
* Instantiates an Adapter exeception with the given localized
* message and cause.
* @param message
* @param cause
*/
public OdaAdapterException( String message, Throwable cause )
{
super( message );
initCause( cause );
}
}
See more files for this project here