From 2631b9ee4a3625df1dc66926e8610f93c1ecd81f Mon Sep 17 00:00:00 2001 From: ?? ? <ulysseskao@ximple.com.tw> Date: Wed, 14 May 2008 01:11:01 +0800 Subject: [PATCH] update for EOFM-83 --- xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7OracleReader.java | 21 +++++++++------------ 1 files changed, 9 insertions(+), 12 deletions(-) diff --git a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7OracleReader.java b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7OracleReader.java index f5936c7..2db498d 100644 --- a/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7OracleReader.java +++ b/xdgnjobs/ximple-dgnio/src/main/java/com/ximple/io/dgn7/Dgn7OracleReader.java @@ -69,16 +69,12 @@ } catch (SQLException e) { throw new RuntimeException("initialize oralce error.", e); - } catch (Dgn7fileException e) + } catch (Dgn7Exception e) { throw new RuntimeException("initialize oralce error.", e); } } - if (_element == null) - { - return false; - } - return true; + return _element != null; } public Element next() @@ -91,7 +87,7 @@ } catch (SQLException e) { throw new RuntimeException("Error:" + e.getMessage(), e); - } catch (Dgn7fileException e) + } catch (Dgn7Exception e) { throw new RuntimeException("Error:" + e.getMessage(), e); } @@ -104,7 +100,7 @@ throw new RuntimeException("Not Support this method."); } - private boolean initializeReader() throws SQLException, Dgn7fileException + private boolean initializeReader() throws SQLException, Dgn7Exception { if (_resultSet != null) return true; Statement stmtSrc = _connection.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); @@ -117,7 +113,7 @@ return true; } - private boolean fetchElement() throws SQLException, Dgn7fileException + private boolean fetchElement() throws SQLException, Dgn7Exception { if (_resultSet.next()) { @@ -133,7 +129,7 @@ raw = getBytesFromBLOB(blob); } catch (IOException e) { - throw new SQLException("IOError", e); + throw new Dgn7Exception("IOError", e); } blob.close(); } else if (value instanceof byte[]) @@ -208,14 +204,14 @@ protected static byte[] getBytesFromBLOB(BLOB blob) throws SQLException, IOException { - byte[] raw = null; + byte[] raw; // BLOB blob = (BLOB) rs.getBlob(1); int optimalSize = blob.getChunkSize(); byte[] chunk = new byte[optimalSize]; InputStream is = blob.getBinaryStream(0); ByteBuffer buffer = null; // ByteBuffer.allocate(optimalSize); - int len = 0; + int len; try { @@ -233,6 +229,7 @@ } is.close(); + assert buffer != null; buffer.position(0); raw = buffer.array(); } catch (IOException e) -- Gitblit v0.0.0-SNAPSHOT