From f1c3a91b6b8145e243536e4999d393ac4dc99f37 Mon Sep 17 00:00:00 2001 From: Matthew Jason Benson Date: Fri, 1 Aug 2008 17:43:24 +0000 Subject: [PATCH] guard against null Blob git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@681761 13f79535-47bb-0310-9956-ffa450edef68 --- src/main/org/apache/tools/ant/taskdefs/SQLExec.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java index 5c21df872..0411fda31 100644 --- a/src/main/org/apache/tools/ant/taskdefs/SQLExec.java +++ b/src/main/org/apache/tools/ant/taskdefs/SQLExec.java @@ -46,6 +46,7 @@ import java.util.Locale; import java.util.StringTokenizer; import java.util.Vector; +import java.sql.Blob; import java.sql.Connection; import java.sql.Statement; import java.sql.SQLException; @@ -810,7 +811,10 @@ public class SQLExec extends JDBCTask { private void printValue(ResultSet rs, int col, PrintStream out) throws SQLException { 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 { out.print(maybeQuote(rs.getString(col))); }