javax.xml.bind.JAXBException Java Examples

The following examples show how to use javax.xml.bind.JAXBException. 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: MoveServiceSourceAccessControlTest.java    From io with Apache License 2.0 6 votes vote down vote up
/**
 * 移動元Collectionにread権限を持つアカウントでServiceSourceのMOVEをした場合403エラーとなること.
 * @throws JAXBException ACLのパース失敗
 */
@Test
public void 移動元Collectionにread権限を持つアカウントでServiceSourceのMOVEをした場合403エラーとなること() throws JAXBException {
    String token;
    String path = String.format("%s/%s/__src/%s", BOX_NAME, SRC_COL_NAME, FILE_NAME);
    String destination = UrlUtils.box(CELL_NAME, BOX_NAME, DST_COL_NAME, "__src", FILE_NAME);

    try {
        // 事前準備
        setDefaultAcl(SRC_COL_NAME);
        setPrincipalAllAcl(DST_COL_NAME);

        DavResourceUtils.createWebDavFile(MASTER_TOKEN, CELL_NAME, path, FILE_BODY, MediaType.TEXT_PLAIN,
                HttpStatus.SC_CREATED);

        // read権限→403
        token = getToken(ACCOUNT_READ);
        TResponse res = DavResourceUtils.moveWebDav(token, CELL_NAME, path, destination,
                HttpStatus.SC_FORBIDDEN);
        DcCoreException expectedException = DcCoreException.Auth.NECESSARY_PRIVILEGE_LACKING;
        ODataCommon.checkErrorResponseBody(res, expectedException.getCode(), expectedException.getMessage());

    } finally {
        DavResourceUtils.deleteWebDavFile(CELL_NAME, MASTER_TOKEN, BOX_NAME, SRC_COL_NAME + "/__src/" + FILE_NAME);
    }
}
 
Example #2
Source File: JAXBContextImpl.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
@Override
public JAXBIntrospector createJAXBIntrospector() {
    return new JAXBIntrospector() {
        public boolean isElement(Object object) {
            return getElementName(object)!=null;
        }

        public QName getElementName(Object jaxbElement) {
            try {
                return JAXBContextImpl.this.getElementName(jaxbElement);
            } catch (JAXBException e) {
                return null;
            }
        }
    };
}
 
Example #3
Source File: AbstractUnmarshallerImpl.java    From Java8CN with Apache License 2.0 6 votes vote down vote up
public Object unmarshal( Source source ) throws JAXBException {
    if( source == null ) {
        throw new IllegalArgumentException(
            Messages.format( Messages.MUST_NOT_BE_NULL, "source" ) );
    }

    if(source instanceof SAXSource)
        return unmarshal( (SAXSource)source );
    if(source instanceof StreamSource)
        return unmarshal( streamSourceToInputSource((StreamSource)source));
    if(source instanceof DOMSource)
        return unmarshal( ((DOMSource)source).getNode() );

    // we don't handle other types of Source
    throw new IllegalArgumentException();
}
 
Example #4
Source File: MoveODataCollectionAclTest.java    From io with Apache License 2.0 6 votes vote down vote up
/**
 * 移動元の親にread権限を持つ_かつ_移動先の親にread権限を持つアカウントでODataコレクションのMOVEをした場合403となること.
 * @throws JAXBException ACLのパース失敗
 */
@Test
public void 移動元の親にread権限を持つ_かつ_移動先の親にread権限を持つアカウントでODataコレクションのMOVEをした場合403となること()
        throws JAXBException {
    String token;
    String path = String.format("%s/%s/%s", BOX_NAME, SRC_COL_NAME, COL_NAME);
    String destination = UrlUtils.box(CELL_NAME, BOX_NAME, DST_COL_NAME, COL_NAME);
    String srcColPath = SRC_COL_NAME + "/" + COL_NAME;

    // 事前準備
    setDefaultAcl(SRC_COL_NAME);
    setDefaultAcl(DST_COL_NAME);

    DavResourceUtils.createODataCollection(
            MASTER_TOKEN, HttpStatus.SC_CREATED, CELL_NAME, BOX_NAME, srcColPath);

    // 親にread権限+移動先の親にread権限→403
    token = getToken(ACCOUNT_READ);
    TResponse res = DavResourceUtils.moveWebDav(token, CELL_NAME, path, destination, HttpStatus.SC_FORBIDDEN);
    DcCoreException expectedException = DcCoreException.Auth.NECESSARY_PRIVILEGE_LACKING;
    ODataCommon.checkErrorResponseBody(res, expectedException.getCode(), expectedException.getMessage());
}
 
Example #5
Source File: TestEntity.java    From audiveris with GNU Affero General Public License v3.0 6 votes vote down vote up
private void marshall ()
        throws JAXBException, FileNotFoundException, IOException, XMLStreamException
{
    File target = new File(dir, indexFileName);
    Files.deleteIfExists(target.toPath());

    MyBasicIndex<MyEntity> index = new MyBasicIndex<MyEntity>("my-index-name");

    index.register(new MyGlyph("First"));
    index.register(new MySymbol(100));
    index.register(new MyGlyph("Second"));
    index.register(new MyGlyph("Third"));
    index.register(new MySymbol(200));

    new Dumping().dump(index);
    System.out.println("index: " + index);

    System.out.println("Marshalling ...");
    Jaxb.marshal(index, target.toPath(), jaxbContext);
    System.out.println("Marshalled   to   " + target);
    System.out.println("=========================================================");
    Jaxb.marshal(index, System.out, jaxbContext);
}
 
Example #6
Source File: JAXBElementEntityProvider.java    From everrest with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public void writeTo(JAXBElement<?> t,
                    Class<?> type,
                    Type genericType,
                    Annotation[] annotations,
                    MediaType mediaType,
                    MultivaluedMap<String, Object> httpHeaders,
                    OutputStream entityStream) throws IOException {
    Class<?> declaredType = t.getDeclaredType();
    try {
        JAXBContext jaxbContext = getJAXBContext(declaredType, mediaType);
        Marshaller marshaller = jaxbContext.createMarshaller();
        String charset = getCharset(mediaType);
        if (!isNullOrEmpty(charset)) {
            marshaller.setProperty(Marshaller.JAXB_ENCODING, charset);
        }

        marshaller.marshal(t, entityStream);
    } catch (JAXBException e) {
        throw new IOException(String.format("Can't write to output stream, %s", e));
    }
}
 
Example #7
Source File: BusinessDataModelFormPart.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void commit(boolean onSave) {
    BusinessObjectModel workingCopy = formPage.observeWorkingCopy().getValue();
    JobSafeStructuredDocument document = (JobSafeStructuredDocument) formPage.getDocument();
    DocumentRewriteSession session = null;
    try {
        session = document.startRewriteSession(DocumentRewriteSessionType.STRICTLY_SEQUENTIAL);
        document.set(new String(formPage.getParser().marshall(formPage.getConverter().toEngineModel(workingCopy))));
        BDMArtifactDescriptor bdmArtifactDescriptor = new BDMArtifactDescriptor();
        bdmArtifactDescriptor.setGroupId(workingCopy.getGroupId());
        formPage.getEditorContribution().saveBdmArtifactDescriptor(bdmArtifactDescriptor);
    } catch (final JAXBException | IOException | SAXException e) {
        throw new RuntimeException("Fail to update the document", e);
    } finally {
        if (session != null) {
            document.stopRewriteSession(session);
        }
    }
    super.commit(onSave);
    if (onSave) {
        getManagedForm().dirtyStateChanged();
    }
}
 
