db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmcna...@apache.org
Subject cvs commit: db-torque/src/java/org/apache/torque/util BasePeer.java
Date Sat, 19 Jul 2003 19:26:34 GMT
jmcnally    2003/07/19 12:26:34

  Modified:    src/java/org/apache/torque/util BasePeer.java
  Log:
  added throwTorqueException method which avoids wrapping TorqueExceptions
  and used it wherever we were wrapping generic Exceptions.
  
  Revision  Changes    Path
  1.73      +30 -17    db-torque/src/java/org/apache/torque/util/BasePeer.java
  
  Index: BasePeer.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/java/org/apache/torque/util/BasePeer.java,v
  retrieving revision 1.72
  retrieving revision 1.73
  diff -u -r1.72 -r1.73
  --- BasePeer.java	19 Jul 2003 18:49:40 -0000	1.72
  +++ BasePeer.java	19 Jul 2003 19:26:33 -0000	1.73
  @@ -184,7 +184,7 @@
           }
           catch (Exception e)
           {
  -            throw new TorqueException(e);
  +            throwTorqueException(e);
           }
           finally
           {
  @@ -224,6 +224,19 @@
           return byteArray;
       }
   
  +    private static void throwTorqueException(Exception e)
  +        throws TorqueException
  +    {
  +        if (e instanceof TorqueException) 
  +        {
  +            throw (TorqueException)e;
  +        }
  +        else 
  +        {
  +            throw new TorqueException(e);
  +        }
  +    }
  +
       /**
        * Sets up a Schema for a table.  This schema is then normally
        * used as the argument for initTableColumns().
  @@ -439,7 +452,7 @@
               {
                   Transaction.rollback(con);   
               }
  -            throw new TorqueException(e);
  +            throw e;
           }
       }
   
  @@ -571,7 +584,7 @@
               }
               catch (Exception e)
               {
  -                throw new TorqueException(e);
  +                throwTorqueException(e);
               }
               finally
               {
  @@ -717,7 +730,7 @@
                   }
                   catch (Exception e)
                   {
  -                    throw new TorqueException(e);
  +                    throwTorqueException(e);
                   }
                   criteria.add(pk.getFullyQualifiedName(), id);
               }
  @@ -733,7 +746,7 @@
           }
           catch (Exception e)
           {
  -            throw new TorqueException(e);
  +            throwTorqueException(e);
           }
           finally
           {
  @@ -745,7 +758,7 @@
                   }
                   catch (Exception e)
                   {
  -                    throw new TorqueException(e);
  +                    throwTorqueException(e);
                   }
               }
           }
  @@ -767,7 +780,7 @@
               }
               catch (Exception e)
               {
  -                throw new TorqueException(e);
  +                throwTorqueException(e);
               }
           }
   
  @@ -876,7 +889,7 @@
                   }
                   catch (Exception e)
                   {
  -                    throw new TorqueException(e);
  +                    throwTorqueException(e);
                   }
                   shouldSave = true;
               }
  @@ -890,7 +903,7 @@
               }
               catch (Exception e)
               {
  -                throw new TorqueException(e);
  +                throwTorqueException(e);
               }
           }
           else
  @@ -1362,7 +1375,7 @@
               {
                   Transaction.rollback(con);   
               }
  -            throw new TorqueException(e);
  +            throwTorqueException(e);
           }
           return results;
       }
  @@ -1535,7 +1548,7 @@
           }
           catch (Exception e)
           {
  -            throw new TorqueException(e);
  +            throwTorqueException(e);
           }
           finally
           {
  @@ -1636,7 +1649,7 @@
           boolean singleRecord)
           throws TorqueException
       {
  -        List results;
  +        List results = null;
           try
           {
               if (numberOfResults <= 0)
  @@ -1671,7 +1684,7 @@
           }
           catch (Exception e)
           {
  -            throw new TorqueException(e);
  +            throwTorqueException(e);
           }
           return results;
       }
  @@ -1933,7 +1946,7 @@
               }
               catch (Exception e)
               {
  -                throw new TorqueException(e);
  +                throwTorqueException(e);
               }
               finally
               {
  @@ -1945,7 +1958,7 @@
                       }
                       catch (Exception e)
                       {
  -                        throw new TorqueException(e);
  +                        throwTorqueException(e);
                       }
                   }
               }
  @@ -2196,7 +2209,7 @@
           }
           catch (Exception e)
           {
  -            throw new TorqueException(e);
  +            throwTorqueException(e);
           }
           finally
           {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message