MCPcopy Create free account
hub / github.com/antlr/codebuff / from

Method from

corpus/java/training/guava/net/HostSpecifier.java:113–125  ·  view source on GitHub ↗

Attempts to return a HostSpecifier for the given string, throwing an exception if parsing fails. Always use this method in preference to #fromValid(String) for a specifier that is not already known to be valid. @throws ParseException if the specifier is not valid.

(String specifier)

Source from the content-addressed store, hash-verified

111 * @throws ParseException if the specifier is not valid.
112 */
113 public static HostSpecifier from(String specifier) throws ParseException {
114 try {
115 return fromValid(specifier);
116 } catch (IllegalArgumentException e) {
117 // Since the IAE can originate at several different points inside
118 // fromValid(), we implement this method in terms of that one rather
119 // than the reverse.
120
121 ParseException parseException = new ParseException("Invalid host specifier: " + specifier, 0);
122 parseException.initCause(e);
123 throw parseException;
124 }
125 }
126
127 /**
128 * Determines whether {@code specifier} represents a valid {@link HostSpecifier} as described in

Callers

nothing calls this directly

Calls 1

fromValidMethod · 0.95

Tested by

no test coverage detected