Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 63554 invoked from network); 9 Apr 2007 21:55:43 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 9 Apr 2007 21:55:43 -0000 Received: (qmail 81831 invoked by uid 500); 9 Apr 2007 21:55:49 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 81611 invoked by uid 500); 9 Apr 2007 21:55:49 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 81600 invoked by uid 500); 9 Apr 2007 21:55:49 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 81597 invoked by uid 99); 9 Apr 2007 21:55:49 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Apr 2007 14:55:49 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of davanum@gmail.com designates 64.233.184.234 as permitted sender) Received: from [64.233.184.234] (HELO wr-out-0506.google.com) (64.233.184.234) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 09 Apr 2007 14:55:41 -0700 Received: by wr-out-0506.google.com with SMTP id 36so1147289wra for ; Mon, 09 Apr 2007 14:55:20 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=jZl44PuyRHel4cSS1DzQp9D/Abybxo/co6nkmMmwRvg0ja0b2t/nUgK8aOE8hDe7AmixFMLlRgK8BTXv0cyMVQgdy3KisZDFKUUI82O+Nz2a1/5Wb3kAXcDWO5+gMp1iZ+qXuGYFWUev/mfVxqtrax3M4HU0PQJf+c2stPjR9Ug= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Zdd5lhuH0txWmH/DUl2u83mDpzqbPSGNvl2pBHjnljqIXunMFWU2DaPqYPttD+IRMUzwqebH4q0607BL1mkLA9UXu6PCODMKxRziEXuP3y1kXzblr0SNf9nkeBgpQvJnYzSzraQCZu8FZUjm6EVHF/OoUe4FTAteBRDGcGto/mA= Received: by 10.114.12.9 with SMTP id 9mr2516723wal.1176155719692; Mon, 09 Apr 2007 14:55:19 -0700 (PDT) Received: by 10.114.133.10 with HTTP; Mon, 9 Apr 2007 14:55:19 -0700 (PDT) Message-ID: <19e0530f0704091455k67f422f3v85de4ea4ca02557c@mail.gmail.com> Date: Mon, 9 Apr 2007 17:55:19 -0400 From: "Davanum Srinivas" Reply-To: dims@apache.org To: "robinsona@apache.org" Subject: Re: svn commit: r526930 [2/2] - in /webservices/axis2/trunk/java/modules/kernel: src/org/apache/axis2/util/ObjectStateUtils.java test/org/apache/axis2/engine/ObjectSaveTest.java Cc: axis2-cvs@ws.apache.org In-Reply-To: <20070409215008.429E51A983E@eris.apache.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20070409215008.429E51A983E@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Ann, Could you please avoid reformatting??? thanks, dims On 4/9/07, robinsona@apache.org wrote: > Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ObjectSaveTest.java > URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ObjectSaveTest.java?view=diff&rev=526930&r1=526929&r2=526930 > ============================================================================== > --- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ObjectSaveTest.java (original) > +++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/engine/ObjectSaveTest.java Mon Apr 9 14:50:06 2007 > @@ -17,9 +17,11 @@ > package org.apache.axis2.engine; > > import junit.framework.TestCase; > + > import org.apache.axis2.util.MetaDataEntry; > import org.apache.axis2.util.ObjectStateUtils; > > +import javax.xml.namespace.QName; > import java.io.Externalizable; > import java.io.File; > import java.io.FileInputStream; > @@ -29,63 +31,70 @@ > import java.io.ObjectInputStream; > import java.io.ObjectOutputStream; > import java.io.PrintStream; > +import java.io.Serializable; > import java.util.ArrayList; > import java.util.HashMap; > import java.util.LinkedList; > > -public class ObjectSaveTest extends TestCase { > +public class ObjectSaveTest extends TestCase > +{ > private String testArg = null; > > // simple constructor needed for nested class Externalizable interface > - public ObjectSaveTest() { > + public ObjectSaveTest() > + { > } > > - public ObjectSaveTest(String arg0) { > + public ObjectSaveTest(String arg0) > + { > super(arg0); > testArg = new String(arg0); > } > > > - protected void setUp() throws Exception { > + protected void setUp() throws Exception > + { > //org.apache.log4j.BasicConfigurator.configure(); > } > > > - public void testObjectSerializable() throws Exception { > - File theFile = null; > - String theFilename = null; > - boolean saved = false; > - boolean restored = false; > - boolean done = false; > + public void testObjectSerializable() throws Exception > + { > + File theFile = null; > + String theFilename = null; > + boolean saved = false; > + boolean restored = false; > + boolean done = false; > > System.out.println("ObjectSaveTest:testObjectSerializable(): BEGIN ---------------"); > > // --------------------------------------------------------- > // setup an object to use > // --------------------------------------------------------- > - MetaDataEntry obj = new MetaDataEntry("object_1", "object_1"); > + MetaDataEntry obj = new MetaDataEntry("object_1","object_1"); > > // --------------------------------------------------------- > // setup a temporary file to use > // --------------------------------------------------------- > - try { > - theFile = File.createTempFile("objectTest", null); > + try > + { > + theFile = File.createTempFile("objectTest",null); > theFilename = theFile.getName(); > - System.out.println( > - "ObjectSaveTest:testObjectSerializable(): temp file = [" + theFilename + "]"); > + System.out.println("ObjectSaveTest:testObjectSerializable(): temp file = ["+theFilename+"]"); > } > - catch (Exception ex) { > - System.out.println( > - "ObjectSaveTest:testObjectSerializable(): error creating temp file = [" + > - ex.getMessage() + "]"); > + catch (Exception ex) > + { > + System.out.println("ObjectSaveTest:testObjectSerializable(): error creating temp file = ["+ex.getMessage()+"]"); > theFile = null; > } > > - if (theFile != null) { > + if (theFile != null) > + { > // --------------------------------------------------------- > // save to the temporary file > // --------------------------------------------------------- > - try { > + try > + { > // setup an output stream to a physical file > FileOutputStream outStream = new FileOutputStream(theFile); > > @@ -105,17 +114,14 @@ > outStream.close(); > > saved = true; > - System.out.println( > - "ObjectSaveTest:testObjectSerializable(): ....save operation completed....."); > + System.out.println("ObjectSaveTest:testObjectSerializable(): ....save operation completed....."); > > long filesize = theFile.length(); > - System.out.println( > - "ObjectSaveTest:testObjectSerializable(): file size after save [" + > - filesize + "] temp file = [" + theFilename + "]"); > - } > - catch (Exception ex2) { > - System.out.println("ObjectSaveTest:testObjectSerializable(): error during save [" + > - ex2.getClass().getName() + " : " + ex2.getMessage() + "]"); > + System.out.println("ObjectSaveTest:testObjectSerializable(): file size after save ["+filesize+"] temp file = ["+theFilename+"]"); > + } > + catch (Exception ex2) > + { > + System.out.println("ObjectSaveTest:testObjectSerializable(): error during save ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]"); > ex2.printStackTrace(); > } > > @@ -124,7 +130,8 @@ > // --------------------------------------------------------- > // restore from the temporary file > // --------------------------------------------------------- > - try { > + try > + { > // setup an input stream to the file > FileInputStream inStream = new FileInputStream(theFile); > > @@ -135,20 +142,17 @@ > // try to restore the options > System.out.println("ObjectSaveTest:testObjectSerializable(): restoring ....."); > restored = false; > - MetaDataEntry restored_obj = (MetaDataEntry) ObjectStateUtils > - .readObject(inObjStream, "testObject:serializable"); > + MetaDataEntry restored_obj = (MetaDataEntry) ObjectStateUtils.readObject(inObjStream, "testObject:serializable"); > inObjStream.close(); > inStream.close(); > > restored = true; > - System.out.println( > - "ObjectSaveTest:testObjectSerializable(): ....restored operation completed....."); > + System.out.println("ObjectSaveTest:testObjectSerializable(): ....restored operation completed....."); > > } > - catch (Exception ex2) { > - System.out.println( > - "ObjectSaveTest:testObjectSerializable(): error during restore [" + > - ex2.getClass().getName() + " : " + ex2.getMessage() + "]"); > + catch (Exception ex2) > + { > + System.out.println("ObjectSaveTest:testObjectSerializable(): error during restore ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]"); > ex2.printStackTrace(); > } > > @@ -157,11 +161,14 @@ > // if the save/restore of the object succeeded, > // then don't keep the temporary file around > boolean removeTmpFile = saved && restored; > - if (removeTmpFile) { > - try { > + if (removeTmpFile) > + { > + try > + { > theFile.delete(); > } > - catch (Exception e) { > + catch (Exception e) > + { > // just absorb it > } > } > @@ -177,84 +184,87 @@ > } > > > - public void testObjectNotSerializable() throws Exception { > - File theFile = null; > - String theFilename = null; > - boolean saved = false; > - boolean restored = false; > - boolean expected_exception = false; > - boolean done = false; > + public void testObjectNotSerializable() throws Exception > + { > + File theFile = null; > + String theFilename = null; > + boolean saved = false; > + boolean restored = false; > + boolean expected_exception = false; > + boolean done = false; > > System.out.println("ObjectSaveTest:testObjectNotSerializable(): BEGIN ---------------"); > > // --------------------------------------------------------- > // setup an object to use > // --------------------------------------------------------- > - NotSerializableObject obj = new NotSerializableObject("nso_1"); > + NotSerializableObject obj = new NotSerializableObject("nso_1"); > + > > // --------------------------------------------------------- > // setup a temporary file to use > // --------------------------------------------------------- > - try { > - theFile = File.createTempFile("objectTest", null); > + try > + { > + theFile = File.createTempFile("objectTest",null); > theFilename = theFile.getName(); > - System.out.println("ObjectSaveTest:testObjectNotSerializable(): temp file = [" + > - theFilename + "]"); > + System.out.println("ObjectSaveTest:testObjectNotSerializable(): temp file = ["+theFilename+"]"); > } > - catch (Exception ex) { > - System.out.println( > - "ObjectSaveTest:testObjectNotSerializable(): error creating temp file = [" + > - ex.getMessage() + "]"); > + catch (Exception ex) > + { > + System.out.println("ObjectSaveTest:testObjectNotSerializable(): error creating temp file = ["+ex.getMessage()+"]"); > theFile = null; > } > > - if (theFile != null) { > + if (theFile != null) > + { > // --------------------------------------------------------- > // save to the temporary file > // --------------------------------------------------------- > - try { > + FileOutputStream outStream = null; > + ObjectOutputStream outObjStream = null; > + try > + { > // setup an output stream to a physical file > - FileOutputStream outStream = new FileOutputStream(theFile); > + outStream = new FileOutputStream(theFile); > > // attach a stream capable of writing objects to the > // stream connected to the file > - ObjectOutputStream outObjStream = new ObjectOutputStream(outStream); > + outObjStream = new ObjectOutputStream(outStream); > > // try to save > System.out.println("ObjectSaveTest:testObjectNotSerializable(): saving ....."); > saved = false; > ObjectStateUtils.writeObject(outObjStream, obj, "testObject:NotSerializable"); > > - // close out the streams > - outObjStream.flush(); > - outObjStream.close(); > - outStream.flush(); > - outStream.close(); > - > saved = true; > - System.out.println( > - "ObjectSaveTest:testObjectNotSerializable(): ....save operation completed....."); > + System.out.println("ObjectSaveTest:testObjectNotSerializable(): ....save operation completed....."); > > long filesize = theFile.length(); > - System.out.println( > - "ObjectSaveTest:testObjectNotSerializable(): file size after save [" + > - filesize + "] temp file = [" + theFilename + "]"); > + System.out.println("ObjectSaveTest:testObjectNotSerializable(): file size after save ["+filesize+"] temp file = ["+theFilename+"]"); > } > - catch (Exception ex2) { > + catch (Exception ex2) > + { > // expect an error here > // ObjectStateUtils catches the NotSerializableException and logs it > - if (ex2 instanceof NotSerializableException) { > + if (ex2 instanceof NotSerializableException) > + { > expected_exception = true; > - } else { > - System.out.println("ObjectSaveTest:testObjectNotSerializable(): save [" + > - ex2.getClass().getName() + " : " + ex2.getMessage() + "]"); > + } > + else > + { > + System.out.println("ObjectSaveTest:testObjectNotSerializable(): save ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]"); > } > } > + // close out the streams > + if(outObjStream != null) outObjStream.close(); > + if(outStream != null) outStream.close(); > > // --------------------------------------------------------- > // restore from the temporary file > // --------------------------------------------------------- > - try { > + try > + { > // setup an input stream to the file > FileInputStream inStream = new FileInputStream(theFile); > > @@ -265,20 +275,17 @@ > // try to restore the options > System.out.println("ObjectSaveTest:testObjectSerializable(): restoring ....."); > restored = false; > - Object restored_obj = > - ObjectStateUtils.readObject(inObjStream, "testObject:NotSerializable"); > + Object restored_obj = ObjectStateUtils.readObject(inObjStream, "testObject:NotSerializable"); > inObjStream.close(); > inStream.close(); > > restored = true; > - System.out.println( > - "ObjectSaveTest:testObjectNotSerializable(): ....restored operation completed....."); > + System.out.println("ObjectSaveTest:testObjectNotSerializable(): ....restored operation completed....."); > > } > - catch (Exception ex) { > - System.out.println( > - "ObjectSaveTest:testObjectNotSerializable(): error during restore [" + > - ex.getClass().getName() + " : " + ex.getMessage() + "]"); > + catch (Exception ex) > + { > + System.out.println("ObjectSaveTest:testObjectNotSerializable(): error during restore ["+ex.getClass().getName()+" : "+ex.getMessage()+"]"); > ex.printStackTrace(); > } > > @@ -287,11 +294,14 @@ > // if the save/restore of the object succeeded, > // then don't keep the temporary file around > boolean removeTmpFile = saved && restored; > - if (removeTmpFile) { > - try { > + if (removeTmpFile) > + { > + try > + { > theFile.delete(); > } > - catch (Exception e) { > + catch (Exception e) > + { > // just absorb it > } > } > @@ -303,13 +313,14 @@ > } > > > - public void testArrayList() throws Exception { > - File theFile = null; > - String theFilename = null; > - boolean saved = false; > - boolean restored = false; > - boolean done = false; > - boolean comparesOK = false; > + public void testArrayList() throws Exception > + { > + File theFile = null; > + String theFilename = null; > + boolean saved = false; > + boolean restored = false; > + boolean done = false; > + boolean comparesOK = false; > > System.out.println("ObjectSaveTest:testArrayList(): BEGIN ---------------"); > > @@ -333,22 +344,25 @@ > // --------------------------------------------------------- > // setup a temporary file to use > // --------------------------------------------------------- > - try { > - theFile = File.createTempFile("arraylistTest", null); > + try > + { > + theFile = File.createTempFile("arraylistTest",null); > theFilename = theFile.getName(); > - System.out.println("ObjectSaveTest:testArrayList(): temp file = [" + theFilename + "]"); > + System.out.println("ObjectSaveTest:testArrayList(): temp file = ["+theFilename+"]"); > } > - catch (Exception ex) { > - System.out.println("ObjectSaveTest:testArrayList(): error creating temp file = [" + > - ex.getMessage() + "]"); > + catch (Exception ex) > + { > + System.out.println("ObjectSaveTest:testArrayList(): error creating temp file = ["+ex.getMessage()+"]"); > theFile = null; > } > > - if (theFile != null) { > + if (theFile != null) > + { > // --------------------------------------------------------- > // save to the temporary file > // --------------------------------------------------------- > - try { > + try > + { > // setup an output stream to a physical file > FileOutputStream outStream = new FileOutputStream(theFile); > > @@ -368,16 +382,14 @@ > outStream.close(); > > saved = true; > - System.out.println( > - "ObjectSaveTest:testArrayList(): ....save operation completed....."); > + System.out.println("ObjectSaveTest:testArrayList(): ....save operation completed....."); > > long filesize = theFile.length(); > - System.out.println("ObjectSaveTest:testArrayList(): file size after save [" + > - filesize + "] temp file = [" + theFilename + "]"); > + System.out.println("ObjectSaveTest:testArrayList(): file size after save ["+filesize+"] temp file = ["+theFilename+"]"); > } > - catch (Exception ex2) { > - System.out.println("ObjectSaveTest:testArrayList(): error during save [" + > - ex2.getClass().getName() + " : " + ex2.getMessage() + "]"); > + catch (Exception ex2) > + { > + System.out.println("ObjectSaveTest:testArrayList(): error during save ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]"); > ex2.printStackTrace(); > } > > @@ -388,7 +400,8 @@ > // --------------------------------------------------------- > ArrayList restored_obj = null; > > - try { > + try > + { > // setup an input stream to the file > FileInputStream inStream = new FileInputStream(theFile); > > @@ -404,33 +417,37 @@ > inStream.close(); > > restored = true; > - System.out.println( > - "ObjectSaveTest:testArrayList(): ....restored operation completed....."); > + System.out.println("ObjectSaveTest:testArrayList(): ....restored operation completed....."); > > } > - catch (Exception ex2) { > - System.out.println("ObjectSaveTest:testArrayList(): error during restore [" + > - ex2.getClass().getName() + " : " + ex2.getMessage() + "]"); > + catch (Exception ex2) > + { > + System.out.println("ObjectSaveTest:testArrayList(): error during restore ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]"); > ex2.printStackTrace(); > } > > // if the save/restore of the object succeeded, > // then don't keep the temporary file around > boolean removeTmpFile = saved && restored; > - if (removeTmpFile) { > - try { > + if (removeTmpFile) > + { > + try > + { > theFile.delete(); > } > - catch (Exception e) { > + catch (Exception e) > + { > // just absorb it > } > } > > assertTrue(restored); > > - if (restored_obj != null) { > + if (restored_obj != null) > + { > int restored_size = restored_obj.size(); > - if (restored_size == (initial_size - 1)) { > + if (restored_size == (initial_size-1)) > + { > comparesOK = true; > } > } > @@ -438,7 +455,7 @@ > // TODO: check for exact entries > > assertTrue(comparesOK); > - > + > // indicate that the temp file was created ok > done = true; > } > @@ -450,13 +467,14 @@ > } > > > - public void testHashMap() throws Exception { > - File theFile = null; > - String theFilename = null; > - boolean saved = false; > - boolean restored = false; > - boolean done = false; > - boolean comparesOK = false; > + public void testHashMap() throws Exception > + { > + File theFile = null; > + String theFilename = null; > + boolean saved = false; > + boolean restored = false; > + boolean done = false; > + boolean comparesOK = false; > > System.out.println("ObjectSaveTest:testHashMap(): BEGIN ---------------"); > > @@ -474,7 +492,7 @@ > obj.put(new String("key8"), new Integer(5)); > obj.put(new String("key9"), new Integer(6)); > obj.put(new NotSerializableObject("TestForHashMapKey"), new Integer(7)); > - obj.put(new String("key10"), new Integer(8)); > + obj.put(new String("key10"),new Integer(8)); > > > int initial_size = obj.size(); > @@ -482,22 +500,25 @@ > // --------------------------------------------------------- > // setup a temporary file to use > // --------------------------------------------------------- > - try { > - theFile = File.createTempFile("hashmapTest", null); > + try > + { > + theFile = File.createTempFile("hashmapTest",null); > theFilename = theFile.getName(); > - System.out.println("ObjectSaveTest:testHashMap(): temp file = [" + theFilename + "]"); > + System.out.println("ObjectSaveTest:testHashMap(): temp file = ["+theFilename+"]"); > } > - catch (Exception ex) { > - System.out.println("ObjectSaveTest:testHashMap(): error creating temp file = [" + > - ex.getMessage() + "]"); > + catch (Exception ex) > + { > + System.out.println("ObjectSaveTest:testHashMap(): error creating temp file = ["+ex.getMessage()+"]"); > theFile = null; > } > > - if (theFile != null) { > + if (theFile != null) > + { > // --------------------------------------------------------- > // save to the temporary file > // --------------------------------------------------------- > - try { > + try > + { > // setup an output stream to a physical file > FileOutputStream outStream = new FileOutputStream(theFile); > > @@ -517,16 +538,14 @@ > outStream.close(); > > saved = true; > - System.out > - .println("ObjectSaveTest:testHashMap(): ....save operation completed....."); > + System.out.println("ObjectSaveTest:testHashMap(): ....save operation completed....."); > > long filesize = theFile.length(); > - System.out.println("ObjectSaveTest:testHashMap(): file size after save [" + > - filesize + "] temp file = [" + theFilename + "]"); > + System.out.println("ObjectSaveTest:testHashMap(): file size after save ["+filesize+"] temp file = ["+theFilename+"]"); > } > - catch (Exception ex2) { > - System.out.println("ObjectSaveTest:testHashMap(): error during save [" + > - ex2.getClass().getName() + " : " + ex2.getMessage() + "]"); > + catch (Exception ex2) > + { > + System.out.println("ObjectSaveTest:testHashMap(): error during save ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]"); > ex2.printStackTrace(); > } > > @@ -537,7 +556,8 @@ > // --------------------------------------------------------- > HashMap restored_obj = null; > > - try { > + try > + { > // setup an input stream to the file > FileInputStream inStream = new FileInputStream(theFile); > > @@ -553,33 +573,37 @@ > inStream.close(); > > restored = true; > - System.out.println( > - "ObjectSaveTest:testHashMap(): ....restored operation completed....."); > + System.out.println("ObjectSaveTest:testHashMap(): ....restored operation completed....."); > > } > - catch (Exception ex2) { > - System.out.println("ObjectSaveTest:testHashMap(): error during restore [" + > - ex2.getClass().getName() + " : " + ex2.getMessage() + "]"); > + catch (Exception ex2) > + { > + System.out.println("ObjectSaveTest:testHashMap(): error during restore ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]"); > ex2.printStackTrace(); > } > > // if the save/restore of the object succeeded, > // then don't keep the temporary file around > boolean removeTmpFile = saved && restored; > - if (removeTmpFile) { > - try { > + if (removeTmpFile) > + { > + try > + { > theFile.delete(); > } > - catch (Exception e) { > + catch (Exception e) > + { > // just absorb it > } > } > > assertTrue(restored); > > - if (restored_obj != null) { > + if (restored_obj != null) > + { > int restored_size = restored_obj.size(); > - if (restored_size == (initial_size - 3)) { > + if (restored_size == (initial_size-3)) > + { > // there are entries in the map that are not serializable > comparesOK = true; > } > @@ -588,7 +612,7 @@ > // TODO: check for exact entries > > assertTrue(comparesOK); > - > + > // indicate that the temp file was created ok > done = true; > } > @@ -600,13 +624,14 @@ > } > > > - public void testLinkedList() throws Exception { > - File theFile = null; > - String theFilename = null; > - boolean saved = false; > - boolean restored = false; > - boolean done = false; > - boolean comparesOK = false; > + public void testLinkedList() throws Exception > + { > + File theFile = null; > + String theFilename = null; > + boolean saved = false; > + boolean restored = false; > + boolean done = false; > + boolean comparesOK = false; > > System.out.println("ObjectSaveTest:testLinkedList(): BEGIN ---------------"); > > @@ -630,23 +655,25 @@ > // --------------------------------------------------------- > // setup a temporary file to use > // --------------------------------------------------------- > - try { > - theFile = File.createTempFile("linkedlistTest", null); > + try > + { > + theFile = File.createTempFile("linkedlistTest",null); > theFilename = theFile.getName(); > - System.out > - .println("ObjectSaveTest:testLinkedList(): temp file = [" + theFilename + "]"); > + System.out.println("ObjectSaveTest:testLinkedList(): temp file = ["+theFilename+"]"); > } > - catch (Exception ex) { > - System.out.println("ObjectSaveTest:testLinkedList(): error creating temp file = [" + > - ex.getMessage() + "]"); > + catch (Exception ex) > + { > + System.out.println("ObjectSaveTest:testLinkedList(): error creating temp file = ["+ex.getMessage()+"]"); > theFile = null; > } > > - if (theFile != null) { > + if (theFile != null) > + { > // --------------------------------------------------------- > // save to the temporary file > // --------------------------------------------------------- > - try { > + try > + { > // setup an output stream to a physical file > FileOutputStream outStream = new FileOutputStream(theFile); > > @@ -666,16 +693,14 @@ > outStream.close(); > > saved = true; > - System.out.println( > - "ObjectSaveTest:testLinkedList(): ....save operation completed....."); > + System.out.println("ObjectSaveTest:testLinkedList(): ....save operation completed....."); > > long filesize = theFile.length(); > - System.out.println("ObjectSaveTest:testLinkedList(): file size after save [" + > - filesize + "] temp file = [" + theFilename + "]"); > + System.out.println("ObjectSaveTest:testLinkedList(): file size after save ["+filesize+"] temp file = ["+theFilename+"]"); > } > - catch (Exception ex2) { > - System.out.println("ObjectSaveTest:testLinkedList(): error during save [" + > - ex2.getClass().getName() + " : " + ex2.getMessage() + "]"); > + catch (Exception ex2) > + { > + System.out.println("ObjectSaveTest:testLinkedList(): error during save ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]"); > ex2.printStackTrace(); > } > > @@ -686,7 +711,8 @@ > // --------------------------------------------------------- > LinkedList restored_obj = null; > > - try { > + try > + { > // setup an input stream to the file > FileInputStream inStream = new FileInputStream(theFile); > > @@ -697,39 +723,42 @@ > // try to restore the options > System.out.println("ObjectSaveTest:testLinkedList(): restoring ....."); > restored = false; > - restored_obj = > - ObjectStateUtils.readLinkedList(inObjStream, "testObject:LinkedList"); > + restored_obj = ObjectStateUtils.readLinkedList(inObjStream, "testObject:LinkedList"); > inObjStream.close(); > inStream.close(); > > restored = true; > - System.out.println( > - "ObjectSaveTest:testLinkedList(): ....restored operation completed....."); > + System.out.println("ObjectSaveTest:testLinkedList(): ....restored operation completed....."); > > } > - catch (Exception ex2) { > - System.out.println("ObjectSaveTest:testLinkedList(): error during restore [" + > - ex2.getClass().getName() + " : " + ex2.getMessage() + "]"); > + catch (Exception ex2) > + { > + System.out.println("ObjectSaveTest:testLinkedList(): error during restore ["+ex2.getClass().getName()+" : "+ex2.getMessage()+"]"); > ex2.printStackTrace(); > } > > // if the save/restore of the object succeeded, > // then don't keep the temporary file around > boolean removeTmpFile = saved && restored; > - if (removeTmpFile) { > - try { > + if (removeTmpFile) > + { > + try > + { > theFile.delete(); > } > - catch (Exception e) { > + catch (Exception e) > + { > // just absorb it > } > } > > assertTrue(restored); > > - if (restored_obj != null) { > + if (restored_obj != null) > + { > int restored_size = restored_obj.size(); > - if (restored_size == (initial_size - 1)) { > + if (restored_size == (initial_size-1)) > + { > comparesOK = true; > } > } > @@ -737,7 +766,7 @@ > // TODO: check for exact entries > > assertTrue(comparesOK); > - > + > // indicate that the temp file was created ok > done = true; > } > @@ -749,7 +778,10 @@ > } > > > - public class NotSerializableObject implements Externalizable { > + > + > + public class NotSerializableObject implements Externalizable > + { > private String label = "TestObject"; > private String ID = null; > > @@ -757,29 +789,34 @@ > private PrintStream ps = System.out; > > // default constructor needed for Externalizable interface > - public NotSerializableObject() { > + public NotSerializableObject() > + { > } > > - public NotSerializableObject(String identifier) { > + public NotSerializableObject(String identifier) > + { > ID = identifier; > ps = System.out; > } > - > - public void setID(String s) { > + > + public void setID(String s) > + { > ID = s; > } > > - public String getID() { > + public String getID() > + { > return ID; > } > > - public void writeExternal(java.io.ObjectOutput out) throws IOException { > + public void writeExternal(java.io.ObjectOutput out) throws IOException > + { > throw new NotSerializableException("Test Object is not serializable"); > } > > > - public void readExternal(java.io.ObjectInput in) > - throws IOException, ClassNotFoundException { > + public void readExternal(java.io.ObjectInput in) throws IOException, ClassNotFoundException > + { > throw new IOException("Test object is not serializable"); > } > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org > For additional commands, e-mail: axis-cvs-help@ws.apache.org > > -- Davanum Srinivas :: http://wso2.org/ :: Oxygen for Web Services Developers --------------------------------------------------------------------- To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org For additional commands, e-mail: axis-cvs-help@ws.apache.org