MCPcopy Create free account
hub / github.com/HtmlUnit/htmlunit / toString

Method toString

src/main/java/org/htmlunit/css/CssStyleSheet.java:1107–1123  ·  view source on GitHub ↗

Returns the contents of the specified input source, ignoring any IOExceptions. @param source the input source from which to read @return the contents of the specified input source, or an empty string if an IOException occurs

(final InputSource source)

Source from the content-addressed store, hash-verified

1105 * @return the contents of the specified input source, or an empty string if an {@link IOException} occurs
1106 */
1107 private static String toString(final InputSource source) {
1108 try {
1109 final Reader reader = source.getReader();
1110 if (null != reader) {
1111 // try to reset to produce some output
1112 if (reader instanceof StringReader sr) {
1113 sr.reset();
1114 }
1115 return IOUtils.toString(reader);
1116 }
1117 return "";
1118 }
1119 catch (final IOException e) {
1120 LOG.error(e.getMessage(), e);
1121 return "";
1122 }
1123 }
1124
1125 /**
1126 * Validates the list of selectors.

Callers 1

parseCSSMethod · 0.95

Calls 3

getMessageMethod · 0.80
resetMethod · 0.65
errorMethod · 0.65

Tested by

no test coverage detected