From: SVN by r. <sv...@ca...> - 2009-09-15 13:06:49
|
Author: roy Date: 2009-09-15 14:39:51 +0200 (Tue, 15 Sep 2009) New Revision: 415 Modified: src/main/java/nl/improved/sqlclient/AbstractSQLShellWindow.java Log: fix export for null values (byte arrays) Modified: src/main/java/nl/improved/sqlclient/AbstractSQLShellWindow.java =================================================================== --- src/main/java/nl/improved/sqlclient/AbstractSQLShellWindow.java 2009-08-06 18:31:54 UTC (rev 414) +++ src/main/java/nl/improved/sqlclient/AbstractSQLShellWindow.java 2009-09-15 12:39:51 UTC (rev 415) @@ -1860,18 +1860,20 @@ byte[] bytes = new byte[bytesSize]; int read; InputStream valueStream = rs.getBinaryStream(col); - while ( (read = valueStream.read(bytes)) != -1) { - if (read == 0) { - continue; + if (valueStream != null) { + while ( (read = valueStream.read(bytes)) != -1) { + if (read == 0) { + continue; + } + if (read != bytes.length) { + bytes = Arrays.copyOf(bytes, read); + } + String stringValue = enc.encode(bytes) +"\n"; + hd.characters(stringValue.toCharArray(), 0, stringValue.length()); + if (bytes.length != bytesSize) { + bytes = new byte[bytesSize]; + } } - if (read != bytes.length) { - bytes = Arrays.copyOf(bytes, read); - } - String stringValue = enc.encode(bytes) +"\n"; - hd.characters(stringValue.toCharArray(), 0, stringValue.length()); - if (bytes.length != bytesSize) { - bytes = new byte[bytesSize]; - } } } else { atts.addAttribute("","","type","",Integer.toString(metaData.getColumnType(col))); |