diff options
author | Matthew Newhook <matthew@zeroc.com> | 2008-08-22 11:34:11 -0230 |
---|---|---|
committer | Matthew Newhook <matthew@zeroc.com> | 2008-08-22 11:34:11 -0230 |
commit | b6477cc39b9fc204c9bd960ce893dfaed32c8d47 (patch) | |
tree | 5d95b60d462fb21da2b32c51f60b4c6884d21640 /java/demo/Database/library/BookI.java | |
parent | more fixes to JDBC demo (diff) | |
download | ice-b6477cc39b9fc204c9bd960ce893dfaed32c8d47.tar.bz2 ice-b6477cc39b9fc204c9bd960ce893dfaed32c8d47.tar.xz ice-b6477cc39b9fc204c9bd960ce893dfaed32c8d47.zip |
Moved to using a dispatch interceptor model.
Diffstat (limited to 'java/demo/Database/library/BookI.java')
-rw-r--r-- | java/demo/Database/library/BookI.java | 42 |
1 files changed, 7 insertions, 35 deletions
diff --git a/java/demo/Database/library/BookI.java b/java/demo/Database/library/BookI.java index 9e8893f2989..ff7a1ee10a5 100644 --- a/java/demo/Database/library/BookI.java +++ b/java/demo/Database/library/BookI.java @@ -34,9 +34,7 @@ class BookI extends _BookDisp } catch(java.sql.SQLException e) { - // Log the error, and raise an UnknownException. - error(e); - Ice.UnknownException ex = new Ice.UnknownException(); + JDBCException ex = new JDBCException(); ex.initCause(e); throw ex; } @@ -62,9 +60,7 @@ class BookI extends _BookDisp } catch(java.sql.SQLException e) { - // Log the error, and raise an UnknownException. - error(e); - Ice.UnknownException ex = new Ice.UnknownException(); + JDBCException ex = new JDBCException(); ex.initCause(e); throw ex; } @@ -89,9 +85,7 @@ class BookI extends _BookDisp } catch(java.sql.SQLException e) { - // Log the error, and raise an UnknownException. - error(e); - Ice.UnknownException ex = new Ice.UnknownException(); + JDBCException ex = new JDBCException(); ex.initCause(e); throw ex; } @@ -130,9 +124,7 @@ class BookI extends _BookDisp } catch(java.sql.SQLException e) { - // Log the error, and raise an UnknownException. - error(e); - Ice.UnknownException ex = new Ice.UnknownException(); + JDBCException ex = new JDBCException(); ex.initCause(e); throw ex; } @@ -191,15 +183,10 @@ class BookI extends _BookDisp stmt.setInt(2, id); int count = stmt.executeUpdate(); assert count == 1; - - // Commit the transaction. - context.commit(); } catch(java.sql.SQLException e) { - // Log the error, and raise an UnknownException. - error(e); - Ice.UnknownException ex = new Ice.UnknownException(); + JDBCException ex = new JDBCException(); ex.initCause(e); throw ex; } @@ -234,17 +221,14 @@ class BookI extends _BookDisp } catch(java.sql.SQLException e) { - // Log the error, and raise an UnknownException. - error(e); - Ice.UnknownException ex = new Ice.UnknownException(); + JDBCException ex = new JDBCException(); ex.initCause(e); throw ex; } } - BookI(Ice.Logger logger) + BookI() { - _logger = logger; } static Ice.Identity @@ -293,16 +277,4 @@ class BookI extends _BookDisp return desc; } - - private void - error(Exception ex) - { - java.io.StringWriter sw = new java.io.StringWriter(); - java.io.PrintWriter pw = new java.io.PrintWriter(sw); - ex.printStackTrace(pw); - pw.flush(); - _logger.error("BookI: error:\n" + sw.toString()); - } - - private Ice.Logger _logger; } |