< prev index next >

src/java.sql/share/classes/java/sql/BatchUpdateException.java

Print this page




 536        int[] tmp = (int[])fields.get("updateCounts", null);
 537        long[] tmp2 = (long[])fields.get("longUpdateCounts", null);
 538        if(tmp != null && tmp2 != null && tmp.length != tmp2.length)
 539            throw new InvalidObjectException("update counts are not the expected size");
 540        if (tmp != null)
 541            updateCounts = tmp.clone();
 542        if (tmp2 != null)
 543            longUpdateCounts = tmp2.clone();
 544        if(updateCounts == null && longUpdateCounts != null)
 545            updateCounts = copyUpdateCount(longUpdateCounts);
 546        if(longUpdateCounts == null && updateCounts != null)
 547            longUpdateCounts = copyUpdateCount(updateCounts);
 548 
 549     }
 550 
 551     /**
 552      * writeObject is called to save the state of the {@code BatchUpdateException}
 553      * to a stream.
 554      */
 555     private void writeObject(ObjectOutputStream s)
 556             throws IOException, ClassNotFoundException {
 557 
 558         ObjectOutputStream.PutField fields = s.putFields();
 559         fields.put("updateCounts", updateCounts);
 560         fields.put("longUpdateCounts", longUpdateCounts);
 561         s.writeFields();
 562     }
 563 }


 536        int[] tmp = (int[])fields.get("updateCounts", null);
 537        long[] tmp2 = (long[])fields.get("longUpdateCounts", null);
 538        if(tmp != null && tmp2 != null && tmp.length != tmp2.length)
 539            throw new InvalidObjectException("update counts are not the expected size");
 540        if (tmp != null)
 541            updateCounts = tmp.clone();
 542        if (tmp2 != null)
 543            longUpdateCounts = tmp2.clone();
 544        if(updateCounts == null && longUpdateCounts != null)
 545            updateCounts = copyUpdateCount(longUpdateCounts);
 546        if(longUpdateCounts == null && updateCounts != null)
 547            longUpdateCounts = copyUpdateCount(updateCounts);
 548 
 549     }
 550 
 551     /**
 552      * writeObject is called to save the state of the {@code BatchUpdateException}
 553      * to a stream.
 554      */
 555     private void writeObject(ObjectOutputStream s)
 556             throws IOException {
 557 
 558         ObjectOutputStream.PutField fields = s.putFields();
 559         fields.put("updateCounts", updateCounts);
 560         fields.put("longUpdateCounts", longUpdateCounts);
 561         s.writeFields();
 562     }
 563 }
< prev index next >