Example #8
Source File: CqlLibraryReader.java    From cql_engine with Apache License 2.0 6 votes vote down vote up
public static Unmarshaller getUnmarshaller() throws JAXBException {
    // This is supposed to work based on this link:
    // https://jaxb.java.net/2.2.11/docs/ch03.html#compiling-xml-schema-adding-behaviors
    // Override the unmarshal to use the XXXEvaluator classes
    // This doesn't work exactly how it's described in the link above, but this is functional
    if (context == null)
    {
        context = JAXBContext.newInstance(ObjectFactory.class);
    }

    if (unmarshaller == null) {
        unmarshaller = context.createUnmarshaller();
        try {
            // https://bugs.eclipse.org/bugs/show_bug.cgi?id=406032
            //https://javaee.github.io/jaxb-v2/doc/user-guide/ch03.html#compiling-xml-schema-adding-behaviors
            // for jre environment
            unmarshaller.setProperty("com.sun.xml.bind.ObjectFactory", new ObjectFactoryEx());
        } catch (javax.xml.bind.PropertyException e) {
            // for jdk environment
            unmarshaller.setProperty("com.sun.xml.internal.bind.ObjectFactory", new ObjectFactoryEx());
        }
    }

    return unmarshaller;
}
 
Example #9
Source File: BinderImpl.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private Object associativeUnmarshal(XmlNode xmlNode, boolean inplace, Class expectedType) throws JAXBException {
    if (xmlNode == null)
        throw new IllegalArgumentException();

    JaxBeanInfo bi = null;
    if(expectedType!=null)
        bi = context.getBeanInfo(expectedType, true);

    InterningXmlVisitor handler = new InterningXmlVisitor(
        getUnmarshaller().createUnmarshallerHandler(scanner,inplace,bi));
    scanner.setContentHandler(new SAXConnector(handler,scanner.getLocator()));
    try {
        scanner.scan(xmlNode);
    } catch( SAXException e ) {
        throw unmarshaller.createUnmarshalException(e);
    }

    return handler.getContext().getResult();
}
 
Example #10
Source File: ODEEndpointUpdater.java    From container with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a list of QName's which are referenced in the ODE deploy.xml File as invoked service.<br>
 *
 * @param deployXML a file object of a valid deploy.xml File
 * @return a list of QNames which represent the PortTypes used by the BPEL process to invoke operations
 * @throws JAXBException if the JAXB parser couldn't work properly
 */
private List<QName> getInvokedDeployXMLPorts(final File deployXML) throws JAXBException {
    // http://svn.apache.org/viewvc/ode/trunk/bpel-schemas/src/main/xsd/
    // grabbed that and using jaxb
    final List<QName> qnames = new LinkedList<>();
    final JAXBContext context =
        JAXBContext.newInstance("org.apache.ode.schemas.dd._2007._03", this.getClass().getClassLoader());
    final Unmarshaller unmarshaller = context.createUnmarshaller();
    final TDeployment deploy = unmarshaller.unmarshal(new StreamSource(deployXML), TDeployment.class).getValue();
    for (final org.apache.ode.schemas.dd._2007._03.TDeployment.Process process : deploy.getProcess()) {
        for (final TInvoke invoke : process.getInvoke()) {
            final QName serviceName = invoke.getService().getName();
            // add only qnames which aren't from the plan itself
            if (!serviceName.getNamespaceURI().equals(process.getName().getNamespaceURI())) {
                qnames.add(new QName(serviceName.getNamespaceURI(), invoke.getService().getPort()));
            }
        }
    }
    return qnames;
}
 
Example #11
Source File: XmlPersistenceHelper.java    From OpenID-Attacker with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Load the current config from an XML file.
 *
 * @param loadFile
 */
public static void mergeConfigFileToConfigObject(final File loadFile, ToolConfiguration currentToolConfig) throws XmlPersistenceError {
    try {
        JAXBContext jaxbContext = JAXBContext.newInstance(ToolConfiguration.class);
        Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
        ToolConfiguration loadedConfig = (ToolConfiguration) jaxbUnmarshaller.unmarshal(loadFile);
        
        //BeanUtils.copyProperties(currentToolConfig, loadedConfig);
        //ServerController controller = new ServerController();
        BeanUtils.copyProperties(currentToolConfig.getAttackerConfig(), loadedConfig.getAttackerConfig());
        BeanUtils.copyProperties(currentToolConfig.getAnalyzerConfig(), loadedConfig.getAnalyzerConfig());
        
        LOG.info(String.format("Loaded successfully config from '%s'", loadFile.getAbsoluteFile()));
    } catch (InvocationTargetException | IllegalAccessException | JAXBException ex) {
        throw new XmlPersistenceError(String.format("Could not load config from File '%s'", loadFile.getAbsoluteFile()), ex);
    }
}
 
Example #12
Source File: FalconHookIT.java    From incubator-atlas with Apache License 2.0 6 votes vote down vote up
private <T extends Entity> T loadEntity(EntityType type, String resource, String name) throws JAXBException {
    Entity entity = (Entity) type.getUnmarshaller().unmarshal(this.getClass().getResourceAsStream(resource));
    switch (entity.getEntityType()) {
        case CLUSTER:
            ((Cluster) entity).setName(name);
            break;

        case FEED:
            ((Feed) entity).setName(name);
            break;

        case PROCESS:
            ((org.apache.falcon.entity.v0.process.Process) entity).setName(name);
            break;
    }
    return (T)entity;
}
 
Example #13
Source File: DeployApplicationDescriptorOperation.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected void deployApplications(IProgressMonitor monitor) {
    try {
        List<ImportStatus> importStatus = applicationAPI.importApplications(
                converter.marshallToXML(applicationNodeContainer),
                ApplicationImportPolicy.FAIL_ON_DUPLICATES);
        monitor.worked(1);
        if (status.isMultiStatus()) {
            final MultiStatus mStatus = status;
            importStatus.stream()
                    .flatMap(s -> s.getErrors().stream()
                            .map(errorToStatus(displayNameForToken(s.getName(), applicationNodeContainer))))
                    .forEach(mStatus::add);
            applicationNodeContainer.getApplications().stream()
                    .map(ApplicationNode::getToken)
                    .map(name -> new Status(IStatus.OK, LivingApplicationPlugin.PLUGIN_ID,
                            StatusCode.LIVING_APP_DEPLOYMENT.ordinal(),
                            name, null))
                    .forEach(mStatus::add);
        }
    } catch (AlreadyExistsException | ImportException | IOException | JAXBException | SAXException e) {
        if (status.isMultiStatus()) {
            status.add(new Status(IStatus.ERROR, LivingApplicationPlugin.PLUGIN_ID,
                    "Failed to deploy application.", e));
        }
    } finally {
        monitor.done();
    }
}
 
Example #14
Source File: DataSourceRepository.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
public DataSourceRepository(int tenantId) throws DataSourceException {
	this.tenantId = tenantId;
	this.dataSources = new HashMap<String, CarbonDataSource>();
	try {
	    JAXBContext ctx = JAXBContext.newInstance(DataSourceMetaInfo.class);
	    this.dsmMarshaller = ctx.createMarshaller();
	    this.dsmUnmarshaller = ctx.createUnmarshaller();
	} catch (JAXBException e) {
		throw new DataSourceException(
				"Error creating data source meta info marshaller/unmarshaller: "
		            + e.getMessage(), e);
	}
}
 
Example #15
Source File: MemberSubmissionEndpointReference.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void writeTo(Result result) {
    try {
        Marshaller marshaller = MemberSubmissionEndpointReference.msjc.get().createMarshaller();
        //marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true);
        marshaller.marshal(this, result);
    } catch (JAXBException e) {
        throw new WebServiceException("Error marshalling W3CEndpointReference. ", e);
    }
}
 
Example #16
Source File: Reports.java    From dss with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * This method returns the XML representation of the JAXB ETSI Validation Report
 * String
 * 
 * @return a String with the XML content of the JAXB
 *         {@code ValidationReportType}
 * @throws DSSReportException - in case of marshalling error
 */
public String getXmlValidationReport() {
	try {
		if (xmlEtsiValidationReport == null) {
			xmlEtsiValidationReport = ValidationReportFacade.newFacade().marshall(getEtsiValidationReportJaxb(), validateXml);
		}
		return xmlEtsiValidationReport;
	} catch (JAXBException | IOException | SAXException e) {
		throw new DSSReportException("An error occurred during marshalling of JAXB Etsi Validation Report", e);
	}
}
 
