Displaying differences for changeset
 
display as  

src/csip/sdm/SDMDatabaseMetaData.java

@@ -1,7 +1,13 @@
 /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
+ * $Id$
+ *
+ * This file is part of the Cloud Services Integration Platform (CSIP),
+ * a Model-as-a-Service framework, API, and application suite.
+ *
+ * 2012-2017, OMSLab, Colorado State University.
+ *
+ * OMSLab licenses this file to you under the MIT license.
+ * See the LICENSE file in the project root for more information.
  */
 package csip.sdm;
 
@@ -17,12 +23,12 @@
  */
 public class SDMDatabaseMetaData implements DatabaseMetaData {
 
-    private String driveName = "org.csu.csip.sdm.SDMDriver";
+    private String driverName = "csip.sdm.SDMDriver";
     private String productName = "Microsoft SQL: REST data service client for USDA SDM database";
     private Connection connection;
 
 
-    public SDMDatabaseMetaData(Connection conn) {
+    SDMDatabaseMetaData(Connection conn) {
         connection = conn;
     }
 
@@ -125,7 +131,7 @@
 
     @Override
     public Connection getConnection() throws SQLException {
-        return this.connection;
+        return connection;
     }
 
 
@@ -149,7 +155,7 @@
 
     @Override
     public String getDatabaseProductName() throws SQLException {
-        return this.productName;
+        return productName;
     }
 
 
@@ -179,7 +185,7 @@
 
     @Override
     public String getDriverName() throws SQLException {
-        throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+        return driverName;
     }
 
 

src/csip/sdm/SDMResultSet.java

@@ -546,11 +546,11 @@
     @Override
     public String getString(int column) throws SQLException {
         try {
-            JSONArray r = mainTable.getJSONArray(row + 1);
-            if (cols != r.length()) {
-                throw new SQLException("Invalid # columns : '" + r.length() + "' in row: " + row);
-            }
             if (column >= 0 && column < cols) {
+                JSONArray r = mainTable.getJSONArray(row + 1);
+                if (cols != r.length()) {
+                    throw new SQLException("Invalid # columns : '" + r.length() + "' in row: " + row);
+                }
                 String rv = r.getString(column);
                 if ("null".equalsIgnoreCase(rv)) {
                     lastReadNull = true;