[Mobies-commit] [commit] r3856 - in UDM/trunk/judm/samples: GeneTF/src/test/edu/vanderbilt/isis/genetf/test GeneTRE/src/test/edu/vanderbilt/isis/genetre/test SBML2Ex/src/test/edu/vanderbilt/isis/sbml2ex/test TimeSeries/src/test/edu/vanderbilt/isis/timeseries/test

ksmyth at redhat1.isis.vanderbilt.edu ksmyth at redhat1.isis.vanderbilt.edu
Fri Aug 26 15:45:45 CDT 2011


Author: ksmyth
Date: Fri Aug 26 15:45:45 2011
New Revision: 3856

Log:
Fix exception handling

Modified:
   UDM/trunk/judm/samples/GeneTF/src/test/edu/vanderbilt/isis/genetf/test/GeneTFFileInstanceTest.java
   UDM/trunk/judm/samples/GeneTF/src/test/edu/vanderbilt/isis/genetf/test/GeneTFStringInstanceTest.java
   UDM/trunk/judm/samples/GeneTRE/src/test/edu/vanderbilt/isis/genetre/test/GeneTREFileInstanceTest.java
   UDM/trunk/judm/samples/GeneTRE/src/test/edu/vanderbilt/isis/genetre/test/GeneTREStringInstanceTest.java
   UDM/trunk/judm/samples/SBML2Ex/src/test/edu/vanderbilt/isis/sbml2ex/test/ReadFileTest.java
   UDM/trunk/judm/samples/SBML2Ex/src/test/edu/vanderbilt/isis/sbml2ex/test/ReadStringTest.java
   UDM/trunk/judm/samples/TimeSeries/src/test/edu/vanderbilt/isis/timeseries/test/TimeSeriesFileInstanceTest.java
   UDM/trunk/judm/samples/TimeSeries/src/test/edu/vanderbilt/isis/timeseries/test/TimeSeriesStringInstanceTest.java

Modified: UDM/trunk/judm/samples/GeneTF/src/test/edu/vanderbilt/isis/genetf/test/GeneTFFileInstanceTest.java
==============================================================================
--- UDM/trunk/judm/samples/GeneTF/src/test/edu/vanderbilt/isis/genetf/test/GeneTFFileInstanceTest.java	Fri Aug 26 15:08:58 2011	(r3855)
+++ UDM/trunk/judm/samples/GeneTF/src/test/edu/vanderbilt/isis/genetf/test/GeneTFFileInstanceTest.java	Fri Aug 26 15:45:45 2011	(r3856)
@@ -125,7 +125,7 @@
      * @param is
      * @throws UdmException
      */
