public static Model readPom(File file) throws AnalysisException {
        Model model = null;
        final PomParser parser = new PomParser();
        try {
            model = parser.parse(file);
        } catch (PomParseException ex) {
            if (ex.getCause() instanceof SAXParseException) {
                try {
                    model = parser.parseWithoutDocTypeCleanup(file);
                } catch (PomParseException ex1) {
                    LOGGER.warn("Unable to parse pom '{}'", file.getPath());
                    LOGGER.debug("", ex1);
                    throw new AnalysisException(ex1);
                }
            }
            if (model == null) {
                LOGGER.warn("Unable to parse pom '{}'", file.getPath());
                LOGGER.debug("", ex);
                throw new AnalysisException(ex);
            }
        } catch (Throwable ex) {
            LOGGER.warn("Unexpected error during parsing of the pom '{}'", file.getPath());
            LOGGER.debug("", ex);
            throw new AnalysisException(ex);
        }
        if (model == null) {
            throw new AnalysisException(String.format("Unable to parse pom '%s'", file.getPath()));
        }
        return model;
    }
@Test
    public void testReadPom_should_trim_version() throws AnalysisException {
        File input = BaseTest.getResourceAsFile(this, "pom/pom-with-new-line.xml");
        String expectedOutputVersion = "2.2.0";

        Model output = PomUtils.readPom(input);

        assertEquals(expectedOutputVersion, output.getVersion());
    }