src/org/ohmage/util/StringUtils.java
public static boolean isValidUrn(String value) {
		if(isEmptyOrWhitespaceOnly(value)) {
			return false;
		}
		
		String s = value.toLowerCase();
		
		if(! s.startsWith("urn:")) {
			return false;
		}
		
		if(s.endsWith(":")) {
			return false;
		}
		
		String[] a = s.split(":");
		
		if(a.length < NUM_URN_SEGMENTS) { // require at least three colon-delimited sections
			return false;
		}
		
		for(int i = 1; i < a.length; i++) { // each section after the initial urn must match URN_PATTERN
			if(! URN_PATTERN.matcher(a[i]).matches()) {
				return false;
			}
		}
		
		return true;
	}
/**
	 * Validates that a String value is a valid URN value.
	 * 
	 * @return true if the provided value is a valid URN, false otherwise
	 */
Validates that a String value is a valid URN value.

@return true if the provided value is a valid URN, false otherwise
Validates that a String value is a valid URN value . @return true if the provided value is a valid URN false otherwise
public static boolean isValidUrn(String value) {
		if(isEmptyOrWhitespaceOnly(value)) {
			return false;
		}
		String s = value.toLowerCase();
		if(! s.startsWith("urn:")) {
			return false;
		}
		if(s.endsWith(":")) {
			return false;
		}
		String[] a = s.split(":");
		if(a.length < NUM_URN_SEGMENTS) { 
			return false;
		}
		for(int i = 1; i < a.length; i++) { 
			if(! URN_PATTERN.matcher(a[i]).matches()) {
				return false;
			}
		}
		return true;
	}
public static boolean isValidUrn ( String value ) { if ( isEmptyOrWhitespaceOnly ( value ) ) { return false ; } String s = value . toLowerCase ( ) ; if ( ! s . startsWith ( "urn:" ) ) { return false ; } if ( s . endsWith ( ":" ) ) { return false ; } String [ ] a = s . split ( ":" ) ; if ( a . length < NUM_URN_SEGMENTS ) { return false ; } for ( int i = 1 ; i < a . length ; i ++ ) { if ( ! URN_PATTERN . matcher ( a [ i ] ) . matches ( ) ) { return false ; } } return true ; }
Validates that a String value is a valid URN value.
Validates that a String value is a valid URN value .
// require at least three colon-delimited sections // each section after the initial urn must match URN_PATTERN