-    protected void printInputStream(InputStream is) throws UdmException {
+    protected void printInputStream(InputStream is) throws UdmException, IOException {
         java.io.DataInputStream din = new java.io.DataInputStream(is);
         String xml = new String("");
         try {
@@ -133,8 +133,6 @@
             while ((line = din.readLine()) != null) {
                 xml += (line + "\n");
             }
-        } catch (IOException ex) {
-            System.out.println("Error reading from stream: " + ex.getMessage());
         } finally {
             //  close stream
             try {
@@ -181,9 +179,10 @@
     /**
      * Opens an existing data network from a file and saves in a stream.
      * @throws UdmException
+     * @throws IOException 
      */
     public void testOpenExistingFromFileSaveToStream()
-        throws UdmException {
+        throws UdmException, IOException {
         ContainerFileFactory gtf = FactoryRepository.getgenetfContainerFileFactory();
         Container con = gtf.open(NEW_INSTANCE_FILE);
 
@@ -196,13 +195,10 @@
      * Opens an existing data network from a stream and saves in a file.
      * @throws UdmException
      */
-    public void testOpenExistingFromStreamSaveToFile()
-        throws UdmException {
+    public void testOpenExistingFromStreamSaveToFile() throws IOException
+        , UdmException {
         InputStream xml = null;
-        try {
-            xml = new FileInputStream(BM_FILE_IN);
-        } catch (IOException e) {
-        }
+        xml = new FileInputStream(BM_FILE_IN);
 
         if (xml == null) {
             System.out.println(

Modified: UDM/trunk/judm/samples/GeneTF/src/test/edu/vanderbilt/isis/genetf/test/GeneTFStringInstanceTest.java
==============================================================================
--- UDM/trunk/judm/samples/GeneTF/src/test/edu/vanderbilt/isis/genetf/test/GeneTFStringInstanceTest.java	Fri Aug 26 15:08:58 2011	(r3855)
+++ UDM/trunk/judm/samples/GeneTF/src/test/edu/vanderbilt/isis/genetf/test/GeneTFStringInstanceTest.java	Fri Aug 26 15:45:45 2011	(r3856)
@@ -7,6 +7,7 @@
 
 import java.io.BufferedWriter;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.RandomAccessFile;
@@ -99,7 +100,7 @@
      * @param is
      * @throws UdmException
      */
-    protected void printInputStream(InputStream is) throws UdmException {
+    protected void printInputStream(InputStream is) throws UdmException, IOException {
         java.io.DataInputStream din = new java.io.DataInputStream(is);
         String xml = new String("");
         try {
@@ -107,8 +108,6 @@
             while ((line = din.readLine()) != null) {
                 xml += (line + "\n");
             }
-        } catch (IOException ex) {
-            System.out.println("Error reading from stream: " + ex.getMessage());
         } finally {
             //  close stream
             try {
@@ -136,9 +135,8 @@
      * Opens an existing data network from a string.
      * @throws UdmException
      */
-    public void testOpenExistingFromString() throws UdmException {
+    public void testOpenExistingFromString() throws UdmException, IOException {
         String xml = new String("");
-        try {
             RandomAccessFile raf = new RandomAccessFile(BM_FILE_IN, "r");
             String line = null;
 
@@ -146,8 +144,6 @@
                 xml += (line + "\n");
             }
             raf.close();
-        } catch (IOException e) {
-        }
 
         ContainerStringFactory gtf = FactoryRepository.getgenetfContainerStringFactory();
         UdmPseudoObject rootUPO = gtf.open(xml);
@@ -167,10 +163,9 @@
      * Opens an existing data network from a string and saves as a stream.
      * @throws UdmException
      */
-    public void testOpenExistingFromStringSaveToStream()
-        throws UdmException {
+    public void testOpenExistingFromStringSaveToStream() throws IOException
+        , UdmException {
         String xml = new String("");
-        try {
             RandomAccessFile raf = new RandomAccessFile(BM_FILE_IN, "r");
             String line = null;
 
@@ -178,8 +173,6 @@
                 xml += (line + "\n");
             }
             raf.close();
-        } catch (IOException e) {
-        }
 
         ContainerStringFactory gtf = FactoryRepository.getgenetfContainerStringFactory();
         UdmPseudoObject rootUPO = gtf.open(xml);
@@ -212,13 +205,11 @@
     /**
      * Opens an existing data network from a stream.
      * @throws UdmException
+     * @throws FileNotFoundException 
      */
-    public void testOpenExistingFromStream() throws UdmException {
+    public void testOpenExistingFromStream() throws UdmException, FileNotFoundException {
         InputStream xml = null;
-        try {
             xml = new FileInputStream(BM_FILE_IN);
-        } catch (IOException e) {
-        }
 
         ContainerStringFactory gtf = FactoryRepository.getgenetfContainerStringFactory();
         UdmPseudoObject rootUPO = gtf.open(xml);
@@ -237,14 +228,12 @@
     /**
      * Opens an existing data network from a stream and saves in a string.
      * @throws UdmException
+     * @throws FileNotFoundException 
      */
     public void testOpenExistingFromStreamSaveToString()
-        throws UdmException {
+        throws UdmException, FileNotFoundException {
         InputStream xml = null;
-        try {
             xml = new FileInputStream(BM_FILE_IN);
-        } catch (IOException e) {
-        }
 
         ContainerStringFactory gtf = FactoryRepository.getgenetfContainerStringFactory();
         UdmPseudoObject rootUPO = gtf.open(xml);

Modified: UDM/trunk/judm/samples/GeneTRE/src/test/edu/vanderbilt/isis/genetre/test/GeneTREFileInstanceTest.java
==============================================================================
--- UDM/trunk/judm/samples/GeneTRE/src/test/edu/vanderbilt/isis/genetre/test/GeneTREFileInstanceTest.java	Fri Aug 26 15:08:58 2011	(r3855)
+++ UDM/trunk/judm/samples/GeneTRE/src/test/edu/vanderbilt/isis/genetre/test/GeneTREFileInstanceTest.java	Fri Aug 26 15:45:45 2011	(r3856)
@@ -7,6 +7,7 @@
 
 import java.io.BufferedWriter;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Vector;
@@ -150,8 +151,9 @@
      * Prints the content of the specified input stream to the output.
      * @param is
      * @throws UdmException
+     * @throws IOException 
      */
-    protected void printInputStream(InputStream is) throws UdmException {
+    protected void printInputStream(InputStream is) throws UdmException, IOException {
         java.io.DataInputStream din = new java.io.DataInputStream(is);
         String xml = new String("");
         try {
@@ -159,8 +161,6 @@
             while ((line = din.readLine()) != null) {
                 xml += (line + "\n");
             }
-        } catch (IOException ex) {
-            System.out.println("Error reading from stream: " + ex.getMessage());
         } finally {
             //  close stream
             try {
@@ -203,9 +203,10 @@
     /**
      * Opens an existing data network from a file and saves in a stream.
      * @throws UdmException
+     * @throws IOException 
      */
     public void testOpenExistingFromFileSaveToStream()
-        throws UdmException {
+        throws UdmException, IOException {
         ContainerFileFactory gtf = FactoryRepository.getgenetreContainerFileFactory();
         Container con = gtf.open(NEW_INSTANCE_FILE);
 
@@ -217,14 +218,12 @@
     /**
      * Opens an existing data network from a stream and saves in a file.
      * @throws UdmException
+     * @throws FileNotFoundException 
      */
     public void testOpenExistingFromStreamSaveToFile()
-        throws UdmException {
+        throws UdmException, FileNotFoundException {
         InputStream xml = null;
-        try {
             xml = new FileInputStream(BM_FILE_IN);
-        } catch (IOException e) {
-        }
 
         if (xml == null) {
             System.out.println(

Modified: UDM/trunk/judm/samples/GeneTRE/src/test/edu/vanderbilt/isis/genetre/test/GeneTREStringInstanceTest.java
==============================================================================
--- UDM/trunk/judm/samples/GeneTRE/src/test/edu/vanderbilt/isis/genetre/test/GeneTREStringInstanceTest.java	Fri Aug 26 15:08:58 2011	(r3855)
+++ UDM/trunk/judm/samples/GeneTRE/src/test/edu/vanderbilt/isis/genetre/test/GeneTREStringInstanceTest.java	Fri Aug 26 15:45:45 2011	(r3856)
@@ -7,6 +7,7 @@
 
 import java.io.BufferedWriter;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.RandomAccessFile;
 import java.io.IOException;
 import java.io.InputStream;
@@ -152,8 +153,9 @@
      * Prints the content of the specified input stream to the output.
      * @param is
      * @throws UdmException
+     * @throws IOException 
      */
-    protected void printInputStream(InputStream is) throws UdmException {
+    protected void printInputStream(InputStream is) throws UdmException, IOException {
         java.io.DataInputStream din = new java.io.DataInputStream(is);
         String xml = new String("");
         try {
@@ -161,8 +163,6 @@
             while ((line = din.readLine()) != null) {
                 xml += (line + "\n");
             }
-        } catch (IOException ex) {
-            System.out.println("Error reading from stream: " + ex.getMessage());
         } finally {
             //  close stream
             try {
@@ -189,10 +189,10 @@
     /**
      * Opens an existing data network from a string.
      * @throws UdmException
+     * @throws IOException 
      */
-    public void testOpenExistingFromString() throws UdmException {
+    public void testOpenExistingFromString() throws UdmException, IOException {
         String xml = new String("");
-        try {
             RandomAccessFile raf = new RandomAccessFile(BM_FILE_IN, "r");
             String line = null;
 
@@ -200,8 +200,6 @@
                 xml += (line + "\n");
             }
             raf.close();
-        } catch (IOException e) {
-        }
 
         ContainerStringFactory gtf = FactoryRepository.getgenetreContainerStringFactory();
         UdmPseudoObject rootUPO = gtf.open(xml);
@@ -220,9 +218,10 @@
     /**
      * Opens an existing data network from a string and saves as a stream.
      * @throws UdmException
+     * @throws IOException 
      */
     public void testOpenExistingFromStringSaveToStream()
-        throws UdmException {
+        throws UdmException, IOException {
         String xml = new String("");
         try {
             RandomAccessFile raf = new RandomAccessFile(BM_FILE_IN, "r");
@@ -266,13 +265,11 @@
     /**
      * Opens an existing data network from a stream.
      * @throws UdmException
+     * @throws FileNotFoundException 
      */
-    public void testOpenExistingFromStream() throws UdmException {
+    public void testOpenExistingFromStream() throws UdmException, FileNotFoundException {
         InputStream xml = null;
-        try {
             xml = new FileInputStream(BM_FILE_IN);
-        } catch (IOException e) {
-        }
 
         ContainerStringFactory gtf = FactoryRepository.getgenetreContainerStringFactory();
         UdmPseudoObject rootUPO = gtf.open(xml);
@@ -291,14 +288,12 @@
     /**
      * Opens an existing data network from a stream and saves in a string.
      * @throws UdmException
+     * @throws FileNotFoundException 
      */
     public void testOpenExistingFromStreamSaveToString()
-        throws UdmException {
+        throws UdmException, FileNotFoundException {
         InputStream xml = null;
-        try {
             xml = new FileInputStream(BM_FILE_IN);
-        } catch (IOException e) {
-        }
 
         ContainerStringFactory gtf = FactoryRepository.getgenetreContainerStringFactory();
         UdmPseudoObject rootUPO = gtf.open(xml);

Modified: UDM/trunk/judm/samples/SBML2Ex/src/test/edu/vanderbilt/isis/sbml2ex/test/ReadFileTest.java
==============================================================================
--- UDM/trunk/judm/samples/SBML2Ex/src/test/edu/vanderbilt/isis/sbml2ex/test/ReadFileTest.java	Fri Aug 26 15:08:58 2011	(r3855)
+++ UDM/trunk/judm/samples/SBML2Ex/src/test/edu/vanderbilt/isis/sbml2ex/test/ReadFileTest.java	Fri Aug 26 15:45:45 2011	(r3856)
@@ -101,8 +101,9 @@
      * Prints the content of the specified input stream to the output.
      * @param is
      * @throws UdmException
+     * @throws IOException 
      */
-    protected void printInputStream(InputStream is) throws UdmException {
+    protected void printInputStream(InputStream is) throws UdmException, IOException {
         java.io.DataInputStream din = new java.io.DataInputStream(is);
         String xml = new String("");
 
@@ -112,8 +113,6 @@
             while ((line = din.readLine()) != null) {
                 xml += (line + "\n");
             }
-        } catch (IOException ex) {
-            System.out.println("Error reading from stream: " + ex.getMessage());
         } finally {
             //  close stream
             try {

Modified: UDM/trunk/judm/samples/SBML2Ex/src/test/edu/vanderbilt/isis/sbml2ex/test/ReadStringTest.java
==============================================================================
--- UDM/trunk/judm/samples/SBML2Ex/src/test/edu/vanderbilt/isis/sbml2ex/test/ReadStringTest.java	Fri Aug 26 15:08:58 2011	(r3855)
+++ UDM/trunk/judm/samples/SBML2Ex/src/test/edu/vanderbilt/isis/sbml2ex/test/ReadStringTest.java	Fri Aug 26 15:45:45 2011	(r3856)
@@ -5,6 +5,7 @@
  */
 package edu.vanderbilt.isis.sbml2ex.test;
 
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.RandomAccessFile;
@@ -101,8 +102,9 @@
      * Prints the content of the specified input stream to the output.
      * @param is
      * @throws UdmException
+     * @throws IOException 
      */
-    protected void printInputStream(InputStream is) throws UdmException {
+    protected void printInputStream(InputStream is) throws UdmException, IOException {
         java.io.DataInputStream din = new java.io.DataInputStream(is);
         String xml = new String("");
         try {
@@ -110,8 +112,6 @@
             while ((line = din.readLine()) != null) {
                 xml += (line + "\n");
             }
-        } catch (IOException ex) {
-            System.out.println("Error reading from stream: " + ex.getMessage());
         } finally {
             //  close stream
             try {
@@ -152,8 +152,9 @@
     /**
      * Opens an existing data network from a file.
      * @throws UdmException
+     * @throws IOException 
      */
-    public void testOpenExistingFromString() throws UdmException {
+    public void testOpenExistingFromString() throws UdmException, IOException {
         System.out.println("\n-----------------------------------");
         System.out.println("\tOpenExistingFromString");
         System.out.println("-----------------------------------");
@@ -215,21 +216,19 @@
     /**
       * Opens an existing data network from a file.
       * @throws UdmException
+     * @throws IOException 
       */
-    public void readStringTest(String fileName) throws UdmException {
+    public void readStringTest(String fileName) throws UdmException, IOException {
         long time1 = System.currentTimeMillis();
         sbmlStringFactory gtf = FactoryRepository.getsbmlsbmlStringFactory();
 
         StringBuffer xmlString = new StringBuffer();
-        try {
             RandomAccessFile ra = new RandomAccessFile(fileName, "r");
             String line = "";
             while ((line = ra.readLine()) != null) {
                 xmlString.append(line);
                 xmlString.append("\n");
             }
-        } catch (IOException iEx) {
-        }
 
         sbml root = gtf.open(xmlString.toString());
 

Modified: UDM/trunk/judm/samples/TimeSeries/src/test/edu/vanderbilt/isis/timeseries/test/TimeSeriesFileInstanceTest.java
==============================================================================
--- UDM/trunk/judm/samples/TimeSeries/src/test/edu/vanderbilt/isis/timeseries/test/TimeSeriesFileInstanceTest.java	Fri Aug 26 15:08:58 2011	(r3855)
+++ UDM/trunk/judm/samples/TimeSeries/src/test/edu/vanderbilt/isis/timeseries/test/TimeSeriesFileInstanceTest.java	Fri Aug 26 15:45:45 2011	(r3856)
@@ -17,6 +17,7 @@
 import junit.framework.TestCase;
 
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 
@@ -95,8 +96,9 @@
      * Prints the content of the specified input stream to the output.
      * @param is
      * @throws UdmException
+     * @throws IOException 
      */
-    protected void printInputStream(InputStream is) throws UdmException {
+    protected void printInputStream(InputStream is) throws UdmException, IOException {
         java.io.DataInputStream din = new java.io.DataInputStream(is);
         String xml = new String("");
 
@@ -106,8 +108,6 @@
             while ((line = din.readLine()) != null) {
                 xml += (line + "\n");
             }
-        } catch (IOException ex) {
-            System.out.println("Error reading from stream: " + ex.getMessage());
         } finally {
             //  close stream
             try {
@@ -153,9 +153,10 @@
     /**
      * Opens an existing data network from a file and saves in a stream.
      * @throws UdmException
+     * @throws IOException 
      */
     public void testOpenExistingFromFileSaveToStream()
-        throws UdmException {
+        throws UdmException, IOException {
         ContainerFileFactory gtf = FactoryRepository.getTimeSeriesContainerFileFactory();
         Container con = gtf.open(NEW_INSTANCE_FILE);
 
@@ -167,15 +168,13 @@
     /**
      * Opens an existing data network from a stream and saves in a file.
      * @throws UdmException
+     * @throws FileNotFoundException 
      */
     public void _testOpenExistingFromStreamSaveToFile()
-        throws UdmException {
+        throws UdmException, FileNotFoundException {
         InputStream xml = null;
 
-        try {
             xml = new FileInputStream(BM_FILE_IN);
-        } catch (IOException e) {
-        }
 
         if (xml == null) {
             System.out.println(

Modified: UDM/trunk/judm/samples/TimeSeries/src/test/edu/vanderbilt/isis/timeseries/test/TimeSeriesStringInstanceTest.java
==============================================================================
--- UDM/trunk/judm/samples/TimeSeries/src/test/edu/vanderbilt/isis/timeseries/test/TimeSeriesStringInstanceTest.java	Fri Aug 26 15:08:58 2011	(r3855)
+++ UDM/trunk/judm/samples/TimeSeries/src/test/edu/vanderbilt/isis/timeseries/test/TimeSeriesStringInstanceTest.java	Fri Aug 26 15:45:45 2011	(r3856)
@@ -18,6 +18,7 @@
 import junit.framework.TestCase;
 
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.RandomAccessFile;
@@ -97,8 +98,9 @@
      * Prints the content of the specified input stream to the output.
      * @param is
      * @throws UdmException
+     * @throws IOException 
      */
-    protected void printInputStream(InputStream is) throws UdmException {
+    protected void printInputStream(InputStream is) throws UdmException, IOException {
         java.io.DataInputStream din = new java.io.DataInputStream(is);
         String xml = new String("");
 
@@ -108,8 +110,6 @@
             while ((line = din.readLine()) != null) {
                 xml += (line + "\n");
             }
-        } catch (IOException ex) {
-            System.out.println("Error reading from stream: " + ex.getMessage());
         } finally {
             //  close stream
             try {
@@ -137,10 +137,9 @@
      * Opens an existing data network from a string.
      * @throws UdmException
      */
-    public void testOpenExistingFromString() throws UdmException {
+    public void testOpenExistingFromString() throws UdmException, IOException {
         String xml = new String("");
 
-        try {
             RandomAccessFile raf = new RandomAccessFile(BM_FILE_IN, "r");
             String line = null;
 
@@ -149,8 +148,6 @@
             }
 
             raf.close();
-        } catch (IOException e) {
-        }
 
         ContainerStringFactory gtf = FactoryRepository.getTimeSeriesContainerStringFactory();
         UdmPseudoObject rootUPO = gtf.open(xml);
@@ -171,12 +168,12 @@
     /**
      * Opens an existing data network from a string and saves as a stream.
      * @throws UdmException
+     * @throws IOException 
      */
     public void testOpenExistingFromStringSaveToStream()
-        throws UdmException {
+        throws UdmException, IOException {
         String xml = new String("");
 
-        try {
             RandomAccessFile raf = new RandomAccessFile(BM_FILE_IN, "r");
             String line = null;
 
@@ -185,8 +182,6 @@
             }
 
             raf.close();
-        } catch (IOException e) {
-        }
 
         ContainerStringFactory gtf = FactoryRepository.getTimeSeriesContainerStringFactory();
         UdmPseudoObject rootUPO = gtf.open(xml);
@@ -220,14 +215,12 @@
     /**
      * Opens an existing data network from a stream.
      * @throws UdmException
+     * @throws FileNotFoundException 
      */
-    public void testOpenExistingFromStream() throws UdmException {
+    public void testOpenExistingFromStream() throws UdmException, FileNotFoundException {
         InputStream xml = null;
 
-        try {
             xml = new FileInputStream(BM_FILE_IN);
-        } catch (IOException e) {
-        }
 
         ContainerStringFactory gtf = FactoryRepository.getTimeSeriesContainerStringFactory();
         UdmPseudoObject rootUPO = gtf.open(xml);
@@ -248,15 +241,13 @@
     /**
      * Opens an existing data network from a stream and saves in a string.
      * @throws UdmException
+     * @throws FileNotFoundException 
      */
     public void testOpenExistingFromStreamSaveToString()
-        throws UdmException {
+        throws UdmException, FileNotFoundException {
         InputStream xml = null;
 
-        try {
             xml = new FileInputStream(BM_FILE_IN);
-        } catch (IOException e) {
-        }
 
         ContainerStringFactory gtf = FactoryRepository.getTimeSeriesContainerStringFactory();
         UdmPseudoObject rootUPO = gtf.open(xml);


More information about the Mobies-commit mailing list