private static AttributesNode noAttributes() { return new AttributesNode(Collections.<AttributesRule> emptyList()); } }
/** 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; }
/** * Load the attributes node * * @return the attributes node * @throws java.io.IOException */ public AttributesNode load() throws IOException { AttributesNode r = new AttributesNode(); FS fs = repository.getFS(); File attributes = fs.resolve(repository.getDirectory(), Constants.INFO_ATTRIBUTES); FileRepository.AttributesNodeProviderImpl.loadRulesFromFile(r, attributes); return r.getRules().isEmpty() ? null : r; }
/** * Load the attributes node * * @return the attributes node * @throws java.io.IOException */ public AttributesNode load() throws IOException { AttributesNode r = new AttributesNode(); FS fs = repository.getFS(); String path = repository.getConfig().get(CoreConfig.KEY) .getAttributesFile(); if (path != null) { File attributesFile; if (path.startsWith("~/")) { //$NON-NLS-1$ attributesFile = fs.resolve(fs.userHome(), path.substring(2)); } else { attributesFile = fs.resolve(null, path); } FileRepository.AttributesNodeProviderImpl.loadRulesFromFile(r, attributesFile); } return r.getRules().isEmpty() ? null : r; } }
private static AttributesNode noAttributes() { return new AttributesNode(Collections.<AttributesRule> emptyList()); } }
private static AttributesNode noAttributes() { return new AttributesNode(Collections.<AttributesRule> emptyList()); } }
/** 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; } }
/** * @return the attributes node * @throws IOException */ public AttributesNode load() throws IOException { AttributesNode r = new AttributesNode(); FS fs = repository.getFS(); File attributes = fs.resolve(repository.getDirectory(), Constants.INFO_ATTRIBUTES); FileRepository.AttributesNodeProviderImpl.loadRulesFromFile(r, attributes); 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; }
/** * Load the attributes node * * @return the attributes node * @throws java.io.IOException */ public AttributesNode load() throws IOException { AttributesNode r = new AttributesNode(); FS fs = repository.getFS(); File attributes = fs.resolve(repository.getDirectory(), Constants.INFO_ATTRIBUTES); FileRepository.AttributesNodeProviderImpl.loadRulesFromFile(r, attributes); return r.getRules().isEmpty() ? null : r; }
/** * @return the attributes node * @throws IOException */ public AttributesNode load() throws IOException { AttributesNode r = new AttributesNode(); FS fs = repository.getFS(); String path = repository.getConfig().get(CoreConfig.KEY) .getAttributesFile(); if (path != null) { File attributesFile; if (path.startsWith("~/")) { //$NON-NLS-1$ attributesFile = fs.resolve(fs.userHome(), path.substring(2)); } else { attributesFile = fs.resolve(null, path); } FileRepository.AttributesNodeProviderImpl.loadRulesFromFile(r, attributesFile); } return r.getRules().isEmpty() ? null : r; } }
/** * Load the attributes node * * @return the attributes node * @throws java.io.IOException */ public AttributesNode load() throws IOException { AttributesNode r = new AttributesNode(); FS fs = repository.getFS(); String path = repository.getConfig().get(CoreConfig.KEY) .getAttributesFile(); if (path != null) { File attributesFile; if (path.startsWith("~/")) { //$NON-NLS-1$ attributesFile = fs.resolve(fs.userHome(), path.substring(2)); } else { attributesFile = fs.resolve(null, path); } FileRepository.AttributesNodeProviderImpl.loadRulesFromFile(r, attributesFile); } return r.getRules().isEmpty() ? null : r; } }