tuscany-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Frank Budinsky <fra...@ca.ibm.com>
Subject Re: Help...NPE at o.a.t.sdo.impl.ClassImpl.getProperty(ClassImpl.java:192) w/multiple threads
Date Thu, 31 Aug 2006 14:47:14 GMT
Hi Ron,

Multiple threads eh .... The only way I can see this happing is when 
propertyNameToProperyMap is set back to null in getProperty(String). Could 
you try changing a couple of ClassImpl methods to the following and see if 
it fixes the problem?

  private void initAliasNames(boolean force) {
    if (propertyNameToPropertyMap == null || force)
    {
      Map result = new HashMap();
      for (Iterator i = getProperties().iterator(); i.hasNext(); )
      {
        Property property = (Property)i.next();
        result.put(property.getName(), property);

        List aliasNames = property.getAliasNames();
        for (int count = aliasNames.size(); count > 0; )
        {
          result.put(aliasNames.get(--count), property);
        }
      }
      propertyNameToPropertyMap = result;
    }
  }
 
  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated NOT
   */
  public Property getProperty(String propertyName)
  {
    initAliasNames(false);
    Property property = 
(Property)propertyNameToPropertyMap.get(propertyName);
    if (property == null && !isOpen()) {
      //propertyNameToPropertyMap = null;
      initAliasNames(true);
      property = (Property)propertyNameToPropertyMap.get(propertyName);
    }
    return property;
  }

Thanks,
Frank.

Ron Gavlin <rgavlin@yahoo.com> wrote on 08/31/2006 10:08:04 AM:

> Hi,
> 
> I receive the following NPE when using Tuscany SDO in a multi-
> threaded environment. Here is the stack trace:
> 
> java.lang.NullPointerException
> at org.apache.tuscany.sdo.impl.ClassImpl.getProperty(ClassImpl.java:192)
> at org.apache.tuscany.sdo.util.DataObjectUtil.
> getProperty(DataObjectUtil.java:2342)
> at org.apache.tuscany.sdo.util.DataObjectUtil.
> getProperty(DataObjectUtil.java:1284)
> at org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.
> setFeatureName(DataObjectUtil.java:2032)
> at org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.
> process(DataObjectUtil.java:2139)
> at org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.
> init(DataObjectUtil.java:1918)
> at org.apache.tuscany.sdo.util.DataObjectUtil$Accessor.
> create(DataObjectUtil.java:1838)
> at 
org.apache.tuscany.sdo.util.DataObjectUtil.get(DataObjectUtil.java:739)
> at 
org.apache.tuscany.sdo.util.DataObjectUtil.get(DataObjectUtil.java:213)
> ...
> 
> I suspect the NPE is due to synchronization problems with the 
> ClassImpl.propertyNameToPropertyMap. This problem occurs during load
> testing of our application. Thanks in advance for your assistance. 
> This is a show-stopper for us.
> 
> - Ron
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: tuscany-user-help@ws.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-user-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-user-help@ws.apache.org


Mime
View raw message