From 70c58f008e8342736c07b604b2adfed70afa1565 Mon Sep 17 00:00:00 2001 From: Jerven bolleman Date: Tue, 20 Apr 2021 17:38:57 +0200 Subject: [PATCH] Do not use new Long/Byte/Short/Character etc. They are all deprecated --- .../virtuoso/javax/BaseRowSet.java | 14 +++---- .../virtuoso/javax/OPLCachedRowSet.java | 38 ++++++++--------- .../virtuoso/jdbc/ConnectionWrapper.java | 8 ++-- .../JDBCDriverType4/virtuoso/jdbc/Driver.java | 6 +-- .../virtuoso/jdbc/VirtuosoBlob.java | 42 +++++++++---------- .../jdbc/VirtuosoCallableStatement.java | 12 +++--- .../virtuoso/jdbc/VirtuosoConnection.java | 26 ++++++------ .../virtuoso/jdbc/VirtuosoExplicitString.java | 6 +-- .../virtuoso/jdbc/VirtuosoFuture.java | 4 +- .../virtuoso/jdbc/VirtuosoInputStream.java | 22 +++++----- .../jdbc/VirtuosoPreparedStatement.java | 18 ++++---- .../virtuoso/jdbc/VirtuosoRdfBox.java | 4 +- .../virtuoso/jdbc/VirtuosoResultSet.java | 24 +++++------ .../jdbc/VirtuosoResultSetMetaData.java | 4 +- .../virtuoso/jdbc/VirtuosoStatement.java | 38 ++++++++--------- .../virtuoso/jdbc/VirtuosoTypes.java | 22 +++++----- .../virtuoso/jdbc/VirtuosoXAResource.java | 2 +- 17 files changed, 145 insertions(+), 145 deletions(-) diff --git a/libsrc/JDBCDriverType4/virtuoso/javax/BaseRowSet.java b/libsrc/JDBCDriverType4/virtuoso/javax/BaseRowSet.java index 2be0f09674..bd7b51610d 100644 --- a/libsrc/JDBCDriverType4/virtuoso/javax/BaseRowSet.java +++ b/libsrc/JDBCDriverType4/virtuoso/javax/BaseRowSet.java @@ -997,7 +997,7 @@ public synchronized void setBoolean(int parameterIndex, boolean x) { Parameter param = getParam(parameterIndex); - param.value = new Boolean(x); + param.value = Boolean.valueOf(x); param.jType = Parameter.jObject; } @@ -1013,7 +1013,7 @@ public synchronized void setByte(int parameterIndex, byte x) { Parameter param = getParam(parameterIndex); - param.value = new Byte(x); + param.value = Byte.valueOf(x); param.jType = Parameter.jObject; } @@ -1322,7 +1322,7 @@ public synchronized void setDouble(int parameterIndex, double x) { Parameter param = getParam(parameterIndex); - param.value = new Double(x); + param.value = Double.valueOf(x); param.jType = Parameter.jObject; } @@ -1339,7 +1339,7 @@ public synchronized void setFloat(int parameterIndex, float x) { Parameter param = getParam(parameterIndex); - param.value = new Float(x); + param.value = Float.valueOf(x); param.jType = Parameter.jObject; } @@ -1355,7 +1355,7 @@ public synchronized void setInt(int parameterIndex, int x) { Parameter param = getParam(parameterIndex); - param.value = new Integer(x); + param.value = Integer.valueOf(x); param.jType = Parameter.jObject; } @@ -1371,7 +1371,7 @@ public synchronized void setLong(int parameterIndex, long x) { Parameter param = getParam(parameterIndex); - param.value = new Long(x); + param.value = Long.valueOf(x); param.jType = Parameter.jObject; } @@ -1402,7 +1402,7 @@ public synchronized void setShort(int parameterIndex, short x) { Parameter param = getParam(parameterIndex); - param.value = new Short(x); + param.value = Short.valueOf(x); param.jType = Parameter.jObject; } diff --git a/libsrc/JDBCDriverType4/virtuoso/javax/OPLCachedRowSet.java b/libsrc/JDBCDriverType4/virtuoso/javax/OPLCachedRowSet.java index 36b96fc96d..2fa671f4e4 100644 --- a/libsrc/JDBCDriverType4/virtuoso/javax/OPLCachedRowSet.java +++ b/libsrc/JDBCDriverType4/virtuoso/javax/OPLCachedRowSet.java @@ -2349,7 +2349,7 @@ public synchronized void updateBoolean(int columnIndex, boolean x) throws SQLExc Row r = this.getRowForUpdate(columnIndex, "'updateBoolean(...)'"); switch(rowSMD.getColumnType(columnIndex)) { case Types.BOOLEAN: - r.setColData(columnIndex, new Boolean(x)); + r.setColData(columnIndex, Boolean.valueOf(x)); break; case Types.BIT: case Types.TINYINT: @@ -2361,7 +2361,7 @@ public synchronized void updateBoolean(int columnIndex, boolean x) throws SQLExc case Types.DOUBLE: case Types.DECIMAL: case Types.NUMERIC: - r.setColData(columnIndex, new Integer((x ?1:0))); + r.setColData(columnIndex, Integer.valueOf((x ?1:0))); break; case Types.CHAR: case Types.VARCHAR: @@ -2389,7 +2389,7 @@ public synchronized void updateBoolean(int columnIndex, boolean x) throws SQLExc * @exception SQLException if a database-access error occurs */ public void updateByte(int columnIndex, byte x) throws SQLException { - updateNumber(columnIndex, new Byte(x), "'byte'", "'updateByte(...)'"); + updateNumber(columnIndex, Byte.valueOf(x), "'byte'", "'updateByte(...)'"); } /** @@ -2405,7 +2405,7 @@ public void updateByte(int columnIndex, byte x) throws SQLException { * @exception SQLException if a database-access error occurs */ public void updateShort(int columnIndex, short x) throws SQLException { - updateNumber(columnIndex, new Short(x), "'short'", "'updateShort(...)'"); + updateNumber(columnIndex, Short.valueOf(x), "'short'", "'updateShort(...)'"); } /** @@ -2421,7 +2421,7 @@ public void updateShort(int columnIndex, short x) throws SQLException { * @exception SQLException if a database-access error occurs */ public void updateInt(int columnIndex, int x) throws SQLException { - updateNumber(columnIndex, new Integer(x), "'int'", "'updateInt(...)'"); + updateNumber(columnIndex, Integer.valueOf(x), "'int'", "'updateInt(...)'"); } /** @@ -2437,7 +2437,7 @@ public void updateInt(int columnIndex, int x) throws SQLException { * @exception SQLException if a database-access error occurs */ public void updateLong(int columnIndex, long x) throws SQLException { - updateNumber(columnIndex, new Long(x), "'long'", "'updateLong(...)'"); + updateNumber(columnIndex, Long.valueOf(x), "'long'", "'updateLong(...)'"); } /** @@ -2453,7 +2453,7 @@ public void updateLong(int columnIndex, long x) throws SQLException { * @exception SQLException if a database-access error occurs */ public void updateFloat(int columnIndex, float x) throws SQLException { - updateNumber(columnIndex, new Float(x), "'float'", "'updateFloat(...)'"); + updateNumber(columnIndex, Float.valueOf(x), "'float'", "'updateFloat(...)'"); } /** @@ -2469,7 +2469,7 @@ public void updateFloat(int columnIndex, float x) throws SQLException { * @exception SQLException if a database-access error occurs */ public void updateDouble(int columnIndex, double x) throws SQLException { - updateNumber(columnIndex, new Double(x), "'double'", "'updateDouble(...)'"); + updateNumber(columnIndex, Double.valueOf(x), "'double'", "'updateDouble(...)'"); } /** @@ -2510,7 +2510,7 @@ public synchronized void updateString(int columnIndex, String x) throws SQLExcep else switch(rowSMD.getColumnType(columnIndex)) { case Types.BOOLEAN: - r.setColData(columnIndex, new Boolean(x)); + r.setColData(columnIndex, Boolean.parseBoolean(x)); break; case Types.BIT: case Types.TINYINT: @@ -5273,7 +5273,7 @@ private synchronized void updateNumber(int columnIndex, Number val, String typeN Row r = this.getRowForUpdate(columnIndex, funcName); switch(rowSMD.getColumnType(columnIndex)) { case Types.BOOLEAN: - r.setColData(columnIndex, new Boolean((val.intValue()!=0? true:false))); + r.setColData(columnIndex, Boolean.valueOf((val.intValue()!=0? true:false))); break; case Types.BIT: case Types.TINYINT: @@ -5688,14 +5688,14 @@ private Scanner(String sql) { query = sql.toCharArray(); end = query.length - 1; - keywords.put("SELECT", new Integer(Token.T_SELECT)); - keywords.put("FROM", new Integer(Token.T_FROM)); - keywords.put("WHERE", new Integer(Token.T_WHERE)); - keywords.put("ORDER", new Integer(Token.T_ORDER)); - keywords.put("BY", new Integer(Token.T_BY)); - keywords.put("GROUP", new Integer(Token.T_GROUP)); - keywords.put("UNION", new Integer(Token.T_UNION)); - keywords.put("HAVING", new Integer(Token.T_HAVING)); + keywords.put("SELECT", Integer.valueOf(Token.T_SELECT)); + keywords.put("FROM", Integer.valueOf(Token.T_FROM)); + keywords.put("WHERE", Integer.valueOf(Token.T_WHERE)); + keywords.put("ORDER", Integer.valueOf(Token.T_ORDER)); + keywords.put("BY", Integer.valueOf(Token.T_BY)); + keywords.put("GROUP", Integer.valueOf(Token.T_GROUP)); + keywords.put("UNION", Integer.valueOf(Token.T_UNION)); + keywords.put("HAVING", Integer.valueOf(Token.T_HAVING)); } // select_stmt = SELECT [ ALL | DISTINCT ] select_item { "," select_item } @@ -6269,7 +6269,7 @@ private boolean doUpdate(OPLCachedRowSet crs) throws SQLException { tmpSQL.append(", "); tmpSQL.append(rsmd.getColumnName(i)); tmpSQL.append(" = ? "); - setData.add(new Integer(i)); + setData.add(Integer.valueOf(i)); } tmpSQL.append(" WHERE "); diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc/ConnectionWrapper.java b/libsrc/JDBCDriverType4/virtuoso/jdbc/ConnectionWrapper.java index 480d5f968e..73b26d3c52 100644 --- a/libsrc/JDBCDriverType4/virtuoso/jdbc/ConnectionWrapper.java +++ b/libsrc/JDBCDriverType4/virtuoso/jdbc/ConnectionWrapper.java @@ -152,7 +152,7 @@ public void setAutoCommit(boolean autoCommit) throws SQLException { check_conn(); if (r_AutoCommit == null) // save the initial autoCommit state - r_AutoCommit = new Boolean(getAutoCommit()); + r_AutoCommit = Boolean.valueOf(getAutoCommit()); rconn.setAutoCommit(autoCommit); } catch (SQLException ex) { @@ -210,7 +210,7 @@ public void setReadOnly(boolean readOnly) throws SQLException { check_conn(); if (r_ReadOnly == null) // save the initial readOnly state - r_ReadOnly = new Boolean(isReadOnly()); + r_ReadOnly = Boolean.valueOf(isReadOnly()); rconn.setReadOnly(readOnly); } catch (SQLException ex) { @@ -258,7 +258,7 @@ public void setTransactionIsolation(int level) throws SQLException { check_conn(); if (r_TxnIsolation == null) // save the initial TxnIsolation state - r_TxnIsolation = new Integer(getTransactionIsolation()); + r_TxnIsolation = Integer.valueOf(getTransactionIsolation()); rconn.setTransactionIsolation(level); } catch (SQLException ex) { @@ -370,7 +370,7 @@ public void setHoldability(int holdability) check_conn(); if (r_Holdability == null) // save the initial holdability state - r_Holdability = new Integer(getHoldability()); + r_Holdability = Integer.valueOf(getHoldability()); rconn.setHoldability(holdability); } catch (SQLException ex) { diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc/Driver.java b/libsrc/JDBCDriverType4/virtuoso/jdbc/Driver.java index 63a1a0d0d5..b6ad91e2b1 100644 --- a/libsrc/JDBCDriverType4/virtuoso/jdbc/Driver.java +++ b/libsrc/JDBCDriverType4/virtuoso/jdbc/Driver.java @@ -181,9 +181,9 @@ protected Properties urlToInfo(String url, Properties _info) { host = "localhost"; port = "1111"; - fbs = new Integer(VirtuosoTypes.DEFAULTPREFETCH); - sendbs = new Integer(32768); - recvbs = new Integer(32768); + fbs = Integer.valueOf(VirtuosoTypes.DEFAULTPREFETCH); + sendbs = Integer.valueOf(32768); + recvbs = Integer.valueOf(32768); Properties props = new Properties(); diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoBlob.java b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoBlob.java index a8b0253aaa..333d993c34 100644 --- a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoBlob.java +++ b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoBlob.java @@ -281,13 +281,13 @@ public byte[] getBytes(long pos, int length) throws VirtuosoException // we should go from start //System.out.println ("vb: rewind pos:" + pos + " ofs:" + bh_offset()); rewind(); -// init_read_len = new Long ((pos - 1) * +// init_read_len = Long.valueOf ((pos - 1) * // (dtp == VirtuosoTypes.DV_BLOB_WIDE_HANDLE ? -1 : 1)); - init_read_len = new Long (pos - 1); + init_read_len = Long.valueOf (pos - 1); } else if (pos - 1 > bh_offset ()) - init_read_len = new Long (pos - bh_offset() - 1); -// init_read_len = new Long ((pos - bh_offset() - 1) * + init_read_len = Long.valueOf (pos - bh_offset() - 1); +// init_read_len = Long.valueOf ((pos - bh_offset() - 1) * // (dtp == VirtuosoTypes.DV_BLOB_WIDE_HANDLE ? -1 : 1)); ***/ if (pos - 1 < bh_offset ()) @@ -298,7 +298,7 @@ else if (pos - 1 > bh_offset ()) } if (pos - 1 > bh_offset ()) - init_read_len = new Long (pos - bh_offset() - 1); + init_read_len = Long.valueOf (pos - bh_offset() - 1); if (init_read_len != null) @@ -309,15 +309,15 @@ else if (pos - 1 > bh_offset ()) { // skip the desired number of bytes Object[] args = new Object[9]; - args[0] = new Long(this.bh_current_page); + args[0] = Long.valueOf(this.bh_current_page); args[1] = init_read_len; - args[2] = new Long(this.bh_position); - args[3] = new Long(this.key_id); - args[4] = new Long(this.frag_no); - args[5] = new Long(this.dir_page); + args[2] = Long.valueOf(this.bh_position); + args[3] = Long.valueOf(this.key_id); + args[4] = Long.valueOf(this.frag_no); + args[5] = Long.valueOf(this.dir_page); args[6] = this.pages; - args[7] = this.dtp == VirtuosoTypes.DV_BLOB_WIDE_HANDLE ? new Long (1) : new Long(0); - args[8] = new Long (this.bh_timestamp); + args[7] = this.dtp == VirtuosoTypes.DV_BLOB_WIDE_HANDLE ? Long.valueOf (1) : Long.valueOf(0); + args[8] = Long.valueOf (this.bh_timestamp); //System.out.println ("vb: init read FUTURE: " + this.bh_current_page + " " + init_read_len + " " + this.bh_position); VirtuosoFuture future = connection.getFuture(VirtuosoFuture.getdata,args, -1); curr = future.nextResult(); @@ -369,17 +369,17 @@ else if (val instanceof String) synchronized (connection) { Object[] args = new Object[9]; - args[0] = new Long(this.bh_current_page); -// args[1] = new Long(length * + args[0] = Long.valueOf(this.bh_current_page); +// args[1] = Long.valueOf(length * // (dtp == VirtuosoTypes.DV_BLOB_WIDE_HANDLE ? -1 : 1)); - args[1] = new Long(length); - args[2] = new Long(this.bh_position); - args[3] = new Long(this.key_id); - args[4] = new Long(this.frag_no); - args[5] = new Long(this.dir_page); + args[1] = Long.valueOf(length); + args[2] = Long.valueOf(this.bh_position); + args[3] = Long.valueOf(this.key_id); + args[4] = Long.valueOf(this.frag_no); + args[5] = Long.valueOf(this.dir_page); args[6] = this.pages; - args[7] = this.dtp == VirtuosoTypes.DV_BLOB_WIDE_HANDLE ? new Long (1) : new Long(0); - args[8] = new Long (this.bh_timestamp); + args[7] = this.dtp == VirtuosoTypes.DV_BLOB_WIDE_HANDLE ? Long.valueOf (1) : Long.valueOf(0); + args[8] = Long.valueOf (this.bh_timestamp); //System.out.println ("vb: FUTURE: " + this.bh_current_page + " " + length + " " + this.bh_position); VirtuosoFuture future = connection.getFuture(VirtuosoFuture.getdata,args, -1); curr = future.nextResult(); diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoCallableStatement.java b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoCallableStatement.java index b0948923eb..1149adb5ab 100644 --- a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoCallableStatement.java +++ b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoCallableStatement.java @@ -136,7 +136,7 @@ public void registerOutParameter(int parameterIndex, int sqlType, int scale) thr return; case Types.BIGINT: if (objparams.elementAt(parameterIndex - 1) == null) - objparams.setElementAt(new Long(Long.MAX_VALUE),parameterIndex - 1); + objparams.setElementAt(Long.valueOf(Long.MAX_VALUE),parameterIndex - 1); return; case Types.LONGVARBINARY: case Types.VARBINARY: @@ -144,7 +144,7 @@ public void registerOutParameter(int parameterIndex, int sqlType, int scale) thr return; case Types.BIT: if (objparams.elementAt(parameterIndex - 1) == null) - objparams.setElementAt(new Boolean(false),parameterIndex - 1); + objparams.setElementAt(Boolean.FALSE,parameterIndex - 1); return; case Types.BLOB: case Types.CLOB: @@ -175,7 +175,7 @@ public void registerOutParameter(int parameterIndex, int sqlType, int scale) thr case Types.FLOAT: case Types.DOUBLE: if (objparams.elementAt(parameterIndex - 1) == null) - objparams.setElementAt(new Double(Double.MAX_VALUE),parameterIndex - 1); + objparams.setElementAt(Double.valueOf(Double.MAX_VALUE),parameterIndex - 1); return; case Types.OTHER: case Types.JAVA_OBJECT: @@ -188,16 +188,16 @@ public void registerOutParameter(int parameterIndex, int sqlType, int scale) thr return; case Types.REAL: if (objparams.elementAt(parameterIndex - 1) == null) - objparams.setElementAt(new Float(Float.MAX_VALUE),parameterIndex - 1); + objparams.setElementAt(Float.valueOf(Float.MAX_VALUE),parameterIndex - 1); return; case Types.SMALLINT: if (objparams.elementAt(parameterIndex - 1) == null) - objparams.setElementAt(new Short(Short.MAX_VALUE),parameterIndex - 1); + objparams.setElementAt(Short.valueOf(Short.MAX_VALUE),parameterIndex - 1); return; case Types.INTEGER: case Types.TINYINT: if (objparams.elementAt(parameterIndex - 1) == null) - objparams.setElementAt(new Integer(Integer.MAX_VALUE),parameterIndex - 1); + objparams.setElementAt(Integer.valueOf(Integer.MAX_VALUE),parameterIndex - 1); return; } ; diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoConnection.java b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoConnection.java index e18572d0c4..95eb65f9df 100644 --- a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoConnection.java +++ b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoConnection.java @@ -469,11 +469,11 @@ private Object[] fill_login_info_array () { Object[] ret = new Object[7]; ret[0] = new String ("JDBC"); - ret[1] = new Integer (0); + ret[1] = Integer.valueOf(0); ret[2] = new String (""); ret[3] = System.getProperty("os.name"); ret[4] = new String (""); - ret[5] = new Integer (0); + ret[5] = Integer.valueOf(0); //System.out.println (con_delegate); ret[6] = new String (con_delegate != null ? con_delegate : ""); return ret; @@ -668,15 +668,15 @@ else if (pwdclear != null && pwdclear.equals ("encrypt")) { //System.err.println ("Mapping1 " + ((int)table.charAt(i)) + "=" + (i + 1)); client_charset_hash.put ( - new Character (table.charAt(i)), - new Byte ((byte) (i + 1))); + Character.valueOf (table.charAt(i)), + Byte.valueOf ((byte) (i + 1))); } else { //System.err.println ("Mapping2 " + (i + 1) + "=" + (i + 1)); client_charset_hash.put ( - new Character ((char) (i + 1)), - new Byte ((byte) (i + 1))); + Character.valueOf ((char) (i + 1)), + Byte.valueOf ((byte) (i + 1))); } } } @@ -717,7 +717,7 @@ else if (pwdclear != null && pwdclear.equals ("encrypt")) "but processing character escapes also disabled", VirtuosoException.MISCERROR); //System.err.println ("version=[" + version + " ver=" + version.substring (6, 10)); - //if ((new Integer (version.substring (6, 10))).intValue() > 2143) + //if ((Integer.valueOf(version.substring (6, 10))).intValue() > 2143) // utf8_execs = true; timezoneless_datetimes = (int) cdef_param (client_defaults, "SQL_TIMEZONELESS_DATETIMES", 0); @@ -876,7 +876,7 @@ protected VirtuosoFuture getFuture(String rpcname, Object[] args, int timeout) // Create a VirtuosoFuture instance fut = new VirtuosoFuture(this,rpcname,args,this_req_no, timeout); // Set the request id and put it into the hash table - futures.put(new Integer(this_req_no),fut); + futures.put(Integer.valueOf(this_req_no),fut); return fut; } @@ -897,7 +897,7 @@ protected void clearFutures() protected void removeFuture(VirtuosoFuture fut) { if (futures != null) - futures.remove(new Integer(fut.hashCode())); + futures.remove(Integer.valueOf(fut.hashCode())); } /** @@ -954,7 +954,7 @@ protected boolean read_request() throws IOException, VirtuosoException return false; // Then put the message into the corresponding future queue //System.out.println("---------------> read_reqest for "+((Number)result.elementAt(1)).intValue()); - VirtuosoFuture fut = (VirtuosoFuture)futures.get(new Integer(((Number)result.elementAt(1)).intValue())); + VirtuosoFuture fut = (VirtuosoFuture)futures.get(Integer.valueOf(((Number)result.elementAt(1)).intValue())); if(fut == null) return false; fut.putResult(result.elementAt(2)); @@ -1018,7 +1018,7 @@ protected int getVersionNum () { try { - return (new Integer (version.substring (6, 10))).intValue(); + return (Integer.valueOf(version.substring (6, 10))).intValue(); } catch (Exception e) { @@ -1120,7 +1120,7 @@ public synchronized void commit() throws VirtuosoException { // RPC transaction Object[] args = new Object[2]; - args[0] = new Long(VirtuosoTypes.SQL_COMMIT); + args[0] = Long.valueOf(VirtuosoTypes.SQL_COMMIT); args[1] = null; VirtuosoFuture fut = getFuture(VirtuosoFuture.transaction,args, this.timeout); openlink.util.Vector trsres = fut.nextResult(); @@ -1301,7 +1301,7 @@ public synchronized void rollback() throws VirtuosoException { // RPC transaction Object[] args = new Object[2]; - args[0] = new Long(VirtuosoTypes.SQL_ROLLBACK); + args[0] = Long.valueOf(VirtuosoTypes.SQL_ROLLBACK); args[1] = null; VirtuosoFuture fut = getFuture(VirtuosoFuture.transaction,args, this.timeout); openlink.util.Vector trsres = fut.nextResult(); diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoExplicitString.java b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoExplicitString.java index 05807229a0..fdae1f9985 100644 --- a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoExplicitString.java +++ b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoExplicitString.java @@ -183,9 +183,9 @@ protected boolean cli_wide_to_narrow (String str, Hashtable charset_ht) { for (int i = 0; i < str.length(); i++) { - Character ch = new Character (str.charAt(i)); + Character ch = Character.valueOf (str.charAt(i)); Byte b; - b = (Byte)(charset_ht != null ? charset_ht.get (ch) : new Byte ((byte) (ch.charValue()))); + b = (Byte)(charset_ht != null ? charset_ht.get (ch) : Byte.valueOf ((byte) (ch.charValue()))); if (b == null) { bytes[i] = (byte) '?'; @@ -218,7 +218,7 @@ protected boolean cli_wide_to_escaped (String str, Hashtable ht) if (ht != null) { - Character ch = new Character (curr); + Character ch = Character.valueOf (curr); b = (Byte)ht.get (ch); if (b == null) { diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoFuture.java b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoFuture.java index 5b84734102..4961b5d3ee 100644 --- a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoFuture.java +++ b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoFuture.java @@ -116,8 +116,8 @@ protected void send_message(String rpcname, Object[] args) throws IOException, V vector[4] = null; vector[3] = rpcname; vector[2] = null; - vector[1] = new Integer(req_no); - vector[0] = new Integer(VirtuosoTypes.DA_FUTURE_REQUEST); + vector[1] = Integer.valueOf(req_no); + vector[0] = Integer.valueOf(VirtuosoTypes.DA_FUTURE_REQUEST); // Serialize data and flush the stream connection.write_object(new openlink.util.Vector(vector)); } diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoInputStream.java b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoInputStream.java index 8a47aa08e2..d966529e73 100644 --- a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoInputStream.java +++ b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoInputStream.java @@ -162,7 +162,7 @@ protected Object read_object() throws IOException, EOFException, VirtuosoExcepti case VirtuosoTypes.DV_NULL: { //System.out.println("DV_NULL"); - return new Short((short)0); //null; because off absence of TAG_BOX in O12 + return Short.valueOf((short)0); //null; because off absence of TAG_BOX in O12 } case VirtuosoTypes.DV_DB_NULL: { @@ -188,7 +188,7 @@ protected Object read_object() throws IOException, EOFException, VirtuosoExcepti int n = readint(); Object[] array = new Object[(int)n]; for(int i = 0;i < n;i++) - array[i] = new Long(readlongint()); + array[i] = Long.valueOf(readlongint()); res = new VectorOfLong(array); //System.out.print("DV_ARRAY_OF_LONG"); //System.out.println (res.toString()); @@ -201,7 +201,7 @@ protected Object read_object() throws IOException, EOFException, VirtuosoExcepti int n = readint(); Object[] array = new Object[(int)n]; for(int i = 0;i < n;i++) - array[i] = new Long(readlongint()); + array[i] = Long.valueOf(readlongint()); res = new VectorOfLong(array); //System.out.print("DV_ARRAY_OF_LONG_PACKED: "); //System.out.println (res.toString()); @@ -213,7 +213,7 @@ protected Object read_object() throws IOException, EOFException, VirtuosoExcepti int n = readint(); Object[] array = new Object[(int)n]; for(int i = 0;i < n;i++) - array[i] = new Double(readdouble()); + array[i] = Double.valueOf(readdouble()); res = new VectorOfDouble(array); //System.out.print("DV_ARRAY_OF_DOUBLE: "); //System.out.println (res.toString()); @@ -225,7 +225,7 @@ protected Object read_object() throws IOException, EOFException, VirtuosoExcepti int n = readint(); Object[] array = new Object[(int)n]; for(int i = 0;i < n;i++) - array[i] = new Float(readfloat()); + array[i] = Float.valueOf(readfloat()); res = new VectorOfFloat(array); //System.out.print("DV_ARRAY_OF_FLOAT: "); //System.out.println (res.toString()); @@ -329,7 +329,7 @@ protected Object read_object() throws IOException, EOFException, VirtuosoExcepti case VirtuosoTypes.DV_SINGLE_FLOAT: { //System.out.println("DV_SINGLE_FLOAT"); - res = new Float(readfloat()); + res = Float.valueOf(readfloat()); //System.out.print("DV_SINGLE_FLOAT: "); //System.out.println (res.toString()); return res; @@ -337,7 +337,7 @@ protected Object read_object() throws IOException, EOFException, VirtuosoExcepti case VirtuosoTypes.DV_DOUBLE_FLOAT: { //System.out.println("DV_DOUBLE_FLOAT"); - res = new Double(readdouble()); + res = Double.valueOf(readdouble()); //System.out.print("DV_DOUBLE_FLOAT: "); //System.out.println (res.toString()); return res; @@ -348,7 +348,7 @@ protected Object read_object() throws IOException, EOFException, VirtuosoExcepti int ret = readshortint(); if (ret > 127) ret = ret - 256; - res = new Short((short)ret); + res = Short.valueOf((short)ret); //System.out.print("DV_SHORT_INT: "); //System.out.println (res.toString()); return res; @@ -356,7 +356,7 @@ protected Object read_object() throws IOException, EOFException, VirtuosoExcepti case VirtuosoTypes.DV_LONG_INT: { //System.out.println("DV_LONG_INT"); - res = new Integer(readlongint()); + res = Integer.valueOf(readlongint()); //System.out.print("DV_LONG_INT: "); //System.out.println (res.toString()); return res; @@ -439,13 +439,13 @@ protected Object read_object() throws IOException, EOFException, VirtuosoExcepti } case VirtuosoTypes.DV_IRI_ID: { - res = new Integer(readlongint()); + res = Integer.valueOf(readlongint()); return res; } case VirtuosoTypes.DV_IRI_ID_8: case VirtuosoTypes.DV_INT64: { - res = new Long(readlong()); + res = Long.valueOf(readlong()); return res; } case VirtuosoTypes.DV_RDF: diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoPreparedStatement.java b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoPreparedStatement.java index ddacc6766f..e96445feb9 100644 --- a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoPreparedStatement.java +++ b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoPreparedStatement.java @@ -87,7 +87,7 @@ public class VirtuosoPreparedStatement extends VirtuosoStatement implements Prep Object[] args = new Object[4]; args[0] = (statid == null) ? statid = new String("ps" + connection.hashCode() + (req_no++)) : statid; args[1] = connection.escapeSQL(sql); - args[2] = new Long(0); + args[2] = Long.valueOf(0); args[3] = getStmtOpts(); // Create a future future = connection.getFuture(VirtuosoFuture.prepare,args, this.rpc_timeout); @@ -364,7 +364,7 @@ public void close() throws VirtuosoException // Build the args array Object[] args = new Object[2]; args[0] = statid; - args[1] = new Long(VirtuosoTypes.STAT_DROP); + args[1] = Long.valueOf(VirtuosoTypes.STAT_DROP); // Create and get a future for this future = connection.getFuture(VirtuosoFuture.close,args, this.rpc_timeout); // Read the answer @@ -614,7 +614,7 @@ public void setBoolean(int parameterIndex, boolean x) throws VirtuosoException // Check parameters if(parameterIndex < 1 || parameterIndex > parameters.capacity()) throw new VirtuosoException("Index " + parameterIndex + " is not 1 parameters.capacity()) throw new VirtuosoException("Index " + parameterIndex + " is not 1 parameters.capacity()) throw new VirtuosoException("Index " + parameterIndex + " is not 1 parameters.capacity()) throw new VirtuosoException("Index " + parameterIndex + " is not 1 parameters.capacity()) throw new VirtuosoException("Index " + parameterIndex + " is not 1 parameters.capacity()) throw new VirtuosoException("Index " + parameterIndex + " is not 1 parameters.capacity()) throw new VirtuosoException("Index " + parameterIndex + " is not 1 rows.size())) ((VirtuosoRow)(rows.elementAt(currentRow - 1))).getContent(row); } - row[columnIndex - 1] = new Boolean(x); + row[columnIndex - 1] = Boolean.valueOf(x); } /** @@ -2733,7 +2733,7 @@ public void updateByte(int columnIndex, byte x) throws VirtuosoException if(!(currentRow < 1 || currentRow > rows.size())) ((VirtuosoRow)(rows.elementAt(currentRow - 1))).getContent(row); } - row[columnIndex - 1] = new Byte(x); + row[columnIndex - 1] = Byte.valueOf(x); } /** @@ -2759,7 +2759,7 @@ public void updateShort(int columnIndex, short x) throws VirtuosoException if(!(currentRow < 1 || currentRow > rows.size())) ((VirtuosoRow)(rows.elementAt(currentRow - 1))).getContent(row); } - row[columnIndex - 1] = new Short(x); + row[columnIndex - 1] = Short.valueOf(x); } /** @@ -2785,7 +2785,7 @@ public void updateInt(int columnIndex, int x) throws VirtuosoException if(!(currentRow < 1 || currentRow > rows.size())) ((VirtuosoRow)(rows.elementAt(currentRow - 1))).getContent(row); } - row[columnIndex - 1] = new Integer(x); + row[columnIndex - 1] = Integer.valueOf(x); } /** @@ -2811,7 +2811,7 @@ public void updateLong(int columnIndex, long x) throws VirtuosoException if(!(currentRow < 1 || currentRow > rows.size())) ((VirtuosoRow)(rows.elementAt(currentRow - 1))).getContent(row); } - row[columnIndex - 1] = new Long(x); + row[columnIndex - 1] = Long.valueOf(x); } /** @@ -2837,7 +2837,7 @@ public void updateFloat(int columnIndex, float x) throws VirtuosoException if(!(currentRow < 1 || currentRow > rows.size())) ((VirtuosoRow)(rows.elementAt(currentRow - 1))).getContent(row); } - row[columnIndex - 1] = new Float(x); + row[columnIndex - 1] = Float.valueOf(x); } /** @@ -2863,7 +2863,7 @@ public void updateDouble(int columnIndex, double x) throws VirtuosoException if(!(currentRow < 1 || currentRow > rows.size())) ((VirtuosoRow)(rows.elementAt(currentRow - 1))).getContent(row); } - row[columnIndex - 1] = new Double(x); + row[columnIndex - 1] = Double.valueOf(x); } /** diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoResultSetMetaData.java b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoResultSetMetaData.java index c03a59db78..1816e03525 100644 --- a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoResultSetMetaData.java +++ b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoResultSetMetaData.java @@ -62,7 +62,7 @@ protected VirtuosoResultSetMetaData (VirtuosoConnection conn, String [] columns, { // Create the new column VirtuosoColumn col = new VirtuosoColumn(columns[i], dtps[i], conn); - hcolumns.put(col,new Integer(i)); + hcolumns.put(col,Integer.valueOf(i)); columnsMetaData.insertElementAt(col,i); } } @@ -87,7 +87,7 @@ protected VirtuosoResultSetMetaData (VirtuosoConnection conn, String [] columns, VirtuosoColumn col = new VirtuosoColumn((openlink.util.Vector)((openlink.util.Vector)vect).elementAt(i), conn); - hcolumns.put(col,new Integer(i)); + hcolumns.put(col,Integer.valueOf(i)); columnsMetaData.insertElementAt(col,i); } } diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoStatement.java b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoStatement.java index 51dcdc9944..9103789cea 100644 --- a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoStatement.java +++ b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoStatement.java @@ -154,56 +154,56 @@ public class VirtuosoStatement implements Statement protected VectorOfLong getStmtOpts () throws VirtuosoException { // Set the concurrency type - Long[] arrLong = new Long[11]; + Long[] arrLong = new Long [11]; if (connection.isReadOnly ()) { - arrLong[0] = new Long (VirtuosoTypes.SQL_CONCUR_ROWVER); + arrLong[0] = Long.valueOf (VirtuosoTypes.SQL_CONCUR_ROWVER); } else { if (concurrency == VirtuosoResultSet.CONCUR_VALUES) - arrLong[0] = new Long(VirtuosoTypes.SQL_CONCUR_VALUES); + arrLong[0] = Long.valueOf(VirtuosoTypes.SQL_CONCUR_VALUES); else - arrLong[0] = new Long(concurrency == VirtuosoResultSet.CONCUR_READ_ONLY ? + arrLong[0] = Long.valueOf(concurrency == VirtuosoResultSet.CONCUR_READ_ONLY ? VirtuosoTypes.SQL_CONCUR_READ_ONLY : VirtuosoTypes.SQL_CONCUR_LOCK); } - arrLong[1] = new Long(0); - arrLong[2] = new Long(maxRows); + arrLong[1] = Long.valueOf(0); + arrLong[2] = Long.valueOf(maxRows); if (connection.getGlobalTransaction()) { VirtuosoXAConnection xac = (VirtuosoXAConnection) connection.xa_connection; if (VirtuosoFuture.rpc_log != null) { VirtuosoFuture.rpc_log.println ("VirtuosoStatement.getStmtOpts () xa_res=" + xac.getVirtuosoXAResource().hashCode() + " :" + hashCode()); } - arrLong[3] = new Long(xac.getVirtuosoXAResource().txn_timeout * 1000); + arrLong[3] = Long.valueOf(xac.getVirtuosoXAResource().txn_timeout * 1000); } else { - arrLong[3] = new Long(txn_timeout * 1000); + arrLong[3] = Long.valueOf(txn_timeout * 1000); } if (VirtuosoFuture.rpc_log != null) { VirtuosoFuture.rpc_log.println ("VirtuosoStatement.getStmtOpts (txn_timeout=" + arrLong[3] + ") (con=" + connection.hashCode() + ") :" + hashCode()); } - arrLong[4] = new Long(prefetch); + arrLong[4] = Long.valueOf(prefetch); // Set the autocommit - arrLong[5] = new Long((connection.getAutoCommit()) ? 1 : 0); - arrLong[6] = new Long (rpc_timeout); + arrLong[5] = Long.valueOf((connection.getAutoCommit()) ? 1 : 0); + arrLong[6] = Long.valueOf (rpc_timeout); // Set the cursor type switch(type) { case VirtuosoResultSet.TYPE_FORWARD_ONLY: - arrLong[7] = new Long(VirtuosoTypes.SQL_CURSOR_FORWARD_ONLY); + arrLong[7] = Long.valueOf(VirtuosoTypes.SQL_CURSOR_FORWARD_ONLY); break; case VirtuosoResultSet.TYPE_SCROLL_SENSITIVE: - arrLong[7] = new Long(VirtuosoTypes.SQL_CURSOR_DYNAMIC); + arrLong[7] = Long.valueOf(VirtuosoTypes.SQL_CURSOR_DYNAMIC); break; case VirtuosoResultSet.TYPE_SCROLL_INSENSITIVE: - arrLong[7] = new Long(VirtuosoTypes.SQL_CURSOR_STATIC); + arrLong[7] = Long.valueOf(VirtuosoTypes.SQL_CURSOR_STATIC); break; } ; // Set keyset size and bookmark - arrLong[8] = new Long(0); - arrLong[9] = new Long(1); + arrLong[8] = Long.valueOf(0); + arrLong[9] = Long.valueOf(1); // Set the isolation mode - arrLong[10] = new Long(connection.getTransactionIsolation()); + arrLong[10] = Long.valueOf(connection.getTransactionIsolation()); // Put the options array in the args array return new VectorOfLong(arrLong); } @@ -336,7 +336,7 @@ public void close_rs(boolean close_stmt, boolean is_prepared) throws VirtuosoExc // Build the args array Object[] args = new Object[2]; args[0] = statid; - args[1] = close_stmt ? new Long(VirtuosoTypes.STAT_DROP): new Long(VirtuosoTypes.STAT_CLOSE); + args[1] = close_stmt ? Long.valueOf(VirtuosoTypes.STAT_DROP): Long.valueOf(VirtuosoTypes.STAT_CLOSE); // Create and get a future for this future = connection.getFuture(VirtuosoFuture.close,args, this.rpc_timeout); // Read the answer @@ -510,7 +510,7 @@ public boolean getMoreResults() throws VirtuosoException // Send the fetch query Object[] args = new Object[2]; args[0] = statid; - args[1] = new Long(future.hashCode()); + args[1] = Long.valueOf(future.hashCode()); future.send_message(VirtuosoFuture.fetch,args); // ReArm the process vresultSet.getMoreResults(false); diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoTypes.java b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoTypes.java index e3c8a477ec..0c88a861b0 100644 --- a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoTypes.java +++ b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoTypes.java @@ -448,7 +448,7 @@ protected static Object mapJavaTypeToSqlType (Object x, int targetSqlType, int s if (x == null) return x; if (x instanceof java.lang.Boolean) - x = new Integer (((Boolean)x).booleanValue() ? 1 : 0); + x = Integer.valueOf (((Boolean)x).booleanValue() ? 1 : 0); switch (targetSqlType) { @@ -550,9 +550,9 @@ else if (x instanceof java.lang.Number) case Types.BIGINT: if (x instanceof java.math.BigDecimal || x instanceof java.lang.String) - return new Long(x.toString()); + return Long.parseLong(x.toString()); else if (x instanceof java.lang.Number) - return new Long(((Number)x).longValue()); + return Long.valueOf(((Number)x).longValue()); break; case Types.FLOAT: @@ -560,26 +560,26 @@ else if (x instanceof java.lang.Number) if (x instanceof java.lang.Double) return x; else if (x instanceof java.lang.Number) - return new Double (((Number)x).doubleValue()); + return Double.valueOf (((Number)x).doubleValue()); else if (x instanceof java.lang.String) - return new Double ((String) x); + return Double.parseDouble((String) x); break; case Types.INTEGER: if (x instanceof java.lang.Integer) return x; else if (x instanceof java.lang.Number) - return new Integer (((Number)x).intValue()); + return Integer.valueOf (((Number)x).intValue()); else if (x instanceof java.lang.String) - return new Integer ((String) x); + return Integer.valueOf ((String) x); break; case Types.REAL: if (x instanceof java.lang.Float) return x; else if (x instanceof java.lang.Number) - return new Float (((Number)x).floatValue()); + return Float.valueOf(((Number)x).floatValue()); else if (x instanceof java.lang.String) - return new Float ((String) x); + return Float.parseFloat((String) x); break; case Types.SMALLINT: @@ -589,9 +589,9 @@ else if (x instanceof java.lang.String) if (x instanceof java.lang.Short) return x; else if (x instanceof java.lang.String) - return new Short ((String) x); + return Short.parseShort((String) x); else if (x instanceof java.lang.Number) - return new Short (((Number)x).shortValue()); + return Short.valueOf (((Number)x).shortValue()); break; case Types.ARRAY: diff --git a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoXAResource.java b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoXAResource.java index 110b5eedf4..a35e04b37d 100644 --- a/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoXAResource.java +++ b/libsrc/JDBCDriverType4/virtuoso/jdbc/VirtuosoXAResource.java @@ -382,7 +382,7 @@ private void transact(XATransaction ctx, int action) throws XAException { private void rpc(VirtuosoConnection connection, int action, Object encodedXid) throws XAException { Object[] args = new Object[2]; - args[0] = new Integer(action); + args[0] = Integer.valueOf(action); args[1] = encodedXid; try {