Example #17
Source File: MetaXmlSerializer.java    From hop with Apache License 2.0 5 votes vote down vote up
public static String serialize( TransformMetaProps transformMetaProps ) {
  try ( ByteArrayOutputStream baos = new ByteArrayOutputStream() ) {
    Marshaller marshalObj = JAXBContext.newInstance( TransformMetaProps.class ).createMarshaller();
    marshalObj.setProperty( Marshaller.JAXB_FORMATTED_OUTPUT, true );
    marshalObj.setProperty( Marshaller.JAXB_FRAGMENT, true );
    marshalObj.marshal( transformMetaProps, baos );
    return baos.toString( defaultCharset().name() );
  } catch ( JAXBException | IOException e ) {
    throw new RuntimeException( e );
  }
}
 
Example #18
Source File: ExiCodec.java    From RISE-V2G with MIT License 5 votes vote down vote up
public Object unmarshallToMessage(String decodedExiString) {
	try {
		if (getInStream() != null) getInStream().reset();
		setInStream(new ByteArrayInputStream(decodedExiString.getBytes()));
		Object unmarhalledObject = getUnmarshaller().unmarshal(getInStream());
		
		if (isXMLMsgRepresentation()) showXMLRepresentationOfMessage(unmarhalledObject);
		return unmarhalledObject;
	} catch (IOException | JAXBException | RuntimeException e) {
		getLogger().error(e.getClass().getSimpleName() + " occurred while trying to unmarshall decoded message", e);
		return null;
	}
}
 
Example #19
Source File: W3CEndpointReference.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private static JAXBContext getW3CJaxbContext() {
    try {
        return JAXBContext.newInstance(W3CEndpointReference.class);
    } catch (JAXBException e) {
        throw new WebServiceException("Error creating JAXBContext for W3CEndpointReference. ", e);
    }
}
 
Example #20
Source File: ConfigTemplateHelper.java    From eagle with Apache License 2.0 5 votes vote down vote up
public static Configuration unmarshallFromXMLString(String xmlConfiguration) throws JAXBException {
    try {
        JAXBContext jc = JAXBContext.newInstance(Configuration.class);
        Unmarshaller unmarshaller = jc.createUnmarshaller();
        return (Configuration) unmarshaller.unmarshal(new StringReader(xmlConfiguration));
    } catch (Exception ex) {
        LOG.error("Failed to unmarshall ConfigTemplate from string", ex);
        throw ex;
    }
}
 
Example #21
Source File: CqlListOperatorsTest.java    From cql_engine with Apache License 2.0 5 votes vote down vote up
/**
 * {@link org.opencds.cqf.cql.elm.execution.IndexOfEvaluator#evaluate(Context)}
 */
@Test
public void testIndexOf() throws JAXBException {
    Context context = new Context(library);

    Object result = context.resolveExpressionRef("IndexOfEmptyNull").getExpression().evaluate(context);
    assertThat(result, is(-1));

    result = context.resolveExpressionRef("IndexOfNullEmpty").getExpression().evaluate(context);
    assertThat(result, is(nullValue()));

    result = context.resolveExpressionRef("IndexOfNullIn1Null").getExpression().evaluate(context);
    assertThat(result, is(1));

    result = context.resolveExpressionRef("IndexOf1In12").getExpression().evaluate(context);
    assertThat(result, is(0));

    result = context.resolveExpressionRef("IndexOf2In12").getExpression().evaluate(context);
    assertThat(result, is(1));

    result = context.resolveExpressionRef("IndexOf3In12").getExpression().evaluate(context);
    assertThat(result, is(-1));

    result = context.resolveExpressionRef("IndexOfDateTime").getExpression().evaluate(context);
    assertThat(result, is(2));

    result = context.resolveExpressionRef("IndexOfTime").getExpression().evaluate(context);
    assertThat(result, is(1));
}
 
Example #22
Source File: Lister.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public String next() throws SAXException, JAXBException {
    last = i.next();
    String id = context.grammar.getBeanInfo(last,true).getId(last,context);
    if(id==null) {
        context.errorMissingId(last);
    }
    return id;
}
 
Example #23
Source File: PluginChecker.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Initializes the processor by loading the device configuration.
 *
 * {@inheritDoc}
 */
