Merge
authoralanb
Sat, 02 Oct 2010 12:59:52 +0100
changeset 6694 342ae2e24cf0
parent 6693 f897a08d4dae (current diff)
parent 6692 aef4e294026f (diff)
child 6695 0e91810597f9
Merge
--- a/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java	Sat Oct 02 12:59:04 2010 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/CachedRowSetImpl.java	Sat Oct 02 12:59:52 2010 +0100
@@ -4042,7 +4042,7 @@
                 case java.sql.Types.CHAR:
                 case java.sql.Types.VARCHAR:
                 case java.sql.Types.LONGVARCHAR:
-                    return new String(srcObj.toString());
+                    return srcObj.toString();
                 default:
                     throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString()+ trgType);
             }
@@ -4139,7 +4139,7 @@
                 case java.sql.Types.CHAR:
                 case java.sql.Types.VARCHAR:
                 case java.sql.Types.LONGVARCHAR:
-                    return new String(srcObj.toString());
+                    return srcObj.toString();
                 default:
                     throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.dtypemismt").toString());
             }
@@ -6434,7 +6434,7 @@
         if (tabName == null)
             throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.tablename").toString());
         else
-            tableName = new String(tabName);
+            tableName = tabName;
     }
 
     /**
--- a/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java	Sat Oct 02 12:59:04 2010 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/FilteredRowSetImpl.java	Sat Oct 02 12:59:52 2010 +0100
@@ -1106,7 +1106,7 @@
    public void updateBytes(int columnIndex , byte []x) throws SQLException {
 
       boolean bool;
-      String val = new String();
+      String val = "";
 
       Byte [] obj_arr = new Byte[x.length];
 
--- a/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java	Sat Oct 02 12:59:04 2010 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/JoinRowSetImpl.java	Sat Oct 02 12:59:52 2010 +0100
@@ -876,8 +876,8 @@
 
        String strWhereClause = "Select ";
        String whereClause;
-       String tabName= null;
-       String strTabName = null;
+       String tabName= "";
+       String strTabName = "";
        int sz,cols;
        int j;
        CachedRowSetImpl crs;
@@ -891,8 +891,6 @@
        // tableNameX.(rowsetX.getMatchColumnName()) ==
        // tableNameZ.(rowsetZ.getMatchColumnName()));
 
-       tabName = new String();
-       strTabName  = new String();
        sz = vecRowSetsInJOIN.size();
        for(int i=0;i<sz; i++) {
           crs = (CachedRowSetImpl)vecRowSetsInJOIN.get(i);
--- a/jdk/src/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java	Sat Oct 02 12:59:04 2010 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/internal/CachedRowSetWriter.java	Sat Oct 02 12:59:52 2010 +0100
@@ -541,7 +541,7 @@
                 // how many fields need to be updated
                 int colsNotChanged = 0;
                 Vector cols = new Vector();
-                String updateExec = new String(updateCmd);
+                String updateExec = updateCmd;
                 Object orig;
                 Object curr;
                 Object rsval;
@@ -1184,7 +1184,7 @@
        // trim all the leading and trailing whitespaces,
        // white spaces can never be catalog, schema or a table name.
 
-        String cmd = new String();
+        String cmd = "";
 
         catalog = catalog.trim();
         schema = schema.trim();
--- a/jdk/src/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java	Sat Oct 02 12:59:04 2010 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java	Sat Oct 02 12:59:52 2010 +0100
@@ -641,7 +641,7 @@
             return null;
         }
         char []charStr = s.toCharArray();
-        String specialStr = new String();
+        String specialStr = "";
 
         for(int i = 0; i < charStr.length; i++) {
             if(charStr[i] == '&') {
--- a/jdk/src/share/classes/com/sun/rowset/internal/XmlReaderContentHandler.java	Sat Oct 02 12:59:04 2010 +0100
+++ b/jdk/src/share/classes/com/sun/rowset/internal/XmlReaderContentHandler.java	Sat Oct 02 12:59:52 2010 +0100
@@ -441,9 +441,9 @@
         updates = new Vector();
 
         // start out with the empty string
-        columnValue = new String("");
-        propertyValue = new String("");
-        metaDataValue = new String("");
+        columnValue = "";
+        propertyValue = "";
+        metaDataValue = "";
 
         nullVal = false;
         idx = 0;
@@ -686,7 +686,7 @@
             }
 
             // propertyValue need to be reset to an empty string
-            propertyValue = new String("");
+            propertyValue = "";
             setTag(-1);
             break;
         case METADATA:
@@ -710,7 +710,7 @@
 
                 }
                 // metaDataValue needs to be reset to an empty string
-                metaDataValue = new String("");
+                metaDataValue = "";
             }
             setTag(-1);
             break;
@@ -736,7 +736,7 @@
                         insertValue(tempStr);
                     }
                     // columnValue now need to be reset to the empty string
-                    columnValue = new String("");
+                    columnValue = "";
                 } catch (SQLException ex) {
                     throw new SAXException(MessageFormat.format(resBundle.handleGetObject("xmlrch.errinsert").toString(), ex.getMessage()));
                 }
--- a/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java	Sat Oct 02 12:59:04 2010 +0100
+++ b/jdk/src/share/classes/javax/sql/rowset/BaseRowSet.java	Sat Oct 02 12:59:52 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -734,7 +734,7 @@
                  throw new SQLException("Set initParams() before setCommand");
             }
             params.clear();
-            command = new String(cmd);
+            command = cmd;
         }
 
     }
@@ -797,7 +797,7 @@
             throw new SQLException("Invalid url string detected. " +
             "Cannot be of length less than 1");
         } else {
-            URL = new String(url);
+            URL = url;
         }
 
         dataSource = null;
@@ -854,7 +854,7 @@
         } else if (name.equals("")) {
            throw new SQLException("DataSource name cannot be empty string");
         } else {
-           dataSource = new String(name);
+           dataSource = name;
         }
 
         URL = null;
@@ -889,7 +889,7 @@
         {
            username = null;
         } else {
-           username = new String(name);
+           username = name;
         }
     }
 
@@ -924,7 +924,7 @@
         {
            password = null;
         } else {
-           password = new String(pass);
+           password = pass;
         }
     }
 
@@ -1645,7 +1645,7 @@
         nullVal = new Object[3];
         nullVal[0] = null;
         nullVal[1] = new Integer(sqlType);
-        nullVal[2] = new String(typeName);
+        nullVal[2] = typeName;
 
        if(params == null){
             throw new SQLException("Set initParams() before setNull");
--- a/jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java	Sat Oct 02 12:59:04 2010 +0100
+++ b/jdk/src/share/classes/javax/sql/rowset/RowSetMetaDataImpl.java	Sat Oct 02 12:59:52 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -306,9 +306,9 @@
     public void setColumnLabel(int columnIndex, String label) throws SQLException {
         checkColRange(columnIndex);
         if (label != null) {
-            colInfo[columnIndex].columnLabel = new String(label);
+            colInfo[columnIndex].columnLabel = label;
         } else {
-            colInfo[columnIndex].columnLabel = new String("");
+            colInfo[columnIndex].columnLabel = "";
         }
     }
 
@@ -326,9 +326,9 @@
     public void setColumnName(int columnIndex, String columnName) throws SQLException {
         checkColRange(columnIndex);
         if (columnName != null) {
-            colInfo[columnIndex].columnName = new String(columnName);
+            colInfo[columnIndex].columnName = columnName;
         } else {
-            colInfo[columnIndex].columnName = new String("");
+            colInfo[columnIndex].columnName = "";
         }
     }
 
@@ -348,9 +348,9 @@
     public void setSchemaName(int columnIndex, String schemaName) throws SQLException {
         checkColRange(columnIndex);
         if (schemaName != null ) {
-            colInfo[columnIndex].schemaName = new String(schemaName);
+            colInfo[columnIndex].schemaName = schemaName;
         } else {
-            colInfo[columnIndex].schemaName = new String("");
+            colInfo[columnIndex].schemaName = "";
         }
     }
 
@@ -411,9 +411,9 @@
     public void setTableName(int columnIndex, String tableName) throws SQLException {
         checkColRange(columnIndex);
         if (tableName != null) {
-            colInfo[columnIndex].tableName = new String(tableName);
+            colInfo[columnIndex].tableName = tableName;
         } else {
-            colInfo[columnIndex].tableName = new String("");
+            colInfo[columnIndex].tableName = "";
         }
     }
 
@@ -432,9 +432,9 @@
     public void setCatalogName(int columnIndex, String catalogName) throws SQLException {
         checkColRange(columnIndex);
         if (catalogName != null)
-            colInfo[columnIndex].catName = new String(catalogName);
+            colInfo[columnIndex].catName = catalogName;
         else
-            colInfo[columnIndex].catName = new String("");
+            colInfo[columnIndex].catName = "";
     }
 
     /**
@@ -474,9 +474,9 @@
         throws SQLException {
         checkColRange(columnIndex);
         if (typeName != null) {
-            colInfo[columnIndex].colTypeName = new String(typeName);
+            colInfo[columnIndex].colTypeName = typeName;
         } else {
-            colInfo[columnIndex].colTypeName = new String("");
+            colInfo[columnIndex].colTypeName = "";
         }
     }
 
@@ -827,7 +827,7 @@
      *         or the given column number is out of bounds
      */
     public String getColumnClassName(int columnIndex) throws SQLException {
-        String className = (new String()).getClass().getName();
+        String className = String.class.getName();
 
         int sqlType = getColumnType(columnIndex);
 
@@ -835,65 +835,62 @@
 
         case Types.NUMERIC:
         case Types.DECIMAL:
-            className = (new java.math.BigDecimal(0)).getClass().getName ();
+            className = java.math.BigDecimal.class.getName();
             break;
 
         case Types.BIT:
-            className = (new Boolean(false)).getClass().getName ();
+            className = java.lang.Boolean.class.getName();
             break;
 
         case Types.TINYINT:
-            className = (new Byte("0")).getClass().getName ();
+            className = java.lang.Byte.class.getName();
             break;
 
         case Types.SMALLINT:
-            className = (new Short("0")).getClass().getName ();
+            className = java.lang.Short.class.getName();
             break;
 
         case Types.INTEGER:
-            className = (new Integer(0)).getClass().getName ();
+            className = java.lang.Integer.class.getName();
             break;
 
         case Types.BIGINT:
-            className = (new Long(0)).getClass().getName ();
+            className = java.lang.Long.class.getName();
             break;
 
         case Types.REAL:
-            className = (new Float(0)).getClass().getName ();
+            className = java.lang.Float.class.getName();
             break;
 
         case Types.FLOAT:
         case Types.DOUBLE:
-            className = (new Double(0)).getClass().getName();
+            className = java.lang.Double.class.getName();
             break;
 
         case Types.BINARY:
         case Types.VARBINARY:
         case Types.LONGVARBINARY:
-            byte[] b = {};
-            className = (b.getClass()).getName();
+            className = "byte[]";
             break;
 
         case Types.DATE:
-            className = (new java.sql.Date(123456)).getClass().getName ();
+            className = java.sql.Date.class.getName();
             break;
 
         case Types.TIME:
-            className = (new java.sql.Time(123456)).getClass().getName ();
+            className = java.sql.Time.class.getName();
             break;
 
         case Types.TIMESTAMP:
-            className = (new java.sql.Timestamp(123456)).getClass().getName ();
+            className = java.sql.Timestamp.class.getName();
             break;
 
         case Types.BLOB:
-            byte[] blob = {};
-            className = (blob.getClass()).getName();
+            className = java.sql.Blob.class.getName();
             break;
 
         case Types.CLOB:
-            char[] c = {};
-            className = (c.getClass()).getName();
+            className = java.sql.Clob.class.getName();
             break;
         }
 
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialRef.java	Sat Oct 02 12:59:04 2010 +0100
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialRef.java	Sat Oct 02 12:59:52 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -77,7 +77,7 @@
             throw new SQLException("Cannot instantiate a SerialRef object " +
                 "that returns a null base type name");
         } else {
-            baseTypeName = new String(ref.getBaseTypeName());
+            baseTypeName = ref.getBaseTypeName();
         }
     }
 
--- a/jdk/src/share/classes/javax/sql/rowset/serial/SerialStruct.java	Sat Oct 02 12:59:04 2010 +0100
+++ b/jdk/src/share/classes/javax/sql/rowset/serial/SerialStruct.java	Sat Oct 02 12:59:52 2010 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -94,7 +94,7 @@
         try {
 
         // get the type name
-        SQLTypeName = new String(in.getSQLTypeName());
+        SQLTypeName = in.getSQLTypeName();
         System.out.println("SQLTypeName: " + SQLTypeName);
 
         // get the attributes of the struct
@@ -137,7 +137,7 @@
         try {
 
         //set the type name
-        SQLTypeName = new String(in.getSQLTypeName());
+        SQLTypeName = in.getSQLTypeName();
 
         Vector tmp = new Vector();
         in.writeSQL(new SQLOutputImpl(tmp, map));
@@ -247,7 +247,7 @@
     }
 
     /**
-         * The identifier that assists in the serialization of this
+     * The identifier that assists in the serialization of this
      * <code>SerialStruct</code> object.
      */
     static final long serialVersionUID = -8322445504027483372L;