NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

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: