If you're going to throw that class into your project and use it
verbatim, you might want to change nullSafeGet as follows:
<snip>
String lineSeparator = System.getProperty("line.separator");
StringBuffer sb = new StringBuffer();
BufferedReader bufferedClobReader = new BufferedReader(clobReader);
try
{
String line = null;
while( (line = bufferedClobReader.readLine()) != null )
{
sb.append(line + lineSeparator);
}
bufferedClobReader.close();
}
catch (IOException e)
{
throw new SQLException( e.toString() );
}
return sb.toString();
<snip>
Changes:
1. Adds the line separator back in, as the BufferedReader removes it.
2. Uses a string buffer, which I'm told is faster than instantiating
tons of strings.
There may be a better way to do this, but I tested this one and I know
it works. :) |