db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/accesslayer PkEnumeration.java
Date Sat, 22 Jan 2005 20:51:15 GMT
brj         2005/01/22 12:51:14

  Modified:    src/java/org/apache/ojb/broker/metadata/fieldaccess Tag:
                        OJB_1_0_RELEASE
                        PersistentFieldPrivilegedImplNew.java
                        PersistentFieldAutoProxyImplNew.java
               src/java/org/apache/ojb/broker/accesslayer/sql Tag:
                        OJB_1_0_RELEASE SqlSelectStatement.java
               src/java/org/apache/ojb/broker/core Tag: OJB_1_0_RELEASE
                        MtoNBroker.java
               src/java/org/apache/ojb/broker/accesslayer Tag:
                        OJB_1_0_RELEASE PkEnumeration.java
  Log:
  small refactorings based on findbugs
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.2.2.1   +3 -3      db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/Attic/PersistentFieldPrivilegedImplNew.java
  
  Index: PersistentFieldPrivilegedImplNew.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/Attic/PersistentFieldPrivilegedImplNew.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- PersistentFieldPrivilegedImplNew.java	26 Jun 2004 23:51:37 -0000	1.2
  +++ PersistentFieldPrivilegedImplNew.java	22 Jan 2005 20:51:14 -0000	1.2.2.1
  @@ -123,7 +123,7 @@
       //************************************************************
       // inner class
       //************************************************************
  -    private class SetAccessibleAction implements PrivilegedAction, Serializable
  +    private static class SetAccessibleAction implements PrivilegedAction, Serializable
       {
           static final long serialVersionUID = 8152025069698028050L;
           transient Field current;
  @@ -135,7 +135,7 @@
           }
       }
   
  -    private class UnsetAccessibleAction implements PrivilegedAction, Serializable
  +    private static class UnsetAccessibleAction implements PrivilegedAction, Serializable
       {
           static final long serialVersionUID = -2284913657454430305L;
           transient Field current;
  
  
  
  1.6.2.1   +14 -11    db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/Attic/PersistentFieldAutoProxyImplNew.java
  
  Index: PersistentFieldAutoProxyImplNew.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/Attic/PersistentFieldAutoProxyImplNew.java,v
  retrieving revision 1.6
  retrieving revision 1.6.2.1
  diff -u -r1.6 -r1.6.2.1
  --- PersistentFieldAutoProxyImplNew.java	27 Jun 2004 23:36:23 -0000	1.6
  +++ PersistentFieldAutoProxyImplNew.java	22 Jan 2005 20:51:14 -0000	1.6.2.1
  @@ -64,7 +64,7 @@
               {
                   index = 0;
                   currentPF = null;
  -                throw new AuoDetectException("Can't autodetect valid PersistentField implementation:
"
  +                throw new AutoDetectException("Can't autodetect valid PersistentField implementation:
"
                           + latestException.message, latestException.exception);
               }
               try
  @@ -73,7 +73,7 @@
               }
               catch (Exception e)
               {
  -                throw new AuoDetectException("Can't create instance for " + persistentFieldClasses[index],
e);
  +                throw new AutoDetectException("Can't create instance for " + persistentFieldClasses[index],
e);
               }
           }
           return currentPF;
  @@ -95,7 +95,7 @@
           }
           catch (Exception e)
           {
  -            if(e instanceof AuoDetectException)
  +            if(e instanceof AutoDetectException)
               {
                   throw (MetadataException) e;
               }
  @@ -116,7 +116,7 @@
           }
           catch (Exception e)
           {
  -            if(e instanceof AuoDetectException)
  +            if(e instanceof AutoDetectException)
               {
                   throw (MetadataException) e;
               }
  @@ -137,7 +137,7 @@
           }
           catch (Exception e)
           {
  -            if(e instanceof AuoDetectException)
  +            if(e instanceof AutoDetectException)
               {
                   throw (MetadataException) e;
               }
  @@ -171,8 +171,9 @@
           return (PersistentField) ClassHelper.newInstance(pfClass, types, args);
       }
   
  -    class ExceptionWrapper implements Serializable
  +    static class ExceptionWrapper implements Serializable
       {
  +        private static final long serialVersionUID = 3691042088451912249L;
           Exception exception;
           String message;
   
  @@ -183,24 +184,26 @@
           }
       }
   
  -    class AuoDetectException extends MetadataException
  +    static class AutoDetectException extends MetadataException
       {
  -        public AuoDetectException()
  +        private static final long serialVersionUID = 3257290223049585970L;
  +
  +        public AutoDetectException()
           {
               super();
           }
   
  -        public AuoDetectException(Throwable t)
  +        public AutoDetectException(Throwable t)
           {
               super(t);
           }
   
  -        public AuoDetectException(String message)
  +        public AutoDetectException(String message)
           {
               super(message);
           }
   
  -        public AuoDetectException(String message, Throwable t)
  +        public AutoDetectException(String message, Throwable t)
           {
               super(message, t);
           }
  
  
  
  No                   revision
  No                   revision
  1.22.2.2  +16 -14    db-ojb/src/java/org/apache/ojb/broker/accesslayer/sql/SqlSelectStatement.java
  
  Index: SqlSelectStatement.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/sql/SqlSelectStatement.java,v
  retrieving revision 1.22.2.1
  retrieving revision 1.22.2.2
  diff -u -r1.22.2.1 -r1.22.2.2
  --- SqlSelectStatement.java	26 Jul 2004 15:49:51 -0000	1.22.2.1
  +++ SqlSelectStatement.java	22 Jan 2005 20:51:14 -0000	1.22.2.2
  @@ -250,23 +250,25 @@
           return stmt.toString();
       }
   
  -    private void appendSuperClassJoin(ClassDescriptor cld, ClassDescriptor cldSuper, StringBuffer
stmt,
  -            StringBuffer where)
  +    private void appendSuperClassJoin(ClassDescriptor cld, ClassDescriptor cldSuper, StringBuffer
stmt, StringBuffer where)
       {
           stmt.append(",").append(cldSuper.getFullTableName());
  -        if (where != null && where.length() > 0)
  +        if (where != null)
           {
  -            where.append(" AND ");
  -        }
  -        // get reference field in super class
  -        // TODO: do not use the superclassfield anymore, just assume that the id is the
same in both tables - @see PBroker.storeToDb
  -        int superFieldRef = cld.getSuperClassFieldRef();
  -        FieldDescriptor refField = cld.getFieldDescriptorByIndex(superFieldRef);
  -        where.append(cldSuper.getFullTableName()).append(".").append(
  -                cldSuper.getAutoIncrementFields()[0].getColumnName());
  -        where.append(" = ");
  -        where.append(cld.getFullTableName()).append(".").append(refField.getColumnName());
  +            if (where.length() > 0)
  +            {
  +                where.append(" AND ");
  +            }
   
  +            // get reference field in super class
  +            // TODO: do not use the superclassfield anymore, just assume that the id is
the same in both tables - @see PBroker.storeToDb
  +            int superFieldRef = cld.getSuperClassFieldRef();
  +            FieldDescriptor refField = cld.getFieldDescriptorByIndex(superFieldRef);
  +            where.append(cldSuper.getFullTableName()).append(".").append(
  +                    cldSuper.getAutoIncrementFields()[0].getColumnName());
  +            where.append(" = ");
  +            where.append(cld.getFullTableName()).append(".").append(refField.getColumnName());
  +        }
       }
   
       private void appendSuperClassColumns(ClassDescriptor cldSub, ClassDescriptor cldSuper,
StringBuffer buf)
  
  
  
  No                   revision
  No                   revision
  1.10.2.3  +7 -8      db-ojb/src/java/org/apache/ojb/broker/core/MtoNBroker.java
  
  Index: MtoNBroker.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/MtoNBroker.java,v
  retrieving revision 1.10.2.2
  retrieving revision 1.10.2.3
  diff -u -r1.10.2.2 -r1.10.2.3
  --- MtoNBroker.java	23 Dec 2004 22:03:25 -0000	1.10.2.2
  +++ MtoNBroker.java	22 Jan 2005 20:51:14 -0000	1.10.2.3
  @@ -15,7 +15,6 @@
    * limitations under the License.
    */
   
  -import java.io.Serializable;
   import java.util.ArrayList;
   import java.util.Collection;
   import java.util.Iterator;
  @@ -407,11 +406,9 @@
       // ************************************************************************
       // inner class
       // ************************************************************************
  -    final class GenericObject implements Serializable
  +    private static final class GenericObject
       {
  -        private static final long serialVersionUID = 3690753999276225586L;
  -
  -        private String tablename;
  +         private String tablename;
           private String[] columnNames;
           private ValueContainer[] values;
   
  @@ -436,10 +433,12 @@
               if(obj instanceof GenericObject)
               {
                   GenericObject other = (GenericObject) obj;
  -                if(result = (tablename.equalsIgnoreCase(other.tablename)
  +                result = (tablename.equalsIgnoreCase(other.tablename)
                           && (columnNames != null)
                           && (other.columnNames != null)
  -                        && (columnNames.length == other.columnNames.length)))
  +                        && (columnNames.length == other.columnNames.length));
  +
  +                if(result)
                   {
                       for (int i = 0; i < columnNames.length; i++)
                       {
  
  
  
  No                   revision
  No                   revision
  1.17.2.1  +4 -3      db-ojb/src/java/org/apache/ojb/broker/accesslayer/PkEnumeration.java
  
  Index: PkEnumeration.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/PkEnumeration.java,v
  retrieving revision 1.17
  retrieving revision 1.17.2.1
  diff -u -r1.17 -r1.17.2.1
  --- PkEnumeration.java	4 Apr 2004 23:53:31 -0000	1.17
  +++ PkEnumeration.java	22 Jan 2005 20:51:14 -0000	1.17.2.1
  @@ -15,7 +15,6 @@
    * limitations under the License.
    */
   
  -import java.io.Serializable;
   import java.lang.reflect.Constructor;
   import java.sql.SQLException;
   import java.util.Enumeration;
  @@ -38,7 +37,7 @@
    * @author Thomas Mahler
    * @version $Id$
    */
  -public class PkEnumeration implements Enumeration, Serializable
  +public class PkEnumeration implements Enumeration
   {
   	static final long serialVersionUID = -834955711995869884L;
       protected boolean hasCalledCheck = false;
  @@ -177,7 +176,9 @@
           try
           {
               if (!hasCalledCheck)
  +            {    
                   hasMoreElements();
  +            }    
               hasCalledCheck = false;
               if (hasNext)
               {
  
  
  

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


Mime
View raw message