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: ScalarType: name already used

>> If I call the
>> server more than once it generates the exception:
>> 
>>   visad.TypeException: ScalarType: name already used
>> 
>> at this line
>> 
>>   RealType X=new RealType("X",null,null);
> 
> Great to hear you're making such good progress.  You can solve
> your problem like this:
>  
>   RealType X = RealType.getRealTypeByName("X");
>   if (X == null) X = new RealType("X",null,null);

An alternative solution (though probably not the one you want to use) is:

        RealType X;
        try {
          X = new RealType("X",null,null);
        } catch (TypeException e) {
          X = RealType.getRealTypeByName("X");
        }

Bill's solution is probably better for a server, since his code assumes
the variable already exists (which sounds like the more common case for
your application)


 
 
  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