Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

Re: visad.TypeException

"Nash'at Ahmad" wrote:
> I am trying to write an application using visad which reads a datafile
> and displays it in a JInternalFrame. The first time display works fine
> but when I clear the internal frame and try to display a second time 
> I get the following exception:
> 
> visad.TypeException: ScalarType: name already used

On the first pass through, you create a bunch of RealTypes.
On the second pass, you're again trying to create them.

VisAD only allows a given type to be created once.

Instead of doing:

    latitude     = new RealType("latitude");
    longitude    = new RealType("longitude");
    domain_tuple = new RealTupleType(latitude, longitude);
    altitude     = new RealType("altitude", SI.meter, null);

you should do:

    latitude     = RealType.getRealType("latitude");
    longitude    = RealType.getRealType("longitude");
    domain_tuple = RealType.getRealTupleType(latitude, longitude);
    altitude     = RealType.getRealType("altitude", SI.meter, null);



 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690