diff options
author | Claude Brisson <cbrisson@apache.org> | 2017-06-25 20:23:54 +0000 |
---|---|---|
committer | Claude Brisson <cbrisson@apache.org> | 2017-06-25 20:23:54 +0000 |
commit | 5629664b6ac705b626199e0d0b60395ae47c3c77 (patch) | |
tree | f9735b095986992697628893409ac92d35f9ff22 /velocity-engine-core/src/main/java/org/apache | |
parent | 9453dc37dee9050da63353d1f1ba83a38c883a0d (diff) | |
download | apache-velocity-engine-5629664b6ac705b626199e0d0b60395ae47c3c77.tar.gz |
[engine] Review DataSourceResourceLoader
- use ResultSet.getCharacterStream()
- fix test case for database genericity
git-svn-id: https://svn.apache.org/repos/asf/velocity/engine/trunk@1799837 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'velocity-engine-core/src/main/java/org/apache')
-rw-r--r-- | velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java index 58bcf2f4..1b81070c 100644 --- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java +++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java @@ -226,31 +226,14 @@ public class DataSourceResourceLoader extends ResourceLoader if (rs.next()) { - InputStream rawStream = rs.getAsciiStream(templateColumn); - if (rawStream == null) + Reader reader = rs.getCharacterStream(templateColumn); + if (reader == null) { throw new ResourceNotFoundException("DataSourceResourceLoader: " + "template column for '" + name + "' is null"); } - try - { - return buildReader(rawStream, encoding); - } - catch (Exception e) - { - if (rawStream != null) - { - try - { - rawStream.close(); - } - catch(IOException ioe) {} - } - String msg = "Exception while loading Template column for " + name; - log.error(msg, e); - throw new VelocityException(msg, e); - } + return reader; } else { |