private static String getMessage(HttpURLConnection conn) { try (InputStream in = conn.getErrorStream()) { if (in != null) return IO.collect(in); } catch (Exception e) { // Ignore } return ""; }
String readSHAFile() throws IOException { String result; if (shaFile != null && shaFile.isFile()) result = IO.collect(shaFile); else result = null; return result; }
String readSHAFile() throws IOException { String result; if (shaFile != null && shaFile.isFile()) result = IO.collect(shaFile); else result = null; return result; }
private Version getVersion(File source, Pattern pattern) throws IOException { if (!source.isFile()) return null; String content = IO.collect(source); Matcher m = pattern.matcher(content); if (!m.find()) return null; return new Version(m.group(1)); }
@Override public void load(Reader r) throws IOException { String s = doBackslashEncoding(IO.collect(r)); super.load(new StringReader(s)); }
@Override public void load(Reader r) throws IOException { String s = doBackslashEncoding(IO.collect(r)); super.load(new StringReader(s)); }
private Version getVersion(File source, Pattern pattern) throws IOException { if (!source.isFile()) return null; String content = IO.collect(source); Matcher m = pattern.matcher(content); if (!m.find()) return null; return new Version(m.group(1)); }
public static FileLine findHeader(File f, Pattern header) throws IOException { String s = IO.collect(f); Matcher matcher = header.matcher(s); if (!matcher.find()) return null; return new FileLine(f, getLine(s, matcher.start(0)), matcher.group().length()); }
public static FileLine findHeader(File f, Pattern header) throws IOException { String s = IO.collect(f); Matcher matcher = header.matcher(s); if (!matcher.find()) return null; return new FileLine(f, getLine(s, matcher.start(0)), matcher.group().length()); }
private boolean replace(File target, final Version newVersion, Pattern pattern) throws IOException { String content = IO.collect(target); Matcher m = pattern.matcher(content); if (!m.find()) { return false; } Version oldVersion = new Version(m.group(1)); if (newVersion.compareTo(oldVersion) == 0) { return true; } return replace(newVersion, content, m, target); }
private boolean replace(File target, final Version newVersion, Pattern pattern) throws IOException { String content = IO.collect(target); Matcher m = pattern.matcher(content); if (!m.find()) { return false; } Version oldVersion = new Version(m.group(1)); if (newVersion.compareTo(oldVersion) == 0) { return true; } return replace(newVersion, content, m, target); }
@Override public void load(Reader r) throws IOException { String source = IO.collect(new NonClosingReader(r)); load(source, null, null, null); }
@Override public void load(Reader r) throws IOException { String source = IO.collect(new NonClosingReader(r)); load(source, null, null, null); }
@Override public void load(Reader r) throws IOException { String source = IO.collect(new NonClosingReader(r)); load(source, null, null, null); }
@Override public void load(Reader r) throws IOException { String source = IO.collect(new NonClosingReader(r)); load(source, null, null, null); }
@Override public void delete(Project p) throws IOException { File root = p.getWorkspace() .getFile("pom.xml"); String rootPom = IO.collect(root); if (rootPom.contains(getTag(p))) { rootPom = rootPom.replaceAll("\n\\s*" + getTag(p) + "\\s*", "\n"); IO.store(rootPom, root); } }
@Override public void delete(Project p) throws IOException { File root = p.getWorkspace().getFile("pom.xml"); String rootPom = IO.collect(root); if ( rootPom.contains(getTag(p))) { rootPom = rootPom.replaceAll("\n\\s*" + getTag(p) + "\\s*", "\n"); IO.store(rootPom, root); } }
@Override public void delete(Project p) throws IOException { File root = p.getWorkspace().getFile("pom.xml"); String rootPom = IO.collect(root); if ( rootPom.contains(getTag(p))) { rootPom = rootPom.replaceAll("\n\\s*" + getTag(p) + "\\s*", "\n"); IO.store(rootPom, root); } }
@Override public void delete(Project p) throws IOException { File root = p.getWorkspace() .getFile("pom.xml"); String rootPom = IO.collect(root); if (rootPom.contains(getTag(p))) { rootPom = rootPom.replaceAll("\n\\s*" + getTag(p) + "\\s*", "\n"); IO.store(rootPom, root); } }
@Override public void created(Project p) throws IOException { Workspace workspace = p.getWorkspace(); copy("pom.xml", "pom.xml", p); File root = workspace.getFile("pom.xml"); doRoot(p, root); String rootPom = IO.collect(root); if (!rootPom.contains(getTag(p))) { rootPom = rootPom.replaceAll("<!-- DO NOT EDIT MANAGED BY BND MAVEN LIFECYCLE PLUGIN -->\n", "$0\n\t\t" + getTag(p) + "\n"); IO.store(rootPom, root); } }