Here you can find the source of assertAttributeNameIsLegal(final String attributeName)
Parameter | Description |
---|---|
attributeName | name to check |
Parameter | Description |
---|---|
IllegalArgumentException | if the attribute name is illegal according to the SAM spec. |
public static void assertAttributeNameIsLegal(final String attributeName)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from ww w . j a v a 2s. co m*/ * Check whether the given String represents a legal attribute name according to the SAM spec, * and throw an exception if it doesn't. * * Legal attribute names are two characters long, start with a letter, and end with a letter or digit. * * @param attributeName name to check * @throws IllegalArgumentException if the attribute name is illegal according to the SAM spec. */ public static void assertAttributeNameIsLegal(final String attributeName) { if (attributeName == null || attributeName.length() != 2 || !Character.isLetter(attributeName.charAt(0)) || !Character.isLetterOrDigit(attributeName.charAt(1))) { throw new IllegalArgumentException( "Read attribute " + attributeName + " invalid: attribute names must be non-null two-character Strings matching the pattern /[A-Za-z][A-Za-z0-9]/"); } } }