static void loadRulesFromFile(AttributesNode r, File attrs) throws FileNotFoundException, IOException { if (attrs.exists()) { try (FileInputStream in = new FileInputStream(attrs)) { r.parse(in); } } }
/** Parses a list of rules from the given file, returning an empty list if the file doesn't exist. */ private static List<AttributesRule> parseRules(@Nullable File file) { if (file != null && file.exists() && file.isFile()) { try (InputStream stream = new FileInputStream(file)) { AttributesNode parsed = new AttributesNode(); parsed.parse(stream); return parsed.getRules(); } catch (IOException e) { // no need to crash the whole plugin System.err.println("Problem parsing " + file.getAbsolutePath()); e.printStackTrace(); } } return Collections.emptyList(); }
AttributesNode load() throws IOException { AttributesNode r = new AttributesNode(); try (InputStream in = entry.openInputStream()) { r.parse(in); } return r.getRules().isEmpty() ? null : r; } }
AttributesNode load(ObjectReader reader) throws IOException { AttributesNode r = new AttributesNode(); ObjectLoader loader = reader.open(objectId); if (loader != null) { try (InputStream in = loader.openStream()) { r.parse(in); } } return r.getRules().isEmpty() ? null : r; } }
private static AttributesNode loadAttributes(ObjectReader reader, AnyObjectId id) throws IOException { AttributesNode r = new AttributesNode(); try (InputStream in = reader.open(id, OBJ_BLOB).openStream()) { r.parse(in); } return r.getRules().isEmpty() ? noAttributes() : r; }
static void loadRulesFromFile(AttributesNode r, File attrs) throws FileNotFoundException, IOException { if (attrs.exists()) { try (FileInputStream in = new FileInputStream(attrs)) { r.parse(in); } } }
static void loadRulesFromFile(AttributesNode r, File attrs) throws FileNotFoundException, IOException { if (attrs.exists()) { FileInputStream in = new FileInputStream(attrs); try { r.parse(in); } finally { in.close(); } } }
/** Parses a list of rules from the given file, returning an empty list if the file doesn't exist. */ private static List<AttributesRule> parseRules(@Nullable File file) { if (file != null && file.exists() && file.isFile()) { try (InputStream stream = new FileInputStream(file)) { AttributesNode parsed = new AttributesNode(); parsed.parse(stream); return parsed.getRules(); } catch (IOException e) { // no need to crash the whole plugin System.err.println("Problem parsing " + file.getAbsolutePath()); e.printStackTrace(); } } return Collections.emptyList(); }
AttributesNode load() throws IOException { AttributesNode r = new AttributesNode(); InputStream in = entry.openInputStream(); try { r.parse(in); } finally { in.close(); } return r.getRules().isEmpty() ? null : r; } }
AttributesNode load() throws IOException { AttributesNode r = new AttributesNode(); try (InputStream in = entry.openInputStream()) { r.parse(in); } return r.getRules().isEmpty() ? null : r; } }
AttributesNode load(ObjectReader reader) throws IOException { AttributesNode r = new AttributesNode(); ObjectLoader loader = reader.open(objectId); if (loader != null) { InputStream in = loader.openStream(); try { r.parse(in); } finally { in.close(); } } return r.getRules().isEmpty() ? null : r; } }
AttributesNode load(ObjectReader reader) throws IOException { AttributesNode r = new AttributesNode(); ObjectLoader loader = reader.open(objectId); if (loader != null) { try (InputStream in = loader.openStream()) { r.parse(in); } } return r.getRules().isEmpty() ? null : r; } }
private static AttributesNode loadAttributes(ObjectReader reader, AnyObjectId id) throws IOException { AttributesNode r = new AttributesNode(); try (InputStream in = reader.open(id, OBJ_BLOB).openStream()) { r.parse(in); } return r.getRules().isEmpty() ? noAttributes() : r; }
private static AttributesNode loadAttributes(ObjectReader reader, AnyObjectId id) throws IOException { AttributesNode r = new AttributesNode(); try (InputStream in = reader.open(id, OBJ_BLOB).openStream()) { r.parse(in); } return r.getRules().isEmpty() ? noAttributes() : r; }