Example usage for org.eclipse.jgit.attributes AttributesNode AttributesNode

List of usage examples for org.eclipse.jgit.attributes AttributesNode AttributesNode

Introduction

In this page you can find the example usage for org.eclipse.jgit.attributes AttributesNode AttributesNode.

Prototype

public AttributesNode() 

Source Link

Document

Create an empty ignore node with no rules.

Usage

From source file:com.diffplug.gradle.spotless.GitAttributesLineEndingPolicy.java

License:Apache License

/** Parses a list of rules from the given file, returning an empty list if the file doesn't exist. */
private static List<AttributesRule> parseRules(File file) {
    if (file.exists() && file.isFile()) {
        try (InputStream stream = new FileInputStream(file)) {
            AttributesNode parsed = new AttributesNode();
            parsed.parse(stream);/*from   ww  w.j a va2 s .c om*/
            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();
}

From source file:com.diffplug.spotless.extra.GitAttributesLineEndings.java

License:Apache License

/** 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);/*from w w  w  .j a  v a  2s . c om*/
            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();
}