javax.xml.stream.XMLStreamException Java Examples

The following examples show how to use javax.xml.stream.XMLStreamException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GXDLMSPrimeNbOfdmPlcMacNetworkAdministrationData.java    From gurux.dlms.java with GNU General Public License v2.0 6 votes vote down vote up
private GXMacDirectTable[] loadDirectTable(GXXmlReader reader)
        throws XMLStreamException {
    List<GXMacDirectTable> list = new ArrayList<GXMacDirectTable>();
    if (reader.isStartElement("DirectTable", true)) {
        while (reader.isStartElement("Item", true)) {
            GXMacDirectTable it = new GXMacDirectTable();
            list.add(it);
            it.setSourceSId(
                    (short) reader.readElementContentAsInt("SourceSId"));
            it.setSourceLnId(
                    (short) reader.readElementContentAsInt("SourceLnId"));
            it.setSourceLcId(
                    (short) reader.readElementContentAsInt("SourceLcId"));
            it.setDestinationSId((short) reader
                    .readElementContentAsInt("DestinationSId"));
            it.setDestinationLnId((short) reader
                    .readElementContentAsInt("DestinationLnId"));
            it.setDestinationLcId((short) reader
                    .readElementContentAsInt("DestinationLcId"));
            it.setDid(GXCommon
                    .hexToBytes(reader.readElementContentAsString("Did")));
        }
        reader.readEndElement("DirectTable");
    }
    return list.toArray(new GXMacDirectTable[list.size()]);
}
 
Example #2
Source File: ModifiedPomXMLEventReader.java    From versions-maven-plugin with Apache License 2.0 6 votes vote down vote up
/**
 * Rewind to the start so we can run through again.
 *
 * @throws XMLStreamException when things go wrong.
 */
public void rewind()
    throws XMLStreamException
{
    backing = factory.createXMLEventReader( new StringReader( pom.toString() ) );
    nextEnd = 0;
    nextDelta = 0;
    for ( int i = 0; i < MAX_MARKS; i++ )
    {
        markStart[i] = -1;
        markEnd[i] = -1;
        markDelta[i] = 0;
    }
    lastStart = -1;
    lastEnd = -1;
    lastDelta = 0;
    next = null;
}
 
Example #3
Source File: ThreadsParser.java    From wildfly-core with GNU Lesser General Public License v2.1 6 votes vote down vote up
public void writeBoundedQueueThreadPool(final XMLExtendedStreamWriter writer, final Property property, final String elementName,
                                        final boolean includeName, final boolean blocking)
        throws XMLStreamException {
    writer.writeStartElement(elementName);
    ModelNode node = property.getValue();
    if (includeName) {
        writer.writeAttribute(Attribute.NAME.getLocalName(), property.getName());
    }
    PoolAttributeDefinitions.ALLOW_CORE_TIMEOUT.marshallAsAttribute(node, writer);
    writeCountElement(PoolAttributeDefinitions.CORE_THREADS, node, writer);
    writeCountElement(PoolAttributeDefinitions.QUEUE_LENGTH, node, writer);
    writeCountElement(PoolAttributeDefinitions.MAX_THREADS, node, writer);

    writeTime(writer, node, Element.KEEPALIVE_TIME);
    writeRef(writer, node, Element.THREAD_FACTORY, THREAD_FACTORY);
    if (!blocking) {
        writeRef(writer, node, Element.HANDOFF_EXECUTOR, HANDOFF_EXECUTOR);
    }
    writer.writeEndElement();
}
 
