harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hinde...@apache.org
Subject svn commit: r561748 [2/2] - in /harmony/enhanced/classlib/trunk: depends/build/platform/ modules/awt/src/main/java/unix/org/apache/harmony/awt/gl/linux/ modules/awt/src/main/java/unix/org/apache/harmony/awt/nativebridge/linux/ modules/awt/src/main/java...
Date Wed, 01 Aug 2007 10:02:01 GMT
Modified: harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java?view=diff&rev=561748&r1=561747&r2=561748
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java (original)
+++ harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java Wed Aug  1 03:01:54 2007
@@ -1,243 +1,243 @@
-/* 
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- * 
- *     http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.harmony.security.tests.java.security;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.security.Key;
-import java.security.KeyPair;
-import java.security.KeyPairGenerator;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.KeyStoreSpi;
-import java.security.NoSuchAlgorithmException;
-import java.security.Provider;
-import java.security.UnrecoverableKeyException;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactory;
-import java.util.Date;
-import java.util.Enumeration;
-
-import junit.framework.TestCase;
-
-public class KeyStore3Test extends TestCase {
-    
-    private KeyStore mockKeyStore;
-    
-    private KeyPair keyPair;
-    
-    private Certificate certificate;
-    
-    public KeyStore3Test() throws Exception {
-        KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("DSA");
-        keyPair = keyPairGenerator.generateKeyPair();
-
-        String certificateData = "-----BEGIN CERTIFICATE-----\n"
-                + "MIICZTCCAdICBQL3AAC2MA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMSAw\n"
-                + "HgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjEuMCwGA1UECxMlU2VjdXJl\n"
-                + "IFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NzAyMjAwMDAwMDBa\n"
-                + "Fw05ODAyMjAyMzU5NTlaMIGWMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZv\n"
-                + "cm5pYTESMBAGA1UEBxMJUGFsbyBBbHRvMR8wHQYDVQQKExZTdW4gTWljcm9zeXN0\n"
-                + "ZW1zLCBJbmMuMSEwHwYDVQQLExhUZXN0IGFuZCBFdmFsdWF0aW9uIE9ubHkxGjAY\n"
-                + "BgNVBAMTEWFyZ29uLmVuZy5zdW4uY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB\n"
-                + "iQKBgQCofmdY+PiUWN01FOzEewf+GaG+lFf132UpzATmYJkA4AEA/juW7jSi+LJk\n"
-                + "wJKi5GO4RyZoyimAL/5yIWDV6l1KlvxyKslr0REhMBaD/3Z3EsLTTEf5gVrQS6sT\n"
-                + "WMoSZAyzB39kFfsB6oUXNtV8+UKKxSxKbxvhQn267PeCz5VX2QIDAQABMA0GCSqG\n"
-                + "SIb3DQEBAgUAA34AXl3at6luiV/7I9MN5CXYoPJYI8Bcdc1hBagJvTMcmlqL2uOZ\n"
-                + "H9T5hNMEL9Tk6aI7yZPXcw/xI2K6pOR/FrMp0UwJmdxX7ljV6ZtUZf7pY492UqwC\n"
-                + "1777XQ9UEZyrKJvF5ntleeO0ayBqLGVKCWzWZX9YsXCpv47FNLZbupE=\n"
-                + "-----END CERTIFICATE-----\n";
-
-        ByteArrayInputStream certArray = new ByteArrayInputStream(
-                certificateData.getBytes());
-        CertificateFactory cf = CertificateFactory.getInstance("X.509");
-        certificate = cf.generateCertificate(certArray);
-    }
-    
-    public void test_load() throws Exception {
-        // No exception should be thrown out.
-        mockKeyStore.load(null);
-    }
-
-    public void test_store() throws Exception {
-        try {
-            mockKeyStore.store(null);
-            fail("should throw KeyStoreException: not initialized");
-        } catch (KeyStoreException e) {
-            // expected
-        }
-        
-        // No exception should be thrown out.
-        mockKeyStore.load(null, null);
-        mockKeyStore.store(null);
-    }
-
-    public void test_setKeyEntry_null() throws Exception {
-        mockKeyStore.load(null, null); 
-        // No exception should be thrown out.
-        mockKeyStore.setKeyEntry(null, null, null, null);        
-    }
-    
-    public void test_setKeyEntry_key_is_null() throws Exception {
-        mockKeyStore.load(null, null);
-        // No exception should be thrown out.
-        mockKeyStore.setKeyEntry("Alias", null, null, new Certificate[]{certificate});        
-    }
-    
-    public void test_setKeyEntry_key_is_private() throws Exception {
-        mockKeyStore.load(null, null);
-        Key key = keyPair.getPrivate();
-        try {
-            mockKeyStore.setKeyEntry("Alias", key, null, null);
-            fail("should throw IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
-            // expected
-        }
-        
-        try {
-            mockKeyStore.setKeyEntry("Alias", key, null,
-                    new Certificate[0]);
-            fail("should throw IllegalArgumentException");
-        } catch (IllegalArgumentException e) {
-            // expected
-        }
-        
-        mockKeyStore.setKeyEntry("Alias", key, null, new Certificate[]{certificate});        
-    }
-    
-    public void test_setKeyEntry_key_is_public() throws Exception
-    {
-        mockKeyStore.load(null, null);
-        Key key = keyPair.getPublic();
-        mockKeyStore.setKeyEntry("Alias1", key, null, null);
-        mockKeyStore.setKeyEntry("Alias2", key, null,
-                new Certificate[0]);
-        mockKeyStore.setKeyEntry("Alias3", key, null, new Certificate[]{certificate});
-    }
-    
-    public void test_setCertificateEntry_null() throws Exception {
-        mockKeyStore.load(null, null);
-
-        mockKeyStore.setCertificateEntry(null, null);
-
-        mockKeyStore.setCertificateEntry(null, certificate);
-
-        mockKeyStore.setCertificateEntry("Alias", null);
-    }
-    
-    public void test_store_null() throws Exception {
-        mockKeyStore.load(null, null);
-        mockKeyStore.store(null, null);
-    }
-    
-    protected void setUp() throws Exception {
-        super.setUp();
-        mockKeyStore = new MyKeyStore(new MyKeyStoreSpi(), null, "MyKeyStore");
-    }
-    
-    private static class MyKeyStore extends KeyStore {
-
-        public MyKeyStore(KeyStoreSpi keyStoreSpi, Provider provider,
-                String type) {
-            super(keyStoreSpi, provider, type);
-        }
-    }
-
-    private static class MyKeyStoreSpi extends KeyStoreSpi {
-
-        public Enumeration<String> engineAliases() {
-            return null;
-        }
-
-        public boolean engineContainsAlias(String arg0) {
-            return false;
-        }
-
-        public void engineDeleteEntry(String arg0) throws KeyStoreException {
-        }
-
-        public Certificate engineGetCertificate(String arg0) {
-            return null;
-        }
-
-        public String engineGetCertificateAlias(Certificate arg0) {
-            return null;
-        }
-
-        public Certificate[] engineGetCertificateChain(String arg0) {
-            return null;
-        }
-
-        public Date engineGetCreationDate(String arg0) {
-            return null;
-        }
-
-        public Key engineGetKey(String arg0, char[] arg1)
-                throws NoSuchAlgorithmException, UnrecoverableKeyException {
-            return null;
-        }
-
-        public boolean engineIsCertificateEntry(String arg0) {
-            return false;
-        }
-
-        public boolean engineIsKeyEntry(String arg0) {
-            return false;
-        }
-
-        public void engineLoad(InputStream arg0, char[] arg1)
-                throws IOException, NoSuchAlgorithmException,
-                CertificateException {
-            return;
-        }
-
-        public void engineSetCertificateEntry(String arg0, Certificate arg1)
-                throws KeyStoreException {
-            return;
-        }
-
-        public void engineSetKeyEntry(String arg0, byte[] arg1,
-                Certificate[] arg2) throws KeyStoreException {
-            return;
-        }
-
-        public void engineSetKeyEntry(String arg0, Key arg1, char[] arg2,
-                Certificate[] arg3) throws KeyStoreException {
-            return;
-        }
-
-        public int engineSize() {
-            return 0;
-        }
-
-        public void engineStore(KeyStore.LoadStoreParameter param){
-            return;
-        }
-
-        public void engineStore(OutputStream arg0, char[] arg1)
-                throws IOException, NoSuchAlgorithmException,
-                CertificateException {
-            return;
-        }        
-    }    
-
-}
-
+/* 
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.harmony.security.tests.java.security;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.security.Key;
+import java.security.KeyPair;
+import java.security.KeyPairGenerator;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.KeyStoreSpi;
+import java.security.NoSuchAlgorithmException;
+import java.security.Provider;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.util.Date;
+import java.util.Enumeration;
+
+import junit.framework.TestCase;
+
+public class KeyStore3Test extends TestCase {
+    
+    private KeyStore mockKeyStore;
+    
+    private KeyPair keyPair;
+    
+    private Certificate certificate;
+    
+    public KeyStore3Test() throws Exception {
+        KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("DSA");
+        keyPair = keyPairGenerator.generateKeyPair();
+
+        String certificateData = "-----BEGIN CERTIFICATE-----\n"
+                + "MIICZTCCAdICBQL3AAC2MA0GCSqGSIb3DQEBAgUAMF8xCzAJBgNVBAYTAlVTMSAw\n"
+                + "HgYDVQQKExdSU0EgRGF0YSBTZWN1cml0eSwgSW5jLjEuMCwGA1UECxMlU2VjdXJl\n"
+                + "IFNlcnZlciBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw05NzAyMjAwMDAwMDBa\n"
+                + "Fw05ODAyMjAyMzU5NTlaMIGWMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZv\n"
+                + "cm5pYTESMBAGA1UEBxMJUGFsbyBBbHRvMR8wHQYDVQQKExZTdW4gTWljcm9zeXN0\n"
+                + "ZW1zLCBJbmMuMSEwHwYDVQQLExhUZXN0IGFuZCBFdmFsdWF0aW9uIE9ubHkxGjAY\n"
+                + "BgNVBAMTEWFyZ29uLmVuZy5zdW4uY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCB\n"
+                + "iQKBgQCofmdY+PiUWN01FOzEewf+GaG+lFf132UpzATmYJkA4AEA/juW7jSi+LJk\n"
+                + "wJKi5GO4RyZoyimAL/5yIWDV6l1KlvxyKslr0REhMBaD/3Z3EsLTTEf5gVrQS6sT\n"
+                + "WMoSZAyzB39kFfsB6oUXNtV8+UKKxSxKbxvhQn267PeCz5VX2QIDAQABMA0GCSqG\n"
+                + "SIb3DQEBAgUAA34AXl3at6luiV/7I9MN5CXYoPJYI8Bcdc1hBagJvTMcmlqL2uOZ\n"
+                + "H9T5hNMEL9Tk6aI7yZPXcw/xI2K6pOR/FrMp0UwJmdxX7ljV6ZtUZf7pY492UqwC\n"
+                + "1777XQ9UEZyrKJvF5ntleeO0ayBqLGVKCWzWZX9YsXCpv47FNLZbupE=\n"
+                + "-----END CERTIFICATE-----\n";
+
+        ByteArrayInputStream certArray = new ByteArrayInputStream(
+                certificateData.getBytes());
+        CertificateFactory cf = CertificateFactory.getInstance("X.509");
+        certificate = cf.generateCertificate(certArray);
+    }
+    
+    public void test_load() throws Exception {
+        // No exception should be thrown out.
+        mockKeyStore.load(null);
+    }
+
+    public void test_store() throws Exception {
+        try {
+            mockKeyStore.store(null);
+            fail("should throw KeyStoreException: not initialized");
+        } catch (KeyStoreException e) {
+            // expected
+        }
+        
+        // No exception should be thrown out.
+        mockKeyStore.load(null, null);
+        mockKeyStore.store(null);
+    }
+
+    public void test_setKeyEntry_null() throws Exception {
+        mockKeyStore.load(null, null); 
+        // No exception should be thrown out.
+        mockKeyStore.setKeyEntry(null, null, null, null);        
+    }
+    
+    public void test_setKeyEntry_key_is_null() throws Exception {
+        mockKeyStore.load(null, null);
+        // No exception should be thrown out.
+        mockKeyStore.setKeyEntry("Alias", null, null, new Certificate[]{certificate});        
+    }
+    
+    public void test_setKeyEntry_key_is_private() throws Exception {
+        mockKeyStore.load(null, null);
+        Key key = keyPair.getPrivate();
+        try {
+            mockKeyStore.setKeyEntry("Alias", key, null, null);
+            fail("should throw IllegalArgumentException");
+        } catch (IllegalArgumentException e) {
+            // expected
+        }
+        
+        try {
+            mockKeyStore.setKeyEntry("Alias", key, null,
+                    new Certificate[0]);
+            fail("should throw IllegalArgumentException");
+        } catch (IllegalArgumentException e) {
+            // expected
+        }
+        
+        mockKeyStore.setKeyEntry("Alias", key, null, new Certificate[]{certificate});        
+    }
+    
+    public void test_setKeyEntry_key_is_public() throws Exception
+    {
+        mockKeyStore.load(null, null);
+        Key key = keyPair.getPublic();
+        mockKeyStore.setKeyEntry("Alias1", key, null, null);
+        mockKeyStore.setKeyEntry("Alias2", key, null,
+                new Certificate[0]);
+        mockKeyStore.setKeyEntry("Alias3", key, null, new Certificate[]{certificate});
+    }
+    
+    public void test_setCertificateEntry_null() throws Exception {
+        mockKeyStore.load(null, null);
+
+        mockKeyStore.setCertificateEntry(null, null);
+
+        mockKeyStore.setCertificateEntry(null, certificate);
+
+        mockKeyStore.setCertificateEntry("Alias", null);
+    }
+    
+    public void test_store_null() throws Exception {
+        mockKeyStore.load(null, null);
+        mockKeyStore.store(null, null);
+    }
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+        mockKeyStore = new MyKeyStore(new MyKeyStoreSpi(), null, "MyKeyStore");
+    }
+    
+    private static class MyKeyStore extends KeyStore {
+
+        public MyKeyStore(KeyStoreSpi keyStoreSpi, Provider provider,
+                String type) {
+            super(keyStoreSpi, provider, type);
+        }
+    }
+
+    private static class MyKeyStoreSpi extends KeyStoreSpi {
+
+        public Enumeration<String> engineAliases() {
+            return null;
+        }
+
+        public boolean engineContainsAlias(String arg0) {
+            return false;
+        }
+
+        public void engineDeleteEntry(String arg0) throws KeyStoreException {
+        }
+
+        public Certificate engineGetCertificate(String arg0) {
+            return null;
+        }
+
+        public String engineGetCertificateAlias(Certificate arg0) {
+            return null;
+        }
+
+        public Certificate[] engineGetCertificateChain(String arg0) {
+            return null;
+        }
+
+        public Date engineGetCreationDate(String arg0) {
+            return null;
+        }
+
+        public Key engineGetKey(String arg0, char[] arg1)
+                throws NoSuchAlgorithmException, UnrecoverableKeyException {
+            return null;
+        }
+
+        public boolean engineIsCertificateEntry(String arg0) {
+            return false;
+        }
+
+        public boolean engineIsKeyEntry(String arg0) {
+            return false;
+        }
+
+        public void engineLoad(InputStream arg0, char[] arg1)
+                throws IOException, NoSuchAlgorithmException,
+                CertificateException {
+            return;
+        }
+
+        public void engineSetCertificateEntry(String arg0, Certificate arg1)
+                throws KeyStoreException {
+            return;
+        }
+
+        public void engineSetKeyEntry(String arg0, byte[] arg1,
+                Certificate[] arg2) throws KeyStoreException {
+            return;
+        }
+
+        public void engineSetKeyEntry(String arg0, Key arg1, char[] arg2,
+                Certificate[] arg3) throws KeyStoreException {
+            return;
+        }
+
+        public int engineSize() {
+            return 0;
+        }
+
+        public void engineStore(KeyStore.LoadStoreParameter param){
+            return;
+        }
+
+        public void engineStore(OutputStream arg0, char[] arg1)
+                throws IOException, NoSuchAlgorithmException,
+                CertificateException {
+            return;
+        }        
+    }    
+
+}
+

Propchange: harmony/enhanced/classlib/trunk/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/KeyStore3Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/rowset/RowSetMetaDataImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/rowset/RowSetMetaDataImpl.java?view=diff&rev=561748&r1=561747&r2=561748
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/rowset/RowSetMetaDataImpl.java (original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/rowset/RowSetMetaDataImpl.java Wed Aug  1 03:01:54 2007
@@ -1,536 +1,536 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package javax.sql.rowset;
-
-import java.io.Serializable;
-import java.sql.ResultSetMetaData;
-import java.sql.SQLException;
-
-import javax.sql.RowSetMetaData;
-
-import org.apache.harmony.sql.internal.nls.Messages;
-
-/**
- * This class is a concrete implementation of javax.sql.RowSetMetatData, which
- * provides methods that get and set column information.
- * 
- * A RowSetMetaDataImpl object can be obtained by the getMetaData() method in
- * javax.sql.RowSet.
- * 
- */
-public class RowSetMetaDataImpl implements RowSetMetaData, Serializable {
-
-    private static final String EMPTY_STRING = ""; //$NON-NLS-1$
-
-    private static final int DEFAULT_COLUMN_COUNT = 5;
-
-    private static final long serialVersionUID = 6893806403181801867L;
-
-    private int colCount;
-
-    private ColInfo[] colInfo;
-
-    /**
-     * The default constructor.
-     */
-    public RowSetMetaDataImpl() {
-        // do nothing
-    }
-
-    private void checkNegativeValue(int value, String msg) throws SQLException {
-        if (value < 0) {
-            throw new SQLException(Messages.getString(msg));
-        }
-    }
-
-    private void checkColumnIndex(int columnIndex) throws SQLException {
-        if (null == colInfo || columnIndex < 1 || columnIndex >= colInfo.length) {
-            throw new SQLException(Messages
-                    .getString("sql.27", columnIndex + 1)); //$NON-NLS-1$
-        }
-        // lazy initialization
-        if (null == colInfo[columnIndex]) {
-            colInfo[columnIndex] = new ColInfo();
-        }
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see javax.sql.RowSetMetaData#setColumnCount(int)
-     */
-    public void setColumnCount(int columnCount) throws SQLException {
-        if (columnCount <= 0) {
-            throw new SQLException(Messages.getString("sql.26")); //$NON-NLS-1$
-        }
-        try {
-            if (columnCount + 1 > 0) {
-                colInfo = new ColInfo[columnCount + 1];
-            } else {
-                colInfo = new ColInfo[DEFAULT_COLUMN_COUNT];
-            }
-        } catch (OutOfMemoryError e) {
-            // For compatibility, use same default value as RI
-            colInfo = new ColInfo[DEFAULT_COLUMN_COUNT];
-        }
-        colCount = columnCount;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see javax.sql.RowSetMetaData#setAutoIncrement(int, boolean)
-     */
-    public void setAutoIncrement(int columnIndex, boolean property)
-            throws SQLException {
-        checkColumnIndex(columnIndex);
-        colInfo[columnIndex].autoIncrement = property;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see javax.sql.RowSetMetaData#setCaseSensitive(int, boolean)
-     */
-    public void setCaseSensitive(int columnIndex, boolean property)
-            throws SQLException {
-        checkColumnIndex(columnIndex);
-        colInfo[columnIndex].caseSensitive = property;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see javax.sql.RowSetMetaData#setSearchable(int, boolean)
-     */
-    public void setSearchable(int columnIndex, boolean property)
-            throws SQLException {
-        checkColumnIndex(columnIndex);
-        colInfo[columnIndex].searchable = property;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see javax.sql.RowSetMetaData#setCurrency(int, boolean)
-     */
-    public void setCurrency(int columnIndex, boolean property)
-            throws SQLException {
-        checkColumnIndex(columnIndex);
-        colInfo[columnIndex].currency = property;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see javax.sql.RowSetMetaData#setNullable(int, int)
-     */
-    public void setNullable(int columnIndex, int property) throws SQLException {
-        if (property != ResultSetMetaData.columnNoNulls
-                && property != ResultSetMetaData.columnNullable
-                && property != ResultSetMetaData.columnNullableUnknown) {
-            throw new SQLException(Messages.getString("sql.29")); //$NON-NLS-1$
-        }
-
-        checkColumnIndex(columnIndex);
-        colInfo[columnIndex].nullable = property;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see javax.sql.RowSetMetaData#setSigned(int, boolean)
-     */
-    public void setSigned(int columnIndex, boolean property)
-            throws SQLException {
-        checkColumnIndex(columnIndex);
-        colInfo[columnIndex].signed = property;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see javax.sql.RowSetMetaData#setColumnDisplaySize(int, int)
-     */
-    public void setColumnDisplaySize(int columnIndex, int size)
-            throws SQLException {
-        checkNegativeValue(size, "sql.30"); //$NON-NLS-1$
-
-        checkColumnIndex(columnIndex);
-        colInfo[columnIndex].columnDisplaySize = size;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see javax.sql.RowSetMetaData#setColumnLabel(int, String)
-     */
-    public void setColumnLabel(int columnIndex, String label)
-            throws SQLException {
-        checkColumnIndex(columnIndex);
-        colInfo[columnIndex].columnLabel = label == null ? EMPTY_STRING : label;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see javax.sql.RowSetMetaData#setColumnName(int, String)
-     */
-    public void setColumnName(int columnIndex, String columnName)
-            throws SQLException {
-        checkColumnIndex(columnIndex);
-        colInfo[columnIndex].columnName = columnName == null ? EMPTY_STRING
-                : columnName;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see javax.sql.RowSetMetaData#setSchemaName(int, String)
-     */
-    public void setSchemaName(int columnIndex, String schemaName)
-            throws SQLException {
-        checkColumnIndex(columnIndex);
-        colInfo[columnIndex].schemaName = schemaName == null ? EMPTY_STRING
-                : schemaName;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see javax.sql.RowSetMetaData#setPrecision(int, int)
-     */
-    public void setPrecision(int columnIndex, int precision)
-            throws SQLException {
-        checkNegativeValue(precision, "sql.31"); //$NON-NLS-1$
-
-        checkColumnIndex(columnIndex);
-        colInfo[columnIndex].precision = precision;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see javax.sql.RowSetMetaData#setScale(int, int)
-     */
-    public void setScale(int columnIndex, int scale) throws SQLException {
-        checkNegativeValue(scale, "sql.32"); //$NON-NLS-1$
-
-        checkColumnIndex(columnIndex);
-        colInfo[columnIndex].scale = scale;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see javax.sql.RowSetMetaData#setTableName(int, String)
-     */
-    public void setTableName(int columnIndex, String tableName)
-            throws SQLException {
-        checkColumnIndex(columnIndex);
-        colInfo[columnIndex].tableName = tableName == null ? EMPTY_STRING
-                : tableName;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see javax.sql.RowSetMetaData#setCatalogName(int, String)
-     */
-    public void setCatalogName(int columnIndex, String catalogName)
-            throws SQLException {
-        checkColumnIndex(columnIndex);
-        colInfo[columnIndex].catalogName = catalogName == null ? EMPTY_STRING
-                : catalogName;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see javax.sql.RowSetMetaData#setColumnType(int, int)
-     */
-    public void setColumnType(int columnIndex, int SQLType) throws SQLException {
-        SqlUtil.validateType(SQLType);
-
-        checkColumnIndex(columnIndex);
-        colInfo[columnIndex].colType = SQLType;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see javax.sql.RowSetMetaData#setColumnTypeName(int, String)
-     */
-    public void setColumnTypeName(int columnIndex, String typeName)
-            throws SQLException {
-        checkColumnIndex(columnIndex);
-        colInfo[columnIndex].colTypeName = typeName == null ? EMPTY_STRING
-                : typeName;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.sql.ResultSetMetaData#getColumnCount()
-     */
-    public int getColumnCount() throws SQLException {
-        return colCount;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.sql.ResultSetMetaData#isAutoIncrement(int)
-     */
-    public boolean isAutoIncrement(int columnIndex) throws SQLException {
-        checkColumnIndex(columnIndex);
-        return colInfo[columnIndex].autoIncrement;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.sql.ResultSetMetaData#isCaseSensitive(int)
-     */
-    public boolean isCaseSensitive(int columnIndex) throws SQLException {
-        checkColumnIndex(columnIndex);
-        return colInfo[columnIndex].caseSensitive;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.sql.ResultSetMetaData#isSearchable(int)
-     */
-    public boolean isSearchable(int columnIndex) throws SQLException {
-        checkColumnIndex(columnIndex);
-        return colInfo[columnIndex].searchable;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.sql.ResultSetMetaData#isCurrency(int)
-     */
-    public boolean isCurrency(int columnIndex) throws SQLException {
-        checkColumnIndex(columnIndex);
-        return colInfo[columnIndex].currency;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.sql.ResultSetMetaData#isNullable(int)
-     */
-    public int isNullable(int columnIndex) throws SQLException {
-        checkColumnIndex(columnIndex);
-        return colInfo[columnIndex].nullable;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.sql.ResultSetMetaData#isSigned(int)
-     */
-    public boolean isSigned(int columnIndex) throws SQLException {
-        checkColumnIndex(columnIndex);
-        return colInfo[columnIndex].signed;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.sql.ResultSetMetaData#getColumnDisplaySize(int)
-     */
-    public int getColumnDisplaySize(int columnIndex) throws SQLException {
-        checkColumnIndex(columnIndex);
-        return colInfo[columnIndex].columnDisplaySize;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.sql.ResultSetMetaData#getColumnLabel(int)
-     */
-    public String getColumnLabel(int columnIndex) throws SQLException {
-        checkColumnIndex(columnIndex);
-        return colInfo[columnIndex].columnLabel;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.sql.ResultSetMetaData#getColumnName(int)
-     */
-    public String getColumnName(int columnIndex) throws SQLException {
-        checkColumnIndex(columnIndex);
-        return colInfo[columnIndex].columnName;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.sql.ResultSetMetaData#getSchemaName(int)
-     */
-    public String getSchemaName(int columnIndex) throws SQLException {
-        checkColumnIndex(columnIndex);
-        return colInfo[columnIndex].schemaName;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.sql.ResultSetMetaData#getPrecision(int)
-     */
-    public int getPrecision(int columnIndex) throws SQLException {
-        checkColumnIndex(columnIndex);
-        return colInfo[columnIndex].precision;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.sql.ResultSetMetaData#getScale(int)
-     */
-    public int getScale(int columnIndex) throws SQLException {
-        checkColumnIndex(columnIndex);
-        return colInfo[columnIndex].scale;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.sql.ResultSetMetaData#getTableName(int)
-     */
-    public String getTableName(int columnIndex) throws SQLException {
-        checkColumnIndex(columnIndex);
-        return colInfo[columnIndex].tableName;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.sql.ResultSetMetaData#getCatalogName(int)
-     */
-    public String getCatalogName(int columnIndex) throws SQLException {
-        checkColumnIndex(columnIndex);
-        return colInfo[columnIndex].catalogName;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.sql.ResultSetMetaData#getColumnType(int)
-     */
-    public int getColumnType(int columnIndex) throws SQLException {
-        checkColumnIndex(columnIndex);
-        return colInfo[columnIndex].colType;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.sql.ResultSetMetaData#getColumnTypeName(int)
-     */
-    public String getColumnTypeName(int columnIndex) throws SQLException {
-        checkColumnIndex(columnIndex);
-        return colInfo[columnIndex].colTypeName;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.sql.ResultSetMetaData#isReadOnly(int)
-     */
-    public boolean isReadOnly(int columnIndex) throws SQLException {
-        return !isWritable(columnIndex);
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.sql.ResultSetMetaData#isWritable(int)
-     */
-    public boolean isWritable(int columnIndex) throws SQLException {
-        checkColumnIndex(columnIndex);
-        return colInfo[columnIndex].writeable;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.sql.ResultSetMetaData#isDefinitelyWritable(int)
-     */
-    public boolean isDefinitelyWritable(int columnIndex) throws SQLException {
-        checkColumnIndex(columnIndex);
-        return colInfo[columnIndex].definiteWritable;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see java.sql.ResultSetMetaData#getColumnClassName(int)
-     */
-    public String getColumnClassName(int columnIndex) throws SQLException {
-        return SqlUtil.getClassNameByType(getColumnType(columnIndex));
-    }
-
-    /**
-     * The inner class to store meta information of columns.
-     */
-    private class ColInfo implements Serializable {
-
-        private static final long serialVersionUID = 5490834817919311283L;
-
-        public boolean autoIncrement;
-
-        public boolean caseSensitive;
-
-        public boolean currency;
-
-        public boolean signed;
-
-        public boolean searchable;
-
-        public boolean writeable = true;
-
-        public boolean definiteWritable = true;
-
-        public String columnLabel;
-
-        public String columnName;
-
-        public String schemaName = EMPTY_STRING;
-
-        public String colTypeName;
-
-        public int colType;
-
-        public int nullable;
-
-        public int columnDisplaySize;
-
-        public int precision;
-
-        public int scale;
-
-        public String tableName = EMPTY_STRING;
-
-        public String catalogName = EMPTY_STRING;
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package javax.sql.rowset;
+
+import java.io.Serializable;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+
+import javax.sql.RowSetMetaData;
+
+import org.apache.harmony.sql.internal.nls.Messages;
+
+/**
+ * This class is a concrete implementation of javax.sql.RowSetMetatData, which
+ * provides methods that get and set column information.
+ * 
+ * A RowSetMetaDataImpl object can be obtained by the getMetaData() method in
+ * javax.sql.RowSet.
+ * 
+ */
+public class RowSetMetaDataImpl implements RowSetMetaData, Serializable {
+
+    private static final String EMPTY_STRING = ""; //$NON-NLS-1$
+
+    private static final int DEFAULT_COLUMN_COUNT = 5;
+
+    private static final long serialVersionUID = 6893806403181801867L;
+
+    private int colCount;
+
+    private ColInfo[] colInfo;
+
+    /**
+     * The default constructor.
+     */
+    public RowSetMetaDataImpl() {
+        // do nothing
+    }
+
+    private void checkNegativeValue(int value, String msg) throws SQLException {
+        if (value < 0) {
+            throw new SQLException(Messages.getString(msg));
+        }
+    }
+
+    private void checkColumnIndex(int columnIndex) throws SQLException {
+        if (null == colInfo || columnIndex < 1 || columnIndex >= colInfo.length) {
+            throw new SQLException(Messages
+                    .getString("sql.27", columnIndex + 1)); //$NON-NLS-1$
+        }
+        // lazy initialization
+        if (null == colInfo[columnIndex]) {
+            colInfo[columnIndex] = new ColInfo();
+        }
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see javax.sql.RowSetMetaData#setColumnCount(int)
+     */
+    public void setColumnCount(int columnCount) throws SQLException {
+        if (columnCount <= 0) {
+            throw new SQLException(Messages.getString("sql.26")); //$NON-NLS-1$
+        }
+        try {
+            if (columnCount + 1 > 0) {
+                colInfo = new ColInfo[columnCount + 1];
+            } else {
+                colInfo = new ColInfo[DEFAULT_COLUMN_COUNT];
+            }
+        } catch (OutOfMemoryError e) {
+            // For compatibility, use same default value as RI
+            colInfo = new ColInfo[DEFAULT_COLUMN_COUNT];
+        }
+        colCount = columnCount;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see javax.sql.RowSetMetaData#setAutoIncrement(int, boolean)
+     */
+    public void setAutoIncrement(int columnIndex, boolean property)
+            throws SQLException {
+        checkColumnIndex(columnIndex);
+        colInfo[columnIndex].autoIncrement = property;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see javax.sql.RowSetMetaData#setCaseSensitive(int, boolean)
+     */
+    public void setCaseSensitive(int columnIndex, boolean property)
+            throws SQLException {
+        checkColumnIndex(columnIndex);
+        colInfo[columnIndex].caseSensitive = property;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see javax.sql.RowSetMetaData#setSearchable(int, boolean)
+     */
+    public void setSearchable(int columnIndex, boolean property)
+            throws SQLException {
+        checkColumnIndex(columnIndex);
+        colInfo[columnIndex].searchable = property;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see javax.sql.RowSetMetaData#setCurrency(int, boolean)
+     */
+    public void setCurrency(int columnIndex, boolean property)
+            throws SQLException {
+        checkColumnIndex(columnIndex);
+        colInfo[columnIndex].currency = property;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see javax.sql.RowSetMetaData#setNullable(int, int)
+     */
+    public void setNullable(int columnIndex, int property) throws SQLException {
+        if (property != ResultSetMetaData.columnNoNulls
+                && property != ResultSetMetaData.columnNullable
+                && property != ResultSetMetaData.columnNullableUnknown) {
+            throw new SQLException(Messages.getString("sql.29")); //$NON-NLS-1$
+        }
+
+        checkColumnIndex(columnIndex);
+        colInfo[columnIndex].nullable = property;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see javax.sql.RowSetMetaData#setSigned(int, boolean)
+     */
+    public void setSigned(int columnIndex, boolean property)
+            throws SQLException {
+        checkColumnIndex(columnIndex);
+        colInfo[columnIndex].signed = property;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see javax.sql.RowSetMetaData#setColumnDisplaySize(int, int)
+     */
+    public void setColumnDisplaySize(int columnIndex, int size)
+            throws SQLException {
+        checkNegativeValue(size, "sql.30"); //$NON-NLS-1$
+
+        checkColumnIndex(columnIndex);
+        colInfo[columnIndex].columnDisplaySize = size;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see javax.sql.RowSetMetaData#setColumnLabel(int, String)
+     */
+    public void setColumnLabel(int columnIndex, String label)
+            throws SQLException {
+        checkColumnIndex(columnIndex);
+        colInfo[columnIndex].columnLabel = label == null ? EMPTY_STRING : label;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see javax.sql.RowSetMetaData#setColumnName(int, String)
+     */
+    public void setColumnName(int columnIndex, String columnName)
+            throws SQLException {
+        checkColumnIndex(columnIndex);
+        colInfo[columnIndex].columnName = columnName == null ? EMPTY_STRING
+                : columnName;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see javax.sql.RowSetMetaData#setSchemaName(int, String)
+     */
+    public void setSchemaName(int columnIndex, String schemaName)
+            throws SQLException {
+        checkColumnIndex(columnIndex);
+        colInfo[columnIndex].schemaName = schemaName == null ? EMPTY_STRING
+                : schemaName;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see javax.sql.RowSetMetaData#setPrecision(int, int)
+     */
+    public void setPrecision(int columnIndex, int precision)
+            throws SQLException {
+        checkNegativeValue(precision, "sql.31"); //$NON-NLS-1$
+
+        checkColumnIndex(columnIndex);
+        colInfo[columnIndex].precision = precision;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see javax.sql.RowSetMetaData#setScale(int, int)
+     */
+    public void setScale(int columnIndex, int scale) throws SQLException {
+        checkNegativeValue(scale, "sql.32"); //$NON-NLS-1$
+
+        checkColumnIndex(columnIndex);
+        colInfo[columnIndex].scale = scale;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see javax.sql.RowSetMetaData#setTableName(int, String)
+     */
+    public void setTableName(int columnIndex, String tableName)
+            throws SQLException {
+        checkColumnIndex(columnIndex);
+        colInfo[columnIndex].tableName = tableName == null ? EMPTY_STRING
+                : tableName;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see javax.sql.RowSetMetaData#setCatalogName(int, String)
+     */
+    public void setCatalogName(int columnIndex, String catalogName)
+            throws SQLException {
+        checkColumnIndex(columnIndex);
+        colInfo[columnIndex].catalogName = catalogName == null ? EMPTY_STRING
+                : catalogName;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see javax.sql.RowSetMetaData#setColumnType(int, int)
+     */
+    public void setColumnType(int columnIndex, int SQLType) throws SQLException {
+        SqlUtil.validateType(SQLType);
+
+        checkColumnIndex(columnIndex);
+        colInfo[columnIndex].colType = SQLType;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see javax.sql.RowSetMetaData#setColumnTypeName(int, String)
+     */
+    public void setColumnTypeName(int columnIndex, String typeName)
+            throws SQLException {
+        checkColumnIndex(columnIndex);
+        colInfo[columnIndex].colTypeName = typeName == null ? EMPTY_STRING
+                : typeName;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.ResultSetMetaData#getColumnCount()
+     */
+    public int getColumnCount() throws SQLException {
+        return colCount;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.ResultSetMetaData#isAutoIncrement(int)
+     */
+    public boolean isAutoIncrement(int columnIndex) throws SQLException {
+        checkColumnIndex(columnIndex);
+        return colInfo[columnIndex].autoIncrement;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.ResultSetMetaData#isCaseSensitive(int)
+     */
+    public boolean isCaseSensitive(int columnIndex) throws SQLException {
+        checkColumnIndex(columnIndex);
+        return colInfo[columnIndex].caseSensitive;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.ResultSetMetaData#isSearchable(int)
+     */
+    public boolean isSearchable(int columnIndex) throws SQLException {
+        checkColumnIndex(columnIndex);
+        return colInfo[columnIndex].searchable;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.ResultSetMetaData#isCurrency(int)
+     */
+    public boolean isCurrency(int columnIndex) throws SQLException {
+        checkColumnIndex(columnIndex);
+        return colInfo[columnIndex].currency;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.ResultSetMetaData#isNullable(int)
+     */
+    public int isNullable(int columnIndex) throws SQLException {
+        checkColumnIndex(columnIndex);
+        return colInfo[columnIndex].nullable;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.ResultSetMetaData#isSigned(int)
+     */
+    public boolean isSigned(int columnIndex) throws SQLException {
+        checkColumnIndex(columnIndex);
+        return colInfo[columnIndex].signed;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.ResultSetMetaData#getColumnDisplaySize(int)
+     */
+    public int getColumnDisplaySize(int columnIndex) throws SQLException {
+        checkColumnIndex(columnIndex);
+        return colInfo[columnIndex].columnDisplaySize;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.ResultSetMetaData#getColumnLabel(int)
+     */
+    public String getColumnLabel(int columnIndex) throws SQLException {
+        checkColumnIndex(columnIndex);
+        return colInfo[columnIndex].columnLabel;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.ResultSetMetaData#getColumnName(int)
+     */
+    public String getColumnName(int columnIndex) throws SQLException {
+        checkColumnIndex(columnIndex);
+        return colInfo[columnIndex].columnName;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.ResultSetMetaData#getSchemaName(int)
+     */
+    public String getSchemaName(int columnIndex) throws SQLException {
+        checkColumnIndex(columnIndex);
+        return colInfo[columnIndex].schemaName;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.ResultSetMetaData#getPrecision(int)
+     */
+    public int getPrecision(int columnIndex) throws SQLException {
+        checkColumnIndex(columnIndex);
+        return colInfo[columnIndex].precision;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.ResultSetMetaData#getScale(int)
+     */
+    public int getScale(int columnIndex) throws SQLException {
+        checkColumnIndex(columnIndex);
+        return colInfo[columnIndex].scale;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.ResultSetMetaData#getTableName(int)
+     */
+    public String getTableName(int columnIndex) throws SQLException {
+        checkColumnIndex(columnIndex);
+        return colInfo[columnIndex].tableName;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.ResultSetMetaData#getCatalogName(int)
+     */
+    public String getCatalogName(int columnIndex) throws SQLException {
+        checkColumnIndex(columnIndex);
+        return colInfo[columnIndex].catalogName;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.ResultSetMetaData#getColumnType(int)
+     */
+    public int getColumnType(int columnIndex) throws SQLException {
+        checkColumnIndex(columnIndex);
+        return colInfo[columnIndex].colType;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.ResultSetMetaData#getColumnTypeName(int)
+     */
+    public String getColumnTypeName(int columnIndex) throws SQLException {
+        checkColumnIndex(columnIndex);
+        return colInfo[columnIndex].colTypeName;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.ResultSetMetaData#isReadOnly(int)
+     */
+    public boolean isReadOnly(int columnIndex) throws SQLException {
+        return !isWritable(columnIndex);
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.ResultSetMetaData#isWritable(int)
+     */
+    public boolean isWritable(int columnIndex) throws SQLException {
+        checkColumnIndex(columnIndex);
+        return colInfo[columnIndex].writeable;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.ResultSetMetaData#isDefinitelyWritable(int)
+     */
+    public boolean isDefinitelyWritable(int columnIndex) throws SQLException {
+        checkColumnIndex(columnIndex);
+        return colInfo[columnIndex].definiteWritable;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see java.sql.ResultSetMetaData#getColumnClassName(int)
+     */
+    public String getColumnClassName(int columnIndex) throws SQLException {
+        return SqlUtil.getClassNameByType(getColumnType(columnIndex));
+    }
+
+    /**
+     * The inner class to store meta information of columns.
+     */
+    private class ColInfo implements Serializable {
+
+        private static final long serialVersionUID = 5490834817919311283L;
+
+        public boolean autoIncrement;
+
+        public boolean caseSensitive;
+
+        public boolean currency;
+
+        public boolean signed;
+
+        public boolean searchable;
+
+        public boolean writeable = true;
+
+        public boolean definiteWritable = true;
+
+        public String columnLabel;
+
+        public String columnName;
+
+        public String schemaName = EMPTY_STRING;
+
+        public String colTypeName;
+
+        public int colType;
+
+        public int nullable;
+
+        public int columnDisplaySize;
+
+        public int precision;
+
+        public int scale;
+
+        public String tableName = EMPTY_STRING;
+
+        public String catalogName = EMPTY_STRING;
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/sql/src/main/java/javax/sql/rowset/RowSetMetaDataImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/org/apache/harmony/swing/tests/javax/swing/text/parser/ContentModelCompatilityTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java.injected/org/apache/harmony/swing/tests/javax/swing/text/parser/ContentModelSemanticTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: harmony/enhanced/classlib/trunk/support/src/test/java/javax/swing/text/parser/utils/DTDGetter.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message