Commit 5ee21af6 authored by Tomas Kraus's avatar Tomas Kraus
Browse files

Initial contribution

parents
/target/
/jaxb-api/target/
/jaxb-api-test/target/
# Contributing to Eclipse Project for JAXB
Thanks for your interest in this project.
## Project description
The Java??? Architecture for XML Binding (JAXB) provides an API and tools that
automate the mapping between XML documents and Java objects.
* https://projects.eclipse.org/projects/ee4j.jaxb
## Developer resources
Information regarding source code management, builds, coding standards, and
more.
* https://projects.eclipse.org/projects/ee4j.jaxb/developer
The project maintains the following source code repositories
* https://github.com/eclipse-ee4j/jaxb-api
## Eclipse Contributor Agreement
Before your contribution can be accepted by the project team contributors must
electronically sign the Eclipse Contributor Agreement (ECA).
* http://www.eclipse.org/legal/ECA.php
Commits that are provided by non-committers must have a Signed-off-by field in
the footer indicating that the author is aware of the terms by which the
contribution has been provided to the project. The non-committer must
additionally have an Eclipse Foundation account and must have a signed Eclipse
Contributor Agreement (ECA) on file.
For more information, please see the Eclipse Committer Handbook:
https://www.eclipse.org/projects/handbook/#resources-commit
## Contact
Contact the project developers via the project's "dev" list.
* https://accounts.eclipse.org/mailing-list/jaxb-dev
Copyright (c) 2017 Oracle and/or its affiliates. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of the Eclipse Foundation, Inc. nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# Java Architecture for XML Binding (JAXB) API
This project contains JAXB API based on JSR-222 specification.
### Licensing and Governance
JAXB API is licensed under a license - [EDL 1.0](LICENSE.md).
### More Info
JSR-222 specification documents are available on [jcp.org](https://jcp.org/en/jsr/detail?id=222).
<?xml version = "1.0" encoding = "UTF-8"?>
<!--
Copyright (c) 2009, 2018 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Distribution License v. 1.0, which is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: BSD-3-Clause
-->
<xs:schema
targetNamespace = "http://java.sun.com/xml/ns/jaxb"
xmlns:jaxb = "http://java.sun.com/xml/ns/jaxb"
xmlns:xs = "http://www.w3.org/2001/XMLSchema"
elementFormDefault = "qualified"
attributeFormDefault = "unqualified">
<xs:annotation>
<xs:documentation>Schema for binding schema. JAXB Version 1.0</xs:documentation>
</xs:annotation>
<xs:group name = "declaration">
<xs:annotation>
<xs:documentation>
Model group that represents a binding declaration.
Each new binding declaration added to the jaxb namespace
that is not restricted to globalBindings should
be added as a child element to this model group.
</xs:documentation>
<xs:documentation>
Allow for extension binding declarations.
</xs:documentation>
</xs:annotation>
<!-- each new binding declaration, not restricted to
globalBindings, should be added here -->
<xs:choice>
<xs:element ref = "jaxb:globalBindings"/>
<xs:element ref = "jaxb:schemaBindings"/>
<xs:element ref = "jaxb:class"/>
<xs:element ref = "jaxb:property"/>
<xs:element ref = "jaxb:typesafeEnumClass"/>
<xs:element ref = "jaxb:typesafeEnumMember"/>
<xs:element ref = "jaxb:javaType"/>
<xs:element ref = "jaxb:inlineBinaryData"/>
<xs:element ref = "jaxb:factoryMethod"/>
<xs:any namespace = "##other" processContents = "lax"/>
</xs:choice>
</xs:group>
<xs:attribute name = "version" type="xs:token" >
<xs:annotation><xs:documentation>
Used to specify the version of the binding schema on the
schema element for inline annotations or jaxb:bindings
for external binding.
</xs:documentation></xs:annotation>
</xs:attribute>
<xs:attributeGroup name = "propertyAttributes">
<xs:annotation>
<xs:documentation>Attributes used for property customization. The attribute group
can be referenced either from the globalBindings declaration or from the
property declaration.
The following defaults are defined by the JAXB specification in global
scope only. Thus they apply when the propertyAttributes group is referenced
from the globalBindings declaration but not when referenced from the
property declaration.
collectionType a class that implements java.util.List, or 'indexed'
fixedAttributeAsConstantProperty false
enableFailFastCheck false
generateIsSetMethod false
</xs:documentation>
</xs:annotation>
<xs:attribute name = "collectionType" type="jaxb:referenceCollectionType"/>
<xs:attribute name = "fixedAttributeAsConstantProperty" type = "xs:boolean"/>
<xs:attribute name = "enableFailFastCheck" type = "xs:boolean"/>
<xs:attribute name = "generateIsSetMethod" type = "xs:boolean"/>
</xs:attributeGroup>
<xs:attributeGroup name = "XMLNameToJavaIdMappingDefaults">
<xs:annotation>
<xs:documentation>Customize XMlNames to Java id mapping </xs:documentation>
</xs:annotation>
<xs:attribute name = "underscoreBinding" default = "asWordSeparator" type = "jaxb:underscoreBindingType"/>
<xs:attribute name = "typesafeEnumMemberName" default = "generateError" type = "jaxb:typesafeEnumMemberNameType"/>
</xs:attributeGroup>
<xs:attributeGroup name = "typesafeEnumClassDefaults">
<xs:attribute name = "typesafeEnumBase" default = "xs:NCname" type = "jaxb:typesafeEnumBaseType"/>
</xs:attributeGroup>
<xs:element name = "globalBindings">
<xs:annotation>
<xs:documentation>Customization values defined in global scope.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence minOccurs = "0">
<xs:element ref = "jaxb:javaType" minOccurs = "0" maxOccurs = "unbounded"/>
<xs:any namespace = "##other" processContents = "lax" maxOccurs = "unbounded">
<xs:annotation> <xs:documentation>
allows extension binding declarations to be specified.
</xs:documentation></xs:annotation>
</xs:any>
</xs:sequence>
<xs:attributeGroup ref = "jaxb:XMLNameToJavaIdMappingDefaults"/>
<xs:attributeGroup ref = "jaxb:typesafeEnumClassDefaults"/>
<xs:attributeGroup ref = "jaxb:propertyAttributes"/>
<xs:attribute name = "enableJavaNamingConventions" default = "true" type = "xs:boolean"/>
<xs:attribute name = "bindingStyle" default = "elementBinding" type = "jaxb:bindingStyleType"/>
<xs:attribute name = "choiceContentProperty" default = "false" type = "xs:boolean"/>
</xs:complexType>
</xs:element>
<xs:element name = "schemaBindings">
<xs:annotation>
<xs:documentation>Customization values with schema scope</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
<xs:element name = "package" type = "jaxb:packageType" minOccurs = "0"/>
<xs:element name = "nameXmlTransform" type = "jaxb:nameXmlTransformType" minOccurs = "0"/>
</xs:all>
</xs:complexType>
</xs:element>
<xs:element name = "class">
<xs:annotation>
<xs:documentation>Customize interface and implementation class.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name = "javadoc" type = "xs:string" minOccurs = "0"/>
</xs:sequence>
<xs:attribute name = "name" type = "jaxb:javaIdentifierType">
<xs:annotation>
<xs:documentation>Java class name without package prefix.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name = "implClass" type = "jaxb:javaIdentifierType">
<xs:annotation>
<xs:documentation>Implementation class name including package prefix. </xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name = "property">
<xs:annotation>
<xs:documentation>Customize property.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:all>
<xs:element name = "javadoc" type = "xs:string" minOccurs="0"/>
<xs:element name = "baseType" type="jaxb:propertyBaseType" minOccurs="0"/>
</xs:all>
<xs:attribute name = "name" type = "jaxb:javaIdentifierType"/>
<xs:attributeGroup ref = "jaxb:propertyAttributes"/>
</xs:complexType>
</xs:element>
<xs:element name = "javaType">
<xs:annotation>
<xs:documentation>Data type conversions; overriding builtins</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:attribute name = "name" use = "required" type = "jaxb:javaIdentifierType">
<xs:annotation>
<xs:documentation>name of the java type to which xml type is to be bound.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name = "xmlType" type = "xs:QName">
<xs:annotation>
<xs:documentation>
xml type to which java datatype has to be bound.
Must be present when javaType is scoped to globalBindings
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name = "parseMethod" type = "jaxb:javaIdentifierType"/>
<xs:attribute name = "printMethod" type = "jaxb:javaIdentifierType"/>
<xs:attribute name = "hasNsContext" default = "false" type = "xs:boolean" >
<xs:annotation>
<xs:documentation>
If true, the parsMethod and printMethod must reference a method
signtature that has a second parameter of type NamespaceContext.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:element name = "typesafeEnumClass">
<xs:annotation>
<xs:documentation>Bind to a type safe enumeration class.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name = "javadoc" type = "xs:string" minOccurs = "0"/>
<xs:element ref = "jaxb:typesafeEnumMember" minOccurs = "0" maxOccurs = "unbounded"/>
</xs:sequence>
<xs:attribute name = "name" type = "jaxb:javaIdentifierType"/>
</xs:complexType>
</xs:element>
<xs:element name = "typesafeEnumMember">
<xs:annotation>
<xs:documentation> Enumeration member name in a type safe enumeration class.</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name = "javadoc" type = "xs:string" minOccurs = "0"/>
</xs:sequence>
<xs:attribute name = "value" type="xs:anySimpleType"/>
<xs:attribute name = "name" use = "required" type = "jaxb:javaIdentifierType"/>
</xs:complexType>
</xs:element>
<xs:element name="inlineBinaryData">
<xs:annotation><xs:documentation><![CDATA[
Disable binary optimization.
Used on elements like <xs:element name="foo" type="xs:base64Binary"/> to indicate
that this base64 binary data is always inlined and never subjected to the binary
transfer optimization (such as XOP/MTOM)
]]></xs:documentation></xs:annotation>
<xs:complexType />
</xs:element>
<xs:element name="factoryMethod">
<xs:annotation><xs:documentation><![CDATA[
Controls the name of the factory method on ObjectFactory.
]]></xs:documentation></xs:annotation>
<xs:complexType>
<xs:sequence />
<xs:attribute name="name" type="xs:string" use="required" />
</xs:complexType>
</xs:element>
<!-- TYPE DEFINITIONS -->
<xs:complexType name = "propertyBaseType">
<xs:annotation>
<xs:documentation>
Customize the base type of a property. For V1.0, only
javaType is allowed for customization of simple types
at point of reference to a simple type.
</xs:documentation>
</xs:annotation>
<xs:all>
<xs:element ref = "jaxb:javaType" minOccurs = "0"/>
</xs:all>
</xs:complexType>
<xs:simpleType name = "bindingStyleType">
<xs:annotation>
<xs:documentation>Allows selection of a binding algorithm</xs:documentation>
</xs:annotation>
<xs:restriction base = "xs:string">
<xs:enumeration value = "elementBinding"/>
<xs:enumeration value = "modelGroupBinding"/>
</xs:restriction>
</xs:simpleType>
<xs:complexType name = "packageType">
<xs:sequence>
<xs:element name = "javadoc" type = "xs:string" minOccurs = "0"/>
</xs:sequence>
<xs:attribute name = "name" type = "jaxb:javaIdentifierType"/>
</xs:complexType>
<xs:simpleType name = "underscoreBindingType">
<xs:annotation>
<xs:documentation>Treate underscore in XML Name to Java identifier mapping. </xs:documentation>
</xs:annotation>
<xs:restriction base = "xs:string">
<xs:enumeration value = "asWordSeparator"/>
<xs:enumeration value = "asCharInWord"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name = "typesafeEnumBaseType">
<xs:annotation>
<xs:documentation>
XML types or types derived from them which have enumeration facet(s) which
are be mapped to typesafeEnumClass by default.
The following types cannot be specified in this list:
"xsd:QName", "xsd:base64Binary", "xsd:hexBinary",
"xsd:date", "xsd:time", "xsd:dateTime", "xsd:duration",
"xsd:gDay", "xsd:gMonth", "xsd:Year", "xsd:gMonthDay", "xsd:YearMonth"
</xs:documentation>
</xs:annotation>
<xs:list itemType = "xs:QName"/>
</xs:simpleType>
<xs:simpleType name = "typesafeEnumMemberNameType">
<xs:annotation>
<xs:documentation>
Used to customize how to handle name collisions.
i. generate VALUE_1, VALUE_2... if generateName.
ii. generate an error if value is generateError. This is JAXB default behavior.
</xs:documentation>
</xs:annotation>
<xs:restriction base = "xs:string">
<xs:enumeration value = "generateName"/>
<xs:enumeration value = "generateError"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name = "javaIdentifierType">
<xs:annotation>
<xs:documentation>Placeholder type to indicate Legal Java identifier.</xs:documentation>
</xs:annotation>
<xs:list itemType = "xs:NCName"/>
</xs:simpleType>
<xs:complexType name = "nameXmlTransformRule">
<xs:annotation>
<xs:documentation>Rule to transform an Xml name into another Xml name</xs:documentation>
</xs:annotation>
<xs:attribute name = "prefix" type = "xs:string">
<xs:annotation>
<xs:documentation>prepend the string to QName.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name = "suffix" type = "xs:string">
<xs:annotation>
<xs:documentation>Append the string to QName.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType name = "nameXmlTransformType">
<xs:annotation>
<xs:documentation>
Allows transforming an xml name into another xml name. Use case UDDI 2.0 schema.
</xs:documentation>
</xs:annotation>
<xs:all>
<xs:element name = "typeName" type = "jaxb:nameXmlTransformRule" minOccurs = "0">
<xs:annotation>
<xs:documentation>Mapping rule for type definitions.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name = "elementName" type = "jaxb:nameXmlTransformRule" minOccurs = "0">
<xs:annotation>
<xs:documentation>Mapping rule for elements</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name = "modelGroupName" type = "jaxb:nameXmlTransformRule" minOccurs = "0">
<xs:annotation>
<xs:documentation>Mapping rule for model group</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name = "anonymousTypeName" type = "jaxb:nameXmlTransformRule" minOccurs = "0">
<xs:annotation>
<xs:documentation>Mapping rule for class names generated for an anonymous type.</xs:documentation>
</xs:annotation>
</xs:element>
</xs:all>
</xs:complexType>
<xs:attribute name = "extensionBindingPrefixes">
<xs:annotation>
<xs:documentation>
A binding compiler only processes this attribute when it occurs on an
an instance of xs:schema element. The value of this attribute is a
whitespace-separated list of namespace prefixes. The namespace bound
to each of the prefixes is designated as a customization declaration
namespace.
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:list itemType = "xs:normalizedString"/>
</xs:simpleType>
</xs:attribute>
<xs:element name = "bindings">
<xs:annotation>
<xs:documentation>
Binding declaration(s) for a remote schema.
If attribute node is set, the binding declaraions
are associated with part of the remote schema
designated by schemaLocation attribute. The node
attribute identifies the node in the remote schema
to associate the binding declaration(s) with.
</xs:documentation>
</xs:annotation>
<!-- a <bindings> element can contain arbitrary number of binding declarations or nested <bindings> elements -->
<xs:complexType>
<xs:sequence>
<xs:choice minOccurs = "0" maxOccurs = "unbounded">
<xs:group ref = "jaxb:declaration"/>
<xs:element ref = "jaxb:bindings"/>
</xs:choice>
</xs:sequence>
<xs:attribute name = "schemaLocation" type = "xs:anyURI">
<xs:annotation>
<xs:documentation>
Location of the remote schema to associate binding declarations with.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name = "node" type = "xs:string">
<xs:annotation>
<xs:documentation>
The value of the string is an XPATH 1.0 compliant string that
resolves to a node in a remote schema to associate
binding declarations with. The remote schema is specified
by the schemaLocation attribute occuring in the current
element or in a parent of this element.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name = "version" type = "xs:token">
<xs:annotation>
<xs:documentation>
Used to indicate the version of binding declarations.
Only valid on root level bindings element.
Either this or "jaxb:version" attribute but not both may be specified.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute ref = "jaxb:version">
<xs:annotation>
<xs:documentation>
Used to indicate the version of binding declarations.
Only valid on root level bindings element.
Either this attribute or "version" attribute but not both may be specified.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
<xs:simpleType name="referenceCollectionType">
<xs:union>
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="indexed"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType>
<xs:restriction base="jaxb:javaIdentifierType"/>
</xs:simpleType>
</xs:union>
</xs:simpleType>
</xs:schema>
.gif
.jpg
.jpeg
.jpeg1
.jpeg2
.png
.svg
.tif
.exe
.ico
.jar
.zip
.war
.sql
.jks
.json
.class
.bin
.iml
.ipr
.envelope
.txt
.bat
.sh
.commented
.svnignore
.svn
/.auth
www
site
etc/config/copyright-exclude
jaxb-api-test/src/test/resources/logging.properties
jaxb-api-test/src/test/resources/javax/xml/bind/test.policy
jaxb-api-test/src/test/resources/jaxb/test/usr/jaxb.index
/LICENSE.md
/README.md
/CONTRIBUTING.md
/*
* Copyright (c) YYYY Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
<!--
Copyright (c) 2013, 2018 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Distribution License v. 1.0, which is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: BSD-3-Clause
-->
<FindBugsFilter>
<!--
As designed.
-->
<Match>
<Class name="javax.xml.bind.util.JAXBSource$1"/>
<Bug pattern="XFB_XML_FACTORY_BYPASS"/>
</Match>
<!--
TODO: reevaluate for MR
As designed, impossible to change, maybe with MR.
-->
<Match>
<Class name="javax.xml.bind.DatatypeConverterImpl"/>
<Bug pattern="NP_BOOLEAN_RETURN_NULL"/>
</Match>
<!--
TODO: reevaluate for MR
As designed, impossible to change, maybe with MR?
-->
<Match>
<Class name="javax.xml.bind.annotation.adapters.HexBinaryAdapter"/>
<Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
</Match>
</FindBugsFilter>
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
This program and the accompanying materials are made available under the
terms of the Eclipse Distribution License v. 1.0, which is available at
http://www.eclipse.org/org/documents/edl-v10.php.
SPDX-License-Identifier: BSD-3-Clause
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>jaxb-api-parent</artifactId>
<groupId>javax.xml.bind</groupId>
<version>2.3.2-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>jaxb-api-test</artifactId>
<packaging>jar</packaging>
<properties>
<config.dir>${project.basedir}/../etc/config</config.dir>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>9</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-source-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>test-compile</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>${project.version}</version>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/mods</outputDirectory>
</artifactItem>
<artifactItem>
<groupId>javax.activation</groupId>
<artifactId>javax.activation-api</artifactId>
<version>${activation.version}</version>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/mods</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>
--add-modules java.xml.bind
--upgrade-module-path ${project.build.directory}/mods/jaxb-api-${project.version}.jar
--module-path ${project.build.directory}/mods/javax.activation-api-${activation.version}.jar
--add-reads java.xml.bind=ALL-UNNAMED
</argLine>
<systemPropertyVariables>
<java.util.logging.config.file>
src/test/resources/logging.properties
</java.util.logging.config.file>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</project>
/*
* Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/**
* Placeholder for
*/
module java.xml.bind.tests.src {}
/*
* Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package javax.xml.bind.test;
import org.junit.Before;
import org.junit.Test;
import javax.xml.bind.*;
import java.util.Map;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.TestCase.fail;
/**
* regression test for
* JDK-8145104: NPE is thrown when JAXBContextFactory implementation is specified in system property
*/
public class JAXBContextServiceProviderNPETest {
public static class Factory implements JAXBContextFactory {
@Override
public JAXBContext createContext(Class<?>[] classesToBeBound, Map<String, ?> properties) throws JAXBException {
return new MyContext();
}
@Override
public JAXBContext createContext(String contextPath, ClassLoader classLoader, Map<String, ?> properties)
throws JAXBException {
return new MyContext();
}
}
static class MyContext extends JAXBContext {
@Override
public Unmarshaller createUnmarshaller() throws JAXBException {
return null;
}
@Override
public Marshaller createMarshaller() throws JAXBException {
return null;
}
@Override
public Validator createValidator() throws JAXBException {
return null;
}
}
@Test
public void testContextPath() {
try {
JAXBContext ctx = JAXBContext.newInstance("whatever", ClassLoader.getSystemClassLoader());
assertNotNull("Expected non-null instance to be returned from the test Factory", ctx);
assertEquals("Expected MyContext instance to be returned from the test Factory", MyContext.class, ctx.getClass());
} catch (Throwable t) {
t.printStackTrace();
fail("Not expected to fail!");
}
}
@Test
public void testClasses() {
try {
JAXBContext ctx = JAXBContext.newInstance(new Class[0]);
assertNotNull("Expected non-null instance to be returned from the test Factory", ctx);
assertEquals("Expected MyContext instance to be returned from the test Factory", MyContext.class, ctx.getClass());
} catch (Throwable t) {
t.printStackTrace();
fail("Not expected to fail!");
}
}
@Before
public void setup() {
System.setProperty("javax.xml.bind.JAXBContextFactory", "javax.xml.bind.test.JAXBContextServiceProviderNPETest$Factory");
}
public static void main(String[] args) throws JAXBException {
JAXBContextServiceProviderNPETest tst = new JAXBContextServiceProviderNPETest();
tst.setup();
tst.testContextPath();
tst.testClasses();
}
}
/*
* Copyright (c) 2003, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package javax.xml.bind.test;
import jaxb.test.usr.A;
import junit.framework.AssertionFailedError;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import javax.xml.bind.JAXBContext;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardOpenOption;
import java.util.Arrays;
import java.util.Collection;
import java.util.logging.Logger;
import static junit.framework.TestCase.assertTrue;
/*
* test for JDK-8131334: SAAJ Plugability Layer: using java.util.ServiceLoader
*
* There are unsafe scenarios not to be run within the build (modifying jdk files).
* To run those, following needs to be done:
* 1. allow java to write into $JAVA_HOME/conf: mkdir $JAVA_HOME/conf; chmod a+rw $JAVA_HOME/conf
* 2. use "runUnsafe" property: mvn clean test -DrunUnsafe=true
*/
@RunWith(Parameterized.class)
public class JAXBContextTest {
static final Logger logger = Logger.getLogger(JAXBContextTest.class.getName());
static final Boolean skipUnsafe = !Boolean.getBoolean("runUnsafe");
// test configuration ------------------------------------------
// test-classes directory (required for setup and for security settings)
static final String classesDir = JAXBContextTest.class.getProtectionDomain().getCodeSource().getLocation().getFile();
private static final String FACTORY_ID_LEGACY = "javax.xml.bind.context.factory";
private static final String FACTORY_ID = "javax.xml.bind.JAXBContextFactory";
private static final String PACKAGE_LEGACY = "jaxb.factory.legacy."; // TODO: ???
private static final String PACKAGE_SPI = "jaxb.factory.spi."; // TODO: ???
private static final Object DEFAULT = "com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl";
static {
System.setProperty("classesDir", classesDir);
}
// configuration to be created by the test
static Path providersDir = Paths.get(classesDir, "META-INF", "services");
static Path providersFileLegacy = providersDir.resolve("javax.xml.bind.JAXBContext");
static Path providersFile = providersDir.resolve("javax.xml.bind.JAXBContextFactory");
// configuration to be created by the test
static Path jaxbPropsDir = Paths.get(classesDir, "jaxb", "test", "usr");
static Path jaxbPropsFile = jaxbPropsDir.resolve("jaxb.properties");
// test instance -----------------------------------------------
// scenario name - just for logging
String scenario;
// java policy file for testing w/security manager
private String expectedFactory;
private Class<?> expectedException;
@Parameterized.Parameters
public static Collection configurations() {
return Arrays.asList(new Object[][]{
// scenario-name, jaxb.properties, svc, arg1, arg2, system-props
{"scenario-1", FACTORY_ID_LEGACY + "="+PACKAGE_LEGACY+"Valid", null, PACKAGE_LEGACY+"Valid$JAXBContext1", null, null},
{"scenario-3", FACTORY_ID_LEGACY + "=non.existing.FactoryClass", null, null, javax.xml.bind.JAXBException.class, null},
{"scenario-4", FACTORY_ID_LEGACY + "="+PACKAGE_LEGACY+"Invalid", null, null, javax.xml.bind.JAXBException.class, null},
{"scenario-13", FACTORY_ID_LEGACY + "="+PACKAGE_LEGACY+"Valid", PACKAGE_LEGACY+"Valid2", PACKAGE_LEGACY+"Valid$JAXBContext1", null, PACKAGE_LEGACY+"Valid3"},
{"scenario-1", FACTORY_ID_LEGACY + "="+PACKAGE_SPI+"Valid", null, PACKAGE_SPI+"Valid$JAXBContext1", null, null},
{"scenario-3", FACTORY_ID_LEGACY + "=non.existing.FactoryClass", null, null, javax.xml.bind.JAXBException.class, null},
{"scenario-4", FACTORY_ID_LEGACY + "="+PACKAGE_SPI+"Invalid", null, null, javax.xml.bind.JAXBException.class, null},
{"scenario-13", FACTORY_ID_LEGACY + "="+PACKAGE_SPI+"Valid", PACKAGE_SPI+"Valid2", PACKAGE_SPI+"Valid$JAXBContext1", null, PACKAGE_SPI+"Valid3"},
{"scenario-1", FACTORY_ID + "="+PACKAGE_SPI+"Valid", null, PACKAGE_SPI+"Valid$JAXBContext1", null, null},
{"scenario-3", FACTORY_ID + "=non.existing.FactoryClass", null, null, javax.xml.bind.JAXBException.class, null},
{"scenario-4", FACTORY_ID + "="+PACKAGE_SPI+"Invalid", null, null, javax.xml.bind.JAXBException.class, null},
{"scenario-13", FACTORY_ID + "="+PACKAGE_SPI+"Valid", PACKAGE_SPI+"Valid2", PACKAGE_SPI+"Valid$JAXBContext1", null, PACKAGE_SPI+"Valid3"},
{"scenario-1", FACTORY_ID + "="+PACKAGE_LEGACY+"Valid", null, PACKAGE_LEGACY+"Valid$JAXBContext1", null, null},
{"scenario-3", FACTORY_ID + "=non.existing.FactoryClass", null, null, javax.xml.bind.JAXBException.class, null},
{"scenario-4", FACTORY_ID + "="+PACKAGE_LEGACY+"Invalid", null, null, javax.xml.bind.JAXBException.class, null},
{"scenario-13", FACTORY_ID + "="+PACKAGE_LEGACY+"Valid", PACKAGE_LEGACY+"Valid2", PACKAGE_LEGACY+"Valid$JAXBContext1", null, PACKAGE_LEGACY+"Valid3"},
{"scenario-2", "something=AnotherThing", null, null, javax.xml.bind.JAXBException.class, null},
// service loader
{"scenario-8", null, PACKAGE_SPI+"Valid\n", PACKAGE_SPI+"Valid$JAXBContext1", null, null},
{"scenario-9", null, PACKAGE_SPI+"Valid", PACKAGE_SPI+"Valid$JAXBContext1", null, null},
{"scenario-11", null, PACKAGE_SPI+"Invalid", null, javax.xml.bind.JAXBException.class, null},
{"scenario-15", null, PACKAGE_SPI+"Valid", PACKAGE_SPI+"Valid$JAXBContext1", null, null},
// service loader - legacy
{"scenario-8 legacy-svc", null, PACKAGE_SPI+"Valid\n", PACKAGE_SPI+"Valid$JAXBContext1", null, null},
{"scenario-9 legacy-svc", null, PACKAGE_SPI+"Valid", PACKAGE_SPI+"Valid$JAXBContext1", null, null},
{"scenario-11 legacy-svc", null, PACKAGE_SPI+"Invalid", null, javax.xml.bind.JAXBException.class, null},
{"scenario-15 legacy-svc", null, PACKAGE_SPI+"Valid", PACKAGE_SPI+"Valid$JAXBContext1", null, null},
// service loader - legacy
{"scenario-8 legacy-svc", null, PACKAGE_LEGACY+"Valid\n", PACKAGE_LEGACY+"Valid$JAXBContext1", null, null},
{"scenario-9 legacy-svc", null, PACKAGE_LEGACY+"Valid", PACKAGE_LEGACY+"Valid$JAXBContext1", null, null},
{"scenario-11 legacy-svc", null, PACKAGE_LEGACY+"Invalid", null, javax.xml.bind.JAXBException.class, null},
{"scenario-15 legacy-svc", null, PACKAGE_LEGACY+"Valid", PACKAGE_LEGACY+"Valid$JAXBContext1", null, null},
// system property
{"scenario-5", null, null, PACKAGE_SPI+"Valid$JAXBContext1", null, PACKAGE_SPI+"Valid"},
{"scenario-7", null, null, null, javax.xml.bind.JAXBException.class, PACKAGE_SPI+"Invalid"},
{"scenario-14", null, PACKAGE_SPI+"Valid2", PACKAGE_SPI+"Valid$JAXBContext1", null, PACKAGE_SPI+"Valid"},
{"scenario-5", null, null, PACKAGE_LEGACY+"Valid$JAXBContext1", null, PACKAGE_LEGACY+"Valid"},
{"scenario-7", null, null, null, javax.xml.bind.JAXBException.class, PACKAGE_LEGACY+"Invalid"},
{"scenario-14", null, PACKAGE_LEGACY+"Valid2", PACKAGE_LEGACY+"Valid$JAXBContext1", null, PACKAGE_LEGACY+"Valid"},
{"scenario-6", null, null, null, javax.xml.bind.JAXBException.class, "jaxb.factory.NonExisting"},
{"scenario-10", null, "jaxb.factory.NonExisting", null, javax.xml.bind.JAXBException.class, null},
{"scenario-12", null, null, DEFAULT, javax.xml.bind.JAXBException.class, null},
});
}
// scenario-name, jaxb.properties, svc, arg1, arg2, system-props
public JAXBContextTest(
String scenario,
String jaxbPropertiesClass,
String spiClass,
String expectedFactory,
Class<?> expectedException,
String systemProperty
) {
// ensure setup may be done ...
System.setSecurityManager(null);
if (systemProperty != null) {
System.setProperty("javax.xml.bind.JAXBContextFactory", systemProperty);
} else {
System.clearProperty("javax.xml.bind.JAXBContextFactory");
}
this.scenario = scenario;
this.expectedFactory = expectedFactory;
this.expectedException = expectedException;
if (skipUnsafe && scenario.startsWith("unsafe")) {
log("Skipping unsafe scenario:" + scenario);
return;
}
prepare(jaxbPropertiesClass, spiClass);
}
@Test
public void testPath() throws IOException {
logConfigurations();
try {
JAXBContext ctx = JAXBContext.newInstance("jaxb.test.usr");
handleResult(ctx);
} catch (Throwable throwable) {
handleThrowable(throwable);
} finally {
doFinally();
}
}
@Test
public void testClasses() throws IOException {
logConfigurations();
try {
JAXBContext ctx = JAXBContext.newInstance(new Class[] {A.class}, null);
handleResult(ctx);
} catch (Throwable throwable) {
handleThrowable(throwable);
} finally {
doFinally();
}
}
@Test
public void testClass() throws IOException {
logConfigurations();
try {
JAXBContext ctx = JAXBContext.newInstance(A.class);
handleResult(ctx);
} catch (Throwable throwable) {
handleThrowable(throwable);
} finally {
doFinally();
}
}
private void handleResult(JAXBContext ctx) {
assertTrue("No ctx found.", ctx != null);
log(" TEST: context class = [" + ctx.getClass().getName() + "]\n");
String className = ctx.getClass().getName();
assertTrue("Incorrect ctx: [" + className + "], Expected: [" + expectedFactory + "]",
className.equals(expectedFactory));
log(" TEST PASSED");
}
private void handleThrowable(Throwable throwable) {
if (throwable instanceof AssertionFailedError) throw ((AssertionFailedError)throwable);
Class<?> throwableClass = throwable.getClass();
boolean correctException = throwableClass.equals(expectedException);
if (!correctException) {
throwable.printStackTrace();
}
if (expectedException == null) {
throw new AssertionFailedError("Unexpected exception:" + throwableClass);
}
assertTrue("Got unexpected exception: [" + throwableClass + "], expected: [" + expectedException + "]",
correctException);
log(" TEST PASSED");
}
private void doFinally() {
cleanResource(providersFile);
//cleanResource(providersDir);
// unsafe; not running:
cleanResource(jaxbPropsFile);
System.setSecurityManager(null);
}
@Test
public void testPathSM() throws IOException {
enableSM();
testPath();
}
@Test
public void testClassSM() throws IOException {
enableSM();
testClass();
}
@Test
public void testClassesSM() throws IOException {
enableSM();
testClasses();
}
private void enableSM() {
System.setSecurityManager(null);
System.setProperty("java.security.policy", classesDir + "javax/xml/bind/test.policy");
System.setSecurityManager(new SecurityManager());
}
private void cleanResource(Path resource) {
try {
if (Files.exists(resource)) {
Files.deleteIfExists(resource);
}
} catch (IOException ignored) {
ignored.printStackTrace();
}
}
private void prepare(String propertiesClassName, String providerClassName) {
try {
log("providerClassName = " + providerClassName);
log("propertiesClassName = " + propertiesClassName);
cleanResource(providersFile);
cleanResource(providersFileLegacy);
if (scenario.contains("legacy-svc")) {
setupFile(providersFileLegacy, providersDir, providerClassName);
} else {
setupFile(providersFile, providersDir, providerClassName);
}
// unsafe; not running:
if (propertiesClassName != null) {
setupFile(jaxbPropsFile, jaxbPropsDir, propertiesClassName);
} else {
cleanResource(jaxbPropsFile);
}
log(" SETUP OK.");
} catch (IOException e) {
log(" SETUP FAILED.");
e.printStackTrace();
}
}
private void logConfigurations() throws IOException {
logFile(providersFile);
logFile(providersFileLegacy);
logFile(jaxbPropsFile);
}
private void logFile(Path path) throws IOException {
if (Files.exists(path)) {
log("File [" + path + "] exists: [");
log(new String(Files.readAllBytes(path)));
log("]");
}
}
private void setupFile(Path file, Path dir, String value) throws IOException {
cleanResource(file);
if (value != null) {
log("writing configuration [" + value + "] into file [" + file.toAbsolutePath() + "]");
Files.createDirectories(dir);
Files.write(
file,
value.getBytes(),
StandardOpenOption.CREATE);
}
}
private void log(String msg) {
logger.info("[" + scenario + "] " + msg);
// System.out.println("[" + scenario + "] " + msg);
}
}
/*
* Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package javax.xml.bind.test;
import org.junit.Before;
import org.junit.Test;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import java.util.Map;
import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertTrue;
import static junit.framework.TestCase.assertNull;
/**
* regression test for
* JDK-8145112: newInstance(String, ClassLoader): java.lang.JAXBException should not be wrapped as expected
* according to spec
*/
public class JAXBContextWrapExceptionTest {
public static class Factory {
public static JAXBContext createContext(Class[] classesToBeBound, Map<String, ?> properties) throws JAXBException {
throw new JAXBException("test");
}
public static JAXBContext createContext(String contextPath, ClassLoader classLoader, Map<String, ?> properties)
throws JAXBException {
throw new JAXBException("test");
}
}
@Test
public void testContextPath() {
try {
JAXBContext.newInstance("whatever", ClassLoader.getSystemClassLoader());
} catch (Throwable t) {
assertEquals("test", t.getMessage());
assertNull("Root cause must be null", t.getCause());
}
}
@Test
public void testClasses() {
try {
JAXBContext.newInstance(new Class[0]);
assertTrue("This should fail", false);
} catch (Throwable t) {
assertEquals("test", t.getMessage());
assertNull("Root cause must be null", t.getCause());
}
}
@Before
public void setup() {
System.setProperty("javax.xml.bind.JAXBContextFactory", "javax.xml.bind.test.JAXBContextWrapExceptionTest$Factory");
}
public static void main(String[] args) throws JAXBException {
new JAXBContextWrapExceptionTest().testContextPath();
new JAXBContextWrapExceptionTest().testClasses();
}
}
/*
* Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package jaxb.factory.legacy;
/**
* Invalid JAXBContext factory class for tests
* - doesn't contain required static methods
*/
public class Invalid {
}
/*
* Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package jaxb.factory.legacy;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.Validator;
import java.util.Map;
/**
* Valid JAXBContext factory class for tests
* - contains required static methods and creates dummy JAXBContext
*/
public class Valid {
public static JAXBContext createContext(java.lang.String path, java.lang.ClassLoader cl) {
return new JAXBContext1();
}
public static JAXBContext createContext(Class[] classes, Map<String, Object> properties) throws JAXBException {
return new JAXBContext1();
}
public static class JAXBContext1 extends JAXBContext {
@Override
public Unmarshaller createUnmarshaller() throws JAXBException {
return null;
}
@Override
public Marshaller createMarshaller() throws JAXBException {
return null;
}
@Override
public Validator createValidator() throws JAXBException {
return null;
}
}
}
/*
* Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package jaxb.factory.legacy;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.Validator;
import java.util.Map;
/**
* (Another) Valid JAXBContext factory class for tests
* - contains required static methods and creates dummy JAXBContext
* - several implementations necessary to test different configuration approaches
*/
public class Valid2 {
public static JAXBContext createContext(String path, ClassLoader cl) {
return new JAXBContext1();
}
public static JAXBContext createContext(Class[] classes, Map<String, Object> properties) throws JAXBException {
return new JAXBContext1();
}
public static class JAXBContext1 extends JAXBContext {
@Override
public Unmarshaller createUnmarshaller() throws JAXBException {
return null;
}
@Override
public Marshaller createMarshaller() throws JAXBException {
return null;
}
@Override
public Validator createValidator() throws JAXBException {
return null;
}
}
}
/*
* Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package jaxb.factory.legacy;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.Validator;
import java.util.Map;
/**
* (Another) Valid JAXBContext factory class for tests
* - contains required static methods and creates dummy JAXBContext
* - several implementations necessary to test different configuration approaches
*/
public class Valid3 {
public static JAXBContext createContext(String path, ClassLoader cl) {
return new JAXBContext1();
}
public static JAXBContext createContext(Class[] classes, Map<String, Object> properties) throws JAXBException {
return new JAXBContext1();
}
public static class JAXBContext1 extends JAXBContext {
@Override
public Unmarshaller createUnmarshaller() throws JAXBException {
return null;
}
@Override
public Marshaller createMarshaller() throws JAXBException {
return null;
}
@Override
public Validator createValidator() throws JAXBException {
return null;
}
}
}
/*
* Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package jaxb.factory.spi;
/**
* Invalid JAXBContext factory class for tests
* - doesn't contain required static methods
*/
public class Invalid {
}
/*
* Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package jaxb.factory.spi;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBContextFactory;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.Validator;
import java.util.Map;
/**
* Created by miran on 10/11/14.
*/
public class Valid implements JAXBContextFactory {
@Override
public JAXBContext createContext(Class<?>[] classesToBeBound, Map<String, ?> properties) throws JAXBException {
return new JAXBContext1();
}
@Override
public JAXBContext createContext(String contextPath, ClassLoader classLoader, Map<String, ?> properties) throws JAXBException {
return new JAXBContext1();
}
public static class JAXBContext1 extends JAXBContext {
@Override
public Unmarshaller createUnmarshaller() throws JAXBException {
return null;
}
@Override
public Marshaller createMarshaller() throws JAXBException {
return null;
}
@Override
public Validator createValidator() throws JAXBException {
return null;
}
}
}
/*
* Copyright (c) 2015, 2018 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package jaxb.factory.spi;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBContextFactory;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.Validator;
import java.util.Map;
/**
* Created by miran on 10/11/14.
*/
public class Valid2 implements JAXBContextFactory {
@Override
public JAXBContext createContext(Class<?>[] classesToBeBound, Map<String, ?> properties) throws JAXBException {
return new JAXBContext1();
}
@Override
public JAXBContext createContext(String contextPath, ClassLoader classLoader, Map<String, ?> properties) throws JAXBException {
return new JAXBContext1();
}
public static class JAXBContext1 extends JAXBContext {
@Override
public Unmarshaller createUnmarshaller() throws JAXBException {
return null;
}
@Override
public Marshaller createMarshaller() throws JAXBException {
return null;
}
@Override
public Validator createValidator() throws JAXBException {
return null;
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment