private Model readModel( String projectId, String pomLocation, Reader reader, boolean strict ) throws IOException, InvalidProjectModelException { String modelSource = IOUtil.toString( reader ); if ( modelSource.indexOf( "<modelVersion>" + MAVEN_MODEL_VERSION ) < 0 ) { throw new InvalidProjectModelException( projectId, pomLocation, "Not a v" + MAVEN_MODEL_VERSION + " POM." ); } StringReader sReader = new StringReader( modelSource ); try { return modelReader.read( sReader, strict ); } catch ( XmlPullParserException e ) { throw new InvalidProjectModelException( projectId, pomLocation, "Parse error reading POM. Reason: " + e.getMessage(), e ); } }
public Metadata read( Reader input, Map<String, ?> options ) throws IOException { Objects.requireNonNull( input, "input cannot be null" ); try ( final Reader in = input ) { return new MetadataXpp3Reader().read( in, isStrict( options ) ); } catch ( XmlPullParserException e ) { throw new MetadataParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e ); } }
public Metadata read( InputStream input, Map<String, ?> options ) throws IOException { Objects.requireNonNull( input, "input cannot be null" ); try ( final InputStream in = input ) { return new MetadataXpp3Reader().read( in, isStrict( options ) ); } catch ( XmlPullParserException e ) { throw new MetadataParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e ); } }
@Override public Settings read( InputStream input, Map<String, ?> options ) throws IOException { Objects.requireNonNull( input, "input cannot be null" ); try ( final InputStream in = input ) { return new SettingsXpp3Reader().read( in, isStrict( options ) ); } catch ( XmlPullParserException e ) { throw new SettingsParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e ); } }
@Override public PersistedToolchains read( Reader input, Map<String, ?> options ) throws IOException { Objects.requireNonNull( input, "input cannot be null" ); try ( final Reader in = input ) { return new MavenToolchainsXpp3Reader().read( in, isStrict( options ) ); } catch ( XmlPullParserException e ) { throw new ToolchainsParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e ); } }
static Metadata read( File metadataFile ) throws RepositoryException { if ( metadataFile.length() <= 0 ) { return new Metadata(); } try ( Reader reader = ReaderFactory.newXmlReader( metadataFile ) ) { return new MetadataXpp3Reader().read( reader, false ); } catch ( IOException e ) { throw new RepositoryException( "Could not read metadata " + metadataFile + ": " + e.getMessage(), e ); } catch ( XmlPullParserException e ) { throw new RepositoryException( "Could not parse metadata " + metadataFile + ": " + e.getMessage(), e ); } }
throw new IOException( "Unable to parse the XML: " + e.getMessage() );
@Override public Settings read( Reader input, Map<String, ?> options ) throws IOException { Objects.requireNonNull( input, "input cannot be null" ); try ( final Reader in = input ) { return new SettingsXpp3Reader().read( in, isStrict( options ) ); } catch ( XmlPullParserException e ) { throw new SettingsParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e ); } }
@Override public PersistedToolchains read( InputStream input, Map<String, ?> options ) throws IOException { Objects.requireNonNull( input, "input cannot be null" ); try ( final InputStream in = input ) { return new MavenToolchainsXpp3Reader().read( in, isStrict( options ) ); } catch ( XmlPullParserException e ) { throw new ToolchainsParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e ); } }
/** * @since 3.3.0 */ public ExtensionDescriptor build( InputStream is ) throws IOException { ExtensionDescriptor extensionDescriptor = new ExtensionDescriptor(); Xpp3Dom dom; try { dom = Xpp3DomBuilder.build( ReaderFactory.newXmlReader( is ) ); } catch ( XmlPullParserException e ) { throw (IOException) new IOException( e.getMessage() ).initCause( e ); } if ( !"extension".equals( dom.getName() ) ) { throw new IOException( "Unexpected root element \"" + dom.getName() + "\", expected \"extension\"" ); } extensionDescriptor.setExportedPackages( parseStrings( dom.getChild( "exportedPackages" ) ) ); extensionDescriptor.setExportedArtifacts( parseStrings( dom.getChild( "exportedArtifacts" ) ) ); return extensionDescriptor; }
throw new IOException( "Unable to parse the XML: " + e.getMessage() );
private Model read( Reader reader, boolean strict, InputSource source ) throws IOException { try { if ( source != null ) { return new MavenXpp3ReaderEx().read( reader, strict, source ); } else { return new MavenXpp3Reader().read( reader, strict ); } } catch ( XmlPullParserException e ) { throw new ModelParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e ); } }
public Model read(Reader input, Map<String, ?> options) throws IOException, ModelParseException { if (input == null) { throw new IllegalArgumentException("XML Reader is null."); } Model model = null; try { model = reader.read(input); } catch (XmlPullParserException e) { throw new ModelParseException(e.getMessage(), -1, -1, e); } return model; } }
public SettingsManager(InputStream stream) throws MojoExecutionException { this(); SettingsXpp3Reader reader = new SettingsXpp3Reader(); try { settings = reader.read(stream); stream.close(); } catch (IOException e) { throw new MojoExecutionException(e.getMessage()); } catch (XmlPullParserException e) { throw new MojoExecutionException(e.getMessage()); } finally { IOUtils.closeQuietly(stream); } }
public Configuration loadNexusConfig() throws IOException { final File nexusConfigFile = getNexusConfigurationFile(); final NexusConfigurationXpp3Reader reader = new NexusConfigurationXpp3Reader(); try (FileInputStream in = new FileInputStream(nexusConfigFile)) { return reader.read(in, false); } catch (XmlPullParserException e) { log.error(e.getMessage(), e); throw new RuntimeException(e); } }
private PlexusConfiguration buildConfiguration( Reader configuration ) throws PlexusConfigurationException { try { return new XmlPlexusConfiguration( Xpp3DomBuilder.build( configuration ) ); } catch ( IOException e ) { throw new PlexusConfigurationException( e.getMessage(), e ); } catch ( XmlPullParserException e ) { throw new PlexusConfigurationException( e.getMessage(), e ); } }
private PlexusConfiguration buildConfiguration( Reader configuration ) throws PlexusConfigurationException { try { return new XmlPlexusConfiguration( Xpp3DomBuilder.build( configuration ) ); } catch ( IOException e ) { throw new PlexusConfigurationException( e.getMessage(), e ); } catch ( XmlPullParserException e ) { throw new PlexusConfigurationException( e.getMessage(), e ); } }
@Override public POM load( final Path path ) { try { final org.kie.commons.java.nio.file.Path nioPath = paths.convert( path ); final String content = ioService.readAllString( nioPath ); return pomContentHandler.toModel( content ); } catch ( IOException e ) { throw new org.kie.commons.java.nio.IOException( e.getMessage() ); } catch ( XmlPullParserException e ) { throw new org.kie.commons.java.nio.IOException( e.getMessage() ); } }
@Override public Settings read( Reader input, Map<String, ?> options ) throws IOException { Objects.requireNonNull( input, "input cannot be null" ); try ( final Reader in = input ) { return new SettingsXpp3Reader().read( in, isStrict( options ) ); } catch ( XmlPullParserException e ) { throw new SettingsParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e ); } }
@Override public Settings read( InputStream input, Map<String, ?> options ) throws IOException { Objects.requireNonNull( input, "input cannot be null" ); try ( final InputStream in = input ) { return new SettingsXpp3Reader().read( in, isStrict( options ) ); } catch ( XmlPullParserException e ) { throw new SettingsParseException( e.getMessage(), e.getLineNumber(), e.getColumnNumber(), e ); } }