public Processor(final Segment segment, final String indentString, final boolean tidyTags, final boolean collapseWhiteSpace, final boolean removeLineBreaks, final boolean indentAllElements, final boolean indentScriptElements, final String newLine) { this.segment=segment; sourceText=segment.source.toString(); this.indentString=indentString; this.tidyTags=tidyTags; this.collapseWhiteSpace=collapseWhiteSpace || removeLineBreaks; this.removeLineBreaks=removeLineBreaks; this.indentAllElements=indentAllElements; this.indentScriptElements=indentScriptElements; this.newLine=newLine; }
private String shortSource(final Source source, final int line) { final String retval = source == null ? "" : source.toString().trim(); if (retval.length() < 300 || source == null) { return retval; } BufferedReader sr = null; try { sr = new BufferedReader(new StringReader(source.toString())); for (int i = 1; i < line; i++) { @SuppressWarnings("unused") String skip = sr.readLine(); } final String sLine = sr.readLine(); return sLine == null ? null : sLine.replaceAll("\t", " "); } catch (final Exception e) { } finally { try { if (sr != null) { sr.close(); } } catch (final IOException e) { } } return retval.substring(0, 300); }
private String shortSource(final Source source, final int line) { final String retval = source == null ? "" : source.toString().trim(); if (retval.length() < 300 || source == null) { return retval; } BufferedReader sr = null; try { sr = new BufferedReader(new StringReader(source.toString())); for (int i = 1; i < line; i++) { @SuppressWarnings("unused") String skip = sr.readLine(); } final String sLine = sr.readLine(); return sLine == null ? null : sLine.replaceAll("\t", " "); } catch (final Exception e) { } finally { try { if (sr != null) { sr.close(); } } catch (final IOException e) { } } return retval.substring(0, 300); }
Source s = new Source(comment.getTagContent()); if (!parseSource(message, s, depth, baseURL)) { Matcher matcher = PLAIN_COMMENTS_URL_PATTERN.matcher(s.toString()); while (matcher.find()) { processURL(message, depth, matcher.group(), baseURL);