harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ton...@apache.org
Subject svn commit: r640730 [1/2] - in /harmony/enhanced/classlib/trunk/modules/sql/src: main/java/org/apache/harmony/sql/internal/nls/ main/java/org/apache/harmony/sql/internal/rowset/ test/java/org/apache/harmony/sql/tests/internal/rowset/ test/resources/org...
Date Tue, 25 Mar 2008 07:44:25 GMT
Author: tonywu
Date: Tue Mar 25 00:44:22 2008
New Revision: 640730

URL: http://svn.apache.org/viewvc?rev=640730&view=rev
Log:
Apply patch for HARMONY-5648 ([classlib][sql][rowset] Implement XmlReaderXml.java and WebRowSetImpl.java)

Added:
    harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/XmlReaderImpl.java   (with props)
    harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/WebRowSetTest.java   (with props)
    harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/XmlReaderTest.java   (with props)
    harmony/enhanced/classlib/trunk/modules/sql/src/test/resources/org/
    harmony/enhanced/classlib/trunk/modules/sql/src/test/resources/org/apache/
    harmony/enhanced/classlib/trunk/modules/sql/src/test/resources/org/apache/harmony/
    harmony/enhanced/classlib/trunk/modules/sql/src/test/resources/org/apache/harmony/sql/
    harmony/enhanced/classlib/trunk/modules/sql/src/test/resources/org/apache/harmony/sql/internal/
    harmony/enhanced/classlib/trunk/modules/sql/src/test/resources/org/apache/harmony/sql/internal/rowset/
    harmony/enhanced/classlib/trunk/modules/sql/src/test/resources/org/apache/harmony/sql/internal/rowset/XmlFile_InvalidHeader.xml   (with props)
    harmony/enhanced/classlib/trunk/modules/sql/src/test/resources/org/apache/harmony/sql/internal/rowset/XmlReaderTest_HY.xml   (with props)
    harmony/enhanced/classlib/trunk/modules/sql/src/test/resources/org/apache/harmony/sql/internal/rowset/XmlReaderTest_RI.xml   (with props)
Modified:
    harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties
    harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetImpl.java
    harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/WebRowSetImpl.java
    harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/XmlWriterImpl.java
    harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetTestCase.java
    harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/XmlWriterTest.java

