src/org/ohmage/domain/Observer.java
public static String sanitizeId(
			final String id)
			throws DomainException {

		if(id == null) {
			throw new DomainException("The ID is null.");
		}

		String trimmedId = id.trim();
		if(! PATTERN_ID_VALIDATOR.matcher(trimmedId).matches()) {
			throw new DomainException(
				ErrorCode.OBSERVER_INVALID_ID,
				"The observer ID is invalid. " +
					"It must consist of only alphanumeric values, " +
					"begin with a letter, " +
					"include at least one '.', " +
					"and cannot end in a '.': " +
					trimmedId);
		}
		else if(trimmedId.length() > MAX_OBSERVER_ID_LENGTH) {
			throw new DomainException(
				ErrorCode.OBSERVER_INVALID_ID,
				"The observer ID cannot be more than " +
					MAX_OBSERVER_ID_LENGTH +
					" long: " +
					trimmedId);
		}

		return trimmedId;
	}
/**
	 * Sanitizes the observer's ID to ensure that it conforms, at least to some
	 * degree, to Java's name-spacing and doesn't contain any illegal 
	 * characters.
	 * 
	 * @param id The ID to sanitize.
	 * 
	 * @return The sanitized ID.
	 * 
	 * @throws DomainException The ID could not be sanitized because it was 
	 * 						   invalid.
	 */
Sanitizes the observer's ID to ensure that it conforms, at least to some
degree, to Java's name-spacing and doesn't contain any illegal
characters.

@param id The ID to sanitize.

@return The sanitized ID.

@throws DomainException The ID could not be sanitized because it was
invalid.
Sanitizes the observer ' s ID to ensure that it conforms at least to some degree to Java ' s name - spacing and doesn ' t contain any illegal characters . @param id The ID to sanitize . @return The sanitized ID . @throws DomainException The ID could not be sanitized because it was invalid .
public static String sanitizeId(
			final String id)
			throws DomainException {
		if(id == null) {
			throw new DomainException("The ID is null.");
		}
		String trimmedId = id.trim();
		if(! PATTERN_ID_VALIDATOR.matcher(trimmedId).matches()) {
			throw new DomainException(
				ErrorCode.OBSERVER_INVALID_ID,
				"The observer ID is invalid. " +
					"It must consist of only alphanumeric values, " +
					"begin with a letter, " +
					"include at least one '.', " +
					"and cannot end in a '.': " +
					trimmedId);
		}
		else if(trimmedId.length() > MAX_OBSERVER_ID_LENGTH) {
			throw new DomainException(
				ErrorCode.OBSERVER_INVALID_ID,
				"The observer ID cannot be more than " +
					MAX_OBSERVER_ID_LENGTH +
					" long: " +
					trimmedId);
		}
		return trimmedId;
	}
public static String sanitizeId ( final String id ) throws DomainException { if ( id == null ) { throw new DomainException ( "The ID is null." ) ; } String trimmedId = id . trim ( ) ; if ( ! PATTERN_ID_VALIDATOR . matcher ( trimmedId ) . matches ( ) ) { throw new DomainException ( ErrorCode . OBSERVER_INVALID_ID , "The observer ID is invalid. " + "It must consist of only alphanumeric values, " + "begin with a letter, " + "include at least one '.', " + "and cannot end in a '.': " + trimmedId ) ; } else if ( trimmedId . length ( ) > MAX_OBSERVER_ID_LENGTH ) { throw new DomainException ( ErrorCode . OBSERVER_INVALID_ID , "The observer ID cannot be more than " + MAX_OBSERVER_ID_LENGTH + " long: " + trimmedId ) ; } return trimmedId ; }
Sanitizes the observer's ID to ensure that it conforms, at least to some
 degree, to Java's name-spacing and doesn't contain any illegal
 characters.
Sanitizes the observer ' s ID to ensure that it conforms at least to some degree to Java ' s name - spacing and doesn ' t contain any illegal characters .