Browse Source

guard against null Blob

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@681761 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 17 years ago
parent
commit
f1c3a91b6b
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      src/main/org/apache/tools/ant/taskdefs/SQLExec.java

+ 5
- 1
src/main/org/apache/tools/ant/taskdefs/SQLExec.java View File

@@ -46,6 +46,7 @@ import java.util.Locale;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.Vector; import java.util.Vector;


import java.sql.Blob;
import java.sql.Connection; import java.sql.Connection;
import java.sql.Statement; import java.sql.Statement;
import java.sql.SQLException; import java.sql.SQLException;
@@ -810,7 +811,10 @@ public class SQLExec extends JDBCTask {
private void printValue(ResultSet rs, int col, PrintStream out) private void printValue(ResultSet rs, int col, PrintStream out)
throws SQLException { throws SQLException {
if (rawBlobs && rs.getMetaData().getColumnType(col) == Types.BLOB) { if (rawBlobs && rs.getMetaData().getColumnType(col) == Types.BLOB) {
new StreamPumper(rs.getBlob(col).getBinaryStream(), out).run();
Blob blob = rs.getBlob(col);
if (blob != null) {
new StreamPumper(rs.getBlob(col).getBinaryStream(), out).run();
}
} else { } else {
out.print(maybeQuote(rs.getString(col))); out.print(maybeQuote(rs.getString(col)));
} }


Loading…
Cancel
Save