@Override
public synchronized void init(ProcessingEnvironment processingEnv) {
    super.init(processingEnv);
    try {
        String deviceOption = processingEnv.getOptions().get(DEVICE_OPTION);
        device = (Device) JAXBContext.newInstance(Device.class)
                .createUnmarshaller().unmarshal(new File(deviceOption));
    } catch (JAXBException e) {
        throw new RuntimeException(
                "Please specify device by -Adevice=device.xml\n"
                + e.toString(), e);
    }
}
 
Example #24
Source File: ExternalMetadataReader.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static JAXBContext createJaxbContext(boolean disableXmlSecurity) {
    Class[] cls = {ObjectFactory.class};
    try {
        if (disableXmlSecurity) {
            Map<String, Object> properties = new HashMap<String, Object>();
            properties.put(JAXBRIContext.DISABLE_XML_SECURITY, disableXmlSecurity);
            return JAXBContext.newInstance(cls, properties);
        } else {
            return JAXBContext.newInstance(cls);
        }
    } catch (JAXBException e) {
        e.printStackTrace();
        return null;
    }
}
 
Example #25
Source File: JaxbUtils.java    From govpay with GNU General Public License v3.0 5 votes vote down vote up
public static byte[] toByte(RR rr) throws JAXBException, SAXException  {
	init();
	Marshaller jaxbMarshaller = jaxbRrErContext.createMarshaller();
	jaxbMarshaller.setProperty("com.sun.xml.bind.xmlDeclaration", Boolean.FALSE);
	ByteArrayOutputStream baos = new ByteArrayOutputStream();
	jaxbMarshaller.marshal(rr, baos);
	return baos.toByteArray();
}
 
Example #26
Source File: ASiCManifestUtils.java    From dss with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Override
public JAXBContext getJAXBContext() throws JAXBException {
	if (jc == null) {
		jc = JAXBContext.newInstance(ObjectFactory.class, eu.europa.esig.asic.manifest.jaxb.ObjectFactory.class);
	}
	return jc;
}
 
Example #27
Source File: OldBridge.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public final void marshal(T object,XMLStreamWriter output, AttachmentMarshaller am) throws JAXBException {
    Marshaller m = context.marshallerPool.take();
    m.setAttachmentMarshaller(am);
    marshal(m,object,output);
    m.setAttachmentMarshaller(null);
    context.marshallerPool.recycle(m);
}
 
Example #28
Source File: XmlMapper.java    From vjtools with Apache License 2.0 5 votes vote down vote up
/**
 * Java Object->Xml with encoding.
 */
public static String toXml(Object root, Class clazz, String encoding) {
	try {
		StringWriter writer = new StringWriter();
		createMarshaller(clazz, encoding).marshal(root, writer);
		return writer.toString();
	} catch (JAXBException e) {
		throw ExceptionUtil.unchecked(e);
	}
}
 
Example #29
Source File: MergeConfigurationCLI.java    From rya with Apache License 2.0 5 votes vote down vote up
public static MergeToolConfiguration createConfigurationFromFile(final File configFile) throws MergeConfigurationException {
    try {
        final JAXBContext context = JAXBContext.newInstance(DBType.class, MergeToolConfiguration.class, AccumuloMergeToolConfiguration.class, TimestampMergePolicyConfiguration.class, MergePolicy.class, InstanceType.class);
        final Unmarshaller unmarshaller = context.createUnmarshaller();
        final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        XmlFactoryConfiguration.harden(dbf);
        final DocumentBuilder db = dbf.newDocumentBuilder();
        return unmarshaller.unmarshal(db.parse(configFile), MergeToolConfiguration.class).getValue();
    } catch (final JAXBException | IllegalArgumentException | ParserConfigurationException | SAXException | IOException JAXBe) {
        throw new MergeConfigurationException("Failed to create a config based on the provided configuration.", JAXBe);
    }
}
 
Example #30
Source File: MarshallerBridge.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void marshal(Marshaller m, Object object, Result result) throws JAXBException {
    m.setProperty(Marshaller.JAXB_FRAGMENT,true);
    try {
        m.marshal(object,result);
    } finally {
        m.setProperty(Marshaller.JAXB_FRAGMENT,false);
    }
}