summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2011-03-30 10:51:07 -0700
committerMark Spruiell <mes@zeroc.com>2011-03-30 10:51:07 -0700
commitc28875d4c01935919396999852cb1c3f92c0fdbc (patch)
tree12f6b1cefe57d572121dcb47bd22b2f65dc3edff
parent4986 - add constructor that takes Throwable (diff)
downloadice-c28875d4c01935919396999852cb1c3f92c0fdbc.tar.bz2
ice-c28875d4c01935919396999852cb1c3f92c0fdbc.tar.xz
ice-c28875d4c01935919396999852cb1c3f92c0fdbc.zip
4987 - preserve exception cause
-rw-r--r--cpp/src/slice2java/Gen.cpp4
-rw-r--r--java/src/Freeze/BackgroundSaveEvictorI.java5
-rw-r--r--java/src/Freeze/ConnectionI.java8
-rw-r--r--java/src/Freeze/EvictorI.java10
-rw-r--r--java/src/Freeze/EvictorIteratorI.java17
-rw-r--r--java/src/Freeze/Index.java39
-rw-r--r--java/src/Freeze/MapDb.java24
-rw-r--r--java/src/Freeze/MapInternal/Index.java39
-rw-r--r--java/src/Freeze/MapInternal/IteratorI.java80
-rw-r--r--java/src/Freeze/MapInternal/MapI.java121
-rw-r--r--java/src/Freeze/MapInternal/Search.java11
-rw-r--r--java/src/Freeze/ObjectStore.java71
-rw-r--r--java/src/Freeze/SharedDbEnv.java15
-rw-r--r--java/src/Freeze/TransactionI.java23
-rw-r--r--java/src/Ice/ConnectionI.java8
-rw-r--r--java/src/Ice/ObjectPrxHelperBase.java15
-rw-r--r--java/src/Ice/PluginManagerI.java25
-rw-r--r--java/src/Ice/PropertiesI.java14
-rw-r--r--java/src/Ice/SysLoggerI.java8
-rw-r--r--java/src/Ice/_ObjectDelD.java3
-rw-r--r--java/src/Ice/_ObjectDelM.java8
-rw-r--r--java/src/IceBox/ServiceManagerI.java32
-rw-r--r--java/src/IceInternal/BasicStream.java45
-rw-r--r--java/src/IceInternal/Buffer.java5
-rw-r--r--java/src/IceInternal/IncomingConnectionFactory.java4
-rw-r--r--java/src/IceInternal/Instance.java10
-rw-r--r--java/src/IceInternal/LocalExceptionWrapper.java5
-rw-r--r--java/src/IceInternal/Network.java191
-rw-r--r--java/src/IceInternal/Selector.java4
-rw-r--r--java/src/IceInternal/TcpTransceiver.java12
-rw-r--r--java/src/IceInternal/ThreadPoolWorkQueue.java12
-rw-r--r--java/src/IceInternal/UdpTransceiver.java28
-rw-r--r--java/src/IceSSL/Instance.java73
-rw-r--r--java/src/IceSSL/TransceiverI.java35
-rw-r--r--java/src/IceUtil/FileLockException.java16
-rw-r--r--java/src/IceUtilInternal/FileLock.java4
-rw-r--r--java/src/IceUtilInternal/StringUtil.java4
37 files changed, 298 insertions, 730 deletions
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index 2a1efea1a36..3f2b833b817 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -4072,7 +4072,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
}
out << nl << "catch(Ice.UserException __ex)";
out << sb;
- out << nl << "throw new Ice.UnknownUserException(__ex.ice_name());";
+ out << nl << "throw new Ice.UnknownUserException(__ex.ice_name(), __ex);";
out << eb;
out << eb;
@@ -5076,7 +5076,7 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
}
out << nl << "catch(Ice.UserException __ex)";
out << sb;
- out << nl << "throw new Ice.UnknownUserException(__ex.ice_name());";
+ out << nl << "throw new Ice.UnknownUserException(__ex.ice_name(), __ex);";
out << eb;
out << eb;
if(ret || !outParams.empty())
diff --git a/java/src/Freeze/BackgroundSaveEvictorI.java b/java/src/Freeze/BackgroundSaveEvictorI.java
index fc2e5d92b82..fcd79d91f43 100644
--- a/java/src/Freeze/BackgroundSaveEvictorI.java
+++ b/java/src/Freeze/BackgroundSaveEvictorI.java
@@ -1240,10 +1240,7 @@ class BackgroundSaveEvictorI extends EvictorI implements BackgroundSaveEvictor,
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = _errorPrefix + "saving: " + dx.getMessage();
- throw ex;
+ throw new DatabaseException(_errorPrefix + "saving: " + dx.getMessage(), dx);
}
}
} while(tryAgain);
diff --git a/java/src/Freeze/ConnectionI.java b/java/src/Freeze/ConnectionI.java
index ec2e129e046..b5f2af9dc66 100644
--- a/java/src/Freeze/ConnectionI.java
+++ b/java/src/Freeze/ConnectionI.java
@@ -43,15 +43,11 @@ public class ConnectionI implements Connection
}
catch(com.sleepycat.db.DeadlockException dx)
{
- DeadlockException ex = new DeadlockException(errorPrefix() + dx.getMessage(), _transaction);
- ex.initCause(dx);
- throw ex;
+ throw new DeadlockException(errorPrefix() + dx.getMessage(), _transaction, dx);
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException(errorPrefix() + dx.getMessage());
- ex.initCause(dx);
- throw ex;
+ throw new DatabaseException(errorPrefix() + dx.getMessage(), dx);
}
catch(java.io.FileNotFoundException fne)
{
diff --git a/java/src/Freeze/EvictorI.java b/java/src/Freeze/EvictorI.java
index 74b133d4f66..e4116a77356 100644
--- a/java/src/Freeze/EvictorI.java
+++ b/java/src/Freeze/EvictorI.java
@@ -507,10 +507,7 @@ abstract class EvictorI implements Evictor
}
catch(java.io.UnsupportedEncodingException ix)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(ix);
- ex.message = _errorPrefix + "cannot decode database names";
- throw ex;
+ throw new DatabaseException(_errorPrefix + "cannot decode database names", ix);
}
catch(java.io.FileNotFoundException ix)
{
@@ -520,10 +517,7 @@ abstract class EvictorI implements Evictor
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = _errorPrefix + "Db.open: " + dx.getMessage();
- throw ex;
+ throw new DatabaseException(_errorPrefix + "Db.open: " + dx.getMessage(), dx);
}
finally
{
diff --git a/java/src/Freeze/EvictorIteratorI.java b/java/src/Freeze/EvictorIteratorI.java
index 938da54afc2..3e16f573dcf 100644
--- a/java/src/Freeze/EvictorIteratorI.java
+++ b/java/src/Freeze/EvictorIteratorI.java
@@ -166,18 +166,13 @@ class EvictorIteratorI implements EvictorIterator
}
else
{
- DeadlockException ex = new DeadlockException(
- _store.evictor().errorPrefix() + "Db.cursor: " + dx.getMessage(), _tx);
- ex.initCause(dx);
- throw ex;
+ throw new DeadlockException(_store.evictor().errorPrefix() + "Db.cursor: " + dx.getMessage(),
+ _tx, dx);
}
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = _store.evictor().errorPrefix() + "Db.cursor: " + dx.getMessage();
- throw ex;
+ throw new DatabaseException(_store.evictor().errorPrefix() + "Db.cursor: " + dx.getMessage(), dx);
}
finally
{
@@ -191,10 +186,8 @@ class EvictorIteratorI implements EvictorIterator
{
if(_tx != null)
{
- DeadlockException ex = new DeadlockException(
- _store.evictor().errorPrefix() + "Db.cursor: " + dx.getMessage(), _tx);
- ex.initCause(dx);
- throw ex;
+ throw new DeadlockException(
+ _store.evictor().errorPrefix() + "Db.cursor: " + dx.getMessage(), _tx, dx);
}
}
catch(com.sleepycat.db.DatabaseException dx)
diff --git a/java/src/Freeze/Index.java b/java/src/Freeze/Index.java
index e92c5ce2b02..33ebfd97953 100644
--- a/java/src/Freeze/Index.java
+++ b/java/src/Freeze/Index.java
@@ -143,10 +143,8 @@ public abstract class Index implements com.sleepycat.db.SecondaryKeyCreator
if(tx != null)
{
- DeadlockException ex = new DeadlockException(
- _store.evictor().errorPrefix() + "Db.cursor: " + dx.getMessage(), transaction);
- ex.initCause(dx);
- throw ex;
+ throw new DeadlockException( _store.evictor().errorPrefix() + "Db.cursor: " + dx.getMessage(),
+ transaction, dx);
}
//
@@ -155,10 +153,7 @@ public abstract class Index implements com.sleepycat.db.SecondaryKeyCreator
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = _store.evictor().errorPrefix() + "Db.cursor: " + dx.getMessage();
- throw ex;
+ throw new DatabaseException(_store.evictor().errorPrefix() + "Db.cursor: " + dx.getMessage(), dx);
}
finally
{
@@ -172,10 +167,8 @@ public abstract class Index implements com.sleepycat.db.SecondaryKeyCreator
{
if(tx != null)
{
- DeadlockException ex = new DeadlockException(
- _store.evictor().errorPrefix() + "Db.cursor: " + dx.getMessage(), transaction);
- ex.initCause(dx);
- throw ex;
+ throw new DeadlockException(
+ _store.evictor().errorPrefix() + "Db.cursor: " + dx.getMessage(), transaction, dx);
}
}
catch(com.sleepycat.db.DatabaseException dx)
@@ -260,10 +253,8 @@ public abstract class Index implements com.sleepycat.db.SecondaryKeyCreator
if(tx != null)
{
- DeadlockException ex = new DeadlockException(
- _store.evictor().errorPrefix() + "Db.cursor: " + dx.getMessage(), transaction);
- ex.initCause(dx);
- throw ex;
+ throw new DeadlockException( _store.evictor().errorPrefix() + "Db.cursor: " + dx.getMessage(),
+ transaction, dx);
}
//
// Otherwise retry
@@ -271,10 +262,7 @@ public abstract class Index implements com.sleepycat.db.SecondaryKeyCreator
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = _store.evictor().errorPrefix() + "Db.cursor: " + dx.getMessage();
- throw ex;
+ throw new DatabaseException(_store.evictor().errorPrefix() + "Db.cursor: " + dx.getMessage(), dx);
}
finally
{
@@ -288,10 +276,8 @@ public abstract class Index implements com.sleepycat.db.SecondaryKeyCreator
{
if(tx != null)
{
- DeadlockException ex = new DeadlockException(
- _store.evictor().errorPrefix() + "Db.cursor: " + dx.getMessage(), transaction);
- ex.initCause(dx);
- throw ex;
+ throw new DeadlockException(
+ _store.evictor().errorPrefix() + "Db.cursor: " + dx.getMessage(), transaction, dx);
}
}
catch(com.sleepycat.db.DatabaseException dx)
@@ -375,10 +361,7 @@ public abstract class Index implements com.sleepycat.db.SecondaryKeyCreator
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = _store.evictor().errorPrefix() + "Db.close: " + dx.getMessage();
- throw ex;
+ throw new DatabaseException(_store.evictor().errorPrefix() + "Db.close: " + dx.getMessage(), dx);
}
_db = null;
}
diff --git a/java/src/Freeze/MapDb.java b/java/src/Freeze/MapDb.java
index af69c68d7cb..d694c581a00 100644
--- a/java/src/Freeze/MapDb.java
+++ b/java/src/Freeze/MapDb.java
@@ -232,10 +232,7 @@ public class MapDb
catch(java.io.FileNotFoundException dx)
{
clearIndices();
- NotFoundException ex = new NotFoundException();
- ex.initCause(dx);
- ex.message = _errorPrefix + "Db.open: " + dx.getMessage();
- throw ex;
+ throw new NotFoundException(_errorPrefix + "Db.open: " + dx.getMessage(), dx);
}
catch(com.sleepycat.db.DeadlockException dx)
{
@@ -251,18 +248,13 @@ public class MapDb
else
{
clearIndices();
- DeadlockException ex = new DeadlockException(_errorPrefix + "Db.open: " + dx.getMessage(), tx);
- ex.initCause(dx);
- throw ex;
+ throw new DeadlockException(_errorPrefix + "Db.open: " + dx.getMessage(), tx, dx);
}
}
catch(com.sleepycat.db.DatabaseException dx)
{
clearIndices();
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = _errorPrefix + "Db.open: " + dx.getMessage();
- throw ex;
+ throw new DatabaseException(_errorPrefix + "Db.open: " + dx.getMessage(), dx);
}
finally
{
@@ -314,10 +306,7 @@ public class MapDb
//
// This should never happen
//
- NotFoundException ex = new NotFoundException();
- ex.initCause(dx);
- ex.message = _errorPrefix + "Db.open: " + dx.getMessage();
- throw ex;
+ throw new NotFoundException(_errorPrefix + "Db.open: " + dx.getMessage(), dx);
}
}
@@ -339,10 +328,7 @@ public class MapDb
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = _errorPrefix + "close: " + dx.getMessage();
- throw ex;
+ throw new DatabaseException(_errorPrefix + "close: " + dx.getMessage(), dx);
}
finally
{
diff --git a/java/src/Freeze/MapInternal/Index.java b/java/src/Freeze/MapInternal/Index.java
index 93e1721ec35..8a2bb6459fa 100644
--- a/java/src/Freeze/MapInternal/Index.java
+++ b/java/src/Freeze/MapInternal/Index.java
@@ -130,10 +130,8 @@ public abstract class Index<K, V, I>
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = _trace.errorPrefix + "Db.close for index \"" + _dbName + "\": " + dx.getMessage();
- throw ex;
+ throw new DatabaseException(
+ _trace.errorPrefix + "Db.close for index \"" + _dbName + "\": " + dx.getMessage(), dx);
}
_db = null;
}
@@ -279,18 +277,17 @@ public abstract class Index<K, V, I>
{
if(_map.connection().dbTxn() != null)
{
- DeadlockException ex = new DeadlockException(
- _trace.errorPrefix + "Dbc.count: " + dx.getMessage(), _map.connection().currentTransaction());
- ex.initCause(dx);
- throw ex;
+ throw new DeadlockException(_trace.errorPrefix + "Dbc.count: " + dx.getMessage(),
+ _map.connection().currentTransaction(), dx);
}
else
{
if(_trace.deadlockWarning)
{
- _trace.logger.warning("Deadlock in Freeze.MapInternal.Index.count while iterating over index \"" +
- _dbName + "\"; retrying...");
+ _trace.logger.warning(
+ "Deadlock in Freeze.MapInternal.Index.count while iterating over index \"" + _dbName +
+ "\"; retrying...");
}
//
@@ -302,10 +299,8 @@ public abstract class Index<K, V, I>
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = _trace.errorPrefix + "Db.cursor for index \"" + _dbName + "\": " + dx.getMessage();
- throw ex;
+ throw new DatabaseException(
+ _trace.errorPrefix + "Db.cursor for index \"" + _dbName + "\": " + dx.getMessage(), dx);
}
}
@@ -438,17 +433,16 @@ public abstract class Index<K, V, I>
{
if(_map.connection().dbTxn() != null)
{
- DeadlockException ex = new DeadlockException(
- _trace.errorPrefix + "Db.get: " + e.getMessage(), _map.connection().currentTransaction());
- ex.initCause(e);
- throw ex;
+ throw new DeadlockException(_trace.errorPrefix + "Db.get: " + e.getMessage(),
+ _map.connection().currentTransaction(), e);
}
else
{
if(_trace.deadlockWarning)
{
- _trace.logger.warning("Deadlock in Freeze.MapInternal.Index.containsKey while " + "reading Db \"" +
- _dbName + "\"; retrying...");
+ _trace.logger.warning(
+ "Deadlock in Freeze.MapInternal.Index.containsKey while " + "reading Db \"" + _dbName +
+ "\"; retrying...");
}
//
// Try again
@@ -457,10 +451,7 @@ public abstract class Index<K, V, I>
}
catch(com.sleepycat.db.DatabaseException e)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(e);
- ex.message = _trace.errorPrefix + "Db.get: " + e.getMessage();
- throw ex;
+ throw new DatabaseException(_trace.errorPrefix + "Db.get: " + e.getMessage(), e);
}
}
}
diff --git a/java/src/Freeze/MapInternal/IteratorI.java b/java/src/Freeze/MapInternal/IteratorI.java
index e4c5d8afdbb..355d16dd46b 100644
--- a/java/src/Freeze/MapInternal/IteratorI.java
+++ b/java/src/Freeze/MapInternal/IteratorI.java
@@ -33,19 +33,13 @@ class IteratorI<K, V> implements Freeze.Map.EntryIterator<java.util.Map.Entry<K,
catch(com.sleepycat.db.DeadlockException dx)
{
dead();
- DeadlockException ex = new DeadlockException(
- _trace.errorPrefix + "EntryIterator constructor: " + dx.getMessage(),
- _map.connection().currentTransaction());
- ex.initCause(dx);
- throw ex;
+ throw new DeadlockException(_trace.errorPrefix + "EntryIterator constructor: " + dx.getMessage(),
+ _map.connection().currentTransaction(), dx);
}
catch(com.sleepycat.db.DatabaseException dx)
{
dead();
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = _trace.errorPrefix + "EntryIterator constructor: " + dx.getMessage();
- throw ex;
+ throw new DatabaseException(_trace.errorPrefix + "EntryIterator constructor: " + dx.getMessage(), dx);
}
_iteratorListToken = _map.addIterator(this);
@@ -70,18 +64,13 @@ class IteratorI<K, V> implements Freeze.Map.EntryIterator<java.util.Map.Entry<K,
catch(com.sleepycat.db.DeadlockException dx)
{
dead();
- DeadlockException ex = new DeadlockException(
- _trace.errorPrefix + "Dbc.get: " + dx.getMessage(), _map.connection().currentTransaction());
- ex.initCause(dx);
- throw ex;
+ throw new DeadlockException(_trace.errorPrefix + "Dbc.get: " + dx.getMessage(),
+ _map.connection().currentTransaction(), dx);
}
catch(com.sleepycat.db.DatabaseException dx)
{
dead();
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = _trace.errorPrefix + "Dbc.get: " + dx.getMessage();
- throw ex;
+ throw new DatabaseException(_trace.errorPrefix + "Dbc.get: " + dx.getMessage(), dx);
}
//
@@ -149,17 +138,12 @@ class IteratorI<K, V> implements Freeze.Map.EntryIterator<java.util.Map.Entry<K,
catch(com.sleepycat.db.DeadlockException e)
{
dead();
- DeadlockException ex = new DeadlockException(_trace.errorPrefix + "Dbc.del: " + e.getMessage(),
- _map.connection().currentTransaction());
- ex.initCause(e);
- throw ex;
+ throw new DeadlockException(_trace.errorPrefix + "Dbc.del: " + e.getMessage(),
+ _map.connection().currentTransaction(), e);
}
catch(com.sleepycat.db.DatabaseException e)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(e);
- ex.message = _trace.errorPrefix + "Dbc.del: " + e.getMessage();
- throw ex;
+ throw new DatabaseException(_trace.errorPrefix + "Dbc.del: " + e.getMessage(), e);
}
}
else
@@ -203,18 +187,12 @@ class IteratorI<K, V> implements Freeze.Map.EntryIterator<java.util.Map.Entry<K,
catch(com.sleepycat.db.DeadlockException e)
{
dead();
- DeadlockException ex = new DeadlockException(
- _trace.errorPrefix + "EntryIterator.remove: " + e.getMessage(),
- _map.connection().currentTransaction());
- ex.initCause(e);
- throw ex;
+ throw new DeadlockException(_trace.errorPrefix + "EntryIterator.remove: " + e.getMessage(),
+ _map.connection().currentTransaction(), e);
}
catch(com.sleepycat.db.DatabaseException e)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(e);
- ex.message = _trace.errorPrefix + "EntryIterator.remove: " + e.getMessage();
- throw ex;
+ throw new DatabaseException(_trace.errorPrefix + "EntryIterator.remove: " + e.getMessage(), e);
}
finally
{
@@ -303,17 +281,12 @@ class IteratorI<K, V> implements Freeze.Map.EntryIterator<java.util.Map.Entry<K,
catch(com.sleepycat.db.DeadlockException e)
{
dead();
- DeadlockException ex = new DeadlockException(_trace.errorPrefix + "Dbc.put: " + e.getMessage(),
- _map.connection().currentTransaction());
- ex.initCause(e);
- throw ex;
+ throw new DeadlockException(_trace.errorPrefix + "Dbc.put: " + e.getMessage(),
+ _map.connection().currentTransaction(), e);
}
catch(com.sleepycat.db.DatabaseException e)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(e);
- ex.message = _trace.errorPrefix + "Dbc.put: " + e.getMessage();
- throw ex;
+ throw new DatabaseException(_trace.errorPrefix + "Dbc.put: " + e.getMessage(), e);
}
}
else
@@ -351,18 +324,12 @@ class IteratorI<K, V> implements Freeze.Map.EntryIterator<java.util.Map.Entry<K,
catch(com.sleepycat.db.DeadlockException e)
{
dead();
- DeadlockException ex = new DeadlockException(
- _trace.errorPrefix + "EntryIterator.setValue: " + e.getMessage(),
- _map.connection().currentTransaction());
- ex.initCause(e);
- throw ex;
+ throw new DeadlockException(_trace.errorPrefix + "EntryIterator.setValue: " + e.getMessage(),
+ _map.connection().currentTransaction(), e);
}
catch(com.sleepycat.db.DatabaseException e)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(e);
- ex.message = _trace.errorPrefix + "EntryIterator.setValue: " + e.getMessage();
- throw ex;
+ throw new DatabaseException(_trace.errorPrefix + "EntryIterator.setValue: " + e.getMessage(), e);
}
finally
{
@@ -384,17 +351,12 @@ class IteratorI<K, V> implements Freeze.Map.EntryIterator<java.util.Map.Entry<K,
catch(com.sleepycat.db.DeadlockException e)
{
dead();
- DeadlockException ex = new DeadlockException(
- _trace.errorPrefix + "Dbc.close: " + e.getMessage(), _map.connection().currentTransaction());
- ex.initCause(e);
- throw ex;
+ throw new DeadlockException(_trace.errorPrefix + "Dbc.close: " + e.getMessage(),
+ _map.connection().currentTransaction(), e);
}
catch(com.sleepycat.db.DatabaseException e)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(e);
- ex.message = _trace.errorPrefix + "Dbc.close: " + e.getMessage();
- throw ex;
+ throw new DatabaseException(_trace.errorPrefix + "Dbc.close: " + e.getMessage(), e);
}
}
diff --git a/java/src/Freeze/MapInternal/MapI.java b/java/src/Freeze/MapInternal/MapI.java
index f0d1b4c9831..7b1a67d8863 100644
--- a/java/src/Freeze/MapInternal/MapI.java
+++ b/java/src/Freeze/MapInternal/MapI.java
@@ -197,23 +197,16 @@ public abstract class MapI<K, V> extends java.util.AbstractMap<K, V>
}
else
{
- DeadlockException ex = new DeadlockException(
- trace.errorPrefix + "Map.recreate: " + dx.getMessage(), tx);
- ex.initCause(dx);
- throw ex;
+ throw new DeadlockException(trace.errorPrefix + "Map.recreate: " + dx.getMessage(), tx, dx);
}
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException(trace.errorPrefix + "Map.recreate: " + dx.getMessage());
- ex.initCause(dx);
- throw ex;
+ throw new DatabaseException(trace.errorPrefix + "Map.recreate: " + dx.getMessage(), dx);
}
catch(java.io.FileNotFoundException fne)
{
- DatabaseException ex = new DatabaseException(trace.errorPrefix + "Map.recreate: " + fne.getMessage());
- ex.initCause(fne);
- throw ex;
+ throw new DatabaseException(trace.errorPrefix + "Map.recreate: " + fne.getMessage(), fne);
}
finally
{
@@ -243,10 +236,7 @@ public abstract class MapI<K, V> extends java.util.AbstractMap<K, V>
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException(
- trace.errorPrefix + "Map.recreate: " + dx.getMessage());
- ex.initCause(dx);
- throw ex;
+ throw new DatabaseException(trace.errorPrefix + "Map.recreate: " + dx.getMessage(), dx);
}
}
}
@@ -392,15 +382,14 @@ public abstract class MapI<K, V> extends java.util.AbstractMap<K, V>
{
}
- DatabaseException e = new DatabaseException(_trace.errorPrefix + "file not found");
- e.initCause(dx);
- throw e;
+ throw new DatabaseException(_trace.errorPrefix + "file not found", dx);
}
catch(com.sleepycat.db.DeadlockException dx)
{
if(_trace.deadlockWarning)
{
- _trace.logger.warning("Deadlock in Freeze.MapInternal.MapI.destroy on Db \"" + _dbName + "\"; retrying...");
+ _trace.logger.warning("Deadlock in Freeze.MapInternal.MapI.destroy on Db \"" + _dbName +
+ "\"; retrying...");
}
//
@@ -417,9 +406,7 @@ public abstract class MapI<K, V> extends java.util.AbstractMap<K, V>
{
}
- DatabaseException e = new DatabaseException(_trace.errorPrefix + dx.getMessage());
- e.initCause(dx);
- throw e;
+ throw new DatabaseException(_trace.errorPrefix + dx.getMessage(), dx);
}
catch(RuntimeException rx)
{
@@ -696,24 +683,23 @@ public abstract class MapI<K, V> extends java.util.AbstractMap<K, V>
try
{
- com.sleepycat.db.BtreeStats s = (com.sleepycat.db.BtreeStats)_db.db().getStats(_connection.dbTxn(), null);
+ com.sleepycat.db.BtreeStats s =
+ (com.sleepycat.db.BtreeStats)_db.db().getStats(_connection.dbTxn(), null);
return s.getNumKeys();
}
catch(com.sleepycat.db.DeadlockException e)
{
if(_connection.dbTxn() != null)
{
- DeadlockException ex = new DeadlockException(
- _trace.errorPrefix + "Db.getStats: " + e.getMessage(), _connection.currentTransaction());
- ex.initCause(e);
- throw ex;
+ throw new DeadlockException(_trace.errorPrefix + "Db.getStats: " + e.getMessage(),
+ _connection.currentTransaction(), e);
}
else
{
if(_trace.deadlockWarning)
{
- _trace.logger.warning("Deadlock in Freeze.MapInternal.MapI.size while " + "reading Db \"" + _dbName +
- "\"; retrying...");
+ _trace.logger.warning("Deadlock in Freeze.MapInternal.MapI.size while " + "reading Db \"" +
+ _dbName + "\"; retrying...");
}
//
// Try again
@@ -722,10 +708,7 @@ public abstract class MapI<K, V> extends java.util.AbstractMap<K, V>
}
catch(com.sleepycat.db.DatabaseException e)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(e);
- ex.message = _trace.errorPrefix + "Db.getStats: " + e.getMessage();
- throw ex;
+ throw new DatabaseException(_trace.errorPrefix + "Db.getStats: " + e.getMessage(), e);
}
}
}
@@ -828,17 +811,15 @@ public abstract class MapI<K, V> extends java.util.AbstractMap<K, V>
{
if(_connection.dbTxn() != null)
{
- DeadlockException ex = new DeadlockException(
- _trace.errorPrefix + "Db.get: " + e.getMessage(), _connection.currentTransaction());
- ex.initCause(e);
- throw ex;
+ throw new DeadlockException(_trace.errorPrefix + "Db.get: " + e.getMessage(),
+ _connection.currentTransaction(), e);
}
else
{
if(_trace.deadlockWarning)
{
- _trace.logger.warning("Deadlock in Freeze.MapInternal.MapI.containsKey while " + "reading Db \"" + _dbName +
- "\"; retrying...");
+ _trace.logger.warning("Deadlock in Freeze.MapInternal.MapI.containsKey while " +
+ "reading Db \"" + _dbName + "\"; retrying...");
}
//
// Try again
@@ -847,10 +828,7 @@ public abstract class MapI<K, V> extends java.util.AbstractMap<K, V>
}
catch(com.sleepycat.db.DatabaseException e)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(e);
- ex.message = _trace.errorPrefix + "Db.get: " + e.getMessage();
- throw ex;
+ throw new DatabaseException(_trace.errorPrefix + "Db.get: " + e.getMessage(), e);
}
}
}
@@ -932,16 +910,15 @@ public abstract class MapI<K, V> extends java.util.AbstractMap<K, V>
{
if(txn != null)
{
- DeadlockException ex = new DeadlockException(
- _trace.errorPrefix + "Db.truncate: " + e.getMessage(), _connection.currentTransaction());
- ex.initCause(e);
- throw ex;
+ throw new DeadlockException(_trace.errorPrefix + "Db.truncate: " + e.getMessage(),
+ _connection.currentTransaction(), e);
}
else
{
if(_trace.deadlockWarning)
{
- _trace.logger.warning("Deadlock in Freeze.MapInternal.MapI.clear on Db \"" + _dbName + "\"; retrying...");
+ _trace.logger.warning("Deadlock in Freeze.MapInternal.MapI.clear on Db \"" + _dbName +
+ "\"; retrying...");
}
//
@@ -951,10 +928,7 @@ public abstract class MapI<K, V> extends java.util.AbstractMap<K, V>
}
catch(com.sleepycat.db.DatabaseException e)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(e);
- ex.message = _trace.errorPrefix + "Db.truncate: " + e.getMessage();
- throw ex;
+ throw new DatabaseException(_trace.errorPrefix + "Db.truncate: " + e.getMessage(), e);
}
}
}
@@ -1311,17 +1285,15 @@ public abstract class MapI<K, V> extends java.util.AbstractMap<K, V>
{
if(txn != null)
{
- DeadlockException ex = new DeadlockException(
- _trace.errorPrefix + "Db.put: " + e.getMessage(), _connection.currentTransaction());
- ex.initCause(e);
- throw ex;
+ throw new DeadlockException(_trace.errorPrefix + "Db.put: " + e.getMessage(),
+ _connection.currentTransaction(), e);
}
else
{
if(_trace.deadlockWarning)
{
- _trace.logger.warning("Deadlock in Freeze.MapInternal.MapI.putImpl while " + "writing into Db \"" +
- _dbName + "\"; retrying...");
+ _trace.logger.warning("Deadlock in Freeze.MapInternal.MapI.putImpl while " +
+ "writing into Db \"" + _dbName + "\"; retrying...");
}
//
@@ -1331,10 +1303,7 @@ public abstract class MapI<K, V> extends java.util.AbstractMap<K, V>
}
catch(com.sleepycat.db.DatabaseException e)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(e);
- ex.message = _trace.errorPrefix + "Db.put: " + e.getMessage();
- throw ex;
+ throw new DatabaseException(_trace.errorPrefix + "Db.put: " + e.getMessage(), e);
}
}
}
@@ -1371,17 +1340,15 @@ public abstract class MapI<K, V> extends java.util.AbstractMap<K, V>
{
if(txn != null)
{
- DeadlockException ex = new DeadlockException(
- _trace.errorPrefix + "Db.del: " + e.getMessage(), _connection.currentTransaction());
- ex.initCause(e);
- throw ex;
+ throw new DeadlockException(_trace.errorPrefix + "Db.del: " + e.getMessage(),
+ _connection.currentTransaction(), e);
}
else
{
if(_trace.deadlockWarning)
{
- _trace.logger.warning("Deadlock in Freeze.MapInternal.MapI.removeImpl while " + "writing into Db \"" +
- _dbName + "\"; retrying...");
+ _trace.logger.warning("Deadlock in Freeze.MapInternal.MapI.removeImpl while " +
+ "writing into Db \"" + _dbName + "\"; retrying...");
}
//
@@ -1391,10 +1358,7 @@ public abstract class MapI<K, V> extends java.util.AbstractMap<K, V>
}
catch(com.sleepycat.db.DatabaseException e)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(e);
- ex.message = _trace.errorPrefix + "Db.del: " + e.getMessage();
- throw ex;
+ throw new DatabaseException(_trace.errorPrefix + "Db.del: " + e.getMessage(), e);
}
}
}
@@ -1434,17 +1398,15 @@ public abstract class MapI<K, V> extends java.util.AbstractMap<K, V>
{
if(_connection.dbTxn() != null)
{
- DeadlockException ex = new DeadlockException(
- _trace.errorPrefix + "Db.get: " + e.getMessage(), _connection.currentTransaction());
- ex.initCause(e);
- throw ex;
+ throw new DeadlockException(_trace.errorPrefix + "Db.get: " + e.getMessage(),
+ _connection.currentTransaction(), e);
}
else
{
if(_trace.deadlockWarning)
{
- _trace.logger.warning("Deadlock in Freeze.MapInternal.MapI.getImpl while " + "reading Db \"" + _dbName +
- "\"; retrying...");
+ _trace.logger.warning("Deadlock in Freeze.MapInternal.MapI.getImpl while " +
+ "reading Db \"" + _dbName + "\"; retrying...");
}
//
@@ -1454,10 +1416,7 @@ public abstract class MapI<K, V> extends java.util.AbstractMap<K, V>
}
catch(com.sleepycat.db.DatabaseException e)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(e);
- ex.message = _trace.errorPrefix + "Db.get: " + e.getMessage();
- throw ex;
+ throw new DatabaseException(_trace.errorPrefix + "Db.get: " + e.getMessage(), e);
}
}
}
diff --git a/java/src/Freeze/MapInternal/Search.java b/java/src/Freeze/MapInternal/Search.java
index 8650eb16caa..1afdbccce8d 100644
--- a/java/src/Freeze/MapInternal/Search.java
+++ b/java/src/Freeze/MapInternal/Search.java
@@ -191,10 +191,8 @@ class Search
{
if(connection.dbTxn() != null)
{
- DeadlockException ex = new DeadlockException(
- trace.errorPrefix + dx.getMessage(), connection.currentTransaction());
- ex.initCause(dx);
- throw ex;
+ throw new DeadlockException(trace.errorPrefix + dx.getMessage(),
+ connection.currentTransaction(), dx);
}
else
{
@@ -229,10 +227,7 @@ class Search
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = trace.errorPrefix + dx.getMessage();
- throw ex;
+ throw new DatabaseException(trace.errorPrefix + dx.getMessage(), dx);
}
}
}
diff --git a/java/src/Freeze/ObjectStore.java b/java/src/Freeze/ObjectStore.java
index b0ba17e66d7..70c1a6fb31c 100644
--- a/java/src/Freeze/ObjectStore.java
+++ b/java/src/Freeze/ObjectStore.java
@@ -130,17 +130,11 @@ class ObjectStore implements IceUtil.Store
}
catch(java.io.FileNotFoundException dx)
{
- NotFoundException ex = new NotFoundException();
- ex.initCause(dx);
- ex.message = _evictor.errorPrefix() + "Db.open: " + dx.getMessage();
- throw ex;
+ throw new NotFoundException(_evictor.errorPrefix() + "Db.open: " + dx.getMessage(), dx);
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = _evictor.errorPrefix() + "Db.open: " + dx.getMessage();
- throw ex;
+ throw new DatabaseException(_evictor.errorPrefix() + "Db.open: " + dx.getMessage(), dx);
}
finally
{
@@ -178,10 +172,7 @@ class ObjectStore implements IceUtil.Store
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = _evictor.errorPrefix() + "Db.close: " + dx.getMessage();
- throw ex;
+ throw new DatabaseException(_evictor.errorPrefix() + "Db.close: " + dx.getMessage(), dx);
}
_db = null;
}
@@ -238,10 +229,7 @@ class ObjectStore implements IceUtil.Store
if(tx != null)
{
- DeadlockException ex = new DeadlockException(
- _evictor.errorPrefix() + "Db.get: " + dx.getMessage(), transaction);
- ex.initCause(dx);
- throw ex;
+ throw new DeadlockException(_evictor.errorPrefix() + "Db.get: " + dx.getMessage(), transaction, dx);
}
//
// Otherwise try again
@@ -249,9 +237,7 @@ class ObjectStore implements IceUtil.Store
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException(_evictor.errorPrefix() + "Db.get: " + dx.getMessage());
- ex.initCause(dx);
- throw ex;
+ throw new DatabaseException(_evictor.errorPrefix() + "Db.get: " + dx.getMessage(), dx);
}
}
}
@@ -449,10 +435,7 @@ class ObjectStore implements IceUtil.Store
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = _evictor.errorPrefix() + "Db.get: " + dx.getMessage();
- throw ex;
+ throw new DatabaseException(_evictor.errorPrefix() + "Db.get: " + dx.getMessage(), dx);
}
}
@@ -507,17 +490,11 @@ class ObjectStore implements IceUtil.Store
_evictor.filename() + "/" + _dbName + "\"");
}
- DeadlockException ex = new DeadlockException(
- _evictor.errorPrefix() + "Db.get: " + dx.getMessage(), transaction);
- ex.initCause(dx);
- throw ex;
+ throw new DeadlockException(_evictor.errorPrefix() + "Db.get: " + dx.getMessage(), transaction, dx);
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = _evictor.errorPrefix() + "Db.get: " + dx.getMessage();
- throw ex;
+ throw new DatabaseException(_evictor.errorPrefix() + "Db.get: " + dx.getMessage(), dx);
}
ObjectRecord rec = unmarshalValue(dbValue.getData(), _communicator);
@@ -566,17 +543,11 @@ class ObjectStore implements IceUtil.Store
_evictor.filename() + "/" + _dbName + "\"");
}
- DeadlockException ex = new DeadlockException(
- _evictor.errorPrefix() + "Db.put: " + dx.getMessage(), transaction);
- ex.initCause(dx);
- throw ex;
+ throw new DeadlockException(_evictor.errorPrefix() + "Db.put: " + dx.getMessage(), transaction, dx);
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = _evictor.errorPrefix() + "Db.put: " + dx.getMessage();
- throw ex;
+ throw new DatabaseException(_evictor.errorPrefix() + "Db.put: " + dx.getMessage(), dx);
}
}
@@ -622,10 +593,8 @@ class ObjectStore implements IceUtil.Store
if(tx != null)
{
- DeadlockException ex = new DeadlockException(
- _evictor.errorPrefix() + "Db.putNoOverwrite: " + dx.getMessage(), transaction);
- ex.initCause(dx);
- throw ex;
+ throw new DeadlockException(_evictor.errorPrefix() + "Db.putNoOverwrite: " + dx.getMessage(),
+ transaction, dx);
}
//
// Otherwise retry
@@ -633,10 +602,7 @@ class ObjectStore implements IceUtil.Store
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = _evictor.errorPrefix() + "Db.putNoOverwrite: " + dx.getMessage();
- throw ex;
+ throw new DatabaseException(_evictor.errorPrefix() + "Db.putNoOverwrite: " + dx.getMessage(), dx);
}
}
}
@@ -673,10 +639,8 @@ class ObjectStore implements IceUtil.Store
if(tx != null)
{
- DeadlockException ex = new DeadlockException(
- _evictor.errorPrefix() + "Db.delete: " + dx.getMessage(), transaction);
- ex.initCause(dx);
- throw ex;
+ throw new DeadlockException(_evictor.errorPrefix() + "Db.delete: " + dx.getMessage(), transaction,
+ dx);
}
//
@@ -686,10 +650,7 @@ class ObjectStore implements IceUtil.Store
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = _evictor.errorPrefix() + "Db.delete: " + dx.getMessage();
- throw ex;
+ throw new DatabaseException(_evictor.errorPrefix() + "Db.delete: " + dx.getMessage(), dx);
}
}
}
diff --git a/java/src/Freeze/SharedDbEnv.java b/java/src/Freeze/SharedDbEnv.java
index ccdf4821d29..d667cc4afb3 100644
--- a/java/src/Freeze/SharedDbEnv.java
+++ b/java/src/Freeze/SharedDbEnv.java
@@ -354,10 +354,7 @@ public class SharedDbEnv implements com.sleepycat.db.ErrorHandler, Runnable
}
catch(java.io.FileNotFoundException dx)
{
- NotFoundException ex = new NotFoundException();
- ex.initCause(dx);
- ex.message = errorPrefix(_key.envName) + "open: " + dx.getMessage();
- throw ex;
+ throw new NotFoundException(errorPrefix(_key.envName) + "open: " + dx.getMessage(), dx);
}
//
@@ -395,10 +392,7 @@ public class SharedDbEnv implements com.sleepycat.db.ErrorHandler, Runnable
catch(com.sleepycat.db.DatabaseException dx)
{
cleanup();
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = errorPrefix(_key.envName) + "creation: " + dx.getMessage();
- throw ex;
+ throw new DatabaseException(errorPrefix(_key.envName) + "creation: " + dx.getMessage(), dx);
}
catch(java.lang.RuntimeException ex)
{
@@ -488,10 +482,7 @@ public class SharedDbEnv implements com.sleepycat.db.ErrorHandler, Runnable
}
catch(com.sleepycat.db.DatabaseException dx)
{
- DatabaseException ex = new DatabaseException();
- ex.initCause(dx);
- ex.message = errorPrefix(_key.envName) + "close: " + dx.getMessage();
- throw ex;
+ throw new DatabaseException(errorPrefix(_key.envName) + "close: " + dx.getMessage(), dx);
}
finally
{
diff --git a/java/src/Freeze/TransactionI.java b/java/src/Freeze/TransactionI.java
index af0676bb466..8186b1ceb17 100644
--- a/java/src/Freeze/TransactionI.java
+++ b/java/src/Freeze/TransactionI.java
@@ -52,9 +52,7 @@ class TransactionI implements Transaction
e.getMessage());
}
- DeadlockException ex = new DeadlockException(_errorPrefix + "DbTxn.commit: " + e.getMessage(), this);
- ex.initCause(e);
- throw ex;
+ throw new DeadlockException(_errorPrefix + "DbTxn.commit: " + e.getMessage(), this, e);
}
catch(com.sleepycat.db.DatabaseException e)
{
@@ -65,10 +63,7 @@ class TransactionI implements Transaction
e.getMessage());
}
- DatabaseException ex = new DatabaseException();
- ex.initCause(e);
- ex.message = _errorPrefix + "DbTxn.commit: " + e.getMessage();
- throw ex;
+ throw new DatabaseException(_errorPrefix + "DbTxn.commit: " + e.getMessage(), e);
}
finally
{
@@ -123,9 +118,7 @@ class TransactionI implements Transaction
deadlock = true;
- DeadlockException ex = new DeadlockException(_errorPrefix + "DbTxn.abort: " + e.getMessage(), this);
- ex.initCause(e);
- throw ex;
+ throw new DeadlockException(_errorPrefix + "DbTxn.abort: " + e.getMessage(), this, e);
}
catch(com.sleepycat.db.DatabaseException e)
{
@@ -136,10 +129,7 @@ class TransactionI implements Transaction
e.getMessage());
}
- DatabaseException ex = new DatabaseException();
- ex.initCause(e);
- ex.message = _errorPrefix + "DbTxn.abort: " + e.getMessage();
- throw ex;
+ throw new DatabaseException(_errorPrefix + "DbTxn.abort: " + e.getMessage(), e);
}
finally
{
@@ -187,10 +177,7 @@ class TransactionI implements Transaction
"failed to start transaction: " + e.getMessage());
}
- DatabaseException ex = new DatabaseException();
- ex.initCause(e);
- ex.message = _errorPrefix + "txn_begin: " + e.getMessage();
- throw ex;
+ throw new DatabaseException(_errorPrefix + "txn_begin: " + e.getMessage(), e);
}
}
diff --git a/java/src/Ice/ConnectionI.java b/java/src/Ice/ConnectionI.java
index 5992d297464..8230ba129e1 100644
--- a/java/src/Ice/ConnectionI.java
+++ b/java/src/Ice/ConnectionI.java
@@ -1512,9 +1512,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
}
catch(java.lang.Exception ex)
{
- Ice.SyscallException e = new Ice.SyscallException();
- e.initCause(ex);
- throw e;
+ throw new Ice.SyscallException(ex);
}
}
@@ -2338,7 +2336,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
}
catch(java.lang.AssertionError ex) // Upon assertion, we print the stack trace.
{
- UnknownException uex = new UnknownException();
+ UnknownException uex = new UnknownException(ex);
java.io.StringWriter sw = new java.io.StringWriter();
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
ex.printStackTrace(pw);
@@ -2349,7 +2347,7 @@ public final class ConnectionI extends IceInternal.EventHandler implements Conne
}
catch(java.lang.OutOfMemoryError ex)
{
- UnknownException uex = new UnknownException();
+ UnknownException uex = new UnknownException(ex);
java.io.StringWriter sw = new java.io.StringWriter();
java.io.PrintWriter pw = new java.io.PrintWriter(sw);
ex.printStackTrace(pw);
diff --git a/java/src/Ice/ObjectPrxHelperBase.java b/java/src/Ice/ObjectPrxHelperBase.java
index 19467ac4453..dcb9d03c624 100644
--- a/java/src/Ice/ObjectPrxHelperBase.java
+++ b/java/src/Ice/ObjectPrxHelperBase.java
@@ -239,7 +239,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
}
catch(UserException __ex)
{
- throw new UnknownUserException(__ex.ice_name());
+ throw new UnknownUserException(__ex.ice_name(), __ex);
}
}
boolean __ret;
@@ -570,7 +570,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
}
catch(UserException __ex)
{
- throw new UnknownUserException(__ex.ice_name());
+ throw new UnknownUserException(__ex.ice_name(), __ex);
}
}
String[] __ret = null;
@@ -745,7 +745,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
}
catch(UserException __ex)
{
- throw new UnknownUserException(__ex.ice_name());
+ throw new UnknownUserException(__ex.ice_name(), __ex);
}
}
String __ret = null;
@@ -2107,7 +2107,7 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
}
catch(UserException __ex)
{
- throw new UnknownUserException(__ex.ice_name());
+ throw new UnknownUserException(__ex.ice_name(), __ex);
}
}
IceInternal.BasicStream __is = __result.__is();
@@ -2215,11 +2215,14 @@ public class ObjectPrxHelperBase implements ObjectPrx, java.io.Serializable
}
catch(ClassCastException ex)
{
- throw new java.io.IOException("Cannot deserialize proxy: Ice.ObjectInputStream not found");
+ java.io.IOException e =
+ new java.io.IOException("Cannot deserialize proxy: Ice.ObjectInputStream not found");
+ e.initCause(ex);
+ throw e;
}
catch(LocalException ex)
{
- java.io.IOException e = new java.io.IOException("Failure occurred while deserializing proxy");
+ java.io.IOException e = new java.io.IOException("Failure occurred while deserializing proxy", ex);
e.initCause(ex);
throw e;
}
diff --git a/java/src/Ice/PluginManagerI.java b/java/src/Ice/PluginManagerI.java
index 605a509ef1a..2648a4006b8 100644
--- a/java/src/Ice/PluginManagerI.java
+++ b/java/src/Ice/PluginManagerI.java
@@ -315,25 +315,17 @@ public final class PluginManagerI implements PluginManager
}
catch(ClassCastException ex)
{
- PluginInitializationException e = new PluginInitializationException();
- e.reason = "class " + className + " does not implement Ice.PluginFactory";
- e.initCause(ex);
- throw e;
+ throw new PluginInitializationException(
+ "class " + className + " does not implement Ice.PluginFactory", ex);
}
}
catch(IllegalAccessException ex)
{
- PluginInitializationException e = new PluginInitializationException();
- e.reason = "unable to access default constructor in class " + className;
- e.initCause(ex);
- throw e;
+ throw new PluginInitializationException("unable to access default constructor in class " + className, ex);
}
catch(InstantiationException ex)
{
- PluginInitializationException e = new PluginInitializationException();
- e.reason = "unable to instantiate class " + className;
- e.initCause(ex);
- throw e;
+ throw new PluginInitializationException("unable to instantiate class " + className, ex);
}
//
@@ -350,17 +342,12 @@ public final class PluginManagerI implements PluginManager
}
catch(Throwable ex)
{
- PluginInitializationException e = new PluginInitializationException();
- e.reason = "exception in factory " + className;
- e.initCause(ex);
- throw e;
+ throw new PluginInitializationException("exception in factory " + className, ex);
}
if(plugin == null)
{
- PluginInitializationException e = new PluginInitializationException();
- e.reason = "failure in factory " + className;
- throw e;
+ throw new PluginInitializationException("failure in factory " + className);
}
_plugins.put(name, plugin);
diff --git a/java/src/Ice/PropertiesI.java b/java/src/Ice/PropertiesI.java
index 55f48d374b1..a5909db7cde 100644
--- a/java/src/Ice/PropertiesI.java
+++ b/java/src/Ice/PropertiesI.java
@@ -361,10 +361,7 @@ public final class PropertiesI implements Properties
}
catch(Exception ex)
{
- InitializationException ie = new InitializationException();
- ie.reason = "Could not read Windows registry key `" + file + "'";
- ie.initCause(ex); // Exception chaining
- throw ie;
+ throw new InitializationException("Could not read Windows registry key `" + file + "'", ex);
}
}
else
@@ -399,10 +396,7 @@ public final class PropertiesI implements Properties
}
catch(java.io.IOException ex)
{
- FileException fe = new FileException();
- fe.path = file;
- fe.initCause(ex); // Exception chaining
- throw fe;
+ throw new FileException(0, file, ex);
}
finally
{
@@ -519,9 +513,7 @@ public final class PropertiesI implements Properties
}
catch(java.io.IOException ex)
{
- SyscallException se = new SyscallException();
- se.initCause(ex); // Exception chaining
- throw se;
+ throw new SyscallException(ex);
}
}
diff --git a/java/src/Ice/SysLoggerI.java b/java/src/Ice/SysLoggerI.java
index 628dfb50ed2..58fdcd90238 100644
--- a/java/src/Ice/SysLoggerI.java
+++ b/java/src/Ice/SysLoggerI.java
@@ -131,9 +131,7 @@ public final class SysLoggerI implements Logger
}
catch(IOException ex)
{
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
@@ -190,9 +188,7 @@ public final class SysLoggerI implements Logger
}
catch(IOException ex)
{
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
diff --git a/java/src/Ice/_ObjectDelD.java b/java/src/Ice/_ObjectDelD.java
index 80d3837ac12..0ed48ca6c2c 100644
--- a/java/src/Ice/_ObjectDelD.java
+++ b/java/src/Ice/_ObjectDelD.java
@@ -82,7 +82,8 @@ public class _ObjectDelD implements _ObjectDel
}
catch(Ice.UserException __ex)
{
- throw new IceInternal.LocalExceptionWrapper(new Ice.UnknownUserException(__ex.ice_name()), false);
+ UnknownUserException ex = new UnknownUserException(__ex.ice_name(), __ex);
+ throw new IceInternal.LocalExceptionWrapper(ex, false);
}
try
diff --git a/java/src/Ice/_ObjectDelM.java b/java/src/Ice/_ObjectDelM.java
index 36a712009b6..6fd71a34ae6 100644
--- a/java/src/Ice/_ObjectDelM.java
+++ b/java/src/Ice/_ObjectDelM.java
@@ -38,7 +38,7 @@ public class _ObjectDelM implements _ObjectDel
}
catch(UserException __ex)
{
- throw new UnknownUserException(__ex.ice_name());
+ throw new UnknownUserException(__ex.ice_name(), __ex);
}
}
IceInternal.BasicStream __is = __og.is();
@@ -78,7 +78,7 @@ public class _ObjectDelM implements _ObjectDel
}
catch(UserException __ex)
{
- throw new UnknownUserException(__ex.ice_name());
+ throw new UnknownUserException(__ex.ice_name(), __ex);
}
}
__og.is().skipEmptyEncaps();
@@ -113,7 +113,7 @@ public class _ObjectDelM implements _ObjectDel
}
catch(UserException __ex)
{
- throw new UnknownUserException(__ex.ice_name());
+ throw new UnknownUserException(__ex.ice_name(), __ex);
}
}
IceInternal.BasicStream __is = __og.is();
@@ -151,7 +151,7 @@ public class _ObjectDelM implements _ObjectDel
}
catch(UserException __ex)
{
- throw new UnknownUserException(__ex.ice_name());
+ throw new UnknownUserException(__ex.ice_name(), __ex);
}
}
IceInternal.BasicStream __is = __og.is();
diff --git a/java/src/IceBox/ServiceManagerI.java b/java/src/IceBox/ServiceManagerI.java
index e9dc102d282..b1919dcc505 100644
--- a/java/src/IceBox/ServiceManagerI.java
+++ b/java/src/IceBox/ServiceManagerI.java
@@ -502,10 +502,8 @@ public class ServiceManagerI extends _ServiceManagerDisp
}
catch(IllegalAccessException ex)
{
- FailureException e = new FailureException();
- e.reason = "ServiceManager: unable to access service constructor " + className + "(Ice.Communicator)";
- e.initCause(ex);
- throw e;
+ throw new FailureException(
+ "ServiceManager: unable to access service constructor " + className + "(Ice.Communicator)", ex);
}
catch(NoSuchMethodException ex)
{
@@ -513,10 +511,8 @@ public class ServiceManagerI extends _ServiceManagerDisp
}
catch(java.lang.reflect.InvocationTargetException ex)
{
- FailureException e = new FailureException();
- e.reason = "ServiceManager: service constructor " + className + "(Ice.Communicator) threw an exception";
- e.initCause(ex.getCause());
- throw e;
+ throw new FailureException(
+ "ServiceManager: service constructor " + className + "(Ice.Communicator) threw an exception", ex);
}
if(obj == null)
@@ -530,10 +526,8 @@ public class ServiceManagerI extends _ServiceManagerDisp
}
catch(IllegalAccessException ex)
{
- FailureException e = new FailureException();
- e.reason = "ServiceManager: unable to access default service constructor in class " + className;
- e.initCause(ex);
- throw e;
+ throw new FailureException(
+ "ServiceManager: unable to access default service constructor in class " + className, ex);
}
}
@@ -543,17 +537,12 @@ public class ServiceManagerI extends _ServiceManagerDisp
}
catch(ClassCastException ex)
{
- FailureException e = new FailureException();
- e.reason = "ServiceManager: class " + className + " does not implement IceBox.Service";
- throw e;
+ throw new FailureException("ServiceManager: class " + className + " does not implement IceBox.Service");
}
}
catch(InstantiationException ex)
{
- FailureException e = new FailureException();
- e.reason = "ServiceManager: unable to instantiate class " + className;
- e.initCause(ex);
- throw e;
+ throw new FailureException("ServiceManager: unable to instantiate class " + className, ex);
}
//
@@ -675,10 +664,7 @@ public class ServiceManagerI extends _ServiceManagerDisp
}
catch(Throwable ex)
{
- FailureException e = new FailureException();
- e.reason = "ServiceManager: exception while starting service " + service + ": " + ex;
- e.initCause(ex);
- throw e;
+ throw new FailureException("ServiceManager: exception while starting service " + service + ": " + ex, ex);
}
}
diff --git a/java/src/IceInternal/BasicStream.java b/java/src/IceInternal/BasicStream.java
index a840476f657..1dfb7ba826d 100644
--- a/java/src/IceInternal/BasicStream.java
+++ b/java/src/IceInternal/BasicStream.java
@@ -745,9 +745,7 @@ public class BasicStream
}
catch(java.lang.Exception ex)
{
- Ice.MarshalException e = new Ice.MarshalException("cannot deserialize object");
- e.initCause(ex);
- throw e;
+ throw new Ice.MarshalException("cannot deserialize object", ex);
}
}
@@ -1171,9 +1169,7 @@ public class BasicStream
}
catch(java.nio.charset.CharacterCodingException ex)
{
- Ice.MarshalException e = new Ice.MarshalException();
- e.initCause(ex);
- throw e;
+ throw new Ice.MarshalException(ex);
}
writeSize(b.limit());
expand(b.limit());
@@ -1605,10 +1601,7 @@ public class BasicStream
// When readString raises this exception it means we've seen the last slice,
// so we set the reason member to a more helpful message.
//
- Ice.UnmarshalOutOfBoundsException e = new Ice.UnmarshalOutOfBoundsException();
- e.reason = "unknown exception type `" + origId + "'";
- e.initCause(ex);
- throw e;
+ throw new Ice.UnmarshalOutOfBoundsException("unknown exception type `" + origId + "'", ex);
}
}
}
@@ -1784,10 +1777,7 @@ public class BasicStream
}
catch(ClassCastException ex)
{
- Ice.NoObjectFactoryException nof = new Ice.NoObjectFactoryException();
- nof.type = p.type();
- nof.initCause(ex);
- throw nof;
+ throw new Ice.NoObjectFactoryException("no object factory", p.type(), ex);
}
}
@@ -1930,10 +1920,7 @@ public class BasicStream
}
catch(Exception ex)
{
- Ice.CompressionException e = new Ice.CompressionException();
- e.reason = "bzip2 compression failure";
- e.initCause(ex);
- throw e;
+ throw new Ice.CompressionException("bzip2 compression failure", ex);
}
//
@@ -2042,10 +2029,7 @@ public class BasicStream
}
catch(Exception ex)
{
- Ice.CompressionException e = new Ice.CompressionException();
- e.reason = "bzip2 uncompression failure";
- e.initCause(ex);
- throw e;
+ throw new Ice.CompressionException("bzip2 uncompression failure", ex);
}
//
@@ -2083,9 +2067,7 @@ public class BasicStream
}
catch(java.lang.Exception ex)
{
- Ice.SyscallException e = new Ice.SyscallException();
- e.initCause(ex);
- throw e;
+ throw new Ice.SyscallException(ex);
}
}
@@ -2137,10 +2119,7 @@ public class BasicStream
}
catch(LinkageError ex)
{
- Ice.NoObjectFactoryException e = new Ice.NoObjectFactoryException();
- e.type = id;
- e.initCause(ex);
- throw e;
+ throw new Ice.NoObjectFactoryException("no object factory", id, ex);
}
return factory;
@@ -2168,9 +2147,7 @@ public class BasicStream
}
catch(java.lang.Exception ex)
{
- Ice.SyscallException e = new Ice.SyscallException();
- e.initCause(ex);
- throw e;
+ throw new Ice.SyscallException(ex);
}
}
@@ -2204,9 +2181,7 @@ public class BasicStream
}
catch(LinkageError ex)
{
- Ice.MarshalException e = new Ice.MarshalException();
- e.initCause(ex);
- throw e;
+ throw new Ice.MarshalException(ex);
}
if(factory != null)
diff --git a/java/src/IceInternal/Buffer.java b/java/src/IceInternal/Buffer.java
index e404bdc063c..8a7b8713dc4 100644
--- a/java/src/IceInternal/Buffer.java
+++ b/java/src/IceInternal/Buffer.java
@@ -161,10 +161,7 @@ public class Buffer
}
catch(OutOfMemoryError ex)
{
- Ice.MarshalException e = new Ice.MarshalException();
- e.reason = "OutOfMemoryError occurred while allocating a ByteBuffer";
- e.initCause(ex);
- throw e;
+ throw new Ice.MarshalException("OutOfMemoryError occurred while allocating a ByteBuffer", ex);
}
}
diff --git a/java/src/IceInternal/IncomingConnectionFactory.java b/java/src/IceInternal/IncomingConnectionFactory.java
index 1133f0d1dfa..ce36a3bc498 100644
--- a/java/src/IceInternal/IncomingConnectionFactory.java
+++ b/java/src/IceInternal/IncomingConnectionFactory.java
@@ -409,9 +409,7 @@ public final class IncomingConnectionFactory extends EventHandler implements Ice
}
else
{
- Ice.SyscallException e = new Ice.SyscallException();
- e.initCause(ex);
- throw e;
+ throw new Ice.SyscallException(ex);
}
}
}
diff --git a/java/src/IceInternal/Instance.java b/java/src/IceInternal/Instance.java
index fe5c3427310..1cb34a7940d 100644
--- a/java/src/IceInternal/Instance.java
+++ b/java/src/IceInternal/Instance.java
@@ -564,10 +564,7 @@ public final class Instance
}
catch(java.io.FileNotFoundException ex)
{
- Ice.FileException fe = new Ice.FileException();
- fe.path = stdOut;
- fe.initCause(ex);
- throw fe;
+ throw new Ice.FileException(0, stdOut, ex);
}
System.setOut(outStream);
@@ -591,10 +588,7 @@ public final class Instance
}
catch(java.io.FileNotFoundException ex)
{
- Ice.FileException fe = new Ice.FileException();
- fe.path = stdErr;
- fe.initCause(ex);
- throw fe;
+ throw new Ice.FileException(0, stdErr, ex);
}
}
diff --git a/java/src/IceInternal/LocalExceptionWrapper.java b/java/src/IceInternal/LocalExceptionWrapper.java
index c5896c6ca0b..6b741f463de 100644
--- a/java/src/IceInternal/LocalExceptionWrapper.java
+++ b/java/src/IceInternal/LocalExceptionWrapper.java
@@ -60,9 +60,10 @@ public class LocalExceptionWrapper extends Exception
{
throw new LocalExceptionWrapper((Ice.LocalException)ex, false);
}
- throw new LocalExceptionWrapper(new Ice.UnknownLocalException(((Ice.LocalException)ex).ice_name()), false);
+ throw new LocalExceptionWrapper(new Ice.UnknownLocalException(((Ice.LocalException)ex).ice_name(), ex),
+ false);
}
- throw new LocalExceptionWrapper(new Ice.UnknownException(Ex.toString(ex)), false);
+ throw new LocalExceptionWrapper(new Ice.UnknownException(Ex.toString(ex), ex), false);
}
private Ice.LocalException _ex;
diff --git a/java/src/IceInternal/Network.java b/java/src/IceInternal/Network.java
index d2ccaec4f90..5110caa6680 100644
--- a/java/src/IceInternal/Network.java
+++ b/java/src/IceInternal/Network.java
@@ -88,9 +88,7 @@ public final class Network
}
catch(java.io.IOException ex)
{
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
@@ -111,9 +109,7 @@ public final class Network
}
catch(java.io.IOException ex)
{
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
@@ -126,9 +122,7 @@ public final class Network
}
catch(java.io.IOException ex)
{
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
@@ -154,9 +148,7 @@ public final class Network
}
catch(java.io.IOException ex)
{
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
@@ -170,9 +162,7 @@ public final class Network
catch(java.io.IOException ex)
{
closeSocketNoThrow(fd);
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
@@ -186,9 +176,7 @@ public final class Network
catch(java.io.IOException ex)
{
closeSocketNoThrow(fd);
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
@@ -202,9 +190,7 @@ public final class Network
catch(java.io.IOException ex)
{
closeSocketNoThrow(fd);
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
@@ -220,9 +206,7 @@ public final class Network
catch(java.io.IOException ex)
{
closeSocketNoThrow(fd);
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
@@ -238,9 +222,7 @@ public final class Network
catch(java.io.IOException ex)
{
closeSocketNoThrow(fd);
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
@@ -262,9 +244,7 @@ public final class Network
continue;
}
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
@@ -276,9 +256,7 @@ public final class Network
}
catch(java.io.IOException ex)
{
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
return fd;
@@ -298,31 +276,24 @@ public final class Network
{
closeSocketNoThrow(fd);
- Ice.ConnectFailedException se;
if(connectionRefused(ex))
{
- se = new Ice.ConnectionRefusedException();
+ throw new Ice.ConnectionRefusedException(ex);
}
else
{
- se = new Ice.ConnectFailedException();
+ throw new Ice.ConnectFailedException(ex);
}
- se.initCause(ex);
- throw se;
}
catch(java.io.IOException ex)
{
closeSocketNoThrow(fd);
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
catch(java.lang.SecurityException ex)
{
closeSocketNoThrow(fd);
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
if(System.getProperty("os.name").equals("Linux"))
@@ -372,23 +343,18 @@ public final class Network
}
catch(java.net.ConnectException ex)
{
- Ice.ConnectFailedException se;
if(connectionRefused(ex))
{
- se = new Ice.ConnectionRefusedException();
+ throw new Ice.ConnectionRefusedException(ex);
}
else
{
- se = new Ice.ConnectFailedException();
+ throw new Ice.ConnectFailedException(ex);
}
- se.initCause(ex);
- throw se;
}
catch(java.io.IOException ex)
{
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
@@ -403,24 +369,19 @@ public final class Network
{
closeSocketNoThrow(fd);
- Ice.ConnectFailedException se;
if(connectionRefused(ex))
{
- se = new Ice.ConnectionRefusedException();
+ throw new Ice.ConnectionRefusedException(ex);
}
else
{
- se = new Ice.ConnectFailedException();
+ throw new Ice.ConnectFailedException(ex);
}
- se.initCause(ex);
- throw se;
}
catch(java.io.IOException ex)
{
closeSocketNoThrow(fd);
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
@@ -471,9 +432,7 @@ public final class Network
{
continue;
}
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
}
@@ -496,9 +455,7 @@ public final class Network
{
continue;
}
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
@@ -510,9 +467,7 @@ public final class Network
}
catch(java.io.IOException ex)
{
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
return result;
@@ -529,9 +484,7 @@ public final class Network
catch(java.io.IOException ex)
{
closeSocketNoThrow(fd);
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
@@ -547,9 +500,7 @@ public final class Network
catch(java.io.IOException ex)
{
closeSocketNoThrow(fd);
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
return size;
}
@@ -565,9 +516,7 @@ public final class Network
catch(java.io.IOException ex)
{
closeSocketNoThrow(fd);
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
@@ -583,9 +532,7 @@ public final class Network
catch(java.io.IOException ex)
{
closeSocketNoThrow(fd);
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
return size;
}
@@ -601,9 +548,7 @@ public final class Network
catch(java.io.IOException ex)
{
closeSocketNoThrow(fd);
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
@@ -619,9 +564,7 @@ public final class Network
catch(java.io.IOException ex)
{
closeSocketNoThrow(fd);
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
return size;
}
@@ -637,9 +580,7 @@ public final class Network
catch(java.io.IOException ex)
{
closeSocketNoThrow(fd);
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
@@ -655,9 +596,7 @@ public final class Network
catch(java.io.IOException ex)
{
closeSocketNoThrow(fd);
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
return size;
}
@@ -673,9 +612,7 @@ public final class Network
catch(java.io.IOException ex)
{
closeSocketNoThrow(fd);
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
@@ -691,9 +628,7 @@ public final class Network
catch(java.io.IOException ex)
{
closeSocketNoThrow(fd);
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
return size;
}
@@ -825,16 +760,11 @@ public final class Network
}
catch(java.net.UnknownHostException ex)
{
- Ice.DNSException e = new Ice.DNSException();
- e.host = host;
- e.initCause(ex);
- throw e;
+ throw new Ice.DNSException(0, host, ex);
}
catch(java.lang.SecurityException ex)
{
- Ice.SocketException e = new Ice.SocketException();
- e.initCause(ex);
- throw e;
+ throw new Ice.SocketException(ex);
}
//
@@ -842,9 +772,7 @@ public final class Network
//
if(addresses.size() == 0)
{
- Ice.DNSException e = new Ice.DNSException();
- e.host = host;
- throw e;
+ throw new Ice.DNSException(0, host);
}
return addresses;
@@ -874,17 +802,13 @@ public final class Network
}
}
}
- catch(java.net.SocketException e)
+ catch(java.net.SocketException ex)
{
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(e);
- throw se;
+ throw new Ice.SocketException(ex);
}
catch(java.lang.SecurityException ex)
{
- Ice.SocketException e = new Ice.SocketException();
- e.initCause(ex);
- throw e;
+ throw new Ice.SocketException(ex);
}
return result;
@@ -902,15 +826,13 @@ public final class Network
SocketPair fds = new SocketPair();
try
{
- java.nio.channels.Pipe pipe = java.nio.channels.Pipe.open();
- fds.sink = pipe.sink();
- fds.source = pipe.source();
+ java.nio.channels.Pipe pipe = java.nio.channels.Pipe.open();
+ fds.sink = pipe.sink();
+ fds.source = pipe.source();
}
catch(java.io.IOException ex)
{
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
return fds;
}
@@ -930,9 +852,7 @@ public final class Network
}
catch(java.lang.SecurityException ex)
{
- Ice.SocketException e = new Ice.SocketException();
- e.initCause(ex);
- throw e;
+ throw new Ice.SocketException(ex);
}
}
@@ -1206,24 +1126,17 @@ public final class Network
}
catch(java.net.UnknownHostException ex)
{
- Ice.DNSException e = new Ice.DNSException();
- e.host = host;
- e.initCause(ex);
- throw e;
+ throw new Ice.DNSException(0, host, ex);
}
catch(java.lang.SecurityException ex)
{
- Ice.SocketException e = new Ice.SocketException();
- e.initCause(ex);
- throw e;
+ throw new Ice.SocketException(ex);
}
//
// No Inet4Address/Inet6Address available.
//
- Ice.DNSException e = new Ice.DNSException();
- e.host = host;
- throw e;
+ throw new Ice.DNSException(0, host);
}
private static java.net.InetAddress[]
@@ -1250,9 +1163,7 @@ public final class Network
}
catch(java.lang.SecurityException ex)
{
- Ice.SocketException e = new Ice.SocketException();
- e.initCause(ex);
- throw e;
+ throw new Ice.SocketException(ex);
}
}
@@ -1280,9 +1191,7 @@ public final class Network
}
catch(java.lang.SecurityException ex)
{
- Ice.SocketException e = new Ice.SocketException();
- e.initCause(ex);
- throw e;
+ throw new Ice.SocketException(ex);
}
}
}
diff --git a/java/src/IceInternal/Selector.java b/java/src/IceInternal/Selector.java
index f604b4d7e37..d2206edb5a2 100644
--- a/java/src/IceInternal/Selector.java
+++ b/java/src/IceInternal/Selector.java
@@ -26,9 +26,7 @@ public final class Selector
}
catch(java.io.IOException ex)
{
- Ice.SyscallException sys = new Ice.SyscallException();
- sys.initCause(ex);
- throw sys;
+ throw new Ice.SyscallException(ex);
}
//
diff --git a/java/src/IceInternal/TcpTransceiver.java b/java/src/IceInternal/TcpTransceiver.java
index 94c29aa8452..3df1c906d65 100644
--- a/java/src/IceInternal/TcpTransceiver.java
+++ b/java/src/IceInternal/TcpTransceiver.java
@@ -70,9 +70,7 @@ final class TcpTransceiver implements Transceiver
}
catch(java.io.IOException ex)
{
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
finally
{
@@ -147,9 +145,7 @@ final class TcpTransceiver implements Transceiver
}
catch(java.io.IOException ex)
{
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
return true;
@@ -200,9 +196,7 @@ final class TcpTransceiver implements Transceiver
}
catch(java.io.IOException ex)
{
- Ice.ConnectionLostException se = new Ice.ConnectionLostException();
- se.initCause(ex);
- throw se;
+ throw new Ice.ConnectionLostException(ex);
}
}
diff --git a/java/src/IceInternal/ThreadPoolWorkQueue.java b/java/src/IceInternal/ThreadPoolWorkQueue.java
index 9e12bd03c37..b689dcd525c 100644
--- a/java/src/IceInternal/ThreadPoolWorkQueue.java
+++ b/java/src/IceInternal/ThreadPoolWorkQueue.java
@@ -27,9 +27,7 @@ final class ThreadPoolWorkQueue extends EventHandler
}
catch(java.io.IOException ex)
{
- Ice.SyscallException sys = new Ice.SyscallException();
- sys.initCause(ex);
- throw sys;
+ throw new Ice.SyscallException(ex);
}
_selector.initialize(this);
@@ -96,9 +94,7 @@ final class ThreadPoolWorkQueue extends EventHandler
}
catch(java.io.IOException ex)
{
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
ThreadPoolWorkItem workItem = null;
@@ -163,9 +159,7 @@ final class ThreadPoolWorkQueue extends EventHandler
}
catch(java.io.IOException ex)
{
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
}
diff --git a/java/src/IceInternal/UdpTransceiver.java b/java/src/IceInternal/UdpTransceiver.java
index b0947970fe7..af42c20c8e4 100644
--- a/java/src/IceInternal/UdpTransceiver.java
+++ b/java/src/IceInternal/UdpTransceiver.java
@@ -78,15 +78,11 @@ final class UdpTransceiver implements Transceiver
}
catch(java.nio.channels.AsynchronousCloseException ex)
{
- Ice.ConnectionLostException se = new Ice.ConnectionLostException();
- se.initCause(ex);
- throw se;
+ throw new Ice.ConnectionLostException(ex);
}
catch(java.net.PortUnreachableException ex)
{
- Ice.ConnectionLostException se = new Ice.ConnectionLostException();
- se.initCause(ex);
- throw se;
+ throw new Ice.ConnectionLostException(ex);
}
catch(java.io.InterruptedIOException ex)
{
@@ -94,9 +90,7 @@ final class UdpTransceiver implements Transceiver
}
catch(java.io.IOException ex)
{
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
@@ -147,15 +141,11 @@ final class UdpTransceiver implements Transceiver
}
catch(java.nio.channels.AsynchronousCloseException ex)
{
- Ice.ConnectionLostException se = new Ice.ConnectionLostException();
- se.initCause(ex);
- throw se;
+ throw new Ice.ConnectionLostException(ex);
}
catch(java.net.PortUnreachableException ex)
{
- Ice.ConnectionLostException se = new Ice.ConnectionLostException();
- se.initCause(ex);
- throw se;
+ throw new Ice.ConnectionLostException(ex);
}
catch(java.io.InterruptedIOException ex)
{
@@ -163,9 +153,7 @@ final class UdpTransceiver implements Transceiver
}
catch(java.io.IOException ex)
{
- Ice.ConnectionLostException se = new Ice.ConnectionLostException();
- se.initCause(ex);
- throw se;
+ throw new Ice.ConnectionLostException(ex);
}
}
@@ -619,9 +607,7 @@ final class UdpTransceiver implements Transceiver
}
catch(Exception ex)
{
- Ice.SocketException se = new Ice.SocketException();
- se.initCause(ex);
- throw se;
+ throw new Ice.SocketException(ex);
}
}
diff --git a/java/src/IceSSL/Instance.java b/java/src/IceSSL/Instance.java
index 25dc8da8486..d4810613919 100644
--- a/java/src/IceSSL/Instance.java
+++ b/java/src/IceSSL/Instance.java
@@ -118,10 +118,8 @@ class Instance
}
catch(Throwable ex)
{
- Ice.PluginInitializationException e = new Ice.PluginInitializationException();
- e.reason = "IceSSL: unable to load certificate verifier class " + certVerifierClass;
- e.initCause(ex);
- throw e;
+ throw new Ice.PluginInitializationException(
+ "IceSSL: unable to load certificate verifier class " + certVerifierClass, ex);
}
try
@@ -130,10 +128,8 @@ class Instance
}
catch(Throwable ex)
{
- Ice.PluginInitializationException e = new Ice.PluginInitializationException();
- e.reason = "IceSSL: unable to instantiate certificate verifier class " + certVerifierClass;
- e.initCause(ex);
- throw e;
+ throw new Ice.PluginInitializationException(
+ "IceSSL: unable to instantiate certificate verifier class " + certVerifierClass, ex);
}
}
@@ -157,10 +153,8 @@ class Instance
}
catch(Throwable ex)
{
- Ice.PluginInitializationException e = new Ice.PluginInitializationException();
- e.reason = "IceSSL: unable to load password callback class " + passwordCallbackClass;
- e.initCause(ex);
- throw e;
+ throw new Ice.PluginInitializationException(
+ "IceSSL: unable to load password callback class " + passwordCallbackClass, ex);
}
try
@@ -169,10 +163,8 @@ class Instance
}
catch(Throwable ex)
{
- Ice.PluginInitializationException e = new Ice.PluginInitializationException();
- e.reason = "IceSSL: unable to instantiate password callback class " + passwordCallbackClass;
- e.initCause(ex);
- throw e;
+ throw new Ice.PluginInitializationException(
+ "IceSSL: unable to instantiate password callback class " + passwordCallbackClass, ex);
}
}
@@ -226,10 +218,8 @@ class Instance
}
catch(java.io.IOException ex)
{
- Ice.PluginInitializationException e = new Ice.PluginInitializationException();
- e.reason = "IceSSL: unable to access random seed file:\n" + file;
- e.initCause(ex);
- throw e;
+ throw new Ice.PluginInitializationException(
+ "IceSSL: unable to access random seed file:\n" + file, ex);
}
}
}
@@ -258,10 +248,7 @@ class Instance
}
catch(java.io.IOException ex)
{
- Ice.PluginInitializationException e = new Ice.PluginInitializationException();
- e.reason = "IceSSL: error while reading random seed";
- e.initCause(ex);
- throw e;
+ throw new Ice.PluginInitializationException("IceSSL: error while reading random seed", ex);
}
finally
{
@@ -381,10 +368,8 @@ class Instance
}
catch(java.io.IOException ex)
{
- Ice.PluginInitializationException e = new Ice.PluginInitializationException();
- e.reason = "IceSSL: unable to load keystore:\n" + keystorePath;
- e.initCause(ex);
- throw e;
+ throw new Ice.PluginInitializationException(
+ "IceSSL: unable to load keystore:\n" + keystorePath, ex);
}
finally
{
@@ -503,10 +488,8 @@ class Instance
}
catch(java.io.IOException ex)
{
- Ice.PluginInitializationException e = new Ice.PluginInitializationException();
- e.reason = "IceSSL: unable to load truststore:\n" + truststorePath;
- e.initCause(ex);
- throw e;
+ throw new Ice.PluginInitializationException(
+ "IceSSL: unable to load truststore:\n" + truststorePath, ex);
}
finally
{
@@ -557,10 +540,7 @@ class Instance
}
catch(java.security.GeneralSecurityException ex)
{
- Ice.PluginInitializationException e = new Ice.PluginInitializationException();
- e.reason = "IceSSL: unable to initialize context";
- e.initCause(ex);
- throw e;
+ throw new Ice.PluginInitializationException("IceSSL: unable to initialize context", ex);
}
}
@@ -724,10 +704,7 @@ class Instance
}
catch(IllegalArgumentException ex)
{
- Ice.SecurityException e = new Ice.SecurityException();
- e.reason = "IceSSL: invalid ciphersuite";
- e.initCause(ex);
- throw e;
+ throw new Ice.SecurityException("IceSSL: invalid ciphersuite", ex);
}
if(_securityTraceLevel >= 1)
@@ -750,10 +727,7 @@ class Instance
}
catch(IllegalArgumentException ex)
{
- Ice.SecurityException e = new Ice.SecurityException();
- e.reason = "IceSSL: invalid protocol";
- e.initCause(ex);
- throw e;
+ throw new Ice.SecurityException("IceSSL: invalid protocol", ex);
}
}
@@ -780,10 +754,7 @@ class Instance
}
catch(javax.net.ssl.SSLException ex)
{
- Ice.SecurityException e = new Ice.SecurityException();
- e.reason = "IceSSL: handshake error";
- e.initCause(ex);
- throw e;
+ throw new Ice.SecurityException("IceSSL: handshake error", ex);
}
return engine;
@@ -1146,10 +1117,8 @@ class Instance
}
catch(java.util.regex.PatternSyntaxException ex)
{
- Ice.PluginInitializationException e = new Ice.PluginInitializationException();
- e.reason = "IceSSL: invalid cipher expression `" + exp + "'";
- e.initCause(ex);
- throw e;
+ throw new Ice.PluginInitializationException(
+ "IceSSL: invalid cipher expression `" + exp + "'", ex);
}
}
else
diff --git a/java/src/IceSSL/TransceiverI.java b/java/src/IceSSL/TransceiverI.java
index c7efdbbf4f0..dc2153f9c36 100644
--- a/java/src/IceSSL/TransceiverI.java
+++ b/java/src/IceSSL/TransceiverI.java
@@ -102,10 +102,9 @@ final class TransceiverI implements IceInternal.Transceiver
//
// We can't throw in close.
//
- // Ice.SecurityException se = new Ice.SecurityException();
- // se.reason = "IceSSL: SSL failure while shutting down socket";
- // se.initCause(ex);
- // throw se;
+ // Ice.SecurityException se = new Ice.SecurityException(
+ // "IceSSL: SSL failure while shutting down socket", ex);
+ //
}
try
@@ -249,10 +248,7 @@ final class TransceiverI implements IceInternal.Transceiver
}
catch(SSLException ex)
{
- Ice.SecurityException e = new Ice.SecurityException();
- e.reason = "IceSSL: error during read";
- e.initCause(ex);
- throw e;
+ throw new Ice.SecurityException("IceSSL: error during read", ex);
}
//
@@ -507,10 +503,7 @@ final class TransceiverI implements IceInternal.Transceiver
}
catch(SSLException ex)
{
- Ice.SecurityException e = new Ice.SecurityException();
- e.reason = "IceSSL: handshake error";
- e.initCause(ex);
- throw e;
+ throw new Ice.SecurityException("IceSSL: handshake error", ex);
}
return IceInternal.SocketOperation.None;
@@ -537,10 +530,7 @@ final class TransceiverI implements IceInternal.Transceiver
}
catch(javax.net.ssl.SSLPeerUnverifiedException ex)
{
- Ice.SecurityException e = new Ice.SecurityException();
- e.reason = "IceSSL: server did not supply a certificate";
- e.initCause(ex);
- throw e;
+ throw new Ice.SecurityException("IceSSL: server did not supply a certificate", ex);
}
}
}
@@ -644,10 +634,7 @@ final class TransceiverI implements IceInternal.Transceiver
}
catch(SSLException ex)
{
- Ice.SecurityException e = new Ice.SecurityException();
- e.reason = "IceSSL: error while encoding message";
- e.initCause(ex);
- throw e;
+ throw new Ice.SecurityException("IceSSL: error while encoding message", ex);
}
assert(_netOutput.position() == 0);
@@ -702,9 +689,7 @@ final class TransceiverI implements IceInternal.Transceiver
}
catch(java.io.IOException ex)
{
- Ice.ConnectionLostException se = new Ice.ConnectionLostException();
- se.initCause(ex);
- throw se;
+ throw new Ice.ConnectionLostException(ex);
}
}
@@ -748,9 +733,7 @@ final class TransceiverI implements IceInternal.Transceiver
}
catch(java.io.IOException ex)
{
- Ice.ConnectionLostException se = new Ice.ConnectionLostException();
- se.initCause(ex);
- throw se;
+ throw new Ice.ConnectionLostException(ex);
}
}
diff --git a/java/src/IceUtil/FileLockException.java b/java/src/IceUtil/FileLockException.java
index cd096cea77f..5cb48352854 100644
--- a/java/src/IceUtil/FileLockException.java
+++ b/java/src/IceUtil/FileLockException.java
@@ -11,10 +11,26 @@ package IceUtil;
public class FileLockException extends RuntimeException implements Cloneable
{
+ public FileLockException()
+ {
+ }
+
public FileLockException(String path)
{
this.path = path;
}
+
+ public FileLockException(Throwable cause)
+ {
+ super(cause);
+ }
+
+ public FileLockException(String path, Throwable cause)
+ {
+ super(cause);
+ this.path = path;
+ }
+
public java.lang.Object clone()
{
java.lang.Object o = null;
diff --git a/java/src/IceUtilInternal/FileLock.java b/java/src/IceUtilInternal/FileLock.java
index 693a5949597..869057b877a 100644
--- a/java/src/IceUtilInternal/FileLock.java
+++ b/java/src/IceUtilInternal/FileLock.java
@@ -48,9 +48,7 @@ public final class FileLock
}
catch(Exception ex)
{
- IceUtil.FileLockException fe = new IceUtil.FileLockException(path);
- fe.initCause(ex);
- throw fe;
+ throw new IceUtil.FileLockException(path, ex);
}
if(lock == null)
diff --git a/java/src/IceUtilInternal/StringUtil.java b/java/src/IceUtilInternal/StringUtil.java
index c1494751be9..ca761e33811 100644
--- a/java/src/IceUtilInternal/StringUtil.java
+++ b/java/src/IceUtilInternal/StringUtil.java
@@ -360,9 +360,7 @@ public final class StringUtil
}
catch(java.io.UnsupportedEncodingException ex)
{
- IllegalArgumentException e = new IllegalArgumentException("unsupported encoding");
- e.initCause(ex);
- throw e;
+ throw new IllegalArgumentException("unsupported encoding", ex);
}
}