java: don't catch and then just rethrow an exception
without doing anything else useful Change-Id: I5803d84d46e0a70e1759f2202e2c2273087f8723
This commit is contained in:
@@ -134,8 +134,6 @@ public class OptionsEventHandler {
|
||||
if (sMethod.equals("external_event") ){
|
||||
try {
|
||||
return handleExternalEvent(aWindow, aEventObject);
|
||||
} catch (com.sun.star.uno.RuntimeException re) {
|
||||
throw re;
|
||||
} catch (com.sun.star.uno.Exception e) {
|
||||
throw new WrappedTargetException(sMethod, this, e);
|
||||
}
|
||||
|
@@ -32,6 +32,7 @@ import com.sun.star.io.XTruncate;
|
||||
import com.sun.star.lang.XComponent;
|
||||
import com.sun.star.lang.XMultiServiceFactory;
|
||||
import com.sun.star.lib.uno.helper.WeakBase;
|
||||
import com.sun.star.lib.util.ExceptionHelper;
|
||||
import com.sun.star.uno.AnyConverter;
|
||||
import com.sun.star.uno.UnoRuntime;
|
||||
import com.sun.star.uno.XComponentContext;
|
||||
@@ -109,17 +110,13 @@ public final class OwnEmbeddedObject extends WeakBase
|
||||
XStorage xOwnStorage = xParentStorage.openStorageElement( aEntryName, com.sun.star.embed.ElementModes.READWRITE );
|
||||
SwitchOwnPersistence( xParentStorage, xOwnStorage, aEntryName );
|
||||
}
|
||||
catch( com.sun.star.uno.RuntimeException e )
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
catch( com.sun.star.io.IOException e )
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
catch( com.sun.star.uno.Exception e )
|
||||
{
|
||||
throw new com.sun.star.io.IOException( "Error while switching object storage!" );
|
||||
throw ExceptionHelper.initCause(new com.sun.star.io.IOException( "Error while switching object storage!" ), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,17 +167,13 @@ public final class OwnEmbeddedObject extends WeakBase
|
||||
|
||||
xStreamComp.dispose();
|
||||
}
|
||||
catch( com.sun.star.uno.RuntimeException e )
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
catch( com.sun.star.io.IOException e )
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
catch( com.sun.star.uno.Exception e )
|
||||
{
|
||||
throw new com.sun.star.io.IOException( "Error while switching object storage!" );
|
||||
throw ExceptionHelper.initCause(new com.sun.star.io.IOException( "Error while switching object storage!" ), e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,17 +259,13 @@ public final class OwnEmbeddedObject extends WeakBase
|
||||
|
||||
return aResult;
|
||||
}
|
||||
catch( com.sun.star.uno.RuntimeException e )
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
catch( com.sun.star.io.IOException e )
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
catch( com.sun.star.uno.Exception e )
|
||||
{
|
||||
throw new com.sun.star.io.IOException( "Error while reading one of object streams!" );
|
||||
throw ExceptionHelper.initCause(new com.sun.star.io.IOException( "Error while reading one of object streams!" ), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -218,37 +218,30 @@ public final class WikiOptionsEventHandlerImpl extends WeakBase
|
||||
{
|
||||
if ( sMethod.equals( sExternalEvent ) )
|
||||
{
|
||||
try
|
||||
String sEvent = AnyConverter.toString( aEventObject );
|
||||
if ( sEvent != null )
|
||||
{
|
||||
String sEvent = AnyConverter.toString( aEventObject );
|
||||
if ( sEvent != null )
|
||||
if ( sEvent.equals( sOk ) )
|
||||
{
|
||||
if ( sEvent.equals( sOk ) )
|
||||
{
|
||||
if ( m_aSettings != null )
|
||||
m_aSettings.storeConfiguration();
|
||||
}
|
||||
else if ( sEvent.equals( sInitialize ) || sEvent.equals( sBack ) )
|
||||
{
|
||||
if ( sEvent.equals( sInitialize ) )
|
||||
{
|
||||
m_xDialog = UnoRuntime.queryInterface( XDialog.class, xWindow );
|
||||
m_xControlContainer = UnoRuntime.queryInterface( XControlContainer.class, m_xDialog );
|
||||
m_aSettings = Settings.getSettings( m_xContext );
|
||||
m_aSettings.loadConfiguration(); // throw away all the noncommited changes
|
||||
InitStrings();
|
||||
}
|
||||
else if ( m_aSettings != null )
|
||||
m_aSettings.loadConfiguration(); // throw away all the noncommited changes
|
||||
|
||||
RefreshView();
|
||||
CheckButtonState();
|
||||
}
|
||||
if ( m_aSettings != null )
|
||||
m_aSettings.storeConfiguration();
|
||||
}
|
||||
else if ( sEvent.equals( sInitialize ) || sEvent.equals( sBack ) )
|
||||
{
|
||||
if ( sEvent.equals( sInitialize ) )
|
||||
{
|
||||
m_xDialog = UnoRuntime.queryInterface( XDialog.class, xWindow );
|
||||
m_xControlContainer = UnoRuntime.queryInterface( XControlContainer.class, m_xDialog );
|
||||
m_aSettings = Settings.getSettings( m_xContext );
|
||||
m_aSettings.loadConfiguration(); // throw away all the noncommited changes
|
||||
InitStrings();
|
||||
}
|
||||
else if ( m_aSettings != null )
|
||||
m_aSettings.loadConfiguration(); // throw away all the noncommited changes
|
||||
|
||||
RefreshView();
|
||||
CheckButtonState();
|
||||
}
|
||||
}
|
||||
catch ( com.sun.star.uno.RuntimeException r )
|
||||
{
|
||||
throw r;
|
||||
}
|
||||
}
|
||||
else if ( sMethod.equals( sAdd ) )
|
||||
|
@@ -917,16 +917,9 @@ public class TestComponent {
|
||||
public int getRuntimeException()
|
||||
throws com.sun.star.uno.RuntimeException
|
||||
{
|
||||
try
|
||||
{
|
||||
dothrow( new com.sun.star.uno.RuntimeException(
|
||||
_string, _xInterface ) );
|
||||
return 0; // dummy
|
||||
}
|
||||
catch (com.sun.star.uno.RuntimeException t)
|
||||
{
|
||||
throw t;
|
||||
}
|
||||
dothrow( new com.sun.star.uno.RuntimeException(
|
||||
_string, _xInterface ) );
|
||||
return 0; // dummy
|
||||
}
|
||||
|
||||
public void setRuntimeException(int _runtimeexception) throws com.sun.star.uno.RuntimeException {
|
||||
|
@@ -200,12 +200,6 @@ public class EmbeddedXMLObject extends EmbeddedObject {
|
||||
}
|
||||
|
||||
}
|
||||
catch (SAXException se) {
|
||||
throw se;
|
||||
}
|
||||
catch (IOException ioe) {
|
||||
throw ioe;
|
||||
}
|
||||
catch (ParserConfigurationException pce) {
|
||||
throw new SAXException(pce);
|
||||
}
|
||||
|
Reference in New Issue
Block a user