Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.

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)


  • 1998 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: