jdk/src/share/classes/javax/sql/rowset/serial/SerialStruct.java
changeset 11683 5e02efd89af6
parent 11129 f9ad1aadf3fa
child 14409 d879c92507ec
equal deleted inserted replaced
11682:0abce7b186a8 11683:5e02efd89af6
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    27 
    27 
    28 import java.sql.*;
    28 import java.sql.*;
    29 import javax.sql.*;
    29 import javax.sql.*;
    30 import java.io.*;
    30 import java.io.*;
    31 import java.math.*;
    31 import java.math.*;
       
    32 import java.util.Arrays;
    32 import java.util.Map;
    33 import java.util.Map;
    33 import java.util.Vector;
    34 import java.util.Vector;
    34 
    35 
    35 import javax.sql.rowset.*;
    36 import javax.sql.rowset.*;
    36 
    37 
   172      *         element being an attribute of the SQL structured type
   173      *         element being an attribute of the SQL structured type
   173      *         that this <code>SerialStruct</code> object represents
   174      *         that this <code>SerialStruct</code> object represents
   174      * @throws SerialException if an error occurs
   175      * @throws SerialException if an error occurs
   175      */
   176      */
   176     public Object[]  getAttributes() throws SerialException {
   177     public Object[]  getAttributes() throws SerialException {
   177         return attribs;
   178         Object[] val = this.attribs;
       
   179         return (val == null) ? null : Arrays.copyOf(val, val.length);
   178     }
   180     }
   179 
   181 
   180     /**
   182     /**
   181      * Retrieves the attributes for the SQL structured type that
   183      * Retrieves the attributes for the SQL structured type that
   182      * this <code>SerialStruct</code> represents as an array of
   184      * this <code>SerialStruct</code> represents as an array of
   195      * @throws SerialException if an error occurs
   197      * @throws SerialException if an error occurs
   196      */
   198      */
   197     public Object[] getAttributes(Map<String,Class<?>> map)
   199     public Object[] getAttributes(Map<String,Class<?>> map)
   198         throws SerialException
   200         throws SerialException
   199     {
   201     {
   200        return attribs;
   202         Object[] val = this.attribs;
       
   203         return (val == null) ? null : Arrays.copyOf(val, val.length);
   201     }
   204     }
   202 
   205 
   203 
   206 
   204     /**
   207     /**
   205      * Maps attributes of an SQL structured type that are not
   208      * Maps attributes of an SQL structured type that are not