Examples of EolDetectingInputStream


Examples of org.jfrog.build.extractor.EolDetectingInputStream

    public Boolean transform() throws IOException, InterruptedException {
        if (!propertiesFile.exists()) {
            throw new IllegalArgumentException("Couldn't find properties file: " + propertiesFile.getAbsolutePath());
        }
        Properties properties = new Properties();
        EolDetectingInputStream eolDetectingInputStream = null;
        try {
            eolDetectingInputStream = new EolDetectingInputStream(new FileInputStream(propertiesFile));
            properties.load(eolDetectingInputStream);
        } finally {
            IOUtils.closeQuietly(eolDetectingInputStream);
        }
        String eol = eolDetectingInputStream.getEol();
        boolean hasEol = !"".equals(eol);

        StringBuilder resultBuilder = new StringBuilder();
        boolean modified = false;
        Enumeration<?> propertyNames = properties.propertyNames();
View Full Code Here

Examples of org.jfrog.build.extractor.EolDetectingInputStream

            throw new IllegalArgumentException("Couldn't find pom file: " + pomFile);
        }

        SAXBuilder saxBuilder = createSaxBuilder();
        Document document;
        EolDetectingInputStream eolDetectingStream = null;
        try {
            eolDetectingStream = new EolDetectingInputStream(new FileInputStream(pomFile));
            InputStreamReader inputStreamReader = new InputStreamReader(eolDetectingStream, "UTF-8");
            document = saxBuilder.build(inputStreamReader);
        } catch (JDOMException e) {
            throw new IOException("Failed to parse pom: " + pomFile.getAbsolutePath(), e);
        } finally {
            if (eolDetectingStream != null) {
                eolDetectingStream.close();
            }
        }

        Element rootElement = document.getRootElement();
        Namespace ns = rootElement.getNamespace();

        changeParentVersion(rootElement, ns);

        changeCurrentModuleVersion(rootElement, ns);

        //changePropertiesVersion(rootElement, ns);

        changeDependencyManagementVersions(rootElement, ns);

        changeDependencyVersions(rootElement, ns);

        if (scmUrl != null) {
            changeScm(rootElement, ns);
        }

        if (modified) {
            FileOutputStream fileOutputStream = new FileOutputStream(pomFile);
            OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream, "UTF-8");
            try {
                XMLOutputter outputter = new XMLOutputter();
                String eol = eolDetectingStream.getEol();
                if (!"".equals(eol)) {
                    Format format = outputter.getFormat();
                    format.setLineSeparator(eol);
                    format.setTextMode(Format.TextMode.PRESERVE);
                    outputter.setFormat(format);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.