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/metadata/fieldaccess AnonymousPersistentFieldHelper.java
Date Thu, 23 Dec 2004 22:03:25 GMT
brj         2004/12/23 14:03:25

  Modified:    src/java/org/apache/ojb/odmg Tag: OJB_1_0_RELEASE
                        ImplementationImpl.java
               src/java/org/apache/ojb/broker/query Tag: OJB_1_0_RELEASE
                        UserAlias.java
               src/java/org/apache/ojb/broker/metadata Tag: OJB_1_0_RELEASE
                        ClassDescriptor.java DescriptorRepository.java
               src/java/org/apache/ojb/broker/core Tag: OJB_1_0_RELEASE
                        MtoNBroker.java ValueContainer.java
               src/java/org/apache/ojb/broker/metadata/fieldaccess Tag:
                        OJB_1_0_RELEASE AnonymousPersistentFieldHelper.java
  Log:
  problems detected by findbugs
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.3   +2 -2      db-ojb/src/java/org/apache/ojb/odmg/ImplementationImpl.java
  
  Index: ImplementationImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/odmg/ImplementationImpl.java,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- ImplementationImpl.java	27 Nov 2004 23:46:07 -0000	1.1.2.2
  +++ ImplementationImpl.java	23 Dec 2004 22:03:24 -0000	1.1.2.3
  @@ -79,7 +79,7 @@
           currentDatabase = curDB;
       }
   
  -    protected DatabaseImpl getCurrentDatabase()
  +    protected synchronized DatabaseImpl getCurrentDatabase()
       {
           return currentDatabase;
       }
  
  
  
  No                   revision
  No                   revision
  1.2.2.1   +4 -1      db-ojb/src/java/org/apache/ojb/broker/query/UserAlias.java
  
  Index: UserAlias.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/query/UserAlias.java,v
  retrieving revision 1.2
  retrieving revision 1.2.2.1
  diff -u -r1.2 -r1.2.2.1
  --- UserAlias.java	19 Jun 2004 09:21:37 -0000	1.2
  +++ UserAlias.java	23 Dec 2004 22:03:24 -0000	1.2.2.1
  @@ -15,6 +15,7 @@
    * limitations under the License.
    */
   
  +import java.io.Serializable;
   import java.util.ArrayList;
   import java.util.HashMap;
   import java.util.Iterator;
  @@ -30,8 +31,10 @@
    * 
    * @author <a href="mailto:philip.warrick@mcgill.ca">Phil Warrick</a> 
    */
  -public class UserAlias
  +public class UserAlias implements Serializable
   {
  +    private static final long serialVersionUID = 3257282552220627249L;
  +    
       private Map m_mapping = new HashMap();
       private String m_name = null;
       private String m_attributePath = null;
  
  
  
  No                   revision
  No                   revision
  1.88.2.3  +7 -7      db-ojb/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java
  
  Index: ClassDescriptor.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/ClassDescriptor.java,v
  retrieving revision 1.88.2.2
  retrieving revision 1.88.2.3
  diff -u -r1.88.2.2 -r1.88.2.3
  --- ClassDescriptor.java	26 Nov 2004 19:32:06 -0000	1.88.2.2
  +++ ClassDescriptor.java	23 Dec 2004 22:03:24 -0000	1.88.2.3
  @@ -1776,7 +1776,7 @@
       /**
        * sets the initialization method for this descriptor
        */
  -    private void setInitializationMethod(Method newMethod)
  +    private synchronized void setInitializationMethod(Method newMethod)
       {
           if (newMethod != null)
           {
  @@ -1802,7 +1802,7 @@
       /**
        * sets the initialization method for this descriptor by name
        */
  -    public void setInitializationMethod(String newMethodName)
  +    public synchronized void setInitializationMethod(String newMethodName)
       {
           Method newMethod = null;
           if (newMethodName != null)
  @@ -1903,7 +1903,7 @@
        * descriptor.
        * @see #setFactoryMethod
        */
  -    public void setFactoryClass(Class newClass)
  +    public synchronized void setFactoryClass(Class newClass)
       {
           this.factoryClass = newClass;
       }
  @@ -1935,9 +1935,9 @@
       /**
        * Specify the method to instantiate objects
        * represented by this descriptor.
  -     * @see #setFactoryClass
  +     * @see #setFactoryClass 
        */
  -    private void setFactoryMethod(Method newMethod)
  +    private synchronized void setFactoryMethod(Method newMethod)
       {
           if (newMethod != null)
           {
  @@ -1964,7 +1964,7 @@
       /**
        * sets the initialization method for this descriptor by name
        */
  -    public void setFactoryMethod(String factoryMethodName)
  +    public synchronized void setFactoryMethod(String factoryMethodName)
       {
           Method newMethod = null;
           this.factoryMethodName = factoryMethodName;
  
  
  
  1.50.2.4  +12 -15    db-ojb/src/java/org/apache/ojb/broker/metadata/DescriptorRepository.java
  
  Index: DescriptorRepository.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/DescriptorRepository.java,v
  retrieving revision 1.50.2.3
  retrieving revision 1.50.2.4
  diff -u -r1.50.2.3 -r1.50.2.4
  --- DescriptorRepository.java	27 Nov 2004 02:10:27 -0000	1.50.2.3
  +++ DescriptorRepository.java	23 Dec 2004 22:03:25 -0000	1.50.2.4
  @@ -185,20 +185,18 @@
        * to the same table, otherwise the select queries produced won't contain the necessary
        * information to materialize extents mapped to the same class.
        */
  -    public FieldDescriptor[] getFieldDescriptorsForMultiMappedTable(ClassDescriptor targetCld)
  +    public synchronized FieldDescriptor[] getFieldDescriptorsForMultiMappedTable(ClassDescriptor
targetCld)
       {
  -        if(m_multiMappedTableMap == null)
  +        if (m_multiMappedTableMap == null)
           {
               m_multiMappedTableMap = new HashMap();
           }
  +        
           FieldDescriptor[] retval = (FieldDescriptor[]) m_multiMappedTableMap.get(targetCld.getClassNameOfObject());
           if (retval == null)
           {
  -            synchronized (m_multiMappedTableMap)
  -            {
  -                retval = getAllMappedColumns(getClassesMappedToSameTable(targetCld));
  -                m_multiMappedTableMap.put(targetCld.getClassNameOfObject(), retval);
  -            }
  +            retval = getAllMappedColumns(getClassesMappedToSameTable(targetCld));
  +            m_multiMappedTableMap.put(targetCld.getClassNameOfObject(), retval);
           }
           return retval;
       }
  @@ -476,7 +474,7 @@
           remove(clazz.getName());
       }
   
  -    private void changeDescriptorEvent()
  +    private synchronized void changeDescriptorEvent()
       {
           m_multiMappedTableMap = null;
           m_topLevelClassTable = null;
  @@ -518,16 +516,15 @@
        */
       public String toString()
       {
  -        Map temp = (Map)descriptorTable.clone();
  -        Iterator itKey = temp.keySet().iterator();
  +        Iterator it = descriptorTable.entrySet().iterator();
           ToStringBuilder buf = new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE);
           String className = "class name: ";
           String tableName = "> table name: ";
  -        while (itKey.hasNext())
  +        while (it.hasNext())
           {
  -            Object cl = itKey.next();
  -            ClassDescriptor descriptor = (ClassDescriptor) temp.get(cl);
  -            buf.append(className + cl.toString() + " =", tableName + descriptor.getFullTableName());
  +            Map.Entry me = (Map.Entry) it.next();
  +            ClassDescriptor descriptor = (ClassDescriptor) me.getValue();
  +            buf.append(className + me.getKey() + " =", tableName + descriptor.getFullTableName());
           }
           return buf.toString();
       }
  
  
  
  No                   revision
  No                   revision
  1.10.2.2  +3 -1      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.1
  retrieving revision 1.10.2.2
  diff -u -r1.10.2.1 -r1.10.2.2
  --- MtoNBroker.java	21 Sep 2004 00:29:01 -0000	1.10.2.1
  +++ MtoNBroker.java	23 Dec 2004 22:03:25 -0000	1.10.2.2
  @@ -409,6 +409,8 @@
       // ************************************************************************
       final class GenericObject implements Serializable
       {
  +        private static final long serialVersionUID = 3690753999276225586L;
  +
           private String tablename;
           private String[] columnNames;
           private ValueContainer[] values;
  
  
  
  1.7.2.1   +5 -1      db-ojb/src/java/org/apache/ojb/broker/core/ValueContainer.java
  
  Index: ValueContainer.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/core/ValueContainer.java,v
  retrieving revision 1.7
  retrieving revision 1.7.2.1
  diff -u -r1.7 -r1.7.2.1
  --- ValueContainer.java	4 Apr 2004 23:53:33 -0000	1.7
  +++ ValueContainer.java	23 Dec 2004 22:03:25 -0000	1.7.2.1
  @@ -1,5 +1,7 @@
   package org.apache.ojb.broker.core;
   
  +import java.io.Serializable;
  +
   import org.apache.ojb.broker.metadata.JdbcType;
   import org.apache.commons.lang.builder.EqualsBuilder;
   import org.apache.commons.lang.builder.HashCodeBuilder;
  @@ -18,8 +20,10 @@
    * See the License for the specific language governing permissions and
    * limitations under the License.
    */
  -public final class ValueContainer
  +public final class ValueContainer implements Serializable
   {
  +    private static final long serialVersionUID = 3689069556052340793L;
  +  
       private JdbcType m_jdbcType;
       private Object m_value;
   
  
  
  
  No                   revision
  No                   revision
  1.7.2.2   +4 -4      db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/AnonymousPersistentFieldHelper.java
  
  Index: AnonymousPersistentFieldHelper.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/metadata/fieldaccess/AnonymousPersistentFieldHelper.java,v
  retrieving revision 1.7.2.1
  retrieving revision 1.7.2.2
  diff -u -r1.7.2.1 -r1.7.2.2
  --- AnonymousPersistentFieldHelper.java	27 Jul 2004 00:33:11 -0000	1.7.2.1
  +++ AnonymousPersistentFieldHelper.java	23 Dec 2004 22:03:25 -0000	1.7.2.2
  @@ -38,10 +38,10 @@
       {
           Map descriptorTable = repository.getDescriptorTable();
           final String OBJECT = Object.class.getName();
  -        for (Iterator iter = descriptorTable.keySet().iterator(); iter.hasNext();)
  +        for (Iterator iter = descriptorTable.entrySet().iterator(); iter.hasNext();)
           {
  -            String key = (String) iter.next();
  -            ClassDescriptor cld = (ClassDescriptor) descriptorTable.get(key);
  +            Map.Entry me = (Map.Entry) iter.next();
  +            ClassDescriptor cld = (ClassDescriptor) me.getValue();
               String baseClass = cld.getBaseClass();
               if (null != baseClass)
               {
  
  
  

---------------------------------------------------------------------
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