Example #4
Source File: KeycloakSubsystemParser.java    From keycloak with Apache License 2.0 6 votes vote down vote up
private void readSpi(final List<ModelNode> list, final XMLExtendedStreamReader reader) throws XMLStreamException {
    String spiName = ParseUtils.requireAttributes(reader, "name")[0];
    ModelNode addSpi = new ModelNode();
    addSpi.get(ModelDescriptionConstants.OP).set(ModelDescriptionConstants.ADD);
    PathAddress addr = PathAddress.pathAddress(PathElement.pathElement(ModelDescriptionConstants.SUBSYSTEM, KeycloakExtension.SUBSYSTEM_NAME),
                                               PathElement.pathElement(SpiResourceDefinition.TAG_NAME, spiName));
    addSpi.get(ModelDescriptionConstants.OP_ADDR).set(addr.toModelNode());
    list.add(addSpi);
    
    while (reader.hasNext() && nextTag(reader) != END_ELEMENT) {
        if (reader.getLocalName().equals(DEFAULT_PROVIDER.getXmlName())) {
            DEFAULT_PROVIDER.parseAndSetParameter(reader.getElementText(), addSpi, reader);
        } else if (reader.getLocalName().equals(ProviderResourceDefinition.TAG_NAME)) {
            readProvider(list, spiName, reader);
        }
    }
}
 
Example #5
Source File: StAXDocumentSerializer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void writeNamespace(String prefix, String namespaceURI)
    throws XMLStreamException
{
    if (prefix == null || prefix.length() == 0 || prefix.equals(EncodingConstants.XMLNS_NAMESPACE_PREFIX)) {
        writeDefaultNamespace(namespaceURI);
    }
    else {
        if (!_inStartElement) {
            throw new IllegalStateException(CommonResourceBundle.getInstance().getString("message.attributeWritingNotAllowed"));
        }

        if (_namespacesArrayIndex == _namespacesArray.length) {
            final String[] namespacesArray = new String[_namespacesArrayIndex * 2];
            System.arraycopy(_namespacesArray, 0, namespacesArray, 0, _namespacesArrayIndex);
            _namespacesArray = namespacesArray;
        }

        _namespacesArray[_namespacesArrayIndex++] = prefix;
        _namespacesArray[_namespacesArrayIndex++] = namespaceURI;
        setPrefix(prefix, namespaceURI);
    }
}
 
Example #6
Source File: StreamingWorkbookReader.java    From excel-streaming-reader with Apache License 2.0 6 votes vote down vote up
void loadSheets(XSSFReader reader, SharedStringsTable sst, StylesTable stylesTable, int rowCacheSize)
        throws IOException, InvalidFormatException, XMLStreamException {
  lookupSheetNames(reader);

  //Some workbooks have multiple references to the same sheet. Need to filter
  //them out before creating the XMLEventReader by keeping track of their URIs.
  //The sheets are listed in order, so we must keep track of insertion order.
  SheetIterator iter = (SheetIterator) reader.getSheetsData();
  Map<URI, InputStream> sheetStreams = new LinkedHashMap<>();
  while(iter.hasNext()) {
    InputStream is = iter.next();
    sheetStreams.put(iter.getSheetPart().getPartName().getURI(), is);
  }

  //Iterate over the loaded streams
  int i = 0;
  for(URI uri : sheetStreams.keySet()) {
    XMLEventReader parser = StaxHelper.newXMLInputFactory().createXMLEventReader(sheetStreams.get(uri));
    sheets.add(new StreamingSheet(sheetProperties.get(i++).get("name"), new StreamingSheetReader(sst, stylesTable, parser, use1904Dates, rowCacheSize)));
  }
}
 
Example #7
Source File: BooksReader.java    From softwarecave with GNU General Public License v3.0 6 votes vote down vote up
private List<String> readAuthors(XMLStreamReader reader) throws XMLStreamException {
    List<String> authors = new ArrayList<>();
    while (reader.hasNext()) {
        int eventType = reader.next();
        switch (eventType) {
            case XMLStreamReader.START_ELEMENT:
                String elementName = reader.getLocalName();
                if (elementName.equals("author"))
                    authors.add(readCharacters(reader));
                break;
            case XMLStreamReader.END_ELEMENT:
                return authors;
        }
    }
    throw new XMLStreamException("Premature end of file");

}
 
Example #8
Source File: MapFileGenerator.java    From mpxj with GNU Lesser General Public License v2.1 6 votes vote down vote up
/**
 * Add classes to the map file.
 *
 * @param writer XML stream writer
 * @param jarFile jar file
 * @param mapClassMethods true if we want to produce .Net style class method names
 * @throws IOException
 * @throws ClassNotFoundException
 * @throws XMLStreamException
 * @throws IntrospectionException
 */
