Skip to content
Snippets Groups Projects
Verified Commit 339120d5 authored by Fredrik Roubert's avatar Fredrik Roubert
Browse files

ITS#4501 Replace use of deprecated class StringBufferInputStream.

JDK 1.1 deprecated class StringBufferInputStream because it does not
properly convert characters into bytes.
parent fa6c4c44
No related branches found
No related tags found
1 merge request!6ITS#4501 Update code base to Java8.
...@@ -28,6 +28,7 @@ import java.io.*; ...@@ -28,6 +28,7 @@ import java.io.*;
import java.util.*; import java.util.*;
import java.net.*; import java.net.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
/** /**
*Stores the result from a query *Stores the result from a query
...@@ -183,12 +184,12 @@ public class LdapResultSet implements java.sql.ResultSet { ...@@ -183,12 +184,12 @@ public class LdapResultSet implements java.sql.ResultSet {
public java.io.InputStream getAsciiStream(int param) public java.io.InputStream getAsciiStream(int param)
throws java.sql.SQLException { throws java.sql.SQLException {
return new StringBufferInputStream(getByNum(param)); return new ByteArrayInputStream(getByNum(param).getBytes(StandardCharsets.US_ASCII));
} }
public java.io.InputStream getAsciiStream(java.lang.String str) public java.io.InputStream getAsciiStream(java.lang.String str)
throws java.sql.SQLException { throws java.sql.SQLException {
return new StringBufferInputStream(getByName(str)); return new ByteArrayInputStream(getByName(str).getBytes(StandardCharsets.US_ASCII));
} }
public java.math.BigDecimal getBigDecimal(int param) public java.math.BigDecimal getBigDecimal(int param)
...@@ -479,12 +480,12 @@ public class LdapResultSet implements java.sql.ResultSet { ...@@ -479,12 +480,12 @@ public class LdapResultSet implements java.sql.ResultSet {
public java.io.InputStream getUnicodeStream(int param) public java.io.InputStream getUnicodeStream(int param)
throws java.sql.SQLException { throws java.sql.SQLException {
return new StringBufferInputStream(getByNum(param)); return new ByteArrayInputStream(getByNum(param).getBytes(StandardCharsets.UTF_8));
} }
public java.io.InputStream getUnicodeStream(java.lang.String str) public java.io.InputStream getUnicodeStream(java.lang.String str)
throws java.sql.SQLException { throws java.sql.SQLException {
return new StringBufferInputStream(getByName(str)); return new ByteArrayInputStream(getByName(str).getBytes(StandardCharsets.UTF_8));
} }
public java.sql.SQLWarning getWarnings() throws java.sql.SQLException { public java.sql.SQLWarning getWarnings() throws java.sql.SQLException {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment