Exemplo n.º 1
0
Arquivo: Name.java Projeto: enonic/xp
 private static void checkValidName(final String value) {
   for (final char c : value.toCharArray()) {
     if (!NameCharacterHelper.isValidCharacter(c)) {
       final String unicodeChar =
           c > 255 ? " (" + NameCharacterHelper.getUnicodeString(c) + ")" : "";
       throw new IllegalArgumentException("Invalid character in name: '" + c + "'" + unicodeChar);
     }
   }
 }
Exemplo n.º 2
0
Arquivo: Name.java Projeto: enonic/xp
 private static void validateName(final String name) {
   Preconditions.checkNotNull(name, "name cannot be null");
   Preconditions.checkArgument(!name.trim().isEmpty(), "name cannot be empty");
   Preconditions.checkArgument(
       NameCharacterHelper.hasNoExplicitIllegal(name),
       "Invalid name: '"
           + name
           + "'. Cannot contain "
           + Arrays.toString(NameCharacterHelper.getExplicitlyIllegalCharacters()));
   checkValidName(name);
 }