Name format limitations ...

Some of our user data comes in tagged with human readable names (eg.,
with spaces) which we'd like to maintain as is, but which causes
problems for RealType/ScalarType objects when they hit validateName().
I guess the question is why are there "reserved" characters for the
RealType/ScalarType name String's, or alternatively, what would break if
a name were just any String?

Would this work and are there hidden effects???


  /**
   * Throw a <CODE>TypeException</CODE> if the name is invalid.
   *
   * @param name Name to check.
   * @param type Type used in exception message.
   *
   * @exception TypeException If there is a problem with the name.
   */
  public static synchronized void validateName(String name, String type)
    throws TypeException
  {
    if (name == null) {
      throw new TypeException("ScalarType: " + type + " cannot be
null");
    }
//    if (name.indexOf(".") > -1 ||
//        name.indexOf(" ") > -1 ||
//        name.indexOf("(") > -1 ||
//        name.indexOf(")") > -1) {
//      throw new TypeException("ScalarType: " + type + " cannot contain
" +
//                              "space . ( or ) " + name);
//    }
    if (getScalarTypeByName(name) != null) {
      throw new TypeException("ScalarType: " + type + " already used");
    }
    if (Translations.containsKey(name)) {
      throw new TypeException("ScalarType: " + type + " already used" +
                              " as an alias");
    }
  }

thanks...  dlf

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