Modified: harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties?rev=640730&r1=640729&r2=640730&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties (original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/nls/messages.properties Tue Mar 25 00:44:22 2008
@@ -87,3 +87,4 @@
 rowset.24=Unable to get connection
 rowset.25=(JNDI)Unable to get connection
 rowset.26=The object has not been initialized
+rowset.27=Illegal input string "{0}"

Modified: harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetImpl.java?rev=640730&r1=640729&r2=640730&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetImpl.java (original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/CachedRowSetImpl.java Tue Mar 25 00:44:22 2008
@@ -975,7 +975,7 @@
     public void setTableName(String tabName) throws SQLException {
         if (tabName == null) {
             // rowset.3=Table name should not be null
-            throw new SQLException("rowset.3"); //$NON-NLS-1$
+            throw new SQLException(Messages.getString("rowset.3")); //$NON-NLS-1$
         }
         tableName = tabName;
     }

Modified: harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/WebRowSetImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/WebRowSetImpl.java?rev=640730&r1=640729&r2=640730&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/WebRowSetImpl.java (original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/WebRowSetImpl.java Tue Mar 25 00:44:22 2008
@@ -18,6 +18,7 @@
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.Reader;
@@ -28,10 +29,10 @@
 import javax.sql.rowset.WebRowSet;
 import javax.sql.rowset.spi.SyncFactoryException;
 
-import org.apache.harmony.luni.util.NotImplementedException;
-
 public class WebRowSetImpl extends CachedRowSetImpl implements WebRowSet {
 
+    private static final long serialVersionUID = -1585509574069224797L;
+
     public WebRowSetImpl() throws SyncFactoryException {
         super();
     }
@@ -41,11 +42,11 @@
     }
 
     public void readXml(Reader reader) throws SQLException {
-        throw new NotImplementedException();
+        new XmlReaderImpl().readXML(this, reader);
     }
 
     public void readXml(InputStream iStream) throws SQLException, IOException {
-        throw new NotImplementedException();
+        new XmlReaderImpl().readXML(this, new InputStreamReader(iStream));
     }
 
     public void writeXml(ResultSet rs, Writer writer) throws SQLException {

Added: harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/XmlReaderImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/XmlReaderImpl.java?rev=640730&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/XmlReaderImpl.java (added)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/XmlReaderImpl.java Tue Mar 25 00:44:22 2008
@@ -0,0 +1,539 @@
+/*
+ *  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.sql.internal.rowset;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.sql.Date;
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.sql.RowSetMetaData;
+import javax.sql.rowset.RowSetMetaDataImpl;
+import javax.sql.rowset.WebRowSet;
+import javax.sql.rowset.spi.XmlReader;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.apache.harmony.sql.internal.nls.Messages;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+public class XmlReaderImpl extends CachedRowSetReader implements XmlReader {
+
+    public void readXML(WebRowSet caller, Reader reader) throws SQLException {
+        SAXParser parser = null;
+        try {
+            parser = SAXParserFactory.newInstance().newSAXParser();
+            XmlHandler xmlHandler = new XmlHandler(caller);
+            parser.parse(new InputSource(reader), xmlHandler);
+        } catch (ParserConfigurationException e) {
+            SQLException ex = new SQLException();
+            ex.initCause(e);
+            throw ex;
+        } catch (SAXException e) {
+            if (e.getCause() instanceof SQLException) {
+                throw (SQLException) e.getCause();
+            }
+            SQLException ex = new SQLException();
+            ex.initCause(e);
+            throw ex;
+        } catch (IOException e) {
+            SQLException ex = new SQLException();
+            ex.initCause(e);
+            throw ex;
+        }
+    }
+
+    private class XmlHandler extends DefaultHandler {
+        private WebRowSet webRs;
+
+        private static final int READ_PROPERTIES = 1;
+
+        private static final int READ_METADATA = 2;
+
+        private static final int READ_DATA = 3;
+
+        private int state = 0;
+
+        private String currentTagName;
+
+        private String currentValue;
+
+        private int colIndex;
+
+        private ArrayList<CachedRow> rows;
+
+        private CachedRow currentRow;
+
+        private int columnCount;
+
+        private ArrayList<Object> columnData;
+
+        private ArrayList<Object> updateData;
+
+        private ArrayList<Integer> updateColIndex;
+
+        private ArrayList<Integer> keyCols;
+
+        private Map<String, Class<?>> map;
+
+        private String type;
+
+        private String className;
+
+        public XmlHandler(WebRowSet webRs) {
+            this.webRs = webRs;
+            keyCols = new ArrayList<Integer>();
+            map = new HashMap<String, Class<?>>();
+        }
+
+        @Override
+        public void startDocument() throws SAXException {
+            rows = new ArrayList<CachedRow>();
+        }
+
+        @Override
+        public void endDocument() throws SAXException {
+            /*
+             * set keyCols, map
+             */
+            int[] iKeyCols = new int[keyCols.size()];
+            for (int i = 0; i < keyCols.size(); i++) {
+                iKeyCols[i] = keyCols.get(i).intValue();
+            }
+            try {
+                webRs.setKeyColumns(iKeyCols);
+                webRs.setTypeMap(map);
+            } catch (SQLException e) {
+                SAXException ex = new SAXException();
+                ex.initCause(e);
+                throw ex;
+            }
+            /*
+             * set rows
+             */
+            ((CachedRowSetImpl) webRs).setRows(rows, columnCount);
+        }
+
+        @Override
+        public void startElement(String namespaceURI, String localName,
+                String qName, Attributes attr) throws SAXException {
+            if (qName.equals("null")) { //$NON-NLS-1$
+                currentValue = null;
+                return;
+            }
+
+            if (qName.equals("webRowSet")) { //$NON-NLS-1$
+                // TODO
+                return;
+            }
+
+            if (qName.equals("properties")) { //$NON-NLS-1$
+                state = READ_PROPERTIES;
+            } else if (qName.equals("metadata")) { //$NON-NLS-1$
+                state = READ_METADATA;
+            } else if (qName.equals("data")) { //$NON-NLS-1$
+                state = READ_DATA;
+            }
+
+            currentTagName = qName;
+            currentValue = ""; //$NON-NLS-1$
+
+            if (state == READ_DATA) {
+                initRow();
+            }
+        }
+
+        @Override
+        public void endElement(String namespaceURI, String localName,
+                String qName) throws SAXException {
+            try {
+                if (state == READ_DATA) {
+                    insertRow(qName);
+                }
+                if (qName.equals("null") || !qName.equals(currentTagName)) { //$NON-NLS-1$
+                    return;
+                }
+
+                switch (state) {
+                case READ_PROPERTIES:
+                    readProperties();
+                    break;
+                case READ_METADATA:
+                    readMetadata();
+                    break;
+                case READ_DATA:
+                    readData();
+                    break;
+                }
+            } catch (SQLException e) {
+                SAXException ex = new SAXException();
+                ex.initCause(e);
+                throw ex;
+            }
+        }
+
+        @Override
+        public void characters(char[] ch, int start, int length)
+                throws SAXException {
+            currentValue = new String(ch, start, length);
+        }
+
+        private void readHeader() {
+            // TODO
+        }
+
+        private void readProperties() throws SQLException {
+            if ("command".equals(currentTagName)) { //$NON-NLS-1$
+                webRs.setCommand(currentValue);
+            } else if ("concurrency".equals(currentTagName)) { //$NON-NLS-1$
+                webRs.setConcurrency(parseInt(currentValue));
+            } else if ("datasource".equals(currentTagName)) { //$NON-NLS-1$
+                webRs.setDataSourceName(currentValue);
+            } else if ("escape-processing".equals(currentTagName)) { //$NON-NLS-1$
+                webRs.setEscapeProcessing(parseBoolean(currentValue));
+            } else if ("fetch-direction".equals(currentTagName)) { //$NON-NLS-1$
+                webRs.setFetchDirection(parseInt(currentValue));
+            } else if ("fetch-size".equals(currentTagName)) { //$NON-NLS-1$
+                webRs.setFetchSize(parseInt(currentValue));
+            } else if ("isolation-level".equals(currentTagName)) { //$NON-NLS-1$
+                webRs.setTransactionIsolation(parseInt(currentValue));
+            } else if ("column".equals(currentTagName)) { //$NON-NLS-1$
+                keyCols.add(Integer.valueOf(parseInt(currentValue)));
+            } else if ("type".equals(currentTagName)) { //$NON-NLS-1$
+                type = currentValue;
+            } else if ("class".equals(currentTagName)) { //$NON-NLS-1$
+                className = currentValue;
+                try {
+                    map.put(type, Class.forName(className));
+                } catch (ClassNotFoundException e) {
+                    SQLException ex = new SQLException();
+                    ex.initCause(e);
+                    throw ex;
+                }
+                type = null;
+                className = null;
+            } else if ("max-field-size".equals(currentTagName)) { //$NON-NLS-1$
+                webRs.setMaxFieldSize(parseInt(currentValue));
+            } else if ("max-rows".equals(currentTagName)) { //$NON-NLS-1$
+                webRs.setMaxRows(parseInt(currentValue));
+            } else if ("query-timeout".equals(currentTagName)) { //$NON-NLS-1$
+                webRs.setQueryTimeout(parseInt(currentValue));
+            } else if ("read-only".equals(currentTagName)) { //$NON-NLS-1$
+                webRs.setReadOnly(parseBoolean(currentValue));
+            } else if ("rowset-type".equals(currentTagName)) { //$NON-NLS-1$
+                webRs.setType(getType(currentValue));
+            } else if ("show-deleted".equals(currentTagName)) { //$NON-NLS-1$
+                webRs.setShowDeleted(parseBoolean(currentValue));
+            } else if ("table-name".equals(currentTagName)) { //$NON-NLS-1$
+                // currentValue can't be null. Or else it would throw
+                // SQLException.
+                if (currentValue != null) {
+                    webRs.setTableName(currentValue);
+                }
+            } else if ("url".equals(currentTagName)) { //$NON-NLS-1$
+                webRs.setUrl(currentValue);
+            } else if ("sync-provider-name".equals(currentTagName)) { //$NON-NLS-1$
+                webRs.setSyncProvider(currentValue);
+            }
+        }
+
+        private void readMetadata() throws SQLException {
+            RowSetMetaData md = (RowSetMetaData) webRs.getMetaData();
+            if (md == null) {
+                md = new RowSetMetaDataImpl();
+                webRs.setMetaData(md);
+            }
+
+            if (currentTagName.equals("column-count")) { //$NON-NLS-1$
+                columnCount = parseInt(currentValue);
+                md.setColumnCount(columnCount);
+            } else if (currentTagName.equals("column-index")) { //$NON-NLS-1$
+                colIndex = parseInt(currentValue);
+            } else if (currentTagName.equals("auto-increment")) { //$NON-NLS-1$
+                md.setAutoIncrement(colIndex, parseBoolean(currentValue));
+            } else if (currentTagName.equals("case-sensitive")) { //$NON-NLS-1$
+                md.setCaseSensitive(colIndex, parseBoolean(currentValue));
+            } else if (currentTagName.equals("currency")) { //$NON-NLS-1$
+                md.setCurrency(colIndex, parseBoolean(currentValue));
+            } else if (currentTagName.equals("nullable")) { //$NON-NLS-1$
+                md.setNullable(colIndex, parseInt(currentValue));
+            } else if (currentTagName.equals("signed")) { //$NON-NLS-1$
+                md.setSigned(colIndex, parseBoolean(currentValue));
+            } else if (currentTagName.equals("searchable")) { //$NON-NLS-1$
+                md.setSearchable(colIndex, parseBoolean(currentValue));
+            } else if (currentTagName.equals("column-display-size")) { //$NON-NLS-1$
+                md.setColumnDisplaySize(colIndex, parseInt(currentValue));
+            } else if (currentTagName.equals("column-label")) { //$NON-NLS-1$
+                md.setColumnLabel(colIndex, currentValue);
+            } else if (currentTagName.equals("column-name")) { //$NON-NLS-1$
+                md.setColumnName(colIndex, currentValue);
+            } else if (currentTagName.equals("schema-name")) { //$NON-NLS-1$
+                md.setSchemaName(colIndex, currentValue);
+            } else if (currentTagName.equals("column-precision")) { //$NON-NLS-1$
+                md.setPrecision(colIndex, parseInt(currentValue));
+            } else if (currentTagName.equals("column-scale")) { //$NON-NLS-1$
+                md.setScale(colIndex, parseInt(currentValue));
+            } else if (currentTagName.equals("table-name")) { //$NON-NLS-1$
+                md.setTableName(colIndex, currentValue);
+            } else if (currentTagName.equals("catalog-name")) { //$NON-NLS-1$
+                md.setCatalogName(colIndex, currentValue);
+            } else if (currentTagName.equals("column-type")) { //$NON-NLS-1$
+                md.setColumnType(colIndex, parseInt(currentValue));
+            } else if (currentTagName.equals("column-type-name")) { //$NON-NLS-1$
+                md.setColumnTypeName(colIndex, currentValue);
+            }
+
+        }
+
+        private void readData() throws SQLException {
+            if ("columnValue".equals(currentTagName)) { //$NON-NLS-1$
+                colIndex++;
+                columnData.add(parseObject(currentValue));
+            } else if ("updateValue".equals(currentTagName)) { //$NON-NLS-1$
+                updateData.add(parseObject(currentValue));
+                updateColIndex.add(Integer.valueOf(colIndex));
+            }
+        }
+
+        @SuppressWarnings("boxing")
+        private Object parseObject(String value) throws SQLException {
+            if (value == null) {
+                return null;
+            }
+
+            Object obj = null;
+            ResultSetMetaData rsmd = webRs.getMetaData();
+            int colType = rsmd.getColumnType(colIndex);
+            switch (colType) {
+            case Types.BIGINT:
+                obj = parseLong(value);
+                break;
+            case Types.BIT:
+            case Types.BOOLEAN:
+                obj = parseBoolean(value);
+                break;
+            case Types.CHAR:
+            case Types.VARCHAR:
+            case Types.LONGVARCHAR:
+                obj = value;
+                break;
+            case Types.DATE:
+                obj = parseDate(value);
+                break;
+            case Types.FLOAT:
+            case Types.DOUBLE:
+                obj = parseDouble(value);
+                break;
+            case Types.NUMERIC:
+            case Types.DECIMAL:
+                obj = parseBigDecimal(value);
+                break;
+            case Types.REAL:
+                obj = parseFloat(value);
+                break;
+            case Types.TIME:
+                obj = parseTime(value);
+                break;
+            case Types.TIMESTAMP:
+                obj = parseTimestamp(value);
+                break;
+            case Types.TINYINT:
+            case Types.SMALLINT:
+            case Types.INTEGER:
+                obj = parseInt(value);
+                break;
+            }
+            return obj;
+        }
+
+        private int getType(String type) throws SQLException {
+            type = type.trim();
+            if ("ResultSet.TYPE_FORWARD_ONLY".equals(type)) { //$NON-NLS-1$
+                return ResultSet.TYPE_FORWARD_ONLY;
+            } else if ("ResultSet.TYPE_SCROLL_INSENSITIVE".equals(type)) { //$NON-NLS-1$
+                return ResultSet.TYPE_SCROLL_INSENSITIVE;
+            } else if ("ResultSet.TYPE_SCROLL_SENSITIVE".equals(type)) { //$NON-NLS-1$
+                return ResultSet.TYPE_SCROLL_SENSITIVE;
+            }
+            // rowset.27=Illegal input string "{0}"
+            throw new SQLException(Messages.getString("rowset.27", type)); //$NON-NLS-1$
+        }
+
+        private void initRow() {
+            if ("currentRow".equals(currentTagName) //$NON-NLS-1$
+                    || "deleteRow".equals(currentTagName) //$NON-NLS-1$
+                    || "insertRow".equals(currentTagName) //$NON-NLS-1$
+                    || "modifyRow".equals(currentTagName)) { //$NON-NLS-1$
+                columnData = new ArrayList<Object>();
+                updateData = new ArrayList<Object>();
+                updateColIndex = new ArrayList<Integer>();
+                colIndex = 0;
+            }
+        }
+
+        private void insertRow(String tagName) throws SQLException {
+            boolean isInsertRow = false;
+            if ("currentRow".equals(tagName)) { //$NON-NLS-1$
+                currentRow = new CachedRow(columnData.toArray());
+                isInsertRow = true;
+            } else if ("deleteRow".equals(tagName)) { //$NON-NLS-1$
+                currentRow = new CachedRow(columnData.toArray());
+                currentRow.setDelete();
+                isInsertRow = true;
+            } else if ("insertRow".equals(tagName)) { //$NON-NLS-1$
+                currentRow = new CachedRow(columnData.toArray());
+                currentRow.setInsert();
+                isInsertRow = true;
+            } else if ("modifyRow".equals(tagName)) { //$NON-NLS-1$
+                currentRow = new CachedRow(columnData.toArray());
+                currentRow.setUpdate();
+                isInsertRow = true;
+            }
+            if (isInsertRow) {
+                for (int i = 0; i < updateData.size(); i++) {
+                    Object updateValue = updateData.get(i);
+                    Integer updateCol = updateColIndex.get(i);
+                    currentRow.updateObject(updateCol.intValue(), updateValue);
+                }
+                rows.add(currentRow);
+                currentRow = null;
+            }
+        }
+
+        private int parseInt(String value) throws SQLException {
+            if (value == null) {
+                new SQLException(Messages.getString("rowset.27", value)); //$NON-NLS-1$
+            }
+
+            try {
+                return Integer.parseInt(value.trim());
+            } catch (NumberFormatException e) {
+                // rowset.27=Illegal input string "{0}"
+                SQLException ex = new SQLException(Messages.getString(
+                        "rowset.27", value)); //$NON-NLS-1$
+                ex.initCause(e);
+                throw ex;
+            }
+        }
+
+        private long parseLong(String value) throws SQLException {
+            try {
+                return Long.parseLong(value.trim());
+            } catch (NumberFormatException e) {
+                // rowset.27=Illegal input string "{0}"
+                SQLException ex = new SQLException(Messages.getString(
+                        "rowset.27", value)); //$NON-NLS-1$
+                ex.initCause(e);
+                throw ex;
+            }
+        }
+
+        private float parseFloat(String value) throws SQLException {
+            try {
+                return Float.parseFloat(value.trim());
+            } catch (NumberFormatException e) {
+                // rowset.27=Illegal input string "{0}"
+                SQLException ex = new SQLException(Messages.getString(
+                        "rowset.27", value)); //$NON-NLS-1$
+                ex.initCause(e);
+                throw ex;
+            }
+        }
+
+        private double parseDouble(String value) throws SQLException {
+            try {
+                return Double.parseDouble(value.trim());
+            } catch (NumberFormatException e) {
+                // rowset.27=Illegal input string "{0}"
+                SQLException ex = new SQLException(Messages.getString(
+                        "rowset.27", value)); //$NON-NLS-1$
+                ex.initCause(e);
+                throw ex;
+            }
+        }
+
+        private Date parseDate(String value) throws SQLException {
+            try {
+                return new Date(Long.parseLong(value.trim()));
+            } catch (NumberFormatException e) {
+                // rowset.27=Illegal input string "{0}"
+                SQLException ex = new SQLException(Messages.getString(
+                        "rowset.27", value)); //$NON-NLS-1$
+                ex.initCause(e);
+                throw ex;
+            }
+        }
+
+        private Time parseTime(String value) throws SQLException {
+            try {
+                return new Time(Long.parseLong(value.trim()));
+            } catch (NumberFormatException e) {
+                // rowset.27=Illegal input string "{0}"
+                SQLException ex = new SQLException(Messages.getString(
+                        "rowset.27", value)); //$NON-NLS-1$
+                ex.initCause(e);
+                throw ex;
+            }
+        }
+
+        private Timestamp parseTimestamp(String value) throws SQLException {
+            try {
+                return new Timestamp(Long.parseLong(value.trim()));
+            } catch (NumberFormatException e) {
+                // rowset.27=Illegal input string "{0}"
+                SQLException ex = new SQLException(Messages.getString(
+                        "rowset.27", value)); //$NON-NLS-1$
+                ex.initCause(e);
+                throw ex;
+            }
+        }
+
+        private boolean parseBoolean(String value) {
+            if (value == null) {
+                return false;
+            }
+
+            return Boolean.parseBoolean(value.trim());
+        }
+
+        private BigDecimal parseBigDecimal(String value) throws SQLException {
+            try {
+                return new BigDecimal(value.trim());
+            } catch (NumberFormatException e) {
+                // rowset.27=Illegal input string "{0}"
+                SQLException ex = new SQLException(Messages.getString(
+                        "rowset.27", value)); //$NON-NLS-1$
+                ex.initCause(e);
+                throw ex;
+            }
+        }
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/XmlReaderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/XmlWriterImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/XmlWriterImpl.java?rev=640730&r1=640729&r2=640730&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/XmlWriterImpl.java (original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/main/java/org/apache/harmony/sql/internal/rowset/XmlWriterImpl.java Tue Mar 25 00:44:22 2008
@@ -42,7 +42,6 @@
 
 public class XmlWriterImpl extends CachedRowSetWriter implements XmlWriter {
 
-    @SuppressWarnings("nls")
     public void writeXML(WebRowSet caller, Writer writer) throws SQLException {
         if (writer == null || caller == null || caller.getMetaData() == null) {
             throw new NullPointerException();
@@ -55,24 +54,26 @@
                     .newDocumentBuilder();
             doc = docBuidler.newDocument();
         } catch (ParserConfigurationException e) {
-            throw new SQLException(e.getMessage());
+            SQLException ex = new SQLException();
+            ex.initCause(e);
+            throw ex;
         }
 
         /*
          * root element: webRowSet
          */
-        Element rootElement = doc.createElement("webRowSet");
-        rootElement.setAttribute("xmlns", "http://java.sun.com/xml/ns/jdbc");
-        rootElement.setAttribute("xmlns:xsi",
-                "http://www.w3.org/2001/XMLSchema-instance");
+        Element rootElement = doc.createElement("webRowSet"); //$NON-NLS-1$
+        rootElement.setAttribute("xmlns", "http://java.sun.com/xml/ns/jdbc"); //$NON-NLS-1$ //$NON-NLS-2$
+        rootElement.setAttribute("xmlns:xsi", //$NON-NLS-1$
+                "http://www.w3.org/2001/XMLSchema-instance"); //$NON-NLS-1$
         rootElement
-                .setAttribute("xsi:schemaLocation",
-                        "http://java.sun.com/xml/ns/jdbc http://java.sun.com/xml/ns/jdbc/webrowset.xsd");
+                .setAttribute("xsi:schemaLocation", //$NON-NLS-1$
+                        "http://java.sun.com/xml/ns/jdbc http://java.sun.com/xml/ns/jdbc/webrowset.xsd"); //$NON-NLS-1$
 
         /*
          * Element: properties
          */
-        Element prop = doc.createElement("properties");
+        Element prop = doc.createElement("properties"); //$NON-NLS-1$
         rootElement.appendChild(prop);
         writeProperties(doc, prop, caller);
 
@@ -80,10 +81,10 @@
          * Element: metadata
          */
         ResultSetMetaData rsmd = caller.getMetaData();
-        Element metadataEle = doc.createElement("metadata");
+        Element metadataEle = doc.createElement("metadata"); //$NON-NLS-1$
         // column-count
         int colCount = rsmd.getColumnCount();
-        Element colCountEle = doc.createElement("column-count");
+        Element colCountEle = doc.createElement("column-count"); //$NON-NLS-1$
         colCountEle.setTextContent(Integer.toString(colCount));
         metadataEle.appendChild(colCountEle);
         // add each column definition
@@ -95,7 +96,7 @@
         /*
          * Element: data
          */
-        Element data = doc.createElement("data");
+        Element data = doc.createElement("data"); //$NON-NLS-1$
         rootElement.appendChild(data);
 
         writeRowSetData(doc, data, caller);
@@ -112,11 +113,17 @@
             StreamResult streamResult = new StreamResult(writer);
             transformer.transform(domSrc, streamResult);
         } catch (TransformerConfigurationException e) {
-            throw new SQLException(e.getMessage());
+            SQLException ex = new SQLException();
+            ex.initCause(e);
+            throw ex;
         } catch (TransformerFactoryConfigurationError e) {
-            throw new SQLException(e.getMessage());
+            SQLException ex = new SQLException();
+            ex.initCause(e);
+            throw ex;
         } catch (TransformerException e) {
-            throw new SQLException(e.getMessage());
+            SQLException ex = new SQLException();
+            ex.initCause(e);
+            throw ex;
         }
     }
 
@@ -223,79 +230,79 @@
         }
     }
 
-    @SuppressWarnings( { "nls", "boxing" })
+    @SuppressWarnings("boxing")
     private void writeProperties(Document doc, Element prop, WebRowSet caller)
             throws SQLException {
 
-        appendElement(prop, doc, "command", caller.getCommand());
-        appendElement(prop, doc, "concurrency", caller.getConcurrency());
-        appendElement(prop, doc, "datasource", caller.getDataSourceName());
-        appendElement(prop, doc, "escape-processing", caller
+        appendElement(prop, doc, "command", caller.getCommand()); //$NON-NLS-1$
+        appendElement(prop, doc, "concurrency", caller.getConcurrency()); //$NON-NLS-1$
+        appendElement(prop, doc, "datasource", caller.getDataSourceName()); //$NON-NLS-1$
+        appendElement(prop, doc, "escape-processing", caller //$NON-NLS-1$
                 .getEscapeProcessing());
-        appendElement(prop, doc, "fetch-direction", caller.getFetchDirection());
-        appendElement(prop, doc, "fetch-size", caller.getFetchSize());
-        appendElement(prop, doc, "isolation-level", caller
+        appendElement(prop, doc, "fetch-direction", caller.getFetchDirection()); //$NON-NLS-1$
+        appendElement(prop, doc, "fetch-size", caller.getFetchSize()); //$NON-NLS-1$
+        appendElement(prop, doc, "isolation-level", caller //$NON-NLS-1$
                 .getTransactionIsolation());
 
         // write key columns
-        Element keyColumns = doc.createElement("key-columns");
+        Element keyColumns = doc.createElement("key-columns"); //$NON-NLS-1$
         prop.appendChild(keyColumns);
 
         int[] indexes = caller.getKeyColumns();
         for (int i = 0; i < indexes.length; ++i) {
-            appendElement(keyColumns, doc, "column", indexes[i]);
+            appendElement(keyColumns, doc, "column", indexes[i]); //$NON-NLS-1$
         }
 
         // wirte type map
-        Element typeMap = doc.createElement("map");
+        Element typeMap = doc.createElement("map"); //$NON-NLS-1$
         prop.appendChild(typeMap);
         if (caller.getTypeMap() != null) {
             for (Iterator<String> iter = caller.getTypeMap().keySet()
                     .iterator(); iter.hasNext();) {
                 String key = iter.next();
-                appendElement(typeMap, doc, "type", key);
-                appendElement(typeMap, doc, "class", caller.getTypeMap().get(
+                appendElement(typeMap, doc, "type", key); //$NON-NLS-1$
+                appendElement(typeMap, doc, "class", caller.getTypeMap().get( //$NON-NLS-1$
                         key).getName());
             }
         }
 
-        appendElement(prop, doc, "max-field-size", caller.getMaxFieldSize());
-        appendElement(prop, doc, "max-rows", caller.getMaxRows());
-        appendElement(prop, doc, "query-timeout", caller.getQueryTimeout());
-        appendElement(prop, doc, "read-only", caller.isReadOnly());
+        appendElement(prop, doc, "max-field-size", caller.getMaxFieldSize()); //$NON-NLS-1$
+        appendElement(prop, doc, "max-rows", caller.getMaxRows()); //$NON-NLS-1$
+        appendElement(prop, doc, "query-timeout", caller.getQueryTimeout()); //$NON-NLS-1$
+        appendElement(prop, doc, "read-only", caller.isReadOnly()); //$NON-NLS-1$
 
         String rowsetType = null;
         switch (caller.getType()) {
         case ResultSet.TYPE_FORWARD_ONLY:
-            rowsetType = "ResultSet.TYPE_FORWARD_ONLY";
+            rowsetType = "ResultSet.TYPE_FORWARD_ONLY"; //$NON-NLS-1$
             break;
         case ResultSet.TYPE_SCROLL_INSENSITIVE:
-            rowsetType = "ResultSet.TYPE_SCROLL_INSENSITIVE";
+            rowsetType = "ResultSet.TYPE_SCROLL_INSENSITIVE"; //$NON-NLS-1$
             break;
         case ResultSet.TYPE_SCROLL_SENSITIVE:
-            rowsetType = "ResultSet.TYPE_SCROLL_SENSITIVE";
+            rowsetType = "ResultSet.TYPE_SCROLL_SENSITIVE"; //$NON-NLS-1$
             break;
 
         }
 
-        appendElement(prop, doc, "rowset-type", rowsetType);
+        appendElement(prop, doc, "rowset-type", rowsetType); //$NON-NLS-1$
 
-        appendElement(prop, doc, "show-deleted", caller.getShowDeleted());
-        appendElement(prop, doc, "table-name", caller.getTableName());
-        appendElement(prop, doc, "url", caller.getUrl());
+        appendElement(prop, doc, "show-deleted", caller.getShowDeleted()); //$NON-NLS-1$
+        appendElement(prop, doc, "table-name", caller.getTableName()); //$NON-NLS-1$
+        appendElement(prop, doc, "url", caller.getUrl()); //$NON-NLS-1$
 
-        Element provider = doc.createElement("sync-provider");
+        Element provider = doc.createElement("sync-provider"); //$NON-NLS-1$
         prop.appendChild(provider);
 
-        appendElement(provider, doc, "sync-provider-name", caller
+        appendElement(provider, doc, "sync-provider-name", caller //$NON-NLS-1$
                 .getSyncProvider().getProviderID());
-        appendElement(provider, doc, "sync-provider-vendor", caller
+        appendElement(provider, doc, "sync-provider-vendor", caller //$NON-NLS-1$
                 .getSyncProvider().getVendor());
-        appendElement(provider, doc, "sync-provider-version", caller
+        appendElement(provider, doc, "sync-provider-version", caller //$NON-NLS-1$
                 .getSyncProvider().getVersion());
-        appendElement(provider, doc, "sync-provider-grade", caller
+        appendElement(provider, doc, "sync-provider-grade", caller //$NON-NLS-1$
                 .getSyncProvider().getProviderGrade());
-        appendElement(provider, doc, "data-source-lock", caller
+        appendElement(provider, doc, "data-source-lock", caller //$NON-NLS-1$
                 .getSyncProvider().getDataSourceLock());
 
     }
@@ -317,36 +324,36 @@
         root.appendChild(child);
     }
 
-    @SuppressWarnings( { "nls", "boxing" })
+    @SuppressWarnings("boxing")
     private void writeMetadataByCol(Document doc, Element ele,
             ResultSetMetaData rsmd, int colIndex) throws SQLException {
-        Element colDefEle = doc.createElement("column-definition");
-        appendElement(colDefEle, doc, "column-index", colIndex);
-        appendElement(colDefEle, doc, "auto-increment", rsmd
+        Element colDefEle = doc.createElement("column-definition"); //$NON-NLS-1$
+        appendElement(colDefEle, doc, "column-index", colIndex); //$NON-NLS-1$
+        appendElement(colDefEle, doc, "auto-increment", rsmd //$NON-NLS-1$
                 .isAutoIncrement(colIndex));
-        appendElement(colDefEle, doc, "case-sensitive", rsmd
+        appendElement(colDefEle, doc, "case-sensitive", rsmd //$NON-NLS-1$
                 .isCaseSensitive(colIndex));
-        appendElement(colDefEle, doc, "currency", rsmd.isCurrency(colIndex));
-        appendElement(colDefEle, doc, "nullable", rsmd.isNullable(colIndex));
-        appendElement(colDefEle, doc, "signed", rsmd.isSigned(colIndex));
-        appendElement(colDefEle, doc, "searchable", rsmd.isSearchable(colIndex));
-        appendElement(colDefEle, doc, "column-display-size", rsmd
+        appendElement(colDefEle, doc, "currency", rsmd.isCurrency(colIndex)); //$NON-NLS-1$
+        appendElement(colDefEle, doc, "nullable", rsmd.isNullable(colIndex)); //$NON-NLS-1$
+        appendElement(colDefEle, doc, "signed", rsmd.isSigned(colIndex)); //$NON-NLS-1$
+        appendElement(colDefEle, doc, "searchable", rsmd.isSearchable(colIndex)); //$NON-NLS-1$
+        appendElement(colDefEle, doc, "column-display-size", rsmd //$NON-NLS-1$
                 .getColumnDisplaySize(colIndex));
-        appendElement(colDefEle, doc, "column-label", rsmd
+        appendElement(colDefEle, doc, "column-label", rsmd //$NON-NLS-1$
                 .getColumnLabel(colIndex));
-        appendElement(colDefEle, doc, "column-name", rsmd
+        appendElement(colDefEle, doc, "column-name", rsmd //$NON-NLS-1$
                 .getColumnName(colIndex));
-        appendElement(colDefEle, doc, "schema-name", rsmd
+        appendElement(colDefEle, doc, "schema-name", rsmd //$NON-NLS-1$
                 .getSchemaName(colIndex));
-        appendElement(colDefEle, doc, "column-precision", rsmd
+        appendElement(colDefEle, doc, "column-precision", rsmd //$NON-NLS-1$
                 .getPrecision(colIndex));
-        appendElement(colDefEle, doc, "column-scale", rsmd.getScale(colIndex));
-        appendElement(colDefEle, doc, "table-name", rsmd.getTableName(colIndex));
-        appendElement(colDefEle, doc, "catalog-name", rsmd
+        appendElement(colDefEle, doc, "column-scale", rsmd.getScale(colIndex)); //$NON-NLS-1$
+        appendElement(colDefEle, doc, "table-name", rsmd.getTableName(colIndex)); //$NON-NLS-1$
+        appendElement(colDefEle, doc, "catalog-name", rsmd //$NON-NLS-1$
                 .getCatalogName(colIndex));
-        appendElement(colDefEle, doc, "column-type", rsmd
+        appendElement(colDefEle, doc, "column-type", rsmd //$NON-NLS-1$
                 .getColumnType(colIndex));
-        appendElement(colDefEle, doc, "column-type-name", rsmd
+        appendElement(colDefEle, doc, "column-type-name", rsmd //$NON-NLS-1$
                 .getColumnTypeName(colIndex));
         ele.appendChild(colDefEle);
     }

Modified: harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetTestCase.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetTestCase.java?rev=640730&r1=640729&r2=640730&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetTestCase.java (original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/CachedRowSetTestCase.java Tue Mar 25 00:44:22 2008
@@ -259,4 +259,22 @@
     public void testTestCase() throws Exception {
         // do nothing
     }
+
+    public void createNewTable() throws Exception {
+        st = conn.createStatement();
+        rs = conn.getMetaData().getTables(null, "APP", "CUSTOMER_INFO", null);
+        String createTableSQL = "create table CUSTOMER_INFO (ID INTEGER NOT NULL,NAME VARCHAR(30) NOT NULL)";
+        String alterTableSQL = "ALTER TABLE CUSTOMER_INFO ADD CONSTRAINT CUSTOMER_INFO_PK Primary Key (ID)";
+
+        if (!rs.next()) {
+            st.execute(createTableSQL);
+            st.execute(alterTableSQL);
+        }
+
+        st.executeUpdate("delete from CUSTOMER_INFO");
+        st
+                .executeUpdate("insert into CUSTOMER_INFO(ID,NAME) values (1111,'customer_one')");
+        st
+                .executeUpdate("insert into CUSTOMER_INFO(ID,NAME) values (5555,'customer_two')");
+    }
 }

Added: harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/WebRowSetTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/WebRowSetTest.java?rev=640730&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/WebRowSetTest.java (added)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/WebRowSetTest.java Tue Mar 25 00:44:22 2008
@@ -0,0 +1,256 @@
+/* 
+ * 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.sql.tests.internal.rowset;
+
+import java.io.FileWriter;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.sql.SQLException;
+
+import javax.sql.rowset.CachedRowSet;
+import javax.sql.rowset.WebRowSet;
+import javax.sql.rowset.spi.SyncProviderException;
+
+public class WebRowSetTest extends CachedRowSetTestCase {
+    protected WebRowSet webRs;
+
+    protected WebRowSet another;
+
+    public void testWriteAndRead() throws Exception {
+        rs = st.executeQuery("SELECT * FROM USER_INFO");
+        webRs = newWebRowSet();
+        webRs.populate(rs);
+
+        StringWriter writer = new StringWriter();
+        webRs.writeXml(writer);
+
+        another = newWebRowSet();
+        another.readXml(new StringReader(writer.getBuffer().toString()));
+
+        assertCachedRowSetEquals(webRs, another);
+    }
+
+    public void testWriteAndRead_Insert() throws Exception {
+        rs = st.executeQuery("SELECT * FROM USER_INFO");
+        webRs = newWebRowSet();
+        webRs.populate(rs);
+
+        assertTrue(webRs.next());
+        webRs.moveToInsertRow();
+        webRs.updateInt(1, 5);
+        webRs.updateString(2, "insertrow");
+        webRs.insertRow();
+        webRs.moveToCurrentRow();
+        webRs.beforeFirst();
+
+        StringWriter writer = new StringWriter();
+        webRs.writeXml(writer);
+
+        another = newWebRowSet();
+        another.readXml(new StringReader(writer.getBuffer().toString()));
+
+        assertCachedRowSetEquals(webRs, another);
+    }
+
+    public void testWriteAndRead_Update() throws Exception {
+        rs = st.executeQuery("SELECT * FROM USER_INFO");
+        webRs = newWebRowSet();
+        webRs.populate(rs);
+
+        assertTrue(webRs.absolute(3));
+        webRs.updateString(2, "updateRow");
+        webRs.updateRow();
+        
+        assertTrue(webRs.next());
+        webRs.updateString(2, "anotherUpdateRow");
+        webRs.updateRow();
+        
+        StringWriter writer = new StringWriter();
+
+        webRs.writeXml(writer);
+
+        another = newWebRowSet();
+        another.readXml(new StringReader(writer.getBuffer().toString()));
+
+        assertCachedRowSetEquals(webRs, another);
+
+    }
+    
+    public void testWriteAndRead_Delete() throws Exception {
+        rs = st.executeQuery("SELECT * FROM USER_INFO");
+        webRs = newWebRowSet();
+        webRs.populate(rs);
+
+        assertTrue(webRs.absolute(3));
+        webRs.deleteRow();
+        webRs.beforeFirst();
+
+        StringWriter writer = new StringWriter();
+
+        webRs.writeXml(writer);
+
+        another = newWebRowSet();
+        another.readXml(new StringReader(writer.getBuffer().toString()));
+
+        webRs.setShowDeleted(true);
+        another.setShowDeleted(true);
+
+        assertCachedRowSetEquals(webRs, another);
+
+        rs = st.executeQuery("SELECT * FROM USER_INFO");
+        webRs = newWebRowSet();
+        webRs.populate(rs);
+
+        assertTrue(webRs.absolute(4));
+        // set show deleted to true
+        webRs.setShowDeleted(true);
+        webRs.deleteRow();
+        webRs.absolute(3);
+        webRs.deleteRow();
+
+        writer = new StringWriter();
+        webRs.writeXml(writer);
+
+        another = newWebRowSet();
+        another.readXml(new StringReader(writer.getBuffer().toString()));
+
+        webRs.setShowDeleted(true);
+        another.setShowDeleted(true);
+
+        assertCachedRowSetEquals(webRs, another);
+
+    }
+
+    protected WebRowSet newWebRowSet() throws Exception {
+        if ("true".equals(System.getProperty("Testing Harmony"))) {
+            return (WebRowSet) Class.forName(
+                    "org.apache.harmony.sql.internal.rowset.WebRowSetImpl")
+                    .newInstance();
+        }
+        return (WebRowSet) Class.forName("com.sun.rowset.WebRowSetImpl")
+                .newInstance();
+    }
+
+    protected void assertCachedRowSetEquals(CachedRowSet expected,
+            CachedRowSet actual) throws Exception {
+        isMetaDataEquals(expected.getMetaData(), actual.getMetaData());
+        assertProperties(expected, actual);
+        assertData(expected, actual);
+    }
+
+    private void assertData(CachedRowSet expected, CachedRowSet actual)
+            throws SQLException {
+        assertEquals(expected.size(), actual.size());
+        expected.beforeFirst();
+        actual.beforeFirst();
+
+        int columnCount = expected.getMetaData().getColumnCount();
+        while (expected.next()) {
+            assertTrue(actual.next());
+            // TODO RI's bug: read deleted row from xml would become current row
+            if ("true".equals(System.getProperty("Testing Harmony"))) {
+                assertEquals(expected.rowDeleted(), actual.rowDeleted());
+            }
+            assertEquals(expected.rowInserted(), actual.rowInserted());
+            assertEquals(expected.rowUpdated(), actual.rowUpdated());
+            for (int i = 1; i <= columnCount; ++i) {
+                if (expected.getObject(i) == null) {
+                    assertNull(actual.getObject(i));
+                } else {
+                    assertEquals(expected.getObject(i).hashCode(), actual
+                            .getObject(i).hashCode());
+                }
+            }
+        }
+    }
+
+    private void assertProperties(CachedRowSet expected, CachedRowSet actual)
+            throws SQLException, SyncProviderException {
+        assertEquals(expected.getCommand(), actual.getCommand());
+        assertEquals(expected.getConcurrency(), actual.getConcurrency());
+
+        try {
+            assertEquals(expected.getCursorName(), actual.getCursorName());
+            fail("Should throw SQLException");
+        } catch (SQLException e) {
+            // expected
+        }
+        try {
+            assertEquals(expected.getMatchColumnIndexes(), actual
+                    .getMatchColumnIndexes());
+            fail("Should throw SQLException");
+        } catch (SQLException e) {
+            // expected
+        }
+
+        try {
+            assertEquals(expected.getMatchColumnNames(), actual
+                    .getMatchColumnNames());
+        } catch (SQLException e) {
+            // expected
+        }
+
+        assertEquals(expected.getStatement(), actual.getStatement());
+
+        assertEquals(expected.getEscapeProcessing(), actual
+                .getEscapeProcessing());
+        assertEquals(expected.getFetchDirection(), actual.getFetchDirection());
+        assertEquals(expected.getFetchSize(), actual.getFetchSize());
+        if (expected.getKeyColumns() != null
+                && expected.getKeyColumns().length != 0) {
+            int[] keyColumns = expected.getKeyColumns();
+            int[] copyKeyColumns = actual.getKeyColumns();
+
+            assertEquals(keyColumns.length, copyKeyColumns.length);
+            for (int i = 0; i < keyColumns.length; i++) {
+                assertEquals(keyColumns[i], copyKeyColumns[i]);
+            }
+            assertEquals(expected.getKeyColumns(), actual.getKeyColumns());
+        }
+
+        assertEquals(expected.getMaxFieldSize(), actual.getMaxFieldSize());
+        assertEquals(expected.getMaxRows(), actual.getMaxRows());
+
+        assertEquals(expected.getPageSize(), actual.getPageSize());
+        assertEquals(expected.getPassword(), actual.getPassword());
+        assertEquals(expected.getQueryTimeout(), actual.getQueryTimeout());
+
+        // TODO RI doesn't set show deleted row correctly after writeXml
+        if ("true".equals(System.getProperty("Testing Harmony"))) {
+            assertEquals(expected.getShowDeleted(), actual.getShowDeleted());
+        }
+
+        assertEquals(expected.getSyncProvider().getProviderID(), actual
+                .getSyncProvider().getProviderID());
+        assertEquals(expected.getSyncProvider().getProviderGrade(), actual
+                .getSyncProvider().getProviderGrade());
+        assertEquals(expected.getSyncProvider().getDataSourceLock(), actual
+                .getSyncProvider().getDataSourceLock());
+        assertEquals(expected.getSyncProvider().getVendor(), actual
+                .getSyncProvider().getVendor());
+        assertEquals(expected.getSyncProvider().getVersion(), actual
+                .getSyncProvider().getVersion());
+
+        assertEquals(expected.getTableName(), actual.getTableName());
+        assertEquals(expected.getTransactionIsolation(), actual
+                .getTransactionIsolation());
+        assertEquals(expected.getType(), actual.getType());
+
+        assertEquals(expected.getUsername(), actual.getUsername());
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/WebRowSetTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/XmlReaderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/XmlReaderTest.java?rev=640730&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/XmlReaderTest.java (added)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/XmlReaderTest.java Tue Mar 25 00:44:22 2008
@@ -0,0 +1,109 @@
+/*
+ *  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.sql.tests.internal.rowset;
+
+import java.io.FileReader;
+import java.io.Reader;
+import java.io.StringWriter;
+
+import javax.sql.rowset.WebRowSet;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import junit.framework.TestCase;
+
+import org.w3c.dom.Document;
+
+public class XmlReaderTest extends TestCase {
+
+    public final String XML_SRC_URL_RI = "src/test/resources/org/apache/harmony/sql/internal/rowset/XmlReaderTest_RI.xml";
+
+    public final String XML_SRC_URL_HY = "src/test/resources/org/apache/harmony/sql/internal/rowset/XmlReaderTest_HY.xml";
+
+    public final String XML_SRC_URL_INVALID_HEADER = "src/test/resources/org/apache/harmony/sql/internal/rowset/XmlFile_InvalidHeader.xml";
+
+    public String currentUrl;
+
+    public void testReaderXml_Header() throws Exception {
+        /*
+         * when run on RI, the Attribute xmlns can be empty. And the
+         * xsi:schemaLocation also can be empty. However, The value of the
+         * attribute "prefix="xmlns",localpart="xsi" can't be empty. No matter
+         * what the value of these attributes are, the output xml's header of
+         * WebRowSet keeps the same.
+         */
+        WebRowSet webRs = newWebRowSet();
+        Reader fileReader = new FileReader(XML_SRC_URL_INVALID_HEADER);
+        webRs.readXml(fileReader);
+
+        StringWriter strWriter = new StringWriter();
+        webRs.writeXml(strWriter);
+        assertFalse(-1 == strWriter.toString().indexOf(
+                "http://java.sun.com/xml/ns/jdbc"));
+        assertFalse(-1 == strWriter.toString().indexOf(
+                "http://www.w3.org/2001/XMLSchema-instance"));
+    }
+
+    public void testReaderXml_Reader() throws Exception {
+        WebRowSet webRs = newWebRowSet();
+        webRs.readXml(new FileReader(currentUrl));
+
+        /*
+         * TODO A row is marked as delete in XML. The row isn't marked as delete
+         * any more after populate to WebRowSet.
+         */
+        if (!"true".equals(System.getProperty("Testing Harmony"))) {
+            assertTrue(webRs.absolute(3));
+            assertEquals(3, webRs.getInt(1));
+            assertFalse(webRs.rowDeleted());
+            webRs.deleteRow();
+        }
+
+        Document srcDoc = DocumentBuilderFactory.newInstance()
+                .newDocumentBuilder().parse(currentUrl);
+        XmlWriterTest.assertProperties(srcDoc, webRs);
+        XmlWriterTest.assertMetadata(srcDoc, webRs);
+        XmlWriterTest.assertData(srcDoc, webRs);
+    }
+
+    public void testReaderXml_InputStream() throws Exception {
+        // TODO
+    }
+
+    public void setUp() throws Exception {
+        try {
+            Class.forName("com.sun.rowset.WebRowSetImpl");
+            currentUrl = XML_SRC_URL_RI;
+        } catch (ClassNotFoundException e) {
+            System.setProperty("Testing Harmony", "true");
+            Class
+                    .forName("org.apache.harmony.sql.internal.rowset.WebRowSetImpl");
+            currentUrl = XML_SRC_URL_HY;
+        }
+    }
+
+    protected WebRowSet newWebRowSet() throws Exception {
+        try {
+            return (WebRowSet) Class.forName("com.sun.rowset.WebRowSetImpl")
+                    .newInstance();
+        } catch (ClassNotFoundException e) {
+            return (WebRowSet) Class.forName(
+                    "org.apache.harmony.sql.internal.rowset.WebRowSetImpl")
+                    .newInstance();
+        }
+    }
+}

Propchange: harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/XmlReaderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/XmlWriterTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/XmlWriterTest.java?rev=640730&r1=640729&r2=640730&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/XmlWriterTest.java (original)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/test/java/org/apache/harmony/sql/tests/internal/rowset/XmlWriterTest.java Tue Mar 25 00:44:22 2008
@@ -20,9 +20,14 @@
 import java.io.StringReader;
 import java.io.StringWriter;
 import java.io.Writer;
+import java.math.BigDecimal;
 import java.sql.Array;
+import java.sql.Date;
+import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
+import java.sql.Time;
+import java.sql.Timestamp;
 import java.sql.Types;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -48,6 +53,131 @@
         strWriter = new StringWriter();
     }
 
+    public void testWriteXML_Unicode() throws Exception {
+        final String unicodeChar = "\u4e2d\u6587";
+        String insertSQL = "INSERT INTO USER_INFO(ID, NAME, BIGINT_T, NUMERIC_T, DECIMAL_T, SMALLINT_T, "
+                + "FLOAT_T, REAL_T, DOUBLE_T, DATE_T, TIME_T, TIMESTAMP_T) VALUES(?, ?, ?, ?, ?, ?,"
+                + "?, ?, ?, ?, ?, ?)";
+        PreparedStatement preStmt = conn.prepareStatement(insertSQL);
+        preStmt.setInt(1, 10);
+        preStmt.setString(2, unicodeChar);
+        preStmt.setLong(3, 444423L);
+        preStmt.setBigDecimal(4, new BigDecimal(12));
+        preStmt.setBigDecimal(5, new BigDecimal(23));
+        preStmt.setInt(6, 41);
+        preStmt.setFloat(7, 4.8F);
+        preStmt.setFloat(8, 4.888F);
+        preStmt.setDouble(9, 4.9999);
+        preStmt.setDate(10, new Date(965324512));
+        preStmt.setTime(11, new Time(452368512));
+        preStmt.setTimestamp(12, new Timestamp(874532105));
+        preStmt.executeUpdate();
+        preStmt.close();
+
+        WebRowSet webRs = newWebRowSet();
+        rs = st.executeQuery("SELECT * FROM USER_INFO");
+        webRs.populate(rs);
+        webRs.writeXml(strWriter);
+        assertTrue(webRs.last());
+        assertEquals(unicodeChar, webRs.getString(2));
+        assertFalse(-1 == strWriter.toString().indexOf(unicodeChar));
+
+        WebRowSet webRs2 = newWebRowSet();
+        webRs2.readXml(new StringReader(strWriter.toString()));
+        assertTrue(webRs2.last());
+        assertEquals(unicodeChar, webRs2.getString(2));
+    }
+
+    public void testWriteXML_Listener() throws Exception {
+        /*
+         * First, populate WebRowSet using ResultSet; then call WebRowSet's
+         * writeXml(), write to StringWriter; call readXml() to read the
+         * StringWriter's content again. See what happens: The properties and
+         * metadata remains the same. Only four new rows which are the same as
+         * the original data in WebRowSet are added.
+         */
+        WebRowSet webRs = newWebRowSet();
+        rs = st.executeQuery("SELECT * FROM USER_INFO");
+        webRs.populate(rs);
+        ResultSetMetaData meta = webRs.getMetaData();
+        // register listener
+        Listener listener = new Listener();
+        webRs.addRowSetListener(listener);
+        assertNull(listener.getTag());
+        // write to StringWriter
+        webRs.writeXml(strWriter);
+        webRs.beforeFirst();
+        // read from StringWriter
+        webRs.readXml(new StringReader(strWriter.toString()));
+        isMetaDataEquals(meta, webRs.getMetaData());
+        webRs.beforeFirst();
+        int index = 0;
+        while (webRs.next()) {
+            index++;
+            if (index > 4) {
+                assertEquals(index - 4, webRs.getInt(1));
+            } else {
+                assertEquals(index, webRs.getInt(1));
+            }
+        }
+        // TODO How to solve the difference between RI and Harmony
+        // assertEquals(8, index);
+
+        /*
+         * Create a new table. Then populate it to WebRowSet. See what happens:
+         * The metadata and the row datas come from the new table.
+         */
+        createNewTable();
+        rs = st.executeQuery("SELECT * FROM CUSTOMER_INFO");
+        index = 0;
+        while (rs.next()) {
+            index++;
+            if (index == 1) {
+                assertEquals(1111, rs.getInt(1));
+                assertEquals("customer_one", rs.getString(2));
+            } else if (index == 2) {
+                assertEquals(5555, rs.getInt(1));
+                assertEquals("customer_two", rs.getString(2));
+            }
+        }
+        assertEquals(2, index);
+        rs = st.executeQuery("SELECT * FROM CUSTOMER_INFO");
+        webRs.beforeFirst();
+        listener.clear();
+        webRs.populate(rs);
+        assertEquals(CachedRowSetListenerTest.EVENT_ROWSET_CHANGED, listener
+                .getTag());
+        webRs.beforeFirst();
+        index = 0;
+        /*
+         * TODO record the difference between RI and Harmony
+         */
+        if ("true".equals(System.getProperty("Testing Harmony"))) {
+            while (webRs.next()) {
+                index++;
+                if (index == 1) {
+                    assertEquals(1111, webRs.getInt(1));
+                    assertEquals("customer_one", webRs.getString(2));
+                } else if (index == 2) {
+                    assertEquals(5555, webRs.getInt(1));
+                    assertEquals("customer_two", webRs.getString(2));
+                }
+            }
+        } else {
+            while (webRs.next()) {
+                index++;
+                if (index == 1) {
+                    assertEquals(1, webRs.getInt(1));
+                    assertEquals("hermit", webRs.getString(2));
+                } else if (index == 2) {
+                    assertEquals(2, webRs.getInt(1));
+                    assertEquals("test", webRs.getString(2));
+                }
+            }
+        }
+        assertEquals(2, index);
+    }
+
     public void testWriteXML() throws Exception {
         WebRowSet webRs = newWebRowSet();
         rs = st.executeQuery("SELECT * FROM USER_INFO");
@@ -316,7 +446,7 @@
                 .newInstance();
     }
 
-    public Document getDocument(StringWriter strWriter) throws Exception {
+    private Document getDocument(StringWriter strWriter) throws Exception {
         StringBuffer buffer = strWriter.getBuffer();
         DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance()
                 .newDocumentBuilder();
@@ -324,7 +454,7 @@
                 .toString())));
     }
 
-    public void assertProperties(Document doc, WebRowSet webRs)
+    public static void assertProperties(Document doc, WebRowSet webRs)
             throws Exception {
         Element element = (Element) doc.getFirstChild();
         Element prop = getElement(element, "properties");
@@ -507,13 +637,14 @@
 
     }
 
-    private Element getElement(Element node, String name) {
+    private static Element getElement(Element node, String name) {
         NodeList list = node.getElementsByTagName(name);
         assertEquals(1, list.getLength());
         return (Element) list.item(0);
     }
 
-    public void assertMetadata(Document doc, WebRowSet webRs) throws Exception {
+    public static void assertMetadata(Document doc, WebRowSet webRs)
+            throws Exception {
         boolean isArrived = false;
         ResultSetMetaData meta = webRs.getMetaData();
         NodeList nodeList = doc.getFirstChild().getChildNodes();
@@ -658,7 +789,8 @@
         assertTrue(isArrived);
     }
 
-    public void assertData(Document doc, WebRowSet webRs) throws Exception {
+    public static void assertData(Document doc, WebRowSet webRs)
+            throws Exception {
         webRs.setShowDeleted(true);
         webRs.beforeFirst();
 
@@ -678,7 +810,7 @@
         webRs.setShowDeleted(false);
     }
 
-    private void assertRow(Element ele, WebRowSet webRs, int rowIndex)
+    private static void assertRow(Element ele, WebRowSet webRs, int rowIndex)
             throws Exception {
         assertTrue(webRs.absolute(rowIndex));
         String rowTag = null;

Added: harmony/enhanced/classlib/trunk/modules/sql/src/test/resources/org/apache/harmony/sql/internal/rowset/XmlFile_InvalidHeader.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/sql/src/test/resources/org/apache/harmony/sql/internal/rowset/XmlFile_InvalidHeader.xml?rev=640730&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/sql/src/test/resources/org/apache/harmony/sql/internal/rowset/XmlFile_InvalidHeader.xml (added)
+++ harmony/enhanced/classlib/trunk/modules/sql/src/test/resources/org/apache/harmony/sql/internal/rowset/XmlFile_InvalidHeader.xml Tue Mar 25 00:44:22 2008
@@ -0,0 +1,285 @@
+<?xml version="1.0"?>
+<webRowSet xmlns="" xmlns:xsi="http://www.invalid.org"
+xsi:schemaLocation="">
+  <properties>
+    <command><null/></command>
+    <concurrency>1008</concurrency>
+    <datasource><null/></datasource>
+    <escape-processing>true</escape-processing>
+    <fetch-direction>1000</fetch-direction>
+    <fetch-size>0</fetch-size>
+    <isolation-level>2</isolation-level>
+    <key-columns>
+      <column>2</column>
+      <column>1</column>
+    </key-columns>
+    <map>
+      <type>Array</type>
+      <class>java.sql.Array</class>
+      <type>VARCHAR</type>
+      <class>java.lang.String</class>
+    </map>
+    <max-field-size>0</max-field-size>
+    <max-rows>0</max-rows>
+    <query-timeout>0</query-timeout>
+    <read-only>true</read-only>
+    <rowset-type>ResultSet.TYPE_SCROLL_INSENSITIVE</rowset-type>
+    <show-deleted>false</show-deleted>
+    <table-name><null/></table-name>
+    <url><null/></url>
+    <sync-provider>
+      <sync-provider-name>com.sun.rowset.providers.RIOptimisticProvider</sync-provider-name>
+      <sync-provider-vendor>Sun Microsystems Inc.</sync-provider-vendor>
+      <sync-provider-version>1.0</sync-provider-version>
+      <sync-provider-grade>2</sync-provider-grade>
+      <data-source-lock>1</data-source-lock>
+    </sync-provider>
+  </properties>
+  <metadata>
+    <column-count>12</column-count>
+    <column-definition>
+      <column-index>1</column-index>
+      <auto-increment>false</auto-increment>
+      <case-sensitive>false</case-sensitive>
+      <currency>false</currency>
+      <nullable>0</nullable>
+      <signed>true</signed>
+      <searchable>true</searchable>
+      <column-display-size>11</column-display-size>
+      <column-label>ID</column-label>
+      <column-name>ID</column-name>
+      <schema-name>APP</schema-name>
+      <column-precision>10</column-precision>
+      <column-scale>0</column-scale>
+      <table-name>USER_INFO</table-name>
+      <catalog-name></catalog-name>
+      <column-type>4</column-type>
+      <column-type-name>INTEGER</column-type-name>
+    </column-definition>
+    <column-definition>
+      <column-index>2</column-index>
+      <auto-increment>false</auto-increment>
+      <case-sensitive>true</case-sensitive>
+      <currency>false</currency>
+      <nullable>0</nullable>
+      <signed>false</signed>
+      <searchable>true</searchable>
+      <column-display-size>10</column-display-size>
+      <column-label>NAME</column-label>
+      <column-name>NAME</column-name>
+      <schema-name>APP</schema-name>
+      <column-precision>10</column-precision>
+      <column-scale>0</column-scale>
+      <table-name>USER_INFO</table-name>
+      <catalog-name></catalog-name>
+      <column-type>12</column-type>
+      <column-type-name>VARCHAR</column-type-name>
+    </column-definition>
+    <column-definition>
+      <column-index>3</column-index>
+      <auto-increment>false</auto-increment>
+      <case-sensitive>false</case-sensitive>
+      <currency>false</currency>
+      <nullable>1</nullable>
+      <signed>true</signed>
+      <searchable>true</searchable>
+      <column-display-size>20</column-display-size>
+      <column-label>BIGINT_T</column-label>
+      <column-name>BIGINT_T</column-name>
+      <schema-name>APP</schema-name>
+      <column-precision>19</column-precision>
+      <column-scale>0</column-scale>
+      <table-name>USER_INFO</table-name>
+      <catalog-name></catalog-name>
+      <column-type>-5</column-type>
+      <column-type-name>BIGINT</column-type-name>
+    </column-definition>
+    <column-definition>
+      <column-index>4</column-index>
+      <auto-increment>false</auto-increment>
+      <case-sensitive>false</case-sensitive>
+      <currency>true</currency>
+      <nullable>1</nullable>
+      <signed>true</signed>
+      <searchable>true</searchable>
+      <column-display-size>6</column-display-size>
+      <column-label>NUMERIC_T</column-label>
+      <column-name>NUMERIC_T</column-name>
+      <schema-name>APP</schema-name>
+      <column-precision>5</column-precision>
+      <column-scale>0</column-scale>
+      <table-name>USER_INFO</table-name>
+      <catalog-name></catalog-name>
+      <column-type>2</column-type>
+      <column-type-name>NUMERIC</column-type-name>
+    </column-definition>
+    <column-definition>
+      <column-index>5</column-index>
+      <auto-increment>false</auto-increment>
+      <case-sensitive>false</case-sensitive>
+      <currency>true</currency>
+      <nullable>1</nullable>
+      <signed>true</signed>
+      <searchable>true</searchable>
+      <column-display-size>6</column-display-size>
+      <column-label>DECIMAL_T</column-label>
+      <column-name>DECIMAL_T</column-name>
+      <schema-name>APP</schema-name>
+      <column-precision>5</column-precision>
+      <column-scale>0</column-scale>
+      <table-name>USER_INFO</table-name>
+      <catalog-name></catalog-name>
+      <column-type>3</column-type>
+      <column-type-name>DECIMAL</column-type-name>
+    </column-definition>
+    <column-definition>
+      <column-index>6</column-index>
+      <auto-increment>false</auto-increment>
+      <case-sensitive>false</case-sensitive>
+      <currency>false</currency>
+      <nullable>1</nullable>
+      <signed>true</signed>
+      <searchable>true</searchable>
+      <column-display-size>6</column-display-size>
+      <column-label>SMALLINT_T</column-label>
+      <column-name>SMALLINT_T</column-name>
+      <schema-name>APP</schema-name>
+      <column-precision>5</column-precision>
+      <column-scale>0</column-scale>
+      <table-name>USER_INFO</table-name>
+      <catalog-name></catalog-name>
+      <column-type>5</column-type>
+      <column-type-name>SMALLINT</column-type-name>
+    </column-definition>
+    <column-definition>
+      <column-index>7</column-index>
+      <auto-increment>false</auto-increment>
+      <case-sensitive>false</case-sensitive>
+      <currency>false</currency>
+      <nullable>1</nullable>
+      <signed>true</signed>
+      <searchable>true</searchable>
+      <column-display-size>22</column-display-size>
+      <column-label>FLOAT_T</column-label>
+      <column-name>FLOAT_T</column-name>
+      <schema-name>APP</schema-name>
+      <column-precision>15</column-precision>
+      <column-scale>0</column-scale>
+      <table-name>USER_INFO</table-name>
+      <catalog-name></catalog-name>
+      <column-type>8</column-type>
+      <column-type-name>DOUBLE</column-type-name>
+    </column-definition>
+    <column-definition>
+      <column-index>8</column-index>
+      <auto-increment>false</auto-increment>
+      <case-sensitive>false</case-sensitive>
+      <currency>false</currency>
+      <nullable>1</nullable>
+      <signed>true</signed>
+      <searchable>true</searchable>
+      <column-display-size>13</column-display-size>
+      <column-label>REAL_T</column-label>
+      <column-name>REAL_T</column-name>
+      <schema-name>APP</schema-name>
+      <column-precision>7</column-precision>
+      <column-scale>0</column-scale>
+      <table-name>USER_INFO</table-name>
+      <catalog-name></catalog-name>
+      <column-type>7</column-type>
+      <column-type-name>REAL</column-type-name>
+    </column-definition>
+    <column-definition>
+      <column-index>9</column-index>
+      <auto-increment>false</auto-increment>
+      <case-sensitive>false</case-sensitive>
+      <currency>false</currency>
+      <nullable>1</nullable>
+      <signed>true</signed>
+      <searchable>true</searchable>
+      <column-display-size>22</column-display-size>
+      <column-label>DOUBLE_T</column-label>
+      <column-name>DOUBLE_T</column-name>
+      <schema-name>APP</schema-name>
+      <column-precision>15</column-precision>
+      <column-scale>0</column-scale>
+      <table-name>USER_INFO</table-name>
+      <catalog-name></catalog-name>
+      <column-type>8</column-type>
+      <column-type-name>DOUBLE</column-type-name>
+    </column-definition>
+    <column-definition>
+      <column-index>10</column-index>
+      <auto-increment>false</auto-increment>
+      <case-sensitive>false</case-sensitive>
+      <currency>false</currency>
+      <nullable>1</nullable>
+      <signed>false</signed>
+      <searchable>true</searchable>
+      <column-display-size>10</column-display-size>
+      <column-label>DATE_T</column-label>
+      <column-name>DATE_T</column-name>
+      <schema-name>APP</schema-name>
+      <column-precision>10</column-precision>
+      <column-scale>0</column-scale>
+      <table-name>USER_INFO</table-name>
+      <catalog-name></catalog-name>
+      <column-type>91</column-type>
+      <column-type-name>DATE</column-type-name>
+    </column-definition>
+    <column-definition>
+      <column-index>11</column-index>
+      <auto-increment>false</auto-increment>
+      <case-sensitive>false</case-sensitive>
+      <currency>false</currency>
+      <nullable>1</nullable>
+      <signed>false</signed>
+      <searchable>true</searchable>
+      <column-display-size>8</column-display-size>
+      <column-label>TIME_T</column-label>
+      <column-name>TIME_T</column-name>
+      <schema-name>APP</schema-name>
+      <column-precision>8</column-precision>
+      <column-scale>0</column-scale>
+      <table-name>USER_INFO</table-name>
+      <catalog-name></catalog-name>
+      <column-type>92</column-type>
+      <column-type-name>TIME</column-type-name>
+    </column-definition>
+    <column-definition>
+      <column-index>12</column-index>
+      <auto-increment>false</auto-increment>
+      <case-sensitive>false</case-sensitive>
+      <currency>false</currency>
+      <nullable>1</nullable>
+      <signed>false</signed>
+      <searchable>true</searchable>
+      <column-display-size>26</column-display-size>
+      <column-label>TIMESTAMP_T</column-label>
+      <column-name>TIMESTAMP_T</column-name>
+      <schema-name>APP</schema-name>
+      <column-precision>26</column-precision>
+      <column-scale>6</column-scale>
+      <table-name>USER_INFO</table-name>
+      <catalog-name></catalog-name>
+      <column-type>93</column-type>
+      <column-type-name>TIMESTAMP</column-type-name>
+    </column-definition>
+  </metadata>
+  <data>
+    <currentRow>
+      <columnValue>1</columnValue>
+      <columnValue>hermit</columnValue>
+      <columnValue><null/></columnValue>
+      <columnValue><null/></columnValue>
+      <columnValue><null/></columnValue>
+      <columnValue><null/></columnValue>
+      <columnValue><null/></columnValue>
+      <columnValue><null/></columnValue>
+      <columnValue><null/></columnValue>
+      <columnValue><null/></columnValue>
+      <columnValue><null/></columnValue>
+      <columnValue><null/></columnValue>
+    </currentRow>
+  </data>
+</webRowSet>

Propchange: harmony/enhanced/classlib/trunk/modules/sql/src/test/resources/org/apache/harmony/sql/internal/rowset/XmlFile_InvalidHeader.xml
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message