private void addClasses(XMLStreamWriter writer, File jarFile, boolean mapClassMethods) throws IOException, ClassNotFoundException, XMLStreamException, IntrospectionException
{
   ClassLoader currentThreadClassLoader = Thread.currentThread().getContextClassLoader();

   URLClassLoader loader = new URLClassLoader(new URL[]
   {
      jarFile.toURI().toURL()
   }, currentThreadClassLoader);

   JarFile jar = new JarFile(jarFile);
   Enumeration<JarEntry> enumeration = jar.entries();
   while (enumeration.hasMoreElements())
   {
      JarEntry jarEntry = enumeration.nextElement();
      if (!jarEntry.isDirectory() && jarEntry.getName().endsWith(".class"))
      {
         addClass(loader, jarEntry, writer, mapClassMethods);
      }
   }
   jar.close();
}
 
Example #9
Source File: RepairingNsStreamWriter.java    From woodstox with Apache License 2.0 6 votes vote down vote up
@Override
public void writeStartElement(StartElement elem)
    throws XMLStreamException
{
    // In repairing mode this is simple: let's just pass info
    // we have, and things should work... a-may-zing!
    QName name = elem.getName();
    writeStartElement(name.getPrefix(), name.getLocalPart(),
                      name.getNamespaceURI());
    Iterator<Attribute> it = elem.getAttributes();
    while (it.hasNext()) {
        Attribute attr = it.next();
        name = attr.getName();
        writeAttribute(name.getPrefix(), name.getNamespaceURI(),
                       name.getLocalPart(), attr.getValue());
    }
}
 
Example #10
Source File: StAXDocumentSerializer.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void writeCharacters(char[] text, int start, int len)
    throws XMLStreamException
{
     try {
        if (len <= 0) {
            return;
        }

        if (getIgnoreWhiteSpaceTextContent() &&
                isWhiteSpace(text, start, len)) return;

        encodeTerminationAndCurrentElement(true);

        encodeCharacters(text, start, len);
    }
    catch (IOException e) {
        throw new XMLStreamException(e);
    }
}
 
Example #11
Source File: PooledUnmarshaller.java    From sis with Apache License 2.0 6 votes vote down vote up
/**
 * Delegates the unmarshalling to the wrapped unmarshaller.
 */
@Override
public <T> JAXBElement<T> unmarshal(final Node input, final Class<T> declaredType) throws JAXBException {
    final TransformVersion version = getTransformVersion();
    if (version != null) try {
        return unmarshal(InputFactory.createXMLEventReader(input), version, declaredType);
    } catch (XMLStreamException e) {
        throw new JAXBException(e);
    } else {
        final Context context = begin();
        try {
            return unmarshaller.unmarshal(input, declaredType);
        } finally {
            context.finish();
        }
    }
}
 
Example #12
Source File: Bufr2Xml.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public Bufr2Xml(Message message, NetcdfFile ncfile, OutputStream os, boolean skipMissing) throws IOException {
  indent = new Indent(2);
  indent.setIndentLevel(0);

  try {
    XMLOutputFactory fac = XMLOutputFactory.newInstance();
    staxWriter = fac.createXMLStreamWriter(os, CDM.UTF8);

    staxWriter.writeStartDocument(CDM.UTF8, "1.0");
    // staxWriter.writeCharacters("\n");
    // staxWriter.writeStartElement("bufrMessage");

    writeMessage(message, ncfile);

    staxWriter.writeCharacters("\n");
    staxWriter.writeEndDocument();
    staxWriter.flush();

  } catch (XMLStreamException e) {
    throw new IOException(e.getMessage());
  }
}
 
Example #13
Source File: XMLStreamWriterFactory.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void doRecycle(XMLStreamWriter r) {
    if (r instanceof HasEncodingWriter) {
        r = ((HasEncodingWriter)r).getWriter();
    }
    if(zephyrClass.isInstance(r)) {
        // this flushes the underlying stream, so it might cause chunking issue
        try {
            r.close();
        } catch (XMLStreamException e) {
            throw new WebServiceException(e);
        }
        pool.set(r);
    }
    if(r instanceof RecycleAware)
        ((RecycleAware)r).onRecycled();
}
 
Example #14
Source File: CompilerOptions_Tests.java    From iBioSim with Apache License 2.0 5 votes vote down vote up
@Test(expected = VerilogCompilerException.class)
public void Test_VerilogCompilerException() throws org.sbml.jsbml.text.parser.ParseException, SBOLValidationException, VerilogCompilerException, XMLStreamException, IOException, BioSimException, ParseException, SBOLConversionException { 
	String[] args = {"-v", TestingFiles.verilogSRLatch_impFile, TestingFiles.verilogSRLatch_tbFile, 
			"-lpn", "-od", TestingFiles.outputDir, "-o", "srlatch"};
	//error because missing module identifier names for imp and tb
	runCompiler(args);
}
 
Example #15
Source File: PrettyPrintingXmlWriter.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
/**
 * Sets the default namespace.
 * 
 * @param uri The namespace uri
 */
public void setDefaultNamespace(String uri) throws DdlUtilsXMLException
{
    try
    {
        _writer.setDefaultNamespace(uri);
    }
    catch (XMLStreamException ex)
    {
        throwException(ex);
    }
}
 
Example #16
Source File: JBossDeploymentStructureParser10.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static void parseModuleExclusion(final XMLStreamReader reader, final ModuleStructureSpec specBuilder) throws XMLStreamException {
    String name = null;
    String slot = "main";
    final Set<Attribute> required = EnumSet.of(Attribute.NAME);
    final int count = reader.getAttributeCount();
    for (int i = 0; i < count; i++) {
        final Attribute attribute = Attribute.of(reader.getAttributeName(i));
        required.remove(attribute);
        switch (attribute) {
            case NAME:
                name = reader.getAttributeValue(i);
                break;
            case SLOT:
                slot = reader.getAttributeValue(i);
                break;
            default:
                throw unexpectedContent(reader);
        }
    }
    if (!required.isEmpty()) {
        throw missingAttributes(reader.getLocation(), required);
    }
    specBuilder.getExclusions().add(ModuleIdentifier.create(name, slot));
    if (reader.hasNext()) {
        switch (reader.nextTag()) {
            case XMLStreamConstants.END_ELEMENT:
                return;
            default:
                throw unexpectedContent(reader);
        }
    }
}
 
Example #17
Source File: XMLOutputFactoryImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
javax.xml.stream.XMLStreamWriter createXMLStreamWriter(javax.xml.transform.stream.StreamResult sr, String encoding) throws javax.xml.stream.XMLStreamException {
    //if factory is configured to reuse the instance & this instance can be reused
    //& the setProperty() hasn't been called
    try{
        if(fReuseInstance && fStreamWriter != null && fStreamWriter.canReuse() && !fPropertyChanged){
            fStreamWriter.reset();
            fStreamWriter.setOutput(sr, encoding);
            if(DEBUG)System.out.println("reusing instance, object id : " + fStreamWriter);
            return fStreamWriter;
        }
        return fStreamWriter = new XMLStreamWriterImpl(sr, encoding, new PropertyManager(fPropertyManager));
    }catch(java.io.IOException io){
        throw new XMLStreamException(io);
    }
}
 
Example #18
Source File: AvvisaturaUtils.java    From govpay with GNU General Public License v3.0 5 votes vote down vote up
public static List<CtEsitoAvvisoDigitale> leggiListaAvvisiDigitali(InputStream is) throws JAXBException, IOException, XMLStreamException, TransformerException, SAXException {
	init();
	Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
	jaxbUnmarshaller.setSchema(schema);
	
	JAXBElement<ListaEsitoAvvisiDigitali> root = jaxbUnmarshaller.unmarshal(new StreamSource(is), ListaEsitoAvvisiDigitali.class);
	return root.getValue().getEsitoAvvisoDigitale();
}
 
Example #19
Source File: ValueListBeanInfoImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void serializeBody(Object array, XMLSerializer target) throws SAXException, IOException, XMLStreamException {
    int len = Array.getLength(array);
    for( int i=0; i<len; i++ )  {
        Object item = Array.get(array,i);
        try {
            xducer.writeText(target,item,"arrayItem");
        } catch (AccessorException e) {
            target.reportError("arrayItem",e);
        }
    }
}
 
Example #20
Source File: StaxSchemaValidationOutInterceptor.java    From cxf with Apache License 2.0 5 votes vote down vote up
private void setSchemaInMessage(Message message, XMLStreamWriter writer) throws XMLStreamException  {
    if (ServiceUtils.isSchemaValidationEnabled(SchemaValidationType.OUT, message)) {
        try {
            WoodstoxValidationImpl mgr = new WoodstoxValidationImpl();
            if (mgr.canValidate()) {
                mgr.setupValidation(writer, message.getExchange().getEndpoint(),
                                    message.getExchange().getService().getServiceInfos().get(0));
            }
        } catch (Throwable t) {
            //likely no MSV or similar
            LOG.log(Level.FINE, "Problem initializing MSV validation", t);
        }
    }
}
 
Example #21
Source File: StAXDocumentSerializer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void writeAttribute(String namespaceURI, String localName,
    String value) throws XMLStreamException
{
    String prefix = "";

    // Find prefix for attribute, ignoring default namespace
    if (namespaceURI.length() > 0) {
        prefix = _nsContext.getNonDefaultPrefix(namespaceURI);

        // Undeclared prefix or ignorable default ns?
        if (prefix == null || prefix.length() == 0) {
            // Workaround for BUG in SAX NamespaceSupport helper
            // which incorrectly defines namespace declaration URI
            if (namespaceURI == EncodingConstants.XMLNS_NAMESPACE_NAME ||
                    namespaceURI.equals(EncodingConstants.XMLNS_NAMESPACE_NAME)) {
                // TODO
                // Need to check carefully the rule for the writing of
                // namespaces in StAX. Is it safe to ignore such
                // attributes, as declarations will be made using the
                // writeNamespace method
                return;
            }
            throw new XMLStreamException(CommonResourceBundle.getInstance().getString("message.URIUnbound", new Object[]{namespaceURI}));
        }
    }
    writeAttribute(prefix, namespaceURI, localName, value);
}
 
Example #22
Source File: StaEDIXMLStreamWriterTest.java    From staedi with Apache License 2.0 5 votes vote down vote up
@Test
void testSetNamespaceContext_AfterDocumentStart() throws XMLStreamException {
    NamespaceContext ctx = Mockito.mock(NamespaceContext.class);
    Mockito.when(ctx.getNamespaceURI(NS_PFX_TEST)).thenReturn(NS_URI_TEST);
    Mockito.when(ctx.getPrefix(NS_URI_TEST)).thenReturn(NS_PFX_TEST);
    it.writeStartDocument();
    it.writeStartElement("l", "INTERCHANGE", EDINamespaces.LOOPS);
    Throwable thrown = assertThrows(XMLStreamException.class, () -> it.setNamespaceContext(ctx));
    assertEquals("NamespaceContext must only be called at the start of the document", thrown.getMessage());
}
 
Example #23
Source File: ManagementApiParser.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
private static OMElement getInternalApisElement() throws IOException, CarbonException, XMLStreamException {
    File mgtApiUserConfig = getConfigurationFile();
    try (InputStream fileInputStream = new FileInputStream(mgtApiUserConfig)) {
        OMElement documentElement = getOMElementFromFile(fileInputStream);
        createSecretResolver(documentElement);
        return documentElement;
    }
}
 
Example #24
Source File: DTDNmTokenAttr.java    From woodstox with Apache License 2.0 5 votes vote down vote up
/**
 * Method called by the validator
 * to ask attribute to verify that the default it has (if any) is
 * valid for such type.
 */
@Override
public void validateDefault(InputProblemReporter rep, boolean normalize)
    throws XMLStreamException
{
    String def = validateDefaultNmToken(rep, normalize);
    if (normalize) {
        mDefValue.setValue(def);
    }
}
 
Example #25
Source File: ValidatingStreamReader.java    From woodstox with Apache License 2.0 5 votes vote down vote up
private ValidatingStreamReader(InputBootstrapper bs,
                               BranchingReaderSource input, ReaderCreator owner,
                               ReaderConfig cfg, InputElementStack elemStack,
                               boolean forER)
    throws XMLStreamException
{
    super(bs, input, owner, cfg, elemStack, forER);
}
 
Example #26
Source File: GetInboxRulesRequest.java    From ews-java-api with MIT License 5 votes vote down vote up
/**
 * Writes XML elements.
 *
 * @param writer The writer.
 * @throws XMLStreamException the XML stream exception
 * @throws ServiceXmlSerializationException
 */
@Override
protected void writeElementsToXml(EwsServiceXmlWriter writer)
    throws ServiceXmlSerializationException, XMLStreamException {
  if (!(this.mailboxSmtpAddress == null ||
      this.mailboxSmtpAddress.isEmpty())) {
    writer.writeElementValue(
        XmlNamespace.Messages,
        XmlElementNames.MailboxSmtpAddress,
        this.mailboxSmtpAddress);
  }
}
 
Example #27
Source File: HostXml_13.java    From wildfly-core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void parseRemoteDomainController(final XMLExtendedStreamReader reader, final ModelNode address, final List<ModelNode> list) throws XMLStreamException {
    boolean requireDiscoveryOptions = false;
    boolean hasDiscoveryOptions = false;

    requireDiscoveryOptions = parseRemoteDomainControllerAttributes(reader, address, list);


    Set<String> types = new HashSet<String>();
    Set<String> staticDiscoveryOptionNames = new HashSet<String>();
    Set<String> discoveryOptionNames = new HashSet<String>();
    while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
        requireNamespace(reader, namespace);
        final Element element = Element.forName(reader.getLocalName());
        switch (element) {
            case IGNORED_RESOURCE: {
                parseIgnoredResource(reader, address, list, types);
                break;
            }
            case DISCOVERY_OPTIONS: { // Different from parseRemoteDomainController1_1
                if (hasDiscoveryOptions) {
                    throw ControllerLogger.ROOT_LOGGER.alreadyDefined(element.getLocalName(), reader.getLocation());
                }
                parseDiscoveryOptions(reader, address, list, staticDiscoveryOptionNames, discoveryOptionNames);
                hasDiscoveryOptions = true;
                break;
            }
            default:
                throw unexpectedElement(reader);
        }
    }

    if (requireDiscoveryOptions && !hasDiscoveryOptions) {
        throw ControllerLogger.ROOT_LOGGER.discoveryOptionsMustBeDeclared(CommandLineConstants.ADMIN_ONLY,
                Attribute.ADMIN_ONLY_POLICY.getLocalName(), AdminOnlyDomainConfigPolicy.FETCH_FROM_MASTER.toString(),
                Element.DISCOVERY_OPTIONS.getLocalName(), Attribute.HOST.getLocalName(), Attribute.PORT.getLocalName(),
                reader.getLocation());
    }
}
 
Example #28
Source File: ContentHandlerToXMLStreamWriter.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void startDocument() throws SAXException {
    try {
        staxWriter.writeStartDocument();
    } catch (XMLStreamException e) {
        throw new SAXException(e);
    }
}
 
Example #29
Source File: XMLDOMWriterImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Is not supported in this version of the implementation.
 * @param uri {@inheritDoc}
 * @throws javax.xml.stream.XMLStreamException {@inheritDoc}
 */
public void setDefaultNamespace(String uri) throws XMLStreamException {
    namespaceContext.declarePrefix(XMLConstants.DEFAULT_NS_PREFIX, uri);
    if(!needContextPop[depth]){
        needContextPop[depth] = true;
    }
}
 
Example #30
Source File: Creator.java    From packagedrone with Eclipse Public License 1.0 5 votes vote down vote up
public void createBundleP2MetaData ( final P2MetaDataInformation info, final ArtifactInformation art, final BundleInformation bi ) throws Exception
{
    this.context.create ( makeName ( art, "-p2metadata.xml" ), out -> {
        try
        {
            final XMLStreamWriter xsw = this.factoryProvider.get ().createXMLStreamWriter ( out );
            InstallableUnit.fromBundle ( bi, info ).writeXml ( xsw );
            xsw.close ();
        }
        catch ( final XMLStreamException e )
        {
            throw new IOException ( e );
        }
    } );
}