8076549: Update JAX-WS RI integration to latest version (2.2.11-b150402.1412)

Reviewed-by: joehw
This commit is contained in:
Aleksei Efimov 2015-04-10 14:54:20 +03:00
parent e80c4deeea
commit 1c82d4a0c7
72 changed files with 1357 additions and 1101 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,8 +30,6 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.ref.WeakReference;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Map;
import java.util.WeakHashMap;
import java.util.logging.Level;
@ -87,25 +85,19 @@ public final class ClassFactory {
if(consRef!=null)
cons = consRef.get();
if(cons==null) {
cons = AccessController.doPrivileged(new PrivilegedAction<Constructor<T>>() {
@Override
public Constructor<T> run() {
try {
return clazz.getDeclaredConstructor(emptyClass);
} catch (NoSuchMethodException e) {
logger.log(Level.INFO,"No default constructor found on "+clazz,e);
NoSuchMethodError exp;
if(clazz.getDeclaringClass()!=null && !Modifier.isStatic(clazz.getModifiers())) {
exp = new NoSuchMethodError(Messages.NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS
.format(clazz.getName()));
} else {
exp = new NoSuchMethodError(e.getMessage());
}
exp.initCause(e);
throw exp;
}
try {
cons = clazz.getDeclaredConstructor(emptyClass);
} catch (NoSuchMethodException e) {
logger.log(Level.INFO,"No default constructor found on "+clazz,e);
NoSuchMethodError exp;
if(clazz.getDeclaringClass()!=null && !Modifier.isStatic(clazz.getModifiers())) {
exp = new NoSuchMethodError(Messages.NO_DEFAULT_CONSTRUCTOR_IN_INNER_CLASS.format(clazz.getName()));
} else {
exp = new NoSuchMethodError(e.getMessage());
}
});
exp.initCause(e);
throw exp;
}
int classMod = clazz.getModifiers();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,12 +25,18 @@
package com.sun.xml.internal.org.jvnet.mimepull;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.nio.ByteBuffer;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -40,19 +46,21 @@ import java.util.logging.Logger;
*
* @author Jitendra Kotamraju
*/
public class MIMEMessage {
public class MIMEMessage implements Closeable {
private static final Logger LOGGER = Logger.getLogger(MIMEMessage.class.getName());
MIMEConfig config;
private final InputStream in;
private final List<MIMEPart> partsList;
private final Map<String, MIMEPart> partsMap;
private final Iterator<MIMEEvent> it;
private boolean parsed; // true when entire message is parsed
private MIMEPart currentPart;
private int currentIndex;
private final List<MIMEPart> partsList = new ArrayList<MIMEPart>();
private final Map<String, MIMEPart> partsMap = new HashMap<String, MIMEPart>();
/**
* @see MIMEMessage(InputStream, String, MIMEConfig)
*/
@ -64,9 +72,9 @@ public class MIMEMessage {
* Creates a MIME message from the content's stream. The content stream
* is closed when EOF is reached.
*
* @param in MIME message stream
* @param in MIME message stream
* @param boundary the separator for parts(pass it without --)
* @param config various configuration parameters
* @param config various configuration parameters
*/
public MIMEMessage(InputStream in, String boundary, MIMEConfig config) {
this.in = in;
@ -74,8 +82,6 @@ public class MIMEMessage {
MIMEParser parser = new MIMEParser(in, boundary, config);
it = parser.iterator();
partsList = new ArrayList<MIMEPart>();
partsMap = new HashMap<String, MIMEPart>();
if (config.isParseEagerly()) {
parseAll();
}
@ -108,14 +114,14 @@ public class MIMEMessage {
LOGGER.log(Level.FINE, "index={0}", index);
MIMEPart part = (index < partsList.size()) ? partsList.get(index) : null;
if (parsed && part == null) {
throw new MIMEParsingException("There is no "+index+" attachment part ");
throw new MIMEParsingException("There is no " + index + " attachment part ");
}
if (part == null) {
// Parsing will done lazily and will be driven by reading the part
part = new MIMEPart(this);
partsList.add(index, part);
}
LOGGER.log(Level.FINE, "Got attachment at index={0} attachment={1}", new Object[]{index, part});
LOGGER.log(Level.FINE, "Got attachment at index={0} attachment={1}", new Object[] {index, part});
return part;
}
@ -132,14 +138,14 @@ public class MIMEMessage {
LOGGER.log(Level.FINE, "Content-ID={0}", contentId);
MIMEPart part = getDecodedCidPart(contentId);
if (parsed && part == null) {
throw new MIMEParsingException("There is no attachment part with Content-ID = "+contentId);
throw new MIMEParsingException("There is no attachment part with Content-ID = " + contentId);
}
if (part == null) {
// Parsing is done lazily and is driven by reading the part
part = new MIMEPart(this, contentId);
partsMap.put(contentId, part);
}
LOGGER.log(Level.FINE, "Got attachment for Content-ID={0} attachment={1}", new Object[]{contentId, part});
LOGGER.log(Level.FINE, "Got attachment for Content-ID={0} attachment={1}", new Object[] {contentId, part});
return part;
}
@ -151,7 +157,7 @@ public class MIMEMessage {
try {
String tempCid = URLDecoder.decode(cid, "utf-8");
part = partsMap.get(tempCid);
} catch(UnsupportedEncodingException ue) {
} catch (UnsupportedEncodingException ue) {
// Ignore it
}
}
@ -159,22 +165,43 @@ public class MIMEMessage {
return part;
}
/**
* Parses the whole MIME message eagerly
*/
public final void parseAll() {
while(makeProgress()) {
while (makeProgress()) {
// Nothing to do
}
}
/**
* Closes all parsed {@link com.sun.xml.internal.org.jvnet.mimepull.MIMEPart parts}.
* This method is safe to call even if parsing of message failed.
* <p/>
* Does not throw {@link com.sun.xml.internal.org.jvnet.mimepull.MIMEParsingException} if an
* error occurred during closing a MIME part. The exception (if any) is
* still logged.
*/
@Override
public void close() {
close(partsList);
close(partsMap.values());
}
private void close(final Collection<MIMEPart> parts) {
for (final MIMEPart part : parts) {
try {
part.close();
} catch (final MIMEParsingException closeError) {
LOGGER.log(Level.FINE, "Exception during closing MIME part", closeError);
}
}
}
/**
* Parses the MIME message in a pull fashion.
*
* @return
* false if the parsing is completed.
* @return false if the parsing is completed.
*/
public synchronized boolean makeProgress() {
if (!it.hasNext()) {
@ -183,23 +210,23 @@ public class MIMEMessage {
MIMEEvent event = it.next();
switch(event.getEventType()) {
case START_MESSAGE :
switch (event.getEventType()) {
case START_MESSAGE:
LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.START_MESSAGE);
break;
case START_PART :
case START_PART:
LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.START_PART);
break;
case HEADERS :
case HEADERS:
LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.HEADERS);
MIMEEvent.Headers headers = (MIMEEvent.Headers)event;
MIMEEvent.Headers headers = (MIMEEvent.Headers) event;
InternetHeaders ih = headers.getHeaders();
List<String> cids = ih.getHeader("content-id");
String cid = (cids != null) ? cids.get(0) : currentIndex+"";
if (cid.length() > 2 && cid.charAt(0)=='<') {
cid = cid.substring(1,cid.length()-1);
String cid = (cids != null) ? cids.get(0) : currentIndex + "";
if (cid.length() > 2 && cid.charAt(0) == '<') {
cid = cid.substring(1, cid.length() - 1);
}
MIMEPart listPart = (currentIndex < partsList.size()) ? partsList.get(currentIndex) : null;
MIMEPart mapPart = getDecodedCidPart(cid);
@ -219,31 +246,31 @@ public class MIMEMessage {
currentPart.setHeaders(ih);
break;
case CONTENT :
case CONTENT:
LOGGER.log(Level.FINER, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.CONTENT);
MIMEEvent.Content content = (MIMEEvent.Content)event;
MIMEEvent.Content content = (MIMEEvent.Content) event;
ByteBuffer buf = content.getData();
currentPart.addBody(buf);
break;
case END_PART :
case END_PART:
LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.END_PART);
currentPart.doneParsing();
++currentIndex;
break;
case END_MESSAGE :
case END_MESSAGE:
LOGGER.log(Level.FINE, "MIMEEvent={0}", MIMEEvent.EVENT_TYPE.END_MESSAGE);
parsed = true;
try {
in.close();
} catch(IOException ioe) {
} catch (IOException ioe) {
throw new MIMEParsingException(ioe);
}
break;
default :
throw new MIMEParsingException("Unknown Parser state = "+event.getEventType());
default:
throw new MIMEParsingException("Unknown Parser state = " + event.getEventType());
}
return true;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,7 @@
package com.sun.xml.internal.org.jvnet.mimepull;
import java.io.Closeable;
import java.io.File;
import java.io.InputStream;
import java.nio.ByteBuffer;
@ -42,10 +43,11 @@ import java.util.logging.Logger;
*
* @author Jitendra Kotamraju, Martin Grebac
*/
public class MIMEPart {
public class MIMEPart implements Closeable {
private static final Logger LOGGER = Logger.getLogger(MIMEPart.class.getName());
private volatile boolean closed;
private volatile InternetHeaders headers;
private volatile String contentId;
private String contentType;
@ -55,6 +57,8 @@ public class MIMEPart {
final MIMEMessage msg;
private final DataHead dataHead;
private final Object lock = new Object();
MIMEPart(MIMEMessage msg) {
this.msg = msg;
this.dataHead = new DataHead(this);
@ -91,8 +95,16 @@ public class MIMEPart {
* the temp file that is used to serve this part's content). After
* calling this, one shouldn't call {@link #read()} or {@link #readOnce()}
*/
@Override
public void close() {
dataHead.close();
if (!closed) {
synchronized (lock) {
if (!closed) {
dataHead.close();
closed = true;
}
}
}
}
/**
@ -242,6 +254,15 @@ public class MIMEPart {
this.contentTransferEncoding = cte;
}
/**
* Return {@code true} if this part has already been closed, {@code false} otherwise.
*
* @return {@code true} if this part has already been closed, {@code false} otherwise.
*/
public boolean isClosed() {
return closed;
}
@Override
public String toString() {
return "Part="+contentId+":"+contentTransferEncoding;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -84,9 +84,6 @@ final class MemoryData implements Data {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Created temp file = {0}", tempFile);
}
// delete the temp file when VM exits as a last resort for file clean up
tempFile.deleteOnExit();
if (LOGGER.isLoggable(Level.FINE)) {LOGGER.log(Level.FINE, "Created temp file = {0}", tempFile);}
dataHead.dataFile = new DataFile(tempFile);
} catch (IOException ioe) {
throw new MIMEParsingException(ioe);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,7 +25,6 @@
package javax.xml.bind;
import java.util.Iterator;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
@ -34,15 +33,13 @@ import java.io.UnsupportedEncodingException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
import java.security.AccessController;
import java.util.Map;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.security.AccessController;
import static javax.xml.bind.JAXBContext.JAXB_CONTEXT_FACTORY;
/**
@ -55,7 +52,24 @@ import static javax.xml.bind.JAXBContext.JAXB_CONTEXT_FACTORY;
* @see JAXBContext
*/
class ContextFinder {
/**
* When JAXB is in J2SE, rt.jar has to have a JAXB implementation.
* However, rt.jar cannot have META-INF/services/javax.xml.bind.JAXBContext
* because if it has, it will take precedence over any file that applications have
* in their jar files.
*
* <p>
* When the user bundles his own JAXB implementation, we'd like to use it, and we
* want the platform default to be used only when there's no other JAXB provider.
*
* <p>
* For this reason, we have to hard-code the class name into the API.
*/
private static final String PLATFORM_DEFAULT_FACTORY_CLASS = "com.sun.xml.internal.bind.v2.ContextFactory";
private static final Logger logger;
static {
logger = Logger.getLogger("javax.xml.bind");
try {
@ -72,7 +86,7 @@ class ContextFinder {
// to honor what other frameworks
// have done on configurations.
}
} catch(Throwable t) {
} catch (Throwable t) {
// just to be extra safe. in particular System.getProperty may throw
// SecurityException.
}
@ -84,15 +98,15 @@ class ContextFinder {
*/
private static void handleInvocationTargetException(InvocationTargetException x) throws JAXBException {
Throwable t = x.getTargetException();
if( t != null ) {
if( t instanceof JAXBException )
if (t != null) {
if (t instanceof JAXBException)
// one of our exceptions, just re-throw
throw (JAXBException)t;
if( t instanceof RuntimeException )
throw (JAXBException) t;
if (t instanceof RuntimeException)
// avoid wrapping exceptions unnecessarily
throw (RuntimeException)t;
if( t instanceof Error )
throw (Error)t;
throw (RuntimeException) t;
if (t instanceof Error)
throw (Error) t;
}
}
@ -121,18 +135,17 @@ class ContextFinder {
/**
* Create an instance of a class using the specified ClassLoader
*/
static JAXBContext newInstance( String contextPath,
String className,
ClassLoader classLoader,
Map properties )
throws JAXBException {
static JAXBContext newInstance(String contextPath,
String className,
ClassLoader classLoader,
Map properties) throws JAXBException {
try {
Class spFactory = safeLoadClass(className,classLoader);
Class spFactory = ServiceLoaderUtil.safeLoadClass(className, PLATFORM_DEFAULT_FACTORY_CLASS, classLoader);
return newInstance(contextPath, spFactory, classLoader, properties);
} catch (ClassNotFoundException x) {
throw new JAXBException(
Messages.format( Messages.PROVIDER_NOT_FOUND, className ),
x);
throw new JAXBException(Messages.format(Messages.PROVIDER_NOT_FOUND, className), x);
} catch (RuntimeException x) {
// avoid wrapping RuntimeException to JAXBException,
// because it indicates a bug in this code.
@ -142,18 +155,12 @@ class ContextFinder {
// reflection. Root element collisions detected in the call to
// createContext() are reported as JAXBExceptions - just re-throw it
// some other type of exception - just wrap it
throw new JAXBException(
Messages.format( Messages.COULD_NOT_INSTANTIATE, className, x ),
x);
throw new JAXBException(Messages.format(Messages.COULD_NOT_INSTANTIATE, className, x), x);
}
}
static JAXBContext newInstance( String contextPath,
Class spFactory,
ClassLoader classLoader,
Map properties )
throws JAXBException
{
static JAXBContext newInstance(String contextPath, Class spFactory, ClassLoader classLoader, Map properties) throws JAXBException {
try {
/*
* javax.xml.bind.context.factory points to a class which has a
@ -166,35 +173,35 @@ class ContextFinder {
// first check the method that takes Map as the third parameter.
// this is added in 2.0.
try {
Method m = spFactory.getMethod("createContext",String.class,ClassLoader.class,Map.class);
Method m = spFactory.getMethod("createContext", String.class, ClassLoader.class, Map.class);
// any failure in invoking this method would be considered fatal
context = m.invoke(null,contextPath,classLoader,properties);
context = m.invoke(null, contextPath, classLoader, properties);
} catch (NoSuchMethodException e) {
// it's not an error for the provider not to have this method.
}
if(context==null) {
if (context == null) {
// try the old method that doesn't take properties. compatible with 1.0.
// it is an error for an implementation not to have both forms of the createContext method.
Method m = spFactory.getMethod("createContext",String.class,ClassLoader.class);
Method m = spFactory.getMethod("createContext", String.class, ClassLoader.class);
// any failure in invoking this method would be considered fatal
context = m.invoke(null,contextPath,classLoader);
context = m.invoke(null, contextPath, classLoader);
}
if(!(context instanceof JAXBContext)) {
if (!(context instanceof JAXBContext)) {
// the cast would fail, so generate an exception with a nice message
throw handleClassCastException(context.getClass(), JAXBContext.class);
}
return (JAXBContext)context;
return (JAXBContext) context;
} catch (InvocationTargetException x) {
handleInvocationTargetException(x);
// for other exceptions, wrap the internal target exception
// with a JAXBException
Throwable e = x;
if(x.getTargetException()!=null)
if (x.getTargetException() != null)
e = x.getTargetException();
throw new JAXBException( Messages.format( Messages.COULD_NOT_INSTANTIATE, spFactory, e ), e );
throw new JAXBException(Messages.format(Messages.COULD_NOT_INSTANTIATE, spFactory, e), e);
} catch (RuntimeException x) {
// avoid wrapping RuntimeException to JAXBException,
// because it indicates a bug in this code.
@ -204,29 +211,23 @@ class ContextFinder {
// reflection. Root element collisions detected in the call to
// createContext() are reported as JAXBExceptions - just re-throw it
// some other type of exception - just wrap it
throw new JAXBException(
Messages.format( Messages.COULD_NOT_INSTANTIATE, spFactory, x ),
x);
throw new JAXBException(Messages.format(Messages.COULD_NOT_INSTANTIATE, spFactory, x), x);
}
}
/**
* Create an instance of a class using the thread context ClassLoader
*/
static JAXBContext newInstance(
Class[] classes,
Map properties,
String className) throws JAXBException {
ClassLoader cl = getContextClassLoader();
static JAXBContext newInstance(Class[] classes, Map properties, String className) throws JAXBException {
Class spi;
try {
spi = safeLoadClass(className,cl);
spi = ServiceLoaderUtil.safeLoadClass(className, PLATFORM_DEFAULT_FACTORY_CLASS, getContextClassLoader());
} catch (ClassNotFoundException e) {
throw new JAXBException(e);
}
if(logger.isLoggable(Level.FINE)) {
if (logger.isLoggable(Level.FINE)) {
// extra check to avoid costly which operation if not logged
logger.log(Level.FINE, "loaded {0} from {1}", new Object[]{className, which(spi)});
}
@ -237,19 +238,16 @@ class ContextFinder {
static JAXBContext newInstance(Class[] classes,
Map properties,
Class spFactory) throws JAXBException {
Method m;
try {
m = spFactory.getMethod("createContext", Class[].class, Map.class);
} catch (NoSuchMethodException e) {
throw new JAXBException(e);
}
try {
Method m = spFactory.getMethod("createContext", Class[].class, Map.class);
Object context = m.invoke(null, classes, properties);
if(!(context instanceof JAXBContext)) {
if (!(context instanceof JAXBContext)) {
// the cast would fail, so generate an exception with a nice message
throw handleClassCastException(context.getClass(), JAXBContext.class);
}
return (JAXBContext)context;
return (JAXBContext) context;
} catch (NoSuchMethodException e) {
throw new JAXBException(e);
} catch (IllegalAccessException e) {
throw new JAXBException(e);
} catch (InvocationTargetException e) {
@ -263,241 +261,139 @@ class ContextFinder {
}
}
static JAXBContext find(String factoryId, String contextPath, ClassLoader classLoader, Map properties ) throws JAXBException {
static JAXBContext find(String factoryId, String contextPath, ClassLoader classLoader, Map properties) throws JAXBException {
// TODO: do we want/need another layer of searching in $java.home/lib/jaxb.properties like JAXP?
final String jaxbContextFQCN = JAXBContext.class.getName();
// search context path for jaxb.properties first
StringBuilder propFileName;
StringTokenizer packages = new StringTokenizer( contextPath, ":" );
String factoryClassName;
if(!packages.hasMoreTokens())
StringTokenizer packages = new StringTokenizer(contextPath, ":");
if (!packages.hasMoreTokens()) {
// no context is specified
throw new JAXBException(Messages.format(Messages.NO_PACKAGE_IN_CONTEXTPATH));
}
// search for jaxb.properties in the class loader of each class first
logger.fine("Searching jaxb.properties");
while( packages.hasMoreTokens() ) {
String packageName = packages.nextToken(":").replace('.','/');
while (packages.hasMoreTokens()) {
// com.acme.foo - > com/acme/foo/jaxb.properties
propFileName = new StringBuilder().append(packageName).append("/jaxb.properties");
Properties props = loadJAXBProperties( classLoader, propFileName.toString() );
if (props != null) {
if (props.containsKey(factoryId)) {
factoryClassName = props.getProperty(factoryId);
return newInstance( contextPath, factoryClassName, classLoader, properties );
} else {
throw new JAXBException(Messages.format(Messages.MISSING_PROPERTY, packageName, factoryId));
}
}
String className = classNameFromPackageProperties(factoryId, classLoader, packages.nextToken(":").replace('.', '/'));
if (className != null) return newInstance(contextPath, className, classLoader, properties);
}
logger.fine("Searching the system property");
String factoryName = classNameFromSystemProperties();
if (factoryName != null) return newInstance(contextPath, factoryName, classLoader, properties);
// search for a system property second (javax.xml.bind.JAXBContext)
factoryClassName = AccessController.doPrivileged(new GetPropertyAction(JAXBContext.JAXB_CONTEXT_FACTORY));
if( factoryClassName != null ) {
return newInstance( contextPath, factoryClassName, classLoader, properties );
} else { // leave this here to assure compatibility
factoryClassName = AccessController.doPrivileged(new GetPropertyAction(jaxbContextFQCN));
if( factoryClassName != null ) {
return newInstance( contextPath, factoryClassName, classLoader, properties );
}
Class ctxFactory = (Class) ServiceLoaderUtil.lookupUsingOSGiServiceLoader("javax.xml.bind.JAXBContext", logger);
if (ctxFactory != null) {
return newInstance(contextPath, ctxFactory, classLoader, properties);
}
// OSGi search
Class jaxbContext = lookupJaxbContextUsingOsgiServiceLoader();
if (jaxbContext != null) {
logger.fine("OSGi environment detected");
return newInstance(contextPath, jaxbContext, classLoader, properties);
}
// TODO: SPEC change required! This is supposed to be!
// JAXBContext obj = firstByServiceLoader(JAXBContext.class, EXCEPTION_HANDLER);
// if (obj != null) return obj;
logger.fine("Searching META-INF/services");
// search META-INF services next
BufferedReader r = null;
try {
final StringBuilder resource = new StringBuilder().append("META-INF/services/").append(jaxbContextFQCN);
final InputStream resourceStream =
classLoader.getResourceAsStream(resource.toString());
if (resourceStream != null) {
r = new BufferedReader(new InputStreamReader(resourceStream, "UTF-8"));
factoryClassName = r.readLine();
if (factoryClassName != null) {
factoryClassName = factoryClassName.trim();
}
r.close();
return newInstance(contextPath, factoryClassName, classLoader, properties);
} else {
logger.log(Level.FINE, "Unable to load:{0}", resource.toString());
}
} catch (UnsupportedEncodingException e) {
// should never happen
throw new JAXBException(e);
} catch (IOException e) {
throw new JAXBException(e);
} finally {
try {
if (r != null) {
r.close();
}
} catch (IOException ex) {
Logger.getLogger(ContextFinder.class.getName()).log(Level.SEVERE, null, ex);
}
}
// TODO: Deprecated - SPEC change required!
factoryName = firstByServiceLoaderDeprecated(JAXBContext.class, classLoader);
if (factoryName != null) return newInstance(contextPath, factoryName, classLoader, properties);
// else no provider found
logger.fine("Trying to create the platform default provider");
return newInstance(contextPath, PLATFORM_DEFAULT_FACTORY_CLASS, classLoader, properties);
}
static JAXBContext find( Class[] classes, Map properties ) throws JAXBException {
final String jaxbContextFQCN = JAXBContext.class.getName();
String factoryClassName;
static JAXBContext find(Class[] classes, Map properties) throws JAXBException {
// search for jaxb.properties in the class loader of each class first
logger.fine("Searching jaxb.properties");
for (final Class c : classes) {
// this classloader is used only to load jaxb.properties, so doing this should be safe.
ClassLoader classLoader = getClassClassLoader(c);
Package pkg = c.getPackage();
if(pkg==null)
continue; // this is possible for primitives, arrays, and classes that are loaded by poorly implemented ClassLoaders
String packageName = pkg.getName().replace('.', '/');
if (c.getPackage() == null) continue; // this is possible for primitives, arrays, and classes that are loaded by poorly implemented ClassLoaders
// TODO: do we want to optimize away searching the same package? org.Foo, org.Bar, com.Baz
// classes from the same package might come from different class loades, so it might be a bad idea
// classes from the same package might come from different class loades, so it might be a bad idea
// TODO: it's easier to look things up from the class
// c.getResourceAsStream("jaxb.properties");
// build the resource name and use the property loader code
String resourceName = packageName+"/jaxb.properties";
logger.log(Level.FINE, "Trying to locate {0}", resourceName);
Properties props = loadJAXBProperties(classLoader, resourceName);
if (props == null) {
logger.fine(" not found");
} else {
logger.fine(" found");
if (props.containsKey(JAXB_CONTEXT_FACTORY)) {
// trim() seems redundant, but adding to satisfy customer complaint
factoryClassName = props.getProperty(JAXB_CONTEXT_FACTORY).trim();
return newInstance(classes, properties, factoryClassName);
} else {
throw new JAXBException(Messages.format(Messages.MISSING_PROPERTY, packageName, JAXB_CONTEXT_FACTORY));
}
}
String className = classNameFromPackageProperties(JAXBContext.JAXB_CONTEXT_FACTORY, getClassClassLoader(c), c.getPackage().getName().replace('.', '/'));
if (className != null) return newInstance(classes, properties, className);
}
// search for a system property second (javax.xml.bind.JAXBContext)
logger.log(Level.FINE, "Checking system property {0}", JAXBContext.JAXB_CONTEXT_FACTORY);
factoryClassName = AccessController.doPrivileged(new GetPropertyAction(JAXBContext.JAXB_CONTEXT_FACTORY));
if (factoryClassName != null) {
logger.log(Level.FINE, " found {0}", factoryClassName);
return newInstance( classes, properties, factoryClassName );
} else { // leave it here for compatibility reasons
logger.fine(" not found");
logger.log(Level.FINE, "Checking system property {0}", jaxbContextFQCN);
factoryClassName = AccessController.doPrivileged(new GetPropertyAction(jaxbContextFQCN));
if (factoryClassName != null) {
logger.log(Level.FINE, " found {0}", factoryClassName);
return newInstance( classes, properties, factoryClassName );
} else {
logger.fine(" not found");
}
String factoryName = classNameFromSystemProperties();
if (factoryName != null) return newInstance(classes, properties, factoryName);
Class ctxFactoryClass = (Class) ServiceLoaderUtil.lookupUsingOSGiServiceLoader("javax.xml.bind.JAXBContext", logger);
if (ctxFactoryClass != null) {
return newInstance(classes, properties, ctxFactoryClass);
}
// OSGi search
Class jaxbContext = lookupJaxbContextUsingOsgiServiceLoader();
if (jaxbContext != null) {
logger.fine("OSGi environment detected");
return newInstance(classes, properties, jaxbContext);
}
// TODO: to be removed - deprecated!!! Requires SPEC change!!!
String className = firstByServiceLoaderDeprecated(JAXBContext.class, getContextClassLoader());
if (className != null) return newInstance(classes, properties, className);
// search META-INF services next
logger.fine("Checking META-INF/services");
BufferedReader r = null;
try {
final String resource = new StringBuilder("META-INF/services/").append(jaxbContextFQCN).toString();
ClassLoader classLoader = getContextClassLoader();
URL resourceURL;
if(classLoader==null)
resourceURL = ClassLoader.getSystemResource(resource);
else
resourceURL = classLoader.getResource(resource);
if (resourceURL != null) {
logger.log(Level.FINE, "Reading {0}", resourceURL);
r = new BufferedReader(new InputStreamReader(resourceURL.openStream(), "UTF-8"));
factoryClassName = r.readLine();
if (factoryClassName != null) {
factoryClassName = factoryClassName.trim();
}
return newInstance(classes, properties, factoryClassName);
} else {
logger.log(Level.FINE, "Unable to find: {0}", resource);
}
} catch (UnsupportedEncodingException e) {
// should never happen
throw new JAXBException(e);
} catch (IOException e) {
throw new JAXBException(e);
} finally {
if (r != null) {
try {
r.close();
} catch (IOException ex) {
logger.log(Level.FINE, "Unable to close stream", ex);
}
}
}
// // TODO: supposed to be:
// obj = firstByServiceLoader(JAXBContext.class, EXCEPTION_HANDLER);
// if (obj != null) return obj;
// else no provider found
logger.fine("Trying to create the platform default provider");
return newInstance(classes, properties, PLATFORM_DEFAULT_FACTORY_CLASS);
}
private static Class lookupJaxbContextUsingOsgiServiceLoader() {
try {
// Use reflection to avoid having any dependency on ServiceLoader class
Class target = Class.forName("com.sun.org.glassfish.hk2.osgiresourcelocator.ServiceLoader");
Method m = target.getMethod("lookupProviderClasses", Class.class);
Iterator iter = ((Iterable) m.invoke(null, JAXBContext.class)).iterator();
return iter.hasNext() ? (Class)iter.next() : null;
} catch(Exception e) {
logger.log(Level.FINE, "Unable to find from OSGi: javax.xml.bind.JAXBContext");
return null;
private static String classNameFromPackageProperties(String factoryId, ClassLoader classLoader, String packageName) throws JAXBException {
String resourceName = packageName + "/jaxb.properties";
logger.log(Level.FINE, "Trying to locate {0}", resourceName);
Properties props = loadJAXBProperties(classLoader, resourceName);
if (props != null) {
if (props.containsKey(factoryId)) {
return props.getProperty(factoryId);
} else {
throw new JAXBException(Messages.format(Messages.MISSING_PROPERTY, packageName, factoryId));
}
}
return null;
}
private static Properties loadJAXBProperties( ClassLoader classLoader,
String propFileName )
throws JAXBException {
private static String classNameFromSystemProperties() throws JAXBException {
logger.log(Level.FINE, "Checking system property {0}", JAXBContext.JAXB_CONTEXT_FACTORY);
// search for a system property second (javax.xml.bind.JAXBContext)
String factoryClassName = AccessController.doPrivileged(new GetPropertyAction(JAXBContext.JAXB_CONTEXT_FACTORY));
if (factoryClassName != null) {
logger.log(Level.FINE, " found {0}", factoryClassName);
return factoryClassName;
} else { // leave this here to assure compatibility
logger.fine(" not found");
logger.log(Level.FINE, "Checking system property {0}", JAXBContext.class.getName());
factoryClassName = AccessController.doPrivileged(new GetPropertyAction(JAXBContext.class.getName()));
if (factoryClassName != null) {
logger.log(Level.FINE, " found {0}", factoryClassName);
return factoryClassName;
} else {
logger.fine(" not found");
}
}
return null;
}
private static Properties loadJAXBProperties(ClassLoader classLoader, String propFileName) throws JAXBException {
Properties props = null;
try {
URL url;
if(classLoader==null)
if (classLoader == null)
url = ClassLoader.getSystemResource(propFileName);
else
url = classLoader.getResource( propFileName );
url = classLoader.getResource(propFileName);
if( url != null ) {
if (url != null) {
logger.log(Level.FINE, "loading props from {0}", url);
props = new Properties();
InputStream is = url.openStream();
props.load( is );
props.load(is);
is.close();
}
} catch( IOException ioe ) {
logger.log(Level.FINE,"Unable to load "+propFileName,ioe);
throw new JAXBException( ioe.toString(), ioe );
} catch (IOException ioe) {
logger.log(Level.FINE, "Unable to load " + propFileName, ioe);
throw new JAXBException(ioe.toString(), ioe);
}
return props;
@ -520,7 +416,7 @@ class ContextFinder {
String classnameAsResource = clazz.getName().replace('.', '/') + ".class";
if(loader == null) {
if (loader == null) {
loader = getSystemClassLoader();
}
@ -543,50 +439,7 @@ class ContextFinder {
return which(clazz, getClassClassLoader(clazz));
}
/**
* When JAXB is in J2SE, rt.jar has to have a JAXB implementation.
* However, rt.jar cannot have META-INF/services/javax.xml.bind.JAXBContext
* because if it has, it will take precedence over any file that applications have
* in their jar files.
*
* <p>
* When the user bundles his own JAXB implementation, we'd like to use it, and we
* want the platform default to be used only when there's no other JAXB provider.
*
* <p>
* For this reason, we have to hard-code the class name into the API.
*/
private static final String PLATFORM_DEFAULT_FACTORY_CLASS = "com.sun.xml.internal.bind.v2.ContextFactory";
/**
* Loads the class, provided that the calling thread has an access to the class being loaded.
*/
private static Class safeLoadClass(String className, ClassLoader classLoader) throws ClassNotFoundException {
logger.log(Level.FINE, "Trying to load {0}", className);
try {
// make sure that the current thread has an access to the package of the given name.
SecurityManager s = System.getSecurityManager();
if (s != null) {
int i = className.lastIndexOf('.');
if (i != -1) {
s.checkPackageAccess(className.substring(0,i));
}
}
if (classLoader == null) {
return Class.forName(className);
} else {
return classLoader.loadClass(className);
}
} catch (SecurityException se) {
// anyone can access the platform default factory class without permission
if (PLATFORM_DEFAULT_FACTORY_CLASS.equals(className)) {
return Class.forName(className);
}
throw se;
}
}
@SuppressWarnings("unchecked")
private static ClassLoader getContextClassLoader() {
if (System.getSecurityManager() == null) {
return Thread.currentThread().getContextClassLoader();
@ -600,6 +453,7 @@ class ContextFinder {
}
}
@SuppressWarnings("unchecked")
private static ClassLoader getClassClassLoader(final Class c) {
if (System.getSecurityManager() == null) {
return c.getClassLoader();
@ -626,4 +480,50 @@ class ContextFinder {
}
}
// TODO: to be removed - SPEC change required
// ServiceLoaderUtil.firstByServiceLoaderDeprecated should be used instead.
@Deprecated
static String firstByServiceLoaderDeprecated(Class spiClass, ClassLoader classLoader) throws JAXBException {
final String jaxbContextFQCN = spiClass.getName();
logger.fine("Searching META-INF/services");
// search META-INF services next
BufferedReader r = null;
final String resource = new StringBuilder().append("META-INF/services/").append(jaxbContextFQCN).toString();
try {
final InputStream resourceStream =
(classLoader == null) ?
ClassLoader.getSystemResourceAsStream(resource) :
classLoader.getResourceAsStream(resource);
if (resourceStream != null) {
r = new BufferedReader(new InputStreamReader(resourceStream, "UTF-8"));
String factoryClassName = r.readLine();
if (factoryClassName != null) {
factoryClassName = factoryClassName.trim();
}
r.close();
logger.log(Level.FINE, "Configured factorty class:{0}", factoryClassName);
return factoryClassName;
} else {
logger.log(Level.FINE, "Unable to load:{0}", resource);
return null;
}
} catch (UnsupportedEncodingException e) {
// should never happen
throw new JAXBException(e);
} catch (IOException e) {
throw new JAXBException(e);
} finally {
try {
if (r != null) {
r.close();
}
} catch (IOException ex) {
logger.log(Level.SEVERE, "Unable to close resource: " + resource, ex);
}
}
}
}

View File

@ -63,10 +63,10 @@ import java.io.InputStream;
* <i><B>SPEC REQUIREMENT:</B> the provider must supply an implementation
* class containing the following method signatures:</i>
*
* <pre>
* public static JAXBContext createContext( String contextPath, ClassLoader classLoader, Map&lt;String,Object&gt; properties ) throws JAXBException
* public static JAXBContext createContext( Class[] classes, Map&lt;String,Object&gt; properties ) throws JAXBException
* </pre>
* <pre>{@code
* public static JAXBContext createContext( String contextPath, ClassLoader classLoader, Map<String,Object> properties ) throws JAXBException
* public static JAXBContext createContext( Class[] classes, Map<String,Object> properties ) throws JAXBException
* }</pre>
*
* <p><i>
* The following JAXB 1.0 requirement is only required for schema to
@ -352,7 +352,7 @@ public abstract class JAXBContext {
* <p>
* To maintain compatibility with JAXB 1.0 schema to java
* interface/implementation binding, enabled by schema customization
* <tt>&lt;jaxb:globalBindings valueClass="false"&gt;</tt>,
* <tt>{@literal <jaxb:globalBindings valueClass="false">}</tt>,
* the JAXB provider will ensure that each package on the context path
* has a <tt>jaxb.properties</tt> file which contains a value for the
* <tt>javax.xml.bind.context.factory</tt> property and that all values
@ -526,7 +526,7 @@ public abstract class JAXBContext {
* Not only the new context will recognize all the classes specified,
* but it will also recognize any classes that are directly/indirectly
* referenced statically from the specified classes. Subclasses of
* referenced classes nor <tt>&#64;XmlTransient</tt> referenced classes
* referenced classes nor <tt>@XmlTransient</tt> referenced classes
* are not registered with JAXBContext.
*
* For example, in the following Java code, if you do

View File

@ -74,7 +74,7 @@ public abstract class JAXBIntrospector {
*
* <p>Convenience method to abstract whether working with either
* a javax.xml.bind.JAXBElement instance or an instance of
* <tt>&#64;XmlRootElement</tt> annotated Java class.</p>
* <tt>@XmlRootElement</tt> annotated Java class.</p>
*
* @param jaxbElement object that #isElement(Object) returns true.
*

View File

@ -70,11 +70,11 @@ public abstract class SchemaOutputResolver {
*
* If the {@link Result} object has a system ID, it must be an
* absolute system ID. Those system IDs are relativized by the caller and used
* for &lt;xs:import&gt; statements.
* for {@literal <xs:import>} statements.
*
* If the {@link Result} object does not have a system ID, a schema
* for the namespace URI is generated but it won't be explicitly
* &lt;xs:import&gt;ed from other schemas.
* {@literal <xs:import>}ed from other schemas.
*
* If {@code null} is returned, the schema generation for this
* namespace URI will be skipped.

View File

@ -0,0 +1,192 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package javax.xml.bind;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Iterator;
import java.util.Properties;
import java.util.ServiceLoader;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
* Shared ServiceLoader/FactoryFinder Utils shared among SAAJ, JAXB and JAXWS
* - this class must be duplicated to all those projects, but it's
* basically generic code and we want to have it everywhere same.
*
* @author Miroslav.Kos@oracle.com
*/
class ServiceLoaderUtil {
private static final String OSGI_SERVICE_LOADER_CLASS_NAME = "com.sun.org.glassfish.hk2.osgiresourcelocator.ServiceLoader";
private static final String OSGI_SERVICE_LOADER_METHOD_NAME = "lookupProviderClasses";
static <P> P firstByServiceLoader(Class<P> spiClass, Logger logger) {
// service discovery
ServiceLoader<P> serviceLoader = ServiceLoader.load(spiClass);
for (P impl : serviceLoader) {
logger.fine("ServiceProvider loading Facility used; returning object [" + impl.getClass().getName() + "]");
return impl;
}
return null;
}
static boolean isOsgi(Logger logger) {
try {
Class.forName(OSGI_SERVICE_LOADER_CLASS_NAME);
return true;
} catch (ClassNotFoundException ignored) {
logger.log(Level.FINE, "OSGi classes not found, OSGi not available.", ignored);
}
return false;
}
static Object lookupUsingOSGiServiceLoader(String factoryId, Logger logger) {
try {
// Use reflection to avoid having any dependendcy on ServiceLoader class
Class serviceClass = Class.forName(factoryId);
Class target = Class.forName(OSGI_SERVICE_LOADER_CLASS_NAME);
Method m = target.getMethod(OSGI_SERVICE_LOADER_METHOD_NAME, Class.class);
Iterator iter = ((Iterable) m.invoke(null, serviceClass)).iterator();
if (iter.hasNext()) {
Object next = iter.next();
logger.fine("Found implementation using OSGi facility; returning object [" + next.getClass().getName() + "].");
return next;
} else {
return null;
}
} catch (Exception ignored) {
logger.log(Level.FINE, "Unable to find from OSGi: [" + factoryId + "]", ignored);
return null;
}
}
static String propertyFileLookup(final String configFullPath, final String factoryId) throws IOException {
File f = new File(configFullPath);
String factoryClassName = null;
if (f.exists()) {
Properties props = new Properties();
FileInputStream stream = null;
try {
stream = new FileInputStream(f);
props.load(stream);
factoryClassName = props.getProperty(factoryId);
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException ignored) {
}
}
}
}
return factoryClassName;
}
static void checkPackageAccess(String className) {
// make sure that the current thread has an access to the package of the given name.
SecurityManager s = System.getSecurityManager();
if (s != null) {
int i = className.lastIndexOf('.');
if (i != -1) {
s.checkPackageAccess(className.substring(0, i));
}
}
}
static Class nullSafeLoadClass(String className, ClassLoader classLoader) throws ClassNotFoundException {
if (classLoader == null) {
return Class.forName(className);
} else {
return classLoader.loadClass(className);
}
}
/**
* Returns instance of required class. It checks package access (security) unless it is defaultClassname. It means if you
* are trying to instantiate default implementation (fallback), pass the class name to both first and second parameter.
*
* @param className class to be instantiated
* @param isDefaultClassname says whether default implementation class
* @param handler exception handler - necessary for wrapping exceptions and logging
* @param <T> Type of exception being thrown (necessary to distinguish between Runtime and checked exceptions)
* @return instantiated object or throws Runtime/checked exception, depending on ExceptionHandler's type
* @throws T
*/
static <T extends Exception> Object newInstance(String className, String defaultImplClassName, final ExceptionHandler<T> handler) throws T {
try {
return safeLoadClass(className, defaultImplClassName, contextClassLoader(handler)).newInstance();
} catch (ClassNotFoundException x) {
throw handler.createException(x, "Provider " + className + " not found");
} catch (Exception x) {
throw handler.createException(x, "Provider " + className + " could not be instantiated: " + x);
}
}
static Class safeLoadClass(String className, String defaultImplClassName, ClassLoader classLoader) throws ClassNotFoundException {
try {
checkPackageAccess(className);
} catch (SecurityException se) {
// anyone can access the platform default factory class without permission
if (defaultImplClassName != null && defaultImplClassName.equals(className)) {
return Class.forName(className);
}
// not platform default implementation ...
throw se;
}
return nullSafeLoadClass(className, classLoader);
}
static String getJavaHomeLibConfigPath(String filename) {
String javah = AccessController.doPrivileged(new PrivilegedAction<String>() {
@Override
public String run() {
return System.getProperty("java.home");
}
});
return javah + File.separator + "lib" + File.separator + filename;
}
static ClassLoader contextClassLoader(ExceptionHandler exceptionHandler) throws Exception {
try {
return Thread.currentThread().getContextClassLoader();
} catch (Exception x) {
throw exceptionHandler.createException(x, x.toString());
}
}
static abstract class ExceptionHandler<T extends Exception> {
public abstract T createException(Throwable throwable, String message);
}
}

View File

@ -73,12 +73,12 @@ import java.io.Reader;
* Unmarshalling from a StringBuffer using a
* <tt>javax.xml.transform.stream.StreamSource</tt>:
* <blockquote>
* <pre>
* <pre>{@code
* JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
* Unmarshaller u = jc.createUnmarshaller();
* StringBuffer xmlStr = new StringBuffer( "&lt;?xml version=&quot;1.0&quot;?&gt;..." );
* StringBuffer xmlStr = new StringBuffer( "<?xml version="1.0"?>..." );
* Object o = u.unmarshal( new StreamSource( new StringReader( xmlStr.toString() ) ) );
* </pre>
* }</pre>
* </blockquote>
*
* <p>
@ -238,7 +238,7 @@ import java.io.Reader;
* to a JAXB mapped class by {@link JAXBContext}, that the root
* element's <tt>xsi:type</tt> attribute takes
* precedence over the unmarshal methods <tt>declaredType</tt> parameter.
* These methods always return a <tt>JAXBElement&lt;declaredType&gt;</tt>
* These methods always return a <tt>{@literal JAXBElement<declaredType>}</tt>
* instance. The table below shows how the properties of the returned JAXBElement
* instance are set.
*
@ -281,21 +281,21 @@ import java.io.Reader;
* <p>
* Unmarshal by declaredType from a <tt>org.w3c.dom.Node</tt>:
* <blockquote>
* <pre>
* <pre>{@code
* Schema fragment for example
* &lt;xs:schema&gt;
* &lt;xs:complexType name="FooType"&gt;...&lt;\xs:complexType&gt;
* &lt;!-- global element declaration "PurchaseOrder" --&gt;
* &lt;xs:element name="PurchaseOrder"&gt;
* &lt;xs:complexType&gt;
* &lt;xs:sequence&gt;
* &lt;!-- local element declaration "foo" --&gt;
* &lt;xs:element name="foo" type="FooType"/&gt;
* <xs:schema>
* <xs:complexType name="FooType">...<\xs:complexType>
* <!-- global element declaration "PurchaseOrder" -->
* <xs:element name="PurchaseOrder">
* <xs:complexType>
* <xs:sequence>
* <!-- local element declaration "foo" -->
* <xs:element name="foo" type="FooType"/>
* ...
* &lt;/xs:sequence&gt;
* &lt;/xs:complexType&gt;
* &lt;/xs:element&gt;
* &lt;/xs:schema&gt;
* </xs:sequence>
* </xs:complexType>
* </xs:element>
* </xs:schema>
*
* JAXBContext jc = JAXBContext.newInstance( "com.acme.foo" );
* Unmarshaller u = jc.createUnmarshaller();
@ -308,8 +308,8 @@ import java.io.Reader;
* // local element declaration in schema.
*
* // FooType is the JAXB mapping of the type of local element declaration foo.
* JAXBElement&lt;FooType&gt; foo = u.unmarshal( fooSubtree, FooType.class);
* </pre>
* JAXBElement<FooType> foo = u.unmarshal( fooSubtree, FooType.class);
* }</pre>
* </blockquote>
*
* <p>

View File

@ -94,15 +94,15 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* <h2>Schema To Java example</h2>
*
* The following schema would produce the following Java class:
* <pre>
* &lt;xs:complexType name="foo"&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="a" type="xs:int" /&gt;
* &lt;xs:element name="b" type="xs:int" /&gt;
* &lt;xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /&gt;
* &lt;/xs:sequence&gt;
* &lt;/xs:complexType&gt;
* </pre>
* <pre>{@code
* <xs:complexType name="foo">
* <xs:sequence>
* <xs:element name="a" type="xs:int" />
* <xs:element name="b" type="xs:int" />
* <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
* </xs:sequence>
* </xs:complexType>
* }</pre>
*
* <pre>
* class Foo {
@ -115,30 +115,30 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
*
* It can unmarshal instances like
*
* <pre>
* &lt;foo xmlns:e="extra"&gt;
* &lt;a&gt;1&lt;/a&gt;
* &lt;e:other /&gt; // this will be bound to DOM, because unmarshalling is orderless
* &lt;b&gt;3&lt;/b&gt;
* &lt;e:other /&gt;
* &lt;c&gt;5&lt;/c&gt; // this will be bound to DOM, because the annotation doesn't remember namespaces.
* &lt;/foo&gt;
* </pre>
* <pre>{@code
* <foo xmlns:e="extra">
* <a>1</a>
* <e:other /> // this will be bound to DOM, because unmarshalling is orderless
* <b>3</b>
* <e:other />
* <c>5</c> // this will be bound to DOM, because the annotation doesn't remember namespaces.
* </foo>
* }</pre>
*
*
*
* The following schema would produce the following Java class:
* <pre>
* &lt;xs:complexType name="bar"&gt;
* &lt;xs:complexContent&gt;
* &lt;xs:extension base="foo"&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="c" type="xs:int" /&gt;
* &lt;xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" /&gt;
* &lt;/xs:sequence&gt;
* &lt;/xs:extension&gt;
* &lt;/xs:complexType&gt;
* </pre>
* <pre>{@code
* <xs:complexType name="bar">
* <xs:complexContent>
* <xs:extension base="foo">
* <xs:sequence>
* <xs:element name="c" type="xs:int" />
* <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded" />
* </xs:sequence>
* </xs:extension>
* </xs:complexType>
* }</pre>
*
* <pre>
* class Bar extends Foo {
@ -150,16 +150,16 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
*
* It can unmarshal instances like
*
* <pre>
* &lt;bar xmlns:e="extra"&gt;
* &lt;a&gt;1&lt;/a&gt;
* &lt;e:other /&gt; // this will be bound to DOM, because unmarshalling is orderless
* &lt;b&gt;3&lt;/b&gt;
* &lt;e:other /&gt;
* &lt;c&gt;5&lt;/c&gt; // this now goes to Bar.c
* &lt;e:other /&gt; // this will go to Foo.any
* &lt;/bar&gt;
* </pre>
* <pre>{@code
* <bar xmlns:e="extra">
* <a>1</a>
* <e:other /> // this will be bound to DOM, because unmarshalling is orderless
* <b>3</b>
* <e:other />
* <c>5</c> // this now goes to Bar.c
* <e:other /> // this will go to Foo.any
* </bar>
* }</pre>
*
*
*
@ -171,15 +171,15 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
*
* <p>
* The following schema would produce the following Java class:
* <pre>
* &lt;xs:complexType name="foo"&gt;
* &lt;xs:choice maxOccurs="unbounded" minOccurs="0"&gt;
* &lt;xs:element name="a" type="xs:int" /&gt;
* &lt;xs:element name="b" type="xs:int" /&gt;
* &lt;xs:any namespace="##other" processContents="lax" /&gt;
* &lt;/xs:choice&gt;
* &lt;/xs:complexType&gt;
* </pre>
* <pre>{@code
* <xs:complexType name="foo">
* <xs:choice maxOccurs="unbounded" minOccurs="0">
* <xs:element name="a" type="xs:int" />
* <xs:element name="b" type="xs:int" />
* <xs:any namespace="##other" processContents="lax" />
* </xs:choice>
* </xs:complexType>
* }</pre>
*
* <pre>
* class Foo {
@ -204,11 +204,11 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* It can unmarshal instances like
*
* <pre>
* &lt;foo xmlns:e="extra"&gt;
* &lt;a&gt;1&lt;/a&gt; // this will unmarshal to a {@link JAXBElement} instance whose value is 1.
* &lt;e:other /&gt; // this will unmarshal to a DOM {@link Element}.
* &lt;b&gt;3&lt;/b&gt; // this will unmarshal to a {@link JAXBElement} instance whose value is 1.
* &lt;/foo&gt;
*{@code <foo xmlns:e="extra">}
*{@code <a>1</a>} // this will unmarshal to a {@link JAXBElement} instance whose value is 1.
*{@code <e:other />} // this will unmarshal to a DOM {@link Element}.
*{@code <b>3</b>} // this will unmarshal to a {@link JAXBElement} instance whose value is 1.
*{@code </foo>}
* </pre>
*
*
@ -225,11 +225,11 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* }
* </pre>
* then the following document will unmarshal like this:
* <pre>
* &lt;foo&gt;
* &lt;unknown /&gt;
* &lt;foo /&gt;
* &lt;/foo&gt;
* <pre>{@code
* <foo>
* <unknown />
* <foo />
* </foo>
*
* Foo foo = unmarshal();
* // 1 for 'unknown', another for 'foo'
@ -239,7 +239,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* // because of lax=true, the 'foo' element eagerly
* // unmarshals to a Foo object.
* assert foo.others[1] instanceof Foo;
* </pre>
* }</pre>
*
* @author Kohsuke Kawaguchi
* @since 1.6, JAXB 2.0

View File

@ -51,16 +51,16 @@ import java.lang.annotation.Target;
* }
* </pre>
* The above code maps to the following XML:
* <pre>
* &lt;xs:element name="foo" xmlns:ref="http://ws-i.org/profiles/basic/1.1/xsd"&gt;
* &lt;xs:complexType&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="body" type="ref:swaRef" minOccurs="0" /&gt;
* &lt;/xs:sequence&gt;
* &lt;xs:attribute name="data" type="ref:swaRef" use="optional" /&gt;
* &lt;/xs:complexType&gt;
* &lt;/xs:element&gt;
* </pre>
* <pre>{@code
* <xs:element name="foo" xmlns:ref="http://ws-i.org/profiles/basic/1.1/xsd">
* <xs:complexType>
* <xs:sequence>
* <xs:element name="body" type="ref:swaRef" minOccurs="0" />
* </xs:sequence>
* <xs:attribute name="data" type="ref:swaRef" use="optional" />
* </xs:complexType>
* </xs:element>
* }</pre>
*
* <p>
* The above binding supports WS-I AP 1.0 <a href="http://www.ws-i.org/Profiles/AttachmentsProfile-1.0-2004-08-24.html#Referencing_Attachments_from_the_SOAP_Envelope">WS-I Attachments Profile Version 1.0.</a>

View File

@ -89,14 +89,15 @@ import static java.lang.annotation.RetentionPolicy.*;
* public java.math.BigDecimal getPrice() {...} ;
* public void setPrice(java.math.BigDecimal ) {...};
* }
* {@code
*
* &lt;!-- Example: XML Schema fragment --&gt;
* &lt;xs:complexType name="USPrice"&gt;
* &lt;xs:sequence&gt;
* &lt;/xs:sequence&gt;
* &lt;xs:attribute name="price" type="xs:decimal"/&gt;
* &lt;/xs:complexType&gt;
* </pre>
* <!-- Example: XML Schema fragment -->
* <xs:complexType name="USPrice">
* <xs:sequence>
* </xs:sequence>
* <xs:attribute name="price" type="xs:decimal"/>
* </xs:complexType>
* }</pre>
*
* <p> <b>Example 2: </b>Map a JavaBean property to an XML attribute with anonymous type.</p>
* See Example 7 in @{@link XmlType}.
@ -108,17 +109,18 @@ import static java.lang.annotation.RetentionPolicy.*;
* ...
* &#64;XmlAttribute List&lt;Integer&gt; items;
* }
* {@code
*
* &lt;!-- Example: XML Schema fragment --&gt;
* &lt;xs:complexType name="foo"&gt;
* <!-- Example: XML Schema fragment -->
* <xs:complexType name="foo">
* ...
* &lt;xs:attribute name="items"&gt;
* &lt;xs:simpleType&gt;
* &lt;xs:list itemType="xs:int"/&gt;
* &lt;/xs:simpleType&gt;
* &lt;/xs:complexType&gt;
* <xs:attribute name="items">
* <xs:simpleType>
* <xs:list itemType="xs:int"/>
* </xs:simpleType>
* </xs:complexType>
*
* </pre>
* }</pre>
* @author Sekhar Vajjhala, Sun Microsystems, Inc.
* @see XmlType
* @since 1.6, JAXB 2.0

View File

@ -82,14 +82,15 @@ import static java.lang.annotation.RetentionPolicy.*;
* &#64;XmlElement(name="itemprice")
* public java.math.BigDecimal price;
* }
* {@code
*
* &lt;!-- Example: Local XML Schema element --&gt;
* &lt;xs:complexType name="USPrice"/&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="itemprice" type="xs:decimal" minOccurs="0"/&gt;
* &lt;/sequence&gt;
* &lt;/xs:complexType&gt;
* </pre>
* <!-- Example: Local XML Schema element -->
* <xs:complexType name="USPrice"/>
* <xs:sequence>
* <xs:element name="itemprice" type="xs:decimal" minOccurs="0"/>
* </sequence>
* </xs:complexType>
* }</pre>
* <p>
*
* <b> Example 2: </b> Map a field to a nillable element.
@ -100,14 +101,15 @@ import static java.lang.annotation.RetentionPolicy.*;
* &#64;XmlElement(nillable=true)
* public java.math.BigDecimal price;
* }
* {@code
*
* &lt;!-- Example: Local XML Schema element --&gt;
* &lt;xs:complexType name="USPrice"&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="price" type="xs:decimal" nillable="true" minOccurs="0"/&gt;
* &lt;/sequence&gt;
* &lt;/xs:complexType&gt;
* </pre>
* <!-- Example: Local XML Schema element -->
* <xs:complexType name="USPrice">
* <xs:sequence>
* <xs:element name="price" type="xs:decimal" nillable="true" minOccurs="0"/>
* </sequence>
* </xs:complexType>
* }</pre>
* <p>
* <b> Example 3: </b> Map a field to a nillable, required element.
* <pre>
@ -117,14 +119,15 @@ import static java.lang.annotation.RetentionPolicy.*;
* &#64;XmlElement(nillable=true, required=true)
* public java.math.BigDecimal price;
* }
* {@code
*
* &lt;!-- Example: Local XML Schema element --&gt;
* &lt;xs:complexType name="USPrice"&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="price" type="xs:decimal" nillable="true" minOccurs="1"/&gt;
* &lt;/sequence&gt;
* &lt;/xs:complexType&gt;
* </pre>
* <!-- Example: Local XML Schema element -->
* <xs:complexType name="USPrice">
* <xs:sequence>
* <xs:element name="price" type="xs:decimal" nillable="true" minOccurs="1"/>
* </sequence>
* </xs:complexType>
* }</pre>
*
* <p> <b>Example 4: </b>Map a JavaBean property to an XML element
* with anonymous type.</p>
@ -179,7 +182,7 @@ public @interface XmlElement {
* the enclosing class.
*
* <li>
* Otherwise &#39;&#39; (which produces unqualified element in the default
* Otherwise {@literal ''} (which produces unqualified element in the default
* namespace.
* </ol>
*/

View File

@ -65,21 +65,22 @@ import static java.lang.annotation.ElementType.METHOD;
* JAXBElement&lt;String&gt; createFoo(String s) { ... }
* }
* </pre>
* <pre>
* &lt;!-- XML input --&gt;
* &lt;foo&gt;string&lt;/foo&gt;
* <pre> {@code
*
* <!-- XML input -->
* <foo>string</foo>
*
* // Example: code fragment corresponding to XML input
* JAXBElement&lt;String&gt; o =
* (JAXBElement&lt;String&gt;)unmarshaller.unmarshal(aboveDocument);
* JAXBElement<String> o =
* (JAXBElement<String>)unmarshaller.unmarshal(aboveDocument);
* // print JAXBElement instance to show values
* System.out.println(o.getName()); // prints "{}foo"
* System.out.println(o.getValue()); // prints "string"
* System.out.println(o.getValue().getClass()); // prints "java.lang.String"
*
* &lt;!-- Example: XML schema definition --&gt;
* &lt;xs:element name="foo" type="xs:string"/&gt;
* </pre>
* <!-- Example: XML schema definition -->
* <xs:element name="foo" type="xs:string"/>
* }</pre>
*
* <p><b>Example 2: </b> Element declaration with non local scope
* <p>
@ -90,18 +91,18 @@ import static java.lang.annotation.ElementType.METHOD;
* The following example may be replaced in a future revision of
* this javadoc.
*
* <pre>
* &lt;!-- Example: XML schema definition --&gt;
* &lt;xs:schema&gt;
* &lt;xs:complexType name="pea"&gt;
* &lt;xs:choice maxOccurs="unbounded"&gt;
* &lt;xs:element name="foo" type="xs:string"/&gt;
* &lt;xs:element name="bar" type="xs:string"/&gt;
* &lt;/xs:choice&gt;
* &lt;/xs:complexType&gt;
* &lt;xs:element name="foo" type="xs:int"/&gt;
* &lt;/xs:schema&gt;
* </pre>
* <pre>{@code
* <!-- Example: XML schema definition -->
* <xs:schema>
* <xs:complexType name="pea">
* <xs:choice maxOccurs="unbounded">
* <xs:element name="foo" type="xs:string"/>
* <xs:element name="bar" type="xs:string"/>
* </xs:choice>
* </xs:complexType>
* <xs:element name="foo" type="xs:int"/>
* </xs:schema>
* }</pre>
* <pre>
* // Example: expected default binding
* class Pea {

View File

@ -56,10 +56,10 @@ import static java.lang.annotation.ElementType.METHOD;
* support for substitution groups using an <i>element property</i>,
* (section 5.5.5, "Element Property" of JAXB 2.0 specification). An
* element property method signature is of the form:
* <pre>
* public void setTerm(JAXBElement&lt;? extends Operator&gt;);
* public JAXBElement&lt;? extends Operator&gt; getTerm();
* </pre>
* <pre>{@code
* public void setTerm(JAXBElement<? extends Operator>);
* public JAXBElement<? extends Operator> getTerm();
* }</pre>
* <p>
* An element factory method annotated with {@link XmlElementDecl} is
* used to create a <tt>JAXBElement</tt> instance, containing an XML
@ -121,19 +121,20 @@ import static java.lang.annotation.ElementType.METHOD;
* class JavacTask extends Task {
* ...
* }
* {@code
*
* &lt;!-- XML Schema fragment --&gt;
* &lt;xs:element name="target" type="Target"&gt;
* &lt;xs:complexType name="Target"&gt;
* &lt;xs:sequence&gt;
* &lt;xs:choice maxOccurs="unbounded"&gt;
* &lt;xs:element ref="jar"&gt;
* &lt;xs:element ref="javac"&gt;
* &lt;/xs:choice&gt;
* &lt;/xs:sequence&gt;
* &lt;/xs:complexType&gt;
* <!-- XML Schema fragment -->
* <xs:element name="target" type="Target">
* <xs:complexType name="Target">
* <xs:sequence>
* <xs:choice maxOccurs="unbounded">
* <xs:element ref="jar">
* <xs:element ref="javac">
* </xs:choice>
* </xs:sequence>
* </xs:complexType>
*
* </pre>
* }</pre>
* <p>
* Thus the following code fragment:
* <pre>
@ -143,16 +144,16 @@ import static java.lang.annotation.ElementType.METHOD;
* marshal(target);
* </pre>
* will produce the following XML output:
* <pre>
* &lt;target&gt;
* &lt;jar&gt;
* <pre>{@code
* <target>
* <jar>
* ....
* &lt;/jar&gt;
* &lt;javac&gt;
* </jar>
* <javac>
* ....
* &lt;/javac&gt;
* &lt;/target&gt;
* </pre>
* </javac>
* </target>
* }</pre>
* <p>
* It is not an error to have a class that extends <tt>Task</tt>
* that doesn't have {@link XmlRootElement}. But they can't show up in an
@ -207,11 +208,11 @@ import static java.lang.annotation.ElementType.METHOD;
* marshal(m);
* </pre>
* will produce the following XML output:
* <pre>
* &lt;math&gt;
* &lt;add&gt;...&lt;/add&gt;
* &lt;/math&gt;
* </pre>
* <pre>{@code
* <math>
* <add>...</add>
* </math>
* }</pre>
*
*
* @author <ul><li>Kohsuke Kawaguchi, Sun Microsystems,Inc. </li><li>Sekhar Vajjhala, Sun Microsystems, Inc.</li></ul>

View File

@ -39,21 +39,21 @@ import java.lang.annotation.Target;
* XML element around collections. The annotation therefore supports
* two forms of serialization shown below.
*
* <pre>
* <pre>{@code
* //Example: code fragment
* int[] names;
*
* // XML Serialization Form 1 (Unwrapped collection)
* &lt;names&gt; ... &lt;/names&gt;
* &lt;names&gt; ... &lt;/names&gt;
* <names> ... </names>
* <names> ... </names>
*
* // XML Serialization Form 2 ( Wrapped collection )
* &lt;wrapperElement&gt;
* &lt;names&gt; value-of-item &lt;/names&gt;
* &lt;names&gt; value-of-item &lt;/names&gt;
* <wrapperElement>
* <names> value-of-item </names>
* <names> value-of-item </names>
* ....
* &lt;/wrapperElement&gt;
* </pre>
* </wrapperElement>
* }</pre>
*
* <p> The two serialized XML forms allow a null collection to be
* represented either by absence or presence of an element with a

View File

@ -44,7 +44,7 @@ import java.lang.annotation.Target;
* &#64;XmlElements({ @XmlElement(...),@XmlElement(...) })
* </pre>
*
* <p>The <tt>@XmlElements</tt> annnotation can be used with the
* <p>The <tt>@XmlElements</tt> annotation can be used with the
* following program elements: </p>
* <ul>
* <li> a JavaBean property </li>
@ -78,28 +78,29 @@ import java.lang.annotation.Target;
* &#64;XmlElements(
* &#64;XmlElement(name="A", type=Integer.class),
* &#64;XmlElement(name="B", type=Float.class)
* }
* )
* public List items;
* }
* {@code
*
* &lt;!-- XML Representation for a List of {1,2.5}
* XML output is not wrapped using another element --&gt;
* <!-- XML Representation for a List of {1,2.5}
* XML output is not wrapped using another element -->
* ...
* &lt;A&gt; 1 &lt;/A&gt;
* &lt;B&gt; 2.5 &lt;/B&gt;
* <A> 1 </A>
* <B> 2.5 </B>
* ...
*
* &lt;!-- XML Schema fragment --&gt;
* &lt;xs:complexType name="Foo"&gt;
* &lt;xs:sequence&gt;
* &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
* &lt;xs:element name="A" type="xs:int"/&gt;
* &lt;xs:element name="B" type="xs:float"/&gt;
* &lt;xs:choice&gt;
* &lt;/xs:sequence&gt;
* &lt;/xs:complexType&gt;
* <!-- XML Schema fragment -->
* <xs:complexType name="Foo">
* <xs:sequence>
* <xs:choice minOccurs="0" maxOccurs="unbounded">
* <xs:element name="A" type="xs:int"/>
* <xs:element name="B" type="xs:float"/>
* <xs:choice>
* </xs:sequence>
* </xs:complexType>
*
* </pre>
* }</pre>
*
* <p><b>Example 2:</b> Map to a list of elements wrapped with another element
* </p>
@ -114,21 +115,22 @@ import java.lang.annotation.Target;
* }
* public List items;
* }
* {@code
*
* &lt;!-- XML Schema fragment --&gt;
* &lt;xs:complexType name="Foo"&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="bar"&gt;
* &lt;xs:complexType&gt;
* &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
* &lt;xs:element name="A" type="xs:int"/&gt;
* &lt;xs:element name="B" type="xs:float"/&gt;
* &lt;/xs:choice&gt;
* &lt;/xs:complexType&gt;
* &lt;/xs:element&gt;
* &lt;/xs:sequence&gt;
* &lt;/xs:complexType&gt;
* </pre>
* <!-- XML Schema fragment -->
* <xs:complexType name="Foo">
* <xs:sequence>
* <xs:element name="bar">
* <xs:complexType>
* <xs:choice minOccurs="0" maxOccurs="unbounded">
* <xs:element name="A" type="xs:int"/>
* <xs:element name="B" type="xs:float"/>
* </xs:choice>
* </xs:complexType>
* </xs:element>
* </xs:sequence>
* </xs:complexType>
* }</pre>
*
* <p><b>Example 3:</b> Change element name based on type using an adapter.
* </p>
@ -145,21 +147,22 @@ import java.lang.annotation.Target;
* &#64;XmlType abstract class P {...}
* &#64;XmlType(name="PX") class PX extends P {...}
* &#64;XmlType(name="PY") class PY extends P {...}
* {@code
*
* &lt;!-- XML Schema fragment --&gt;
* &lt;xs:complexType name="Foo"&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="bar"&gt;
* &lt;xs:complexType&gt;
* &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
* &lt;xs:element name="A" type="PX"/&gt;
* &lt;xs:element name="B" type="PY"/&gt;
* &lt;/xs:choice&gt;
* &lt;/xs:complexType&gt;
* &lt;/xs:element&gt;
* &lt;/xs:sequence&gt;
* &lt;/xs:complexType&gt;
* </pre>
* <!-- XML Schema fragment -->
* <xs:complexType name="Foo">
* <xs:sequence>
* <xs:element name="bar">
* <xs:complexType>
* <xs:choice minOccurs="0" maxOccurs="unbounded">
* <xs:element name="A" type="PX"/>
* <xs:element name="B" type="PY"/>
* </xs:choice>
* </xs:complexType>
* </xs:element>
* </xs:sequence>
* </xs:complexType>
* }</pre>
*
* @author <ul><li>Kohsuke Kawaguchi, Sun Microsystems, Inc.</li><li>Sekhar Vajjhala, Sun Microsystems, Inc.</li></ul>
* @see XmlElement

View File

@ -56,23 +56,24 @@ import static java.lang.annotation.ElementType.FIELD;
* <p> In the absence of this annotation, {@link Enum#name()} is used
* as the XML representation.
*
* <p> <b>Example 1: </b>Map enum constant name -&gt; enumeration facet</p>
* <p> <b>Example 1: </b>Map enum constant name {@literal ->} enumeration facet</p>
* <pre>
* //Example: Code fragment
* &#64;XmlEnum(String.class)
* public enum Card { CLUBS, DIAMONDS, HEARTS, SPADES }
* {@code
*
* &lt;!-- Example: XML Schema fragment --&gt;
* &lt;xs:simpleType name="Card"&gt;
* &lt;xs:restriction base="xs:string"/&gt;
* &lt;xs:enumeration value="CLUBS"/&gt;
* &lt;xs:enumeration value="DIAMONDS"/&gt;
* &lt;xs:enumeration value="HEARTS"/&gt;
* &lt;xs:enumeration value="SPADES"/&gt;
* &lt;/xs:simpleType&gt;
* </pre>
* <!-- Example: XML Schema fragment -->
* <xs:simpleType name="Card">
* <xs:restriction base="xs:string"/>
* <xs:enumeration value="CLUBS"/>
* <xs:enumeration value="DIAMONDS"/>
* <xs:enumeration value="HEARTS"/>
* <xs:enumeration value="SPADES"/>
* </xs:simpleType>
* }</pre>
*
* <p><b>Example 2: </b>Map enum constant name(value) -&gt; enumeration facet </p>
* <p><b>Example 2: </b>Map enum constant name(value) {@literal ->} enumeration facet </p>
* <pre>
* //Example: code fragment
* &#64;XmlType
@ -82,19 +83,20 @@ import static java.lang.annotation.ElementType.FIELD;
* &#64;XmlEnumValue("5") NICKEL(5),
* &#64;XmlEnumValue("10") DIME(10),
* &#64;XmlEnumValue("25") QUARTER(25) }
* {@code
*
* &lt;!-- Example: XML Schema fragment --&gt;
* &lt;xs:simpleType name="Coin"&gt;
* &lt;xs:restriction base="xs:int"&gt;
* &lt;xs:enumeration value="1"/&gt;
* &lt;xs:enumeration value="5"/&gt;
* &lt;xs:enumeration value="10"/&gt;
* &lt;xs:enumeration value="25"/&gt;
* &lt;/xs:restriction&gt;
* &lt;/xs:simpleType&gt;
* </pre>
* <!-- Example: XML Schema fragment -->
* <xs:simpleType name="Coin">
* <xs:restriction base="xs:int">
* <xs:enumeration value="1"/>
* <xs:enumeration value="5"/>
* <xs:enumeration value="10"/>
* <xs:enumeration value="25"/>
* </xs:restriction>
* </xs:simpleType>
* }</pre>
*
* <p><b>Example 3: </b>Map enum constant name -&gt; enumeration facet </p>
* <p><b>Example 3: </b>Map enum constant name {@literal ->} enumeration facet </p>
*
* <pre>
* //Code fragment
@ -104,15 +106,16 @@ import static java.lang.annotation.ElementType.FIELD;
* &#64;XmlEnumValue("1") ONE,
* &#64;XmlEnumValue("2") TWO;
* }
* {@code
*
* &lt;!-- Example: XML Schema fragment --&gt;
* &lt;xs:simpleType name="Code"&gt;
* &lt;xs:restriction base="xs:int"&gt;
* &lt;xs:enumeration value="1"/&gt;
* &lt;xs:enumeration value="2"/&gt;
* &lt;/xs:restriction&gt;
* &lt;/xs:simpleType&gt;
* </pre>
* <!-- Example: XML Schema fragment -->
* <xs:simpleType name="Code">
* <xs:restriction base="xs:int">
* <xs:enumeration value="1"/>
* <xs:enumeration value="2"/>
* </xs:restriction>
* </xs:simpleType>
* }</pre>
*
* @since 1.6, JAXB 2.0
*/

View File

@ -73,17 +73,18 @@ import static java.lang.annotation.RetentionPolicy.*;
* public void setCustomerID(String id);
* .... other properties not shown
* }
* {@code
*
* &lt;!-- Example: XML Schema fragment --&gt;
* &lt;xs:complexType name="Customer"&gt;
* &lt;xs:complexContent&gt;
* &lt;xs:sequence&gt;
* <!-- Example: XML Schema fragment -->
* <xs:complexType name="Customer">
* <xs:complexContent>
* <xs:sequence>
* ....
* &lt;/xs:sequence&gt;
* &lt;xs:attribute name="customerID" type="xs:ID"/&gt;
* &lt;/xs:complexContent&gt;
* &lt;/xs:complexType&gt;
* </pre>
* </xs:sequence>
* <xs:attribute name="customerID" type="xs:ID"/>
* </xs:complexContent>
* </xs:complexType>
* }</pre>
*
* @author Sekhar Vajjhala, Sun Microsystems, Inc.
* @see XmlIDREF

View File

@ -37,7 +37,7 @@ import static java.lang.annotation.RetentionPolicy.*;
* <p>
* To preserve referential integrity of an object graph across XML
* serialization followed by a XML deserialization, requires an object
* reference to be marshalled by reference or containment
* reference to be marshaled by reference or containment
* appropriately. Annotations <tt>&#64;XmlID</tt> and <tt>&#64;XmlIDREF</tt>
* together allow a customized mapping of a JavaBean property's
* type by containment or reference.
@ -82,18 +82,19 @@ import static java.lang.annotation.RetentionPolicy.*;
* public void setCustomer(Customer customer);
* ....
* }
* {@code
*
* &lt;!-- Example: XML Schema fragment --&gt;
* &lt;xs:complexType name="Shipping"&gt;
* &lt;xs:complexContent&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="customer" type="xs:IDREF"/&gt;
* <!-- Example: XML Schema fragment -->
* <xs:complexType name="Shipping">
* <xs:complexContent>
* <xs:sequence>
* <xs:element name="customer" type="xs:IDREF"/>
* ....
* &lt;/xs:sequence&gt;
* &lt;/xs:complexContent&gt;
* &lt;/xs:complexType&gt;
* </xs:sequence>
* </xs:complexContent>
* </xs:complexType>
*
* </pre>
* }</pre>
*
*
* <p><b>Example 2: </b> The following is a complete example of
@ -142,64 +143,65 @@ import static java.lang.annotation.RetentionPolicy.*;
* // maps reference to Invoice by containment by default.
* public Invoice getInvoice();
* }
* {@code
*
* &lt;!-- XML Schema mapping for above code frament --&gt;
* <!-- XML Schema mapping for above code frament -->
*
* &lt;xs:complexType name="Invoice"&gt;
* &lt;xs:complexContent&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="customer" type="xs:IDREF"/&gt;
* <xs:complexType name="Invoice">
* <xs:complexContent>
* <xs:sequence>
* <xs:element name="customer" type="xs:IDREF"/>
* ....
* &lt;/xs:sequence&gt;
* &lt;/xs:complexContent&gt;
* &lt;/xs:complexType&gt;
* </xs:sequence>
* </xs:complexContent>
* </xs:complexType>
*
* &lt;xs:complexType name="Shipping"&gt;
* &lt;xs:complexContent&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="customer" type="xs:IDREF"/&gt;
* <xs:complexType name="Shipping">
* <xs:complexContent>
* <xs:sequence>
* <xs:element name="customer" type="xs:IDREF"/>
* ....
* &lt;/xs:sequence&gt;
* &lt;/xs:complexContent&gt;
* &lt;/xs:complexType&gt;
* </xs:sequence>
* </xs:complexContent>
* </xs:complexType>
*
* &lt;xs:complexType name="Customer"&gt;
* &lt;xs:complexContent&gt;
* &lt;xs:sequence&gt;
* <xs:complexType name="Customer">
* <xs:complexContent>
* <xs:sequence>
* ....
* &lt;/xs:sequence&gt;
* &lt;xs:attribute name="CustomerID" type="xs:ID"/&gt;
* &lt;/xs:complexContent&gt;
* &lt;/xs:complexType&gt;
* </xs:sequence>
* <xs:attribute name="CustomerID" type="xs:ID"/>
* </xs:complexContent>
* </xs:complexType>
*
* &lt;xs:complexType name="CustomerData"&gt;
* &lt;xs:complexContent&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="customer" type="xs:Customer"/&gt;
* &lt;xs:element name="shipping" type="xs:Shipping"/&gt;
* &lt;xs:element name="invoice" type="xs:Invoice"/&gt;
* &lt;/xs:sequence&gt;
* &lt;/xs:complexContent&gt;
* &lt;/xs:complexType&gt;
* <xs:complexType name="CustomerData">
* <xs:complexContent>
* <xs:sequence>
* <xs:element name="customer" type="xs:Customer"/>
* <xs:element name="shipping" type="xs:Shipping"/>
* <xs:element name="invoice" type="xs:Invoice"/>
* </xs:sequence>
* </xs:complexContent>
* </xs:complexType>
*
* &lt;xs:element name"customerData" type="xs:CustomerData"/&gt;
* <xs:element name"customerData" type="xs:CustomerData"/>
*
* &lt;!-- Instance document conforming to the above XML Schema --&gt;
* &lt;customerData&gt;
* &lt;customer customerID="Alice"&gt;
* <!-- Instance document conforming to the above XML Schema -->
* <customerData>
* <customer customerID="Alice">
* ....
* &lt;/customer&gt;
* </customer>
*
* &lt;shipping customer="Alice"&gt;
* <shipping customer="Alice">
* ....
* &lt;/shipping&gt;
* </shipping>
*
* &lt;invoice customer="Alice"&gt;
* <invoice customer="Alice">
* ....
* &lt;/invoice&gt;
* &lt;/customerData&gt;
* </invoice>
* </customerData>
*
* </pre>
* }</pre>
*
* <p><b>Example 3: </b> Mapping List to repeating element of type IDREF
* <pre>
@ -209,16 +211,17 @@ import static java.lang.annotation.RetentionPolicy.*;
* &#64;XmlElement(name="Alice")
* public List customers;
* }
* {@code
*
* &lt;!-- XML schema fragment --&gt;
* &lt;xs:complexType name="Shipping"&gt;
* &lt;xs:sequence&gt;
* &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
* &lt;xs:element name="Alice" type="xs:IDREF"/&gt;
* &lt;/xs:choice&gt;
* &lt;/xs:sequence&gt;
* &lt;/xs:complexType&gt;
* </pre>
* <!-- XML schema fragment -->
* <xs:complexType name="Shipping">
* <xs:sequence>
* <xs:choice minOccurs="0" maxOccurs="unbounded">
* <xs:element name="Alice" type="xs:IDREF"/>
* </xs:choice>
* </xs:sequence>
* </xs:complexType>
* }</pre>
*
* <p><b>Example 4: </b> Mapping a List to a list of elements of type IDREF.
* <pre>
@ -230,17 +233,18 @@ import static java.lang.annotation.RetentionPolicy.*;
* &#64;XmlElement(name="John", type="InternationalCustomer.class")
* public List customers;
* }
* {@code
*
* &lt;!-- XML Schema fragment --&gt;
* &lt;xs:complexType name="Shipping"&gt;
* &lt;xs:sequence&gt;
* &lt;xs:choice minOccurs="0" maxOccurs="unbounded"&gt;
* &lt;xs:element name="Alice" type="xs:IDREF"/&gt;
* &lt;xs:element name="John" type="xs:IDREF"/&gt;
* &lt;/xs:choice&gt;
* &lt;/xs:sequence&gt;
* &lt;/xs:complexType&gt;
* </pre>
* <!-- XML Schema fragment -->
* <xs:complexType name="Shipping">
* <xs:sequence>
* <xs:choice minOccurs="0" maxOccurs="unbounded">
* <xs:element name="Alice" type="xs:IDREF"/>
* <xs:element name="John" type="xs:IDREF"/>
* </xs:choice>
* </xs:sequence>
* </xs:complexType>
* }</pre>
* @author Sekhar Vajjhala, Sun Microsystems, Inc.
* @see XmlID
* @since 1.6, JAXB 2.0

View File

@ -59,12 +59,12 @@ import static java.lang.annotation.ElementType.PARAMETER;
*
* would produce XML like this:
*
* <pre>
* &lt;foo&gt;
* &lt;data&gt;abc&lt;/data&gt;
* &lt;data&gt;def&lt;/data&gt;
* &lt;/foo&gt;
* </pre>
* <pre>{@code
* <foo>
* <data>abc</data>
* <data>def</data>
* </foo>
* }</pre>
*
* &#64;XmlList annotation, on the other hand, allows multiple values to be
* represented as whitespace-separated tokens in a single element. For example,
@ -80,11 +80,11 @@ import static java.lang.annotation.ElementType.PARAMETER;
*
* the above code will produce XML like this:
*
* <pre>
* &lt;foo&gt;
* &lt;data&gt;abc def&lt;/data&gt;
* &lt;/foo&gt;
* </pre>
* <pre>{@code
* <foo>
* <data>abc def</data>
* </foo>
* }</pre>
*
* <p>This annotation can be used with the following annotations:
* {@link XmlElement},

View File

@ -56,32 +56,33 @@ import javax.xml.bind.JAXBElement;
* </ul>
*
* Below is an example of binding and creation of mixed content.
* <pre>
* &lt;!-- schema fragment having mixed content --&gt;
* &lt;xs:complexType name="letterBody" mixed="true"&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="name" type="xs:string"/&gt;
* &lt;xs:element name="quantity" type="xs:positiveInteger"/&gt;
* &lt;xs:element name="productName" type="xs:string"/&gt;
* &lt;!-- etc. --&gt;
* &lt;/xs:sequence&gt;
* &lt;/xs:complexType&gt;
* &lt;xs:element name="letterBody" type="letterBody"/&gt;
* <pre>{@code
*
* <!-- schema fragment having mixed content -->
* <xs:complexType name="letterBody" mixed="true">
* <xs:sequence>
* <xs:element name="name" type="xs:string"/>
* <xs:element name="quantity" type="xs:positiveInteger"/>
* <xs:element name="productName" type="xs:string"/>
* <!-- etc. -->
* </xs:sequence>
* </xs:complexType>
* <xs:element name="letterBody" type="letterBody"/>
*
* // Schema-derived Java code:
* // (Only annotations relevant to mixed content are shown below,
* // others are ommitted.)
* // others are omitted.)
* import java.math.BigInteger;
* public class ObjectFactory {
* // element instance factories
* JAXBElement&lt;LetterBody&gt; createLetterBody(LetterBody value);
* JAXBElement&lt;String&gt; createLetterBodyName(String value);
* JAXBElement&lt;BigInteger&gt; createLetterBodyQuantity(BigInteger value);
* JAXBElement&lt;String&gt; createLetterBodyProductName(String value);
* JAXBElement<LetterBody> createLetterBody(LetterBody value);
* JAXBElement<String> createLetterBodyName(String value);
* JAXBElement<BigInteger> createLetterBodyQuantity(BigInteger value);
* JAXBElement<String> createLetterBodyProductName(String value);
* // type instance factory
* LetterBody createLetterBody();
* }
* </pre>
* }</pre>
* <pre>
* public class LetterBody {
* // Mixed content can contain instances of Element classes
@ -96,17 +97,17 @@ import javax.xml.bind.JAXBElement;
* }
* </pre>
* The following is an XML instance document with mixed content
* <pre>
* &lt;letterBody&gt;
* Dear Mr.&lt;name&gt;Robert Smith&lt;/name&gt;
* Your order of &lt;quantity&gt;1&lt;/quantity&gt; &lt;productName&gt;Baby
* Monitor&lt;/productName&gt; shipped from our warehouse. ....
* &lt;/letterBody&gt;
* </pre>
* <pre>{@code
* <letterBody>
* Dear Mr.<name>Robert Smith</name>
* Your order of <quantity>1</quantity> <productName>Baby
* Monitor</productName> shipped from our warehouse. ....
* </letterBody>
* }</pre>
* that can be constructed using following JAXB API calls.
* <pre>
* <pre>{@code
* LetterBody lb = ObjectFactory.createLetterBody();
* JAXBElement&lt;LetterBody&gt; lbe = ObjectFactory.createLetterBody(lb);
* JAXBElement<LetterBody> lbe = ObjectFactory.createLetterBody(lb);
* List gcl = lb.getContent(); //add mixed content to general content property.
* gcl.add("Dear Mr."); // add text information item as a String.
*
@ -119,7 +120,7 @@ import javax.xml.bind.JAXBElement;
* createLetterBodyQuantity(new BigInteger("1")));
* gcl.add(ObjectFactory.createLetterBodyProductName("Baby Monitor"));
* gcl.add("shipped from our warehouse"); // add text information item
* </pre>
* }</pre>
*
* <p>See "Package Specification" in javax.xml.bind.package javadoc for
* additional common information.</p>

View File

@ -73,28 +73,30 @@ import static java.lang.annotation.ElementType.TYPE;
* marshal( new Point(3,5), System.out);
* </pre>
*
* <pre>
* &lt;!-- Example: XML output --&gt;
* &lt;point&gt;
* &lt;x&gt; 3 &lt;/x&gt;
* &lt;y&gt; 5 &lt;/y&gt;
* &lt;/point&gt;
* </pre>
* <pre>{@code
*
* <!-- Example: XML output -->
* <point>
* <x> 3 </x>
* <y> 5 </y>
* </point>
* }</pre>
*
* The annotation causes an global element declaration to be produced
* in the schema. The global element declaration is associated with
* the XML schema type to which the class is mapped.
*
* <pre>
* &lt;!-- Example: XML schema definition --&gt;
* &lt;xs:element name="point" type="point"/&gt;
* &lt;xs:complexType name="point"&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="x" type="xs:int"/&gt;
* &lt;xs:element name="y" type="xs:int"/&gt;
* &lt;/xs:sequence&gt;
* &lt;/xs:complexType&gt;
* </pre>
* <pre>{@code
*
* <!-- Example: XML schema definition -->
* <xs:element name="point" type="point"/>
* <xs:complexType name="point">
* <xs:sequence>
* <xs:element name="x" type="xs:int"/>
* <xs:element name="y" type="xs:int"/>
* </xs:sequence>
* </xs:complexType>
* }</pre>
*
* <p>
*
@ -113,27 +115,28 @@ import static java.lang.annotation.ElementType.TYPE;
*
* //Example: Code fragment corresponding to XML output *
* marshal( new Point3D(3,5,0), System.out );
* {@code
*
* &lt;!-- Example: XML output --&gt;
* &lt;!-- The element name is point3D not point --&gt;
* &lt;point3D&gt;
* &lt;x&gt;3&lt;/x&gt;
* &lt;y&gt;5&lt;/y&gt;
* &lt;z&gt;0&lt;/z&gt;
* &lt;/point3D&gt;
* <!-- Example: XML output -->
* <!-- The element name is point3D not point -->
* <point3D>
* <x>3</x>
* <y>5</y>
* <z>0</z>
* </point3D>
*
* &lt;!-- Example: XML schema definition --&gt;
* &lt;xs:element name="point3D" type="point3D"/&gt;
* &lt;xs:complexType name="point3D"&gt;
* &lt;xs:complexContent&gt;
* &lt;xs:extension base="point"&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="z" type="xs:int"/&gt;
* &lt;/xs:sequence&gt;
* &lt;/xs:extension&gt;
* &lt;/xs:complexContent&gt;
* &lt;/xs:complexType&gt;
* </pre>
* <!-- Example: XML schema definition -->
* <xs:element name="point3D" type="point3D"/>
* <xs:complexType name="point3D">
* <xs:complexContent>
* <xs:extension base="point">
* <xs:sequence>
* <xs:element name="z" type="xs:int"/>
* </xs:sequence>
* </xs:extension>
* </xs:complexContent>
* </xs:complexType>
* }</pre>
*
* <b>Example 3: </b> Associate a global element with XML Schema type
* to which the class is mapped.
@ -144,15 +147,16 @@ import static java.lang.annotation.ElementType.TYPE;
* &#64;XmlElement
* public java.math.BigDecimal price;
* }
* {@code
*
* &lt;!-- Example: XML schema definition --&gt;
* &lt;xs:element name="PriceElement" type="USPrice"/&gt;
* &lt;xs:complexType name="USPrice"&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="price" type="xs:decimal"/&gt;
* &lt;/sequence&gt;
* &lt;/xs:complexType&gt;
* </pre>
* <!-- Example: XML schema definition -->
* <xs:element name="PriceElement" type="USPrice"/>
* <xs:complexType name="USPrice">
* <xs:sequence>
* <xs:element name="price" type="xs:decimal"/>
* </sequence>
* </xs:complexType>
* }</pre>
*
* @author Sekhar Vajjhala, Sun Microsystems, Inc.
* @since 1.6, JAXB 2.0

View File

@ -63,16 +63,17 @@ import static java.lang.annotation.RetentionPolicy.*;
* &#64;javax.xml.bind.annotation.XmlSchema (
* namespace = "http://www.example.com/MYPO1"
* )
* {@code
*
* &lt;!-- XML Schema fragment --&gt;
* &lt;schema
* <!-- XML Schema fragment -->
* <schema
* xmlns=...
* xmlns:po=....
* targetNamespace="http://www.example.com/MYPO1"
* &gt;
* &lt;!-- prefixes generated by default are implementation
* depedenent --&gt;
* </pre>
* >
* <!-- prefixes generated by default are implementation
* depedenent -->
* }</pre>
*
* <p><b>Example 2:</b> Customize namespace prefix, namespace URI
* mapping</p>
@ -86,16 +87,17 @@ import static java.lang.annotation.RetentionPolicy.*;
*
* &#64;javax.xml.bind.annotation.XmlNs(prefix="xs",
* namespaceURI="http://www.w3.org/2001/XMLSchema")
* )
* }
* )
* {@code
*
* &lt;!-- XML Schema fragment --&gt;
* &lt;schema
* <!-- XML Schema fragment -->
* <schema
* xmlns:xs="http://www.w3.org/2001/XMLSchema"
* xmlns:po="http://www.example.com/PO1"
* targetNamespace="http://www.example.com/PO1"&gt;
* targetNamespace="http://www.example.com/PO1">
*
* </pre>
* }</pre>
*
* <p><b>Example 3:</b> Customize elementFormDefault</p>
* <pre>
@ -103,14 +105,15 @@ import static java.lang.annotation.RetentionPolicy.*;
* elementFormDefault=XmlNsForm.UNQUALIFIED
* ...
* )
* {@code
*
* &lt;!-- XML Schema fragment --&gt;
* &lt;schema
* <!-- XML Schema fragment -->
* <schema
* xmlns="http://www.w3.org/2001/XMLSchema"
* xmlns:po="http://www.example.com/PO1"
* elementFormDefault="unqualified"&gt;
* elementFormDefault="unqualified">
*
* </pre>
* }</pre>
* @author Sekhar Vajjhala, Sun Microsystems, Inc.
* @since 1.6, JAXB 2.0

View File

@ -65,14 +65,15 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* &#64;XmlSchemaType(name="date")
* public XMLGregorianCalendar date;
* }
* {@code
*
* &lt;!-- Example: Local XML Schema element --&gt;
* &lt;xs:complexType name="USPrice"/&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="date" type="xs:date"/&gt;
* &lt;/sequence&gt;
* &lt;/xs:complexType&gt;
* </pre>
* <!-- Example: Local XML Schema element -->
* <xs:complexType name="USPrice"/>
* <xs:sequence>
* <xs:element name="date" type="xs:date"/>
* </sequence>
* </xs:complexType>
* }</pre>
*
* <p> <b> Example 2: </b> Customize mapping of XMLGregorianCalendar at package
* level </p>

View File

@ -78,14 +78,15 @@ import static java.lang.annotation.RetentionPolicy.*;
* String setName() {..};
* }
*
* {@code
*
* &lt;!-- Example: XML Schema fragment --&gt;
* &lt;xs:complexType name="USAddress"&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="name" type="xs:string"/&gt;
* &lt;/xs:sequence&gt;
* &lt;/xs:complexType&gt;
* </pre>
* <!-- Example: XML Schema fragment -->
* <xs:complexType name="USAddress">
* <xs:sequence>
* <xs:element name="name" type="xs:string"/>
* </xs:sequence>
* </xs:complexType>
* }</pre>
*
* @author Sekhar Vajjhala, Sun Microsystems, Inc.
* @since 1.6, JAXB 2.0

View File

@ -112,7 +112,7 @@ import java.lang.annotation.Target;
* The following table shows the mapping of the class to a XML Schema
* complex type or simple type. The notational symbols used in the table are:
* <ul>
* <li> -&gt; : represents a mapping </li>
* <li> {@literal ->} : represents a mapping </li>
* <li> [x]+ : one or more occurances of x </li>
* <li> [ <tt>@XmlValue</tt> property ]: JavaBean property annotated with
* <tt>@XmlValue</tt></li>
@ -132,7 +132,7 @@ import java.lang.annotation.Target;
* <tr valign="top">
* <td>Class</td>
* <td>{}</td>
* <td>[property]+ -&gt; elements</td>
* <td>[property]+ {@literal ->} elements</td>
* <td>complexcontent<br>xs:all</td>
* <td> </td>
* </tr>
@ -140,7 +140,7 @@ import java.lang.annotation.Target;
* <tr valign="top">
* <td>Class</td>
* <td>non empty</td>
* <td>[property]+ -&gt; elements</td>
* <td>[property]+ {@literal ->} elements</td>
* <td>complexcontent<br>xs:sequence</td>
* <td> </td>
* </tr>
@ -148,7 +148,7 @@ import java.lang.annotation.Target;
* <tr valign="top">
* <td>Class</td>
* <td>X</td>
* <td>no property -&gt; element</td>
* <td>no property {@literal ->} element</td>
* <td>complexcontent<br>empty sequence</td>
* <td> </td>
* </tr>
@ -156,7 +156,7 @@ import java.lang.annotation.Target;
* <tr valign="top">
* <td>Class</td>
* <td>X</td>
* <td>1 [<tt>@XmlValue</tt> property] {@literal &&} <br> [property]+ -&gt; attributes</td>
* <td>1 [<tt>@XmlValue</tt> property] {@literal &&} <br> [property]+ {@literal ->} attributes</td>
* <td>simplecontent</td>
* <td> </td>
* </tr>
@ -164,7 +164,7 @@ import java.lang.annotation.Target;
* <tr valign="top">
* <td>Class</td>
* <td>X</td>
* <td>1 [<tt>@XmlValue</tt> property] {@literal &&} <br> no properties -&gt; attribute</td>
* <td>1 [<tt>@XmlValue</tt> property] {@literal &&} <br> no properties {@literal ->} attribute</td>
* <td> </td>
* <td>simpletype</td>
* </tr>
@ -208,35 +208,37 @@ import java.lang.annotation.Target;
* java.math.BigDecimal getZip() {..};
* void setZip(java.math.BigDecimal) {..};
* }
* {@code
*
* &lt;!-- XML Schema mapping for USAddress --&gt;
* &lt;xs:complexType name="USAddress"&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="street" type="xs:string"/&gt;
* &lt;xs:element name="city" type="xs:string"/&gt;
* &lt;xs:element name="state" type="xs:string"/&gt;
* &lt;xs:element name="zip" type="xs:decimal"/&gt;
* &lt;xs:element name="name" type="xs:string"/&gt;
* &lt;/xs:all&gt;
* &lt;/xs:complexType&gt;
* </pre>
* <!-- XML Schema mapping for USAddress -->
* <xs:complexType name="USAddress">
* <xs:sequence>
* <xs:element name="street" type="xs:string"/>
* <xs:element name="city" type="xs:string"/>
* <xs:element name="state" type="xs:string"/>
* <xs:element name="zip" type="xs:decimal"/>
* <xs:element name="name" type="xs:string"/>
* </xs:all>
* </xs:complexType>
* }</pre>
* <p> <b> Example 2: </b> Map a class to a complex type with
* xs:all </p>
* <pre>
* &#64;XmlType(propOrder={})
* public class USAddress { ...}
* {@code
*
* &lt;!-- XML Schema mapping for USAddress --&gt;
* &lt;xs:complexType name="USAddress"&gt;
* &lt;xs:all&gt;
* &lt;xs:element name="name" type="xs:string"/&gt;
* &lt;xs:element name="street" type="xs:string"/&gt;
* &lt;xs:element name="city" type="xs:string"/&gt;
* &lt;xs:element name="state" type="xs:string"/&gt;
* &lt;xs:element name="zip" type="xs:decimal"/&gt;
* &lt;/xs:sequence&gt;
* &lt;/xs:complexType&gt;
*</pre>
* <!-- XML Schema mapping for USAddress -->
* <xs:complexType name="USAddress">
* <xs:all>
* <xs:element name="name" type="xs:string"/>
* <xs:element name="street" type="xs:string"/>
* <xs:element name="city" type="xs:string"/>
* <xs:element name="state" type="xs:string"/>
* <xs:element name="zip" type="xs:decimal"/>
* </xs:sequence>
* </xs:complexType>
*}</pre>
* <p> <b> Example 3: </b> Map a class to a global element with an
* anonymous type.
* </p>
@ -244,20 +246,21 @@ import java.lang.annotation.Target;
* &#64;XmlRootElement
* &#64;XmlType(name="")
* public class USAddress { ...}
* {@code
*
* &lt;!-- XML Schema mapping for USAddress --&gt;
* &lt;xs:element name="USAddress"&gt;
* &lt;xs:complexType&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="name" type="xs:string"/&gt;
* &lt;xs:element name="street" type="xs:string"/&gt;
* &lt;xs:element name="city" type="xs:string"/&gt;
* &lt;xs:element name="state" type="xs:string"/&gt;
* &lt;xs:element name="zip" type="xs:decimal"/&gt;
* &lt;/xs:sequence&gt;
* &lt;/xs:complexType&gt;
* &lt;/xs:element&gt;
* </pre>
* <!-- XML Schema mapping for USAddress -->
* <xs:element name="USAddress">
* <xs:complexType>
* <xs:sequence>
* <xs:element name="name" type="xs:string"/>
* <xs:element name="street" type="xs:string"/>
* <xs:element name="city" type="xs:string"/>
* <xs:element name="state" type="xs:string"/>
* <xs:element name="zip" type="xs:decimal"/>
* </xs:sequence>
* </xs:complexType>
* </xs:element>
* }</pre>
*
* <p> <b> Example 4: </b> Map a property to a local element with
* anonymous type.
@ -271,22 +274,23 @@ import java.lang.annotation.Target;
* &#64;XmlType(name="")
* public class USAddress { ... }
* }
* {@code
*
* &lt;!-- XML Schema mapping for USAddress --&gt;
* &lt;xs:complexType name="Invoice"&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="addr"&gt;
* &lt;xs:complexType&gt;
* &lt;xs:element name="name", type="xs:string"/&gt;
* &lt;xs:element name="city", type="xs:string"/&gt;
* &lt;xs:element name="city" type="xs:string"/&gt;
* &lt;xs:element name="state" type="xs:string"/&gt;
* &lt;xs:element name="zip" type="xs:decimal"/&gt;
* &lt;/xs:complexType&gt;
* <!-- XML Schema mapping for USAddress -->
* <xs:complexType name="Invoice">
* <xs:sequence>
* <xs:element name="addr">
* <xs:complexType>
* <xs:element name="name", type="xs:string"/>
* <xs:element name="city", type="xs:string"/>
* <xs:element name="city" type="xs:string"/>
* <xs:element name="state" type="xs:string"/>
* <xs:element name="zip" type="xs:decimal"/>
* </xs:complexType>
* ...
* &lt;/xs:sequence&gt;
* &lt;/xs:complexType&gt;
* </pre>
* </xs:sequence>
* </xs:complexType>
* }</pre>
*
* <p> <b> Example 5: </b> Map a property to an attribute with
* anonymous type.
@ -306,19 +310,20 @@ import java.lang.annotation.Target;
* &#64;XmlValue
* public java.math.BigDecimal price;
* }
* {@code
*
* &lt;!-- Example: XML Schema fragment --&gt;
* &lt;xs:complexType name="Item"&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="name" type="xs:string"/&gt;
* &lt;xs:attribute name="price"&gt;
* &lt;xs:simpleType&gt;
* &lt;xs:restriction base="xs:decimal"/&gt;
* &lt;/xs:simpleType&gt;
* &lt;/xs:attribute&gt;
* &lt;/xs:sequence&gt;
* &lt;/xs:complexType&gt;
* </pre>
* <!-- Example: XML Schema fragment -->
* <xs:complexType name="Item">
* <xs:sequence>
* <xs:element name="name" type="xs:string"/>
* <xs:attribute name="price">
* <xs:simpleType>
* <xs:restriction base="xs:decimal"/>
* </xs:simpleType>
* </xs:attribute>
* </xs:sequence>
* </xs:complexType>
* }</pre>
*
* <p> <b> Example 6: </b> Define a factoryClass and factoryMethod
*

View File

@ -87,13 +87,14 @@ import static java.lang.annotation.RetentionPolicy.*;
* &#64;XmlValue
* public java.math.BigDecimal price;
* }
* {@code
*
* &lt;!-- Example 1: XML Schema fragment --&gt;
* &lt;xs:simpleType name="USPrice"&gt;
* &lt;xs:restriction base="xs:decimal"/&gt;
* &lt;/xs:simpleType&gt;
* <!-- Example 1: XML Schema fragment -->
* <xs:simpleType name="USPrice">
* <xs:restriction base="xs:decimal"/>
* </xs:simpleType>
*
* </pre>
* }</pre>
*
* <p><b> Example 2: </b> Map a class to XML Schema complexType with
* with simpleContent.</p>
@ -108,17 +109,18 @@ import static java.lang.annotation.RetentionPolicy.*;
* &#64;XmlAttribute
* public String currency;
* }
* {@code
*
* &lt;!-- Example 2: XML Schema fragment --&gt;
* &lt;xs:complexType name="InternationalPrice"&gt;
* &lt;xs:simpleContent&gt;
* &lt;xs:extension base="xs:decimal"&gt;
* &lt;xs:attribute name="currency" type="xs:string"/&gt;
* &lt;/xs:extension&gt;
* &lt;/xs:simpleContent&gt;
* &lt;/xs:complexType&gt;
* <!-- Example 2: XML Schema fragment -->
* <xs:complexType name="InternationalPrice">
* <xs:simpleContent>
* <xs:extension base="xs:decimal">
* <xs:attribute name="currency" type="xs:string"/>
* </xs:extension>
* </xs:simpleContent>
* </xs:complexType>
*
* </pre>
* }</pre>
*
* @author Sekhar Vajjhala, Sun Microsystems, Inc.
* @see XmlType

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,7 +32,7 @@ package javax.xml.bind.annotation.adapters;
*
* <p>
* This adapter removes leading and trailing whitespaces, then truncate any
* sequnce of tab, CR, LF, and SP by a single whitespace character ' '.
* sequence of tab, CR, LF, and SP by a single whitespace character ' '.
*
* @author Kohsuke Kawaguchi
* @since 1.6, JAXB 2.0
@ -41,7 +41,7 @@ public class CollapsedStringAdapter extends XmlAdapter<String,String> {
/**
* Removes leading and trailing whitespaces of the string
* given as the parameter, then truncate any
* sequnce of tab, CR, LF, and SP by a single whitespace character ' '.
* sequence of tab, CR, LF, and SP by a single whitespace character ' '.
*/
public String unmarshal(String text) {
if(text==null) return null; // be defensive

View File

@ -75,35 +75,35 @@ package javax.xml.bind.annotation.adapters;
*
* <p> <b> Step 1: </b> Determine the desired XML representation for HashMap.
*
* <pre>
* &lt;hashmap&gt;
* &lt;entry key="id123"&gt;this is a value&lt;/entry&gt;
* &lt;entry key="id312"&gt;this is another value&lt;/entry&gt;
* <pre>{@code
* <hashmap>
* <entry key="id123">this is a value</entry>
* <entry key="id312">this is another value</entry>
* ...
* &lt;/hashmap&gt;
* </pre>
* </hashmap>
* }</pre>
*
* <p> <b> Step 2: </b> Determine the schema definition that the
* desired XML representation shown above should follow.
*
* <pre>
* <pre>{@code
*
* &lt;xs:complexType name="myHashMapType"&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="entry" type="myHashMapEntryType"
* minOccurs = "0" maxOccurs="unbounded"/&gt;
* &lt;/xs:sequence&gt;
* &lt;/xs:complexType&gt;
* <xs:complexType name="myHashMapType">
* <xs:sequence>
* <xs:element name="entry" type="myHashMapEntryType"
* minOccurs = "0" maxOccurs="unbounded"/>
* </xs:sequence>
* </xs:complexType>
*
* &lt;xs:complexType name="myHashMapEntryType"&gt;
* &lt;xs:simpleContent&gt;
* &lt;xs:extension base="xs:string"&gt;
* &lt;xs:attribute name="key" type="xs:int"/&gt;
* &lt;/xs:extension&gt;
* &lt;/xs:simpleContent&gt;
* &lt;/xs:complexType&gt;
* <xs:complexType name="myHashMapEntryType">
* <xs:simpleContent>
* <xs:extension base="xs:string">
* <xs:attribute name="key" type="xs:int"/>
* </xs:extension>
* </xs:simpleContent>
* </xs:complexType>
*
* </pre>
* }</pre>
*
* <p> <b> Step 3: </b> Write value types that can generate the above
* schema definition.
@ -125,11 +125,11 @@ package javax.xml.bind.annotation.adapters;
* <p> <b> Step 4: </b> Write the adapter that adapts the value type,
* MyHashMapType to a bound type, HashMap, used by the application.
*
* <pre>
* <pre>{@code
* public final class MyHashMapAdapter extends
* XmlAdapter&lt;MyHashMapType,HashMap&gt; { ... }
* XmlAdapter<MyHashMapType,HashMap> { ... }
*
* </pre>
* }</pre>
*
* <p> <b> Step 5: </b> Use the adapter.
*
@ -143,13 +143,13 @@ package javax.xml.bind.annotation.adapters;
*
* The above code fragment will map to the following schema:
*
* <pre>
* &lt;xs:complexType name="Foo"&gt;
* &lt;xs:sequence&gt;
* &lt;xs:element name="hashmap" type="myHashMapType"&gt;
* &lt;/xs:sequence&gt;
* &lt;/xs:complexType&gt;
* </pre>
* <pre>{@code
* <xs:complexType name="Foo">
* <xs:sequence>
* <xs:element name="hashmap" type="myHashMapType">
* </xs:sequence>
* </xs:complexType>
* }</pre>
*
* @param <BoundType>
* The type that JAXB doesn't know how to handle. An adapter is written

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -42,7 +42,7 @@ import java.lang.annotation.Target;
* &#64;XmlJavaTypeAdapters ({ @XmlJavaTypeAdapter(...),@XmlJavaTypeAdapter(...) })
* </pre>
*
* <p>The <tt>@XmlJavaTypeAdapters</tt> annnotation is useful for
* <p>The <tt>@XmlJavaTypeAdapters</tt> annotation is useful for
* defining {@link XmlJavaTypeAdapter} annotations for different types
* at the package level.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -119,7 +119,7 @@ final class EPRHeader extends AbstractHeaderImpl {
epr.writeTo(localName, w);
w.flush();
ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
DocumentBuilderFactory fac = DocumentBuilderFactory.newInstance();
DocumentBuilderFactory fac = XmlUtil.newDocumentBuilderFactory(false);
fac.setNamespaceAware(true);
Node eprNode = fac.newDocumentBuilder().parse(bais).getDocumentElement();
Node eprNodeToAdd = header.getOwnerDocument().importNode(eprNode, true);

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -194,7 +194,7 @@ public abstract class StreamHeader extends AbstractHeaderImpl {
// TODO what about in-scope namespaces
// Not very efficient consider implementing a stream buffer
// processor that produces a DOM node from the buffer.
TransformerFactory tf = XmlUtil.newTransformerFactory();
TransformerFactory tf = XmlUtil.newTransformerFactory(true);
Transformer t = tf.newTransformer();
XMLStreamBufferSource source = new XMLStreamBufferSource(_mark);
DOMResult result = new DOMResult();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -36,6 +36,9 @@ import com.sun.xml.internal.bind.marshaller.SAX2DOMEx;
//TODO DOMHeader DOMMessage SAAJMessage StatefulInstanceResolver
import com.sun.xml.internal.bind.unmarshaller.DOMScanner;
//TODO MtomCodec
import com.sun.xml.internal.bind.v2.runtime.output.Encoded;
//TODO ExceptionBean
import com.sun.xml.internal.bind.marshaller.NamespacePrefixMapper;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -56,7 +56,7 @@ public class DOMUtil {
synchronized (DOMUtil.class) {
if (db == null) {
try {
DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory();
DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory(true);
dbf.setNamespaceAware(true);
db = dbf.newDocumentBuilder();
} catch (ParserConfigurationException e) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -92,7 +92,7 @@ public abstract class AbstractSchemaValidationTube extends AbstractFilterTubeImp
super(next);
this.binding = binding;
feature = binding.getFeature(SchemaValidationFeature.class);
sf = allowExternalAccess(SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI), "file", false);
sf = allowExternalAccess(SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI), "all", false);
}
protected AbstractSchemaValidationTube(AbstractSchemaValidationTube that, TubeCloner cloner) {

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
# questions.
#
build-id=2.2.11-b150127.1410
build-version=JAX-WS RI 2.2.11-b150127.1410
build-id=2.2.11-b150402.1412
build-version=JAX-WS RI 2.2.11-b150402.1412
major-version=2.2.11
svn-revision=28121d09ed8ac02b76788709ccb4cdb66e03bbfa
svn-revision=f923291dedcf386c5f408263984a99d7cedf0012

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -187,14 +187,11 @@ public class XMLStreamReaderToXMLStreamWriter {
protected void handleStartElement() throws XMLStreamException {
String nsUri = in.getNamespaceURI();
if(nsUri==null)
out.writeStartElement(in.getLocalName());
else
out.writeStartElement(
fixNull(in.getPrefix()),
in.getLocalName(),
nsUri
);
out.writeStartElement(
fixNull(in.getPrefix()),
in.getLocalName(),
fixNull(nsUri)
);
// start namespace bindings
int nsCount = in.getNamespaceCount();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -231,7 +231,7 @@ public class XmlUtil {
static final ContextClassloaderLocal<SAXParserFactory> saxParserFactory = new ContextClassloaderLocal<SAXParserFactory>() {
@Override
protected SAXParserFactory initialValue() throws Exception {
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParserFactory factory = newSAXParserFactory(true);
factory.setNamespaceAware(true);
return factory;
}
@ -371,57 +371,49 @@ public class XmlUtil {
}
};
public static DocumentBuilderFactory newDocumentBuilderFactory() {
return newDocumentBuilderFactory(true);
}
public static DocumentBuilderFactory newDocumentBuilderFactory(boolean secureXmlProcessing) {
public static DocumentBuilderFactory newDocumentBuilderFactory(boolean disableSecurity) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
try {
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessing));
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
} catch (ParserConfigurationException e) {
LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } );
}
return factory;
}
public static TransformerFactory newTransformerFactory(boolean secureXmlProcessingEnabled) {
public static TransformerFactory newTransformerFactory(boolean disableSecurity) {
TransformerFactory factory = TransformerFactory.newInstance();
try {
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessingEnabled));
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
} catch (TransformerConfigurationException e) {
LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[]{factory.getClass().getName()});
}
return factory;
}
public static TransformerFactory newTransformerFactory() {
return newTransformerFactory(true);
}
public static SAXParserFactory newSAXParserFactory(boolean secureXmlProcessingEnabled) {
public static SAXParserFactory newSAXParserFactory(boolean disableSecurity) {
SAXParserFactory factory = SAXParserFactory.newInstance();
try {
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessingEnabled));
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[]{factory.getClass().getName()});
}
return factory;
}
public static XPathFactory newXPathFactory(boolean secureXmlProcessingEnabled) {
public static XPathFactory newXPathFactory(boolean disableSecurity) {
XPathFactory factory = XPathFactory.newInstance();
try {
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessingEnabled));
factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !xmlSecurityDisabled(disableSecurity));
} catch (XPathFactoryConfigurationException e) {
LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } );
}
return factory;
}
public static XMLInputFactory newXMLInputFactory(boolean secureXmlProcessingEnabled) {
public static XMLInputFactory newXMLInputFactory(boolean disableSecurity) {
XMLInputFactory factory = XMLInputFactory.newInstance();
if (isXMLSecurityDisabled(secureXmlProcessingEnabled)) {
if (xmlSecurityDisabled(disableSecurity)) {
// TODO-Miran: are those apppropriate defaults?
factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
@ -429,14 +421,14 @@ public class XmlUtil {
return factory;
}
private static boolean isXMLSecurityDisabled(boolean runtimeDisabled) {
private static boolean xmlSecurityDisabled(boolean runtimeDisabled) {
return XML_SECURITY_DISABLED || runtimeDisabled;
}
public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) {
public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecurity) {
// if xml security (feature secure processing) disabled, nothing to do, no restrictions applied
if (isXMLSecurityDisabled(disableSecureProcessing)) {
if (xmlSecurityDisabled(disableSecurity)) {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.log(Level.FINE, "Xml Security disabled, no JAXP xsd external access configuration necessary.");
}

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -30,10 +30,10 @@ BASEDIR_DOESNT_EXIST = \
Non-existent directory: {0}
VERSION = \
schemagen 2.2.12-b150126.1924
schemagen 2.2.12-b150331.1824
FULLVERSION = \
schemagen full version "2.2.12-b150126.1924"
schemagen full version "2.2.12-b150331.1824"
USAGE = \
Usage: schemagen [-options ...] <java files> \n\

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = Nicht erkanntes {0} in Zeile {1} Spalte {2}
BASEDIR_DOESNT_EXIST = Nicht vorhandenes Verzeichnis: {0}
VERSION = schemagen 2.2.12-b150126.1924
VERSION = schemagen 2.2.12-b150331.1824
FULLVERSION = schemagen vollst\u00E4ndige Version "2.2.12-b150126.1924"
FULLVERSION = schemagen vollst\u00E4ndige Version "2.2.12-b150331.1824"
USAGE = Verwendung: schemagen [-options ...] <java files> \nOptionen: \n\\ \\ \\ \\ -d <path> : Gibt an, wo die von Prozessor und javac generierten Klassendateien gespeichert werden sollen\n\\ \\ \\ \\ -cp <path> : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -classpath <path> : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -encoding <encoding> : Gibt die Codierung f\u00FCr die Annotationsverarbeitung/den javac-Aufruf an \n\\ \\ \\ \\ -episode <file> : Generiert Episodendatei f\u00FCr separate Kompilierung\n\\ \\ \\ \\ -version : Zeigt Versionsinformation an\n\\ \\ \\ \\ -fullversion : Zeigt vollst\u00E4ndige Versionsinformationen an\n\\ \\ \\ \\ -help : Zeigt diese Verwendungsmeldung an

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = Aparece un {0} inesperado en la l\u00EDnea {1} y la colu
BASEDIR_DOESNT_EXIST = Directorio no existente: {0}
VERSION = schemagen 2.2.12-b150126.1924
VERSION = schemagen 2.2.12-b150331.1824
FULLVERSION = versi\u00F3n completa de schemagen "2.2.12-b150126.1924"
FULLVERSION = versi\u00F3n completa de schemagen "2.2.12-b150331.1824"
USAGE = Sintaxis: schemagen [-options ...] <archivos java> \nOpciones: \n\\ \\ \\ \\ -d <ruta de acceso> : especifique d\u00F3nde se colocan los archivos de clase generados por javac y el procesador\n\\ \\ \\ \\ -cp <ruta de acceso> : especifique d\u00F3nde se encuentran los archivos especificados por el usuario\n\\ \\ \\ \\ -encoding <codificaci\u00F3n> : especifique la codificaci\u00F3n que se va a utilizar para el procesamiento de anotaciones/llamada de javac\n\\ \\ \\ \\ -episode <archivo> : genera un archivo de episodio para una compilaci\u00F3n diferente\n\\ \\ \\ \\ -version : muestra la informaci\u00F3n de la versi\u00F3n\n\\ \\ \\ \\ -fullversion : muestra la informaci\u00F3n completa de la versi\u00F3n\n\\ \\ \\ \\ -help : muestra este mensaje de sintaxis

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = Un \u00E9l\u00E9ment {0} inattendu appara\u00EEt \u00E0
BASEDIR_DOESNT_EXIST = R\u00E9pertoire {0} inexistant
VERSION = schemagen 2.2.12-b150126.1924
VERSION = schemagen 2.2.12-b150331.1824
FULLVERSION = version compl\u00E8te de schemagen "2.2.12-b150126.1924"
FULLVERSION = version compl\u00E8te de schemagen "2.2.12-b150331.1824"
USAGE = Syntaxe : schemagen [-options ...] <java files> \nOptions : \n\ \ \ \ -d <path> : indiquez o\u00F9 placer les fichiers de classe g\u00E9n\u00E9r\u00E9s par le processeur et le compilateur javac\n\ \ \ \ -cp <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -classpath <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -encoding <encoding> : indiquez l'encodage \u00E0 utiliser pour l'appel de javac/traitement de l'annotation \n\ \ \ \ -episode <file> : g\u00E9n\u00E9rez un fichier d'\u00E9pisode pour la compilation s\u00E9par\u00E9e\n\ \ \ \ -version : affichez les informations de version\n\ \ \ \ -fullversion : affichez les informations compl\u00E8tes de version\n\ \ \ \ -help : affichez ce message de syntaxe

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = {0} imprevisto visualizzato sulla riga {1} colonna {2}
BASEDIR_DOESNT_EXIST = Directory non esistente: {0}
VERSION = schemagen 2.2.12-b150126.1924
VERSION = schemagen 2.2.12-b150331.1824
FULLVERSION = versione completa schemagen "2.2.12-b150126.1924"
FULLVERSION = versione completa schemagen "2.2.12-b150331.1824"
USAGE = Uso: schemagen [-options ...] <java files> \nOpzioni: \n\ \ \ \ -d <path> : specifica dove posizionare il processore e i file della classe generata javac\n\ \ \ \ -cp <path> : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -classpath <path> : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -encoding <encoding> : specifica la codifica da usare per l'elaborazione dell'annotazione/richiamo javac \n\ \ \ \ -episode <file> : genera il file di episodio per la compilazione separata\n\ \ \ \ -version : visualizza le informazioni sulla versione\n\ \ \ \ -fullversion : visualizza le informazioni sulla versione completa\n\ \ \ \ -help : visualizza questo messaggio sull'uso

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = \u4E88\u671F\u3057\u306A\u3044{0}\u304C\u884C{1}\u3001\u
BASEDIR_DOESNT_EXIST = \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u5B58\u5728\u3057\u307E\u305B\u3093: {0}
VERSION = schemagen 2.2.12-b150126.1924
VERSION = schemagen 2.2.12-b150331.1824
FULLVERSION = schemagen\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.12-b150126.1924"
FULLVERSION = schemagen\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.12-b150331.1824"
USAGE = \u4F7F\u7528\u65B9\u6CD5: schemagen [-options ...] <java files> \n\u30AA\u30D7\u30B7\u30E7\u30F3: \n\ \ \ \ -d <path> : \u30D7\u30ED\u30BB\u30C3\u30B5\u304A\u3088\u3073javac\u304C\u751F\u6210\u3057\u305F\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u7F6E\u304F\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -cp <path> : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -classpath <path> : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -encoding <encoding> : \u6CE8\u91C8\u51E6\u7406/javac\u547C\u51FA\u3057\u306B\u4F7F\u7528\u3059\u308B\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -episode <file> : \u30B3\u30F3\u30D1\u30A4\u30EB\u3054\u3068\u306B\u30A8\u30D4\u30BD\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3057\u307E\u3059\n\ \ \ \ -version : \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -fullversion : \u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -help : \u3053\u306E\u4F7F\u7528\u4F8B\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u307E\u3059

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = \uC608\uC0C1\uCE58 \uC54A\uC740 {0}\uC774(\uAC00) {1}\uD
BASEDIR_DOESNT_EXIST = \uC874\uC7AC\uD558\uC9C0 \uC54A\uB294 \uB514\uB809\uD1A0\uB9AC: {0}
VERSION = schemagen 2.2.12-b150126.1924
VERSION = schemagen 2.2.12-b150331.1824
FULLVERSION = schemagen \uC815\uC2DD \uBC84\uC804 "2.2.12-b150126.1924"
FULLVERSION = schemagen \uC815\uC2DD \uBC84\uC804 "2.2.12-b150331.1824"
USAGE = \uC0AC\uC6A9\uBC95: schemagen [-options ...] <java files> \n\uC635\uC158: \n\ \ \ \ -d <path> : \uD504\uB85C\uC138\uC11C \uBC0F javac\uC5D0\uC11C \uC0DD\uC131\uD55C \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uBC30\uCE58\uD560 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -cp <path> : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -classpath <path> : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -encoding <encoding> : \uC8FC\uC11D \uCC98\uB9AC/javac \uD638\uCD9C\uC5D0 \uC0AC\uC6A9\uD560 \uC778\uCF54\uB529\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4. \n\ \ \ \ -episode <file> : \uBCC4\uB3C4 \uCEF4\uD30C\uC77C\uC744 \uC704\uD574 episode \uD30C\uC77C\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n\ \ \ \ -version : \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -fullversion : \uC815\uC2DD \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -help : \uC774 \uC0AC\uC6A9\uBC95 \uBA54\uC2DC\uC9C0\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = {0} inesperado aparece na linha {1} coluna {2}
BASEDIR_DOESNT_EXIST = Diret\u00F3rio n\u00E3o existente: {0}
VERSION = gera\u00E7\u00E3o do esquema 2.2.12-b150126.1924
VERSION = gera\u00E7\u00E3o do esquema 2.2.12-b150331.1824
FULLVERSION = vers\u00E3o completa da gera\u00E7\u00E3o do esquema "2.2.12-b150126.1924"
FULLVERSION = vers\u00E3o completa da gera\u00E7\u00E3o do esquema "2.2.12-b150331.1824"
USAGE = Uso: gera\u00E7\u00E3o do esquema [-options ...] <java files> \nOp\u00E7\u00F5es: \n\\ \\ \\ \\ -d <path> : especificar onde colocar o processador e os arquivos da classe gerados por javac\n\\ \\ \\ \\ -cp <path> : especificar onde localizar arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -classpath <path> : especificar onde localizar os arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -encoding <encoding> : especificar codifica\u00E7\u00E3o a ser usada para processamento de anota\u00E7\u00E3o/chamada javac \n\\ \\ \\ \\ -episode <file> : gerar arquivo do epis\u00F3dio para compila\u00E7\u00E3o separada\n\\ \\ \\ \\ -version : exibir informa\u00E7\u00F5es da vers\u00E3o\n\\ \\ \\ \\ -fullversion : exibir informa\u00E7\u00F5es da vers\u00E3o completa\n\\ \\ \\ \\ -help : exibir esta mensagem de uso

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = \u5728\u7B2C {1} \u884C, \u7B2C {2} \u5217\u51FA\u73B0\u
BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u5F55: {0}
VERSION = schemagen 2.2.12-b150126.1924
VERSION = schemagen 2.2.12-b150331.1824
FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.12-b150126.1924"
FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.12-b150331.1824"
USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9009\u9879: \n\ \ \ \ -d <path> : \u6307\u5B9A\u653E\u7F6E\u5904\u7406\u7A0B\u5E8F\u548C javac \u751F\u6210\u7684\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -cp <path> : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -classpath <path> : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -encoding <encoding> : \u6307\u5B9A\u7528\u4E8E\u6CE8\u91CA\u5904\u7406/javac \u8C03\u7528\u7684\u7F16\u7801\n\ \ \ \ -episode <file> : \u751F\u6210\u7247\u6BB5\u6587\u4EF6\u4EE5\u4F9B\u5355\u72EC\u7F16\u8BD1\n\ \ \ \ -version : \u663E\u793A\u7248\u672C\u4FE1\u606F\n\ \ \ \ -fullversion : \u663E\u793A\u5B8C\u6574\u7684\u7248\u672C\u4FE1\u606F\n\ \ \ \ -help : \u663E\u793A\u6B64\u7528\u6CD5\u6D88\u606F

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = \u672A\u9810\u671F\u7684 {0} \u986F\u793A\u65BC\u884C {1
BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u9304: {0}
VERSION = schemagen 2.2.12-b150126.1924
VERSION = schemagen 2.2.12-b150331.1824
FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.12-b150126.1924"
FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.12-b150331.1824"
USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9078\u9805: \n\\ \\ \\ \\ -d <path> : \u6307\u5B9A\u8655\u7406\u5668\u4EE5\u53CA javac \u7522\u751F\u7684\u985E\u5225\u6A94\u6848\u653E\u7F6E\u4F4D\u7F6E\n\\ \\ \\ \\ -cp <path> : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -classpath <path> : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -encoding <encoding> : \u6307\u5B9A\u8981\u7528\u65BC\u8A3B\u89E3\u8655\u7406/javac \u547C\u53EB\u7684\u7DE8\u78BC \n\\ \\ \\ \\ -episode <file> : \u7522\u751F\u7368\u7ACB\u7DE8\u8B6F\u7684\u4E8B\u4EF6 (episode) \u6A94\u6848\n\\ \\ \\ \\ -version : \u986F\u793A\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -fullversion : \u986F\u793A\u5B8C\u6574\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -help : \u986F\u793A\u6B64\u7528\u6CD5\u8A0A\u606F

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -158,7 +158,12 @@ public class SchemaGenerator {
while (cl != null) {
if (cl instanceof URLClassLoader) {
for (URL url : ((URLClassLoader) cl).getURLs()) {
appendPath(cp, url.getPath());
try {
appendPath(cp,new File(url.toURI()).getPath());
} catch(URISyntaxException ex) {
/*If the URL is not properly formated - skip it*/
LOGGER.log(Level.SEVERE, ex.getMessage(), ex);
}
}
}
cl = cl.getParent();

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -23,8 +23,6 @@
* questions.
*/
package com.sun.tools.internal.jxc.ap;
import com.sun.tools.internal.jxc.api.JXC;
@ -89,12 +87,12 @@ public class SchemaGenerator extends AbstractProcessor {
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
final ErrorReceiverImpl errorListener = new ErrorReceiverImpl(processingEnv);
List<Reference> classes = new ArrayList<Reference>();
List<Reference> classesToBeBound = new ArrayList<Reference>();
// simply ignore all the interface definitions,
// so that users won't have to manually exclude interfaces, which is silly.
filterClass(classes, roundEnv.getRootElements());
filterClass(classesToBeBound, roundEnv.getRootElements());
J2SJAXBModel model = JXC.createJavaCompiler().bind(classes, Collections.<QName, Reference>emptyMap(), null, processingEnv);
J2SJAXBModel model = JXC.createJavaCompiler().bind(classesToBeBound, Collections.<QName, Reference>emptyMap(), null, processingEnv);
if (model == null)
return false; // error
@ -133,11 +131,17 @@ public class SchemaGenerator extends AbstractProcessor {
return false;
}
private void filterClass(List<Reference> classes, Collection<? extends Element> elements) {
/**
* Filter classes (note that enum is kind of class) from elements tree
* @param result list of found classes
* @param elements tree to be filtered
*/
private void filterClass(List<Reference> result, Collection<? extends Element> elements) {
for (Element element : elements) {
if (element.getKind().equals(ElementKind.CLASS) || element.getKind().equals(ElementKind.ENUM)) {
classes.add(new Reference((TypeElement) element, processingEnv));
filterClass(classes, ElementFilter.typesIn(element.getEnclosedElements()));
final ElementKind kind = element.getKind();
if (ElementKind.CLASS.equals(kind) || ElementKind.ENUM.equals(kind)) {
result.add(new Reference((TypeElement) element, processingEnv));
filterClass(result, ElementFilter.typesIn(element.getEnclosedElements()));
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,7 +30,12 @@ import com.sun.source.util.TreePath;
import com.sun.source.util.Trees;
import com.sun.xml.internal.bind.v2.model.nav.Navigator;
import com.sun.xml.internal.bind.v2.runtime.Location;
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.processing.ProcessingEnvironment;
import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
@ -52,12 +57,6 @@ import javax.lang.model.util.ElementFilter;
import javax.lang.model.util.Elements;
import javax.lang.model.util.SimpleTypeVisitor6;
import javax.lang.model.util.Types;
import java.lang.annotation.Annotation;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
/**
* {@link Navigator} implementation for annotation processing.
@ -241,7 +240,7 @@ public final class ApNavigator implements Navigator<TypeMirror, TypeElement, Var
public VariableElement[] getEnumConstants(TypeElement clazz) {
List<? extends Element> elements = env.getElementUtils().getAllMembers(clazz);
Collection<VariableElement> constants = new HashSet<VariableElement>();
Collection<VariableElement> constants = new ArrayList<VariableElement>();
for (Element element : elements) {
if (element.getKind().equals(ElementKind.ENUM_CONSTANT)) {
constants.add((VariableElement) element);

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -171,20 +171,20 @@ Driver.CompilingSchema = \
Driver.FailedToGenerateCode = \
Failed to produce code.
# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter>
# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = \
This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150126.1924 \n\
This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150331.1824 \n\
See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\
Any modifications to this file will be lost upon recompilation of the source schema. \n\
Generated on: {0} \n
Driver.Version = \
xjc 2.2.12-b150126.1924
xjc 2.2.12-b150331.1824
Driver.FullVersion = \
xjc full version "2.2.12-b150126.1924"
xjc full version "2.2.12-b150331.1824"
Driver.BuildID = 2.2.12-b150126.1924
Driver.BuildID = 2.2.12-b150331.1824
# for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = Ein Schema wird kompiliert ...
Driver.FailedToGenerateCode = Code konnte nicht erzeugt werden.
# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150126.1924 generiert \nSiehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u00c4nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. \nGeneriert: {0} \n
# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150331.1824 generiert \nSiehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u00c4nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. \nGeneriert: {0} \n
Driver.Version = xjc 2.2.12-b150126.1924
Driver.Version = xjc 2.2.12-b150331.1824
Driver.FullVersion = xjc vollst\u00E4ndige Version "2.2.12-b150126.1924"
Driver.FullVersion = xjc vollst\u00E4ndige Version "2.2.12-b150331.1824"
Driver.BuildID = 2.2.12-b150126.1924
Driver.BuildID = 2.2.12-b150331.1824
# for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = Compilando un esquema...
Driver.FailedToGenerateCode = Fallo al producir c\u00f3digo.
# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = Este archivo ha sido generado por la arquitectura JavaTM para la implantaci\u00f3n de la referencia de enlace (JAXB) XML v2.2.12-b150126.1924 \nVisite <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas las modificaciones realizadas en este archivo se perder\u00e1n si se vuelve a compilar el esquema de origen. \nGenerado el: {0} \n
# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = Este archivo ha sido generado por la arquitectura JavaTM para la implantaci\u00f3n de la referencia de enlace (JAXB) XML v2.2.12-b150331.1824 \nVisite <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas las modificaciones realizadas en este archivo se perder\u00e1n si se vuelve a compilar el esquema de origen. \nGenerado el: {0} \n
Driver.Version = xjc 2.2.12-b150126.1924
Driver.Version = xjc 2.2.12-b150331.1824
Driver.FullVersion = versi\u00F3n completa de xjc "2.2.12-b150126.1924"
Driver.FullVersion = versi\u00F3n completa de xjc "2.2.12-b150331.1824"
Driver.BuildID = 2.2.12-b150126.1924
Driver.BuildID = 2.2.12-b150331.1824
# for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = compilation d'un sch\u00e9ma...
Driver.FailedToGenerateCode = Echec de la production du code.
# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = Ce fichier a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 par l''impl\u00e9mentation de r\u00e9f\u00e9rence JavaTM Architecture for XML Binding (JAXB), v2.2.12-b150126.1924 \nVoir <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nToute modification apport\u00e9e \u00e0 ce fichier sera perdue lors de la recompilation du sch\u00e9ma source. \nG\u00e9n\u00e9r\u00e9 le : {0} \n
# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = Ce fichier a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 par l''impl\u00e9mentation de r\u00e9f\u00e9rence JavaTM Architecture for XML Binding (JAXB), v2.2.12-b150331.1824 \nVoir <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nToute modification apport\u00e9e \u00e0 ce fichier sera perdue lors de la recompilation du sch\u00e9ma source. \nG\u00e9n\u00e9r\u00e9 le : {0} \n
Driver.Version = xjc 2.2.12-b150126.1924
Driver.Version = xjc 2.2.12-b150331.1824
Driver.FullVersion = version compl\u00E8te xjc "2.2.12-b150126.1924"
Driver.FullVersion = version compl\u00E8te xjc "2.2.12-b150331.1824"
Driver.BuildID = 2.2.12-b150126.1924
Driver.BuildID = 2.2.12-b150331.1824
# for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = compilazione di uno schema in corso...
Driver.FailedToGenerateCode = Produzione del codice non riuscita.
# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.12-b150126.1924 \nVedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nQualsiasi modifica a questo file andr\u00e0 persa durante la ricompilazione dello schema di origine. \nGenerato il: {0} \n
# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.12-b150331.1824 \nVedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nQualsiasi modifica a questo file andr\u00e0 persa durante la ricompilazione dello schema di origine. \nGenerato il: {0} \n
Driver.Version = xjc 2.2.12-b150126.1924
Driver.Version = xjc 2.2.12-b150331.1824
Driver.FullVersion = versione completa xjc "2.2.12-b150126.1924"
Driver.FullVersion = versione completa xjc "2.2.12-b150331.1824"
Driver.BuildID = 2.2.12-b150126.1924
Driver.BuildID = 2.2.12-b150331.1824
# for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = \u30b9\u30ad\u30fc\u30de\u306e\u30b3\u30f3\u30d1\u30a4\
Driver.FailedToGenerateCode = \u30b3\u30fc\u30c9\u306e\u751f\u6210\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002
# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001JavaTM Architecture for XML Binding(JAXB) Reference Implementation\u3001v2.2.12-b150126.1924\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u307e\u3057\u305f \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044 \n\u30bd\u30fc\u30b9\u30fb\u30b9\u30ad\u30fc\u30de\u306e\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u306f\u5931\u308f\u308c\u307e\u3059\u3002 \n\u751f\u6210\u65e5: {0} \n
# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001JavaTM Architecture for XML Binding(JAXB) Reference Implementation\u3001v2.2.12-b150331.1824\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u307e\u3057\u305f \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044 \n\u30bd\u30fc\u30b9\u30fb\u30b9\u30ad\u30fc\u30de\u306e\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u306f\u5931\u308f\u308c\u307e\u3059\u3002 \n\u751f\u6210\u65e5: {0} \n
Driver.Version = xjc 2.2.12-b150126.1924
Driver.Version = xjc 2.2.12-b150331.1824
Driver.FullVersion = xjc\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.12-b150126.1924"
Driver.FullVersion = xjc\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.12-b150331.1824"
Driver.BuildID = 2.2.12-b150126.1924
Driver.BuildID = 2.2.12-b150331.1824
# for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = \uc2a4\ud0a4\ub9c8\ub97c \ucef4\ud30c\uc77c\ud558\ub294
Driver.FailedToGenerateCode = \ucf54\ub4dc \uc0dd\uc131\uc744 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4.
# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = \uc774 \ud30c\uc77c\uc740 JAXB(JavaTM Architecture for XML Binding) \ucc38\uc870 \uad6c\ud604 2.2.12-b150126.1924 \ubc84\uc804\uc744 \ud1b5\ud574 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. \n\uc774 \ud30c\uc77c\uc744 \uc218\uc815\ud558\uba74 \uc18c\uc2a4 \uc2a4\ud0a4\ub9c8\ub97c \uc7ac\ucef4\ud30c\uc77c\ud560 \ub54c \uc218\uc815 \uc0ac\ud56d\uc774 \uc190\uc2e4\ub429\ub2c8\ub2e4. \n\uc0dd\uc131 \ub0a0\uc9dc: {0} \n
# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = \uc774 \ud30c\uc77c\uc740 JAXB(JavaTM Architecture for XML Binding) \ucc38\uc870 \uad6c\ud604 2.2.12-b150331.1824 \ubc84\uc804\uc744 \ud1b5\ud574 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. \n\uc774 \ud30c\uc77c\uc744 \uc218\uc815\ud558\uba74 \uc18c\uc2a4 \uc2a4\ud0a4\ub9c8\ub97c \uc7ac\ucef4\ud30c\uc77c\ud560 \ub54c \uc218\uc815 \uc0ac\ud56d\uc774 \uc190\uc2e4\ub429\ub2c8\ub2e4. \n\uc0dd\uc131 \ub0a0\uc9dc: {0} \n
Driver.Version = XJC 2.2.12-b150126.1924
Driver.Version = XJC 2.2.12-b150331.1824
Driver.FullVersion = XJC \uC815\uC2DD \uBC84\uC804 "2.2.12-b150126.1924"
Driver.FullVersion = XJC \uC815\uC2DD \uBC84\uC804 "2.2.12-b150331.1824"
Driver.BuildID = 2.2.12-b150126.1924
Driver.BuildID = 2.2.12-b150331.1824
# for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = compilando um esquema...
Driver.FailedToGenerateCode = Falha ao produzir o c\u00f3digo.
# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = Este arquivo foi gerado pela Arquitetura JavaTM para Implementa\u00e7\u00e3o de Refer\u00eancia (JAXB) de Bind XML, v2.2.12-b150126.1924 \nConsulte <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas as modifica\u00e7\u00f5es neste arquivo ser\u00e3o perdidas ap\u00f3s a recompila\u00e7\u00e3o do esquema de origem. \nGerado em: {0} \n
# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = Este arquivo foi gerado pela Arquitetura JavaTM para Implementa\u00e7\u00e3o de Refer\u00eancia (JAXB) de Bind XML, v2.2.12-b150331.1824 \nConsulte <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas as modifica\u00e7\u00f5es neste arquivo ser\u00e3o perdidas ap\u00f3s a recompila\u00e7\u00e3o do esquema de origem. \nGerado em: {0} \n
Driver.Version = xjc 2.2.12-b150126.1924
Driver.Version = xjc 2.2.12-b150331.1824
Driver.FullVersion = vers\u00E3o completa de xjc "2.2.12-b150126.1924"
Driver.FullVersion = vers\u00E3o completa de xjc "2.2.12-b150331.1824"
Driver.BuildID = 2.2.12-b150126.1924
Driver.BuildID = 2.2.12-b150331.1824
# for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = \u6b63\u5728\u7f16\u8bd1\u6a21\u5f0f...
Driver.FailedToGenerateCode = \u65e0\u6cd5\u751f\u6210\u4ee3\u7801\u3002
# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = \u6b64\u6587\u4ef6\u662f\u7531 JavaTM Architecture for XML Binding (JAXB) \u5f15\u7528\u5b9e\u73b0 v2.2.12-b150126.1924 \u751f\u6210\u7684\n\u8bf7\u8bbf\u95ee <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u5728\u91cd\u65b0\u7f16\u8bd1\u6e90\u6a21\u5f0f\u65f6, \u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u4fee\u6539\u90fd\u5c06\u4e22\u5931\u3002\n\u751f\u6210\u65f6\u95f4: {0} \n
# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = \u6b64\u6587\u4ef6\u662f\u7531 JavaTM Architecture for XML Binding (JAXB) \u5f15\u7528\u5b9e\u73b0 v2.2.12-b150331.1824 \u751f\u6210\u7684\n\u8bf7\u8bbf\u95ee <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u5728\u91cd\u65b0\u7f16\u8bd1\u6e90\u6a21\u5f0f\u65f6, \u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u4fee\u6539\u90fd\u5c06\u4e22\u5931\u3002\n\u751f\u6210\u65f6\u95f4: {0} \n
Driver.Version = xjc 2.2.12-b150126.1924
Driver.Version = xjc 2.2.12-b150331.1824
Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.12-b150126.1924"
Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.12-b150331.1824"
Driver.BuildID = 2.2.12-b150126.1924
Driver.BuildID = 2.2.12-b150331.1824
# for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -96,14 +96,14 @@ Driver.CompilingSchema = \u6b63\u5728\u7de8\u8b6f\u7db1\u8981...
Driver.FailedToGenerateCode = \u7121\u6cd5\u7522\u751f\u7a0b\u5f0f\u78bc.
# DO NOT localize the 2.2.12-b150126.1924 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = \u6b64\u6a94\u6848\u662f\u7531 JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150126.1924 \u6240\u7522\u751f \n\u8acb\u53c3\u95b1 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u4e00\u65e6\u91cd\u65b0\u7de8\u8b6f\u4f86\u6e90\u7db1\u8981, \u5c0d\u6b64\u6a94\u6848\u6240\u505a\u7684\u4efb\u4f55\u4fee\u6539\u90fd\u5c07\u6703\u907a\u5931. \n\u7522\u751f\u6642\u9593: {0} \n
# DO NOT localize the 2.2.12-b150331.1824 string - it is a token for an mvn <properties filter>
Driver.FilePrologComment = \u6b64\u6a94\u6848\u662f\u7531 JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b150331.1824 \u6240\u7522\u751f \n\u8acb\u53c3\u95b1 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u4e00\u65e6\u91cd\u65b0\u7de8\u8b6f\u4f86\u6e90\u7db1\u8981, \u5c0d\u6b64\u6a94\u6848\u6240\u505a\u7684\u4efb\u4f55\u4fee\u6539\u90fd\u5c07\u6703\u907a\u5931. \n\u7522\u751f\u6642\u9593: {0} \n
Driver.Version = xjc 2.2.12-b150126.1924
Driver.Version = xjc 2.2.12-b150331.1824
Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.12-b150126.1924"
Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.12-b150331.1824"
Driver.BuildID = 2.2.12-b150126.1924
Driver.BuildID = 2.2.12-b150331.1824
# for JDK integration - include version in source zip
jaxb.jdk.version=@@JAXB_JDK_VERSION@@

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,13 +25,15 @@
package com.sun.tools.internal.xjc.addon.code_injector;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import com.sun.istack.internal.NotNull;
import com.sun.tools.internal.xjc.Options;
import com.sun.tools.internal.xjc.Plugin;
import com.sun.tools.internal.xjc.model.CPluginCustomization;
import com.sun.tools.internal.xjc.outline.ClassOutline;
import com.sun.tools.internal.xjc.outline.CustomizableOutline;
import com.sun.tools.internal.xjc.outline.Outline;
import com.sun.tools.internal.xjc.util.DOMUtils;
@ -54,7 +56,7 @@ public class PluginImpl extends Plugin {
}
public boolean isCustomizationTagName(String nsUri, String localName) {
return nsUri.equals(Const.NS) && localName.equals("code");
return Const.NS.equals(nsUri) && "code".equals(localName);
}
public String getUsage() {
@ -62,9 +64,15 @@ public class PluginImpl extends Plugin {
}
// meat of the processing
public boolean run(Outline model, Options opt, ErrorHandler errorHandler) {
for( ClassOutline co : model.getClasses() ) {
CPluginCustomization c = co.target.getCustomizations().find(Const.NS,"code");
public boolean run(@NotNull Outline model, Options opt, ErrorHandler errorHandler) {
checkAndInject(model.getClasses());
checkAndInject(model.getEnums());
return true;
}
private static void checkAndInject(Collection<? extends CustomizableOutline> outlines) {
for (CustomizableOutline co : outlines) {
CPluginCustomization c = co.getTarget().getCustomizations().find(Const.NS, "code");
if(c==null)
continue; // no customization --- nothing to inject here
@ -74,9 +82,7 @@ public class PluginImpl extends Plugin {
String codeFragment = DOMUtils.getElementText(c.element);
// inject the specified code fragment into the implementation class.
co.implClass.direct(codeFragment);
co.getImplClass().direct(codeFragment);
}
return true;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -33,6 +33,7 @@ import java.util.List;
import com.sun.codemodel.internal.JClass;
import com.sun.codemodel.internal.JDefinedClass;
import com.sun.tools.internal.xjc.model.CClassInfo;
import com.sun.tools.internal.xjc.model.CCustomizable;
import com.sun.tools.internal.xjc.model.CPropertyInfo;
import com.sun.istack.internal.NotNull;
@ -44,7 +45,7 @@ import com.sun.istack.internal.NotNull;
*
* @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
*/
public abstract class ClassOutline {
public abstract class ClassOutline implements CustomizableOutline {
/**
* A {@link Outline} that encloses all the class outlines.
@ -122,4 +123,14 @@ public abstract class ClassOutline {
if(s==null) return null;
return parent().getClazz(s);
}
@Override
public JDefinedClass getImplClass() {
return implClass;
}
@Override
public CCustomizable getTarget() {
return target;
}
}

View File

@ -0,0 +1,53 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.sun.tools.internal.xjc.outline;
import com.sun.codemodel.internal.JDefinedClass;
import com.sun.istack.internal.NotNull;
import com.sun.tools.internal.xjc.model.CCustomizable;
/**
* This interface describes that outline class could be customized.
* It provides the bound info from {@link CCustomizable} target. And
* customization output - implementation class.
*
* @author yaroska
* @since 2.2.12
*/
public interface CustomizableOutline {
/**
* Provides bound information about customizable target.
* @return customizable target
*/
@NotNull CCustomizable getTarget();
/**
* Provides customization output.
* @return Implementation class
*/
@NotNull JDefinedClass getImplClass();
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,7 @@
package com.sun.tools.internal.xjc.outline;
import com.sun.codemodel.internal.JDefinedClass;
import com.sun.tools.internal.xjc.model.CCustomizable;
import com.sun.tools.internal.xjc.model.CElementInfo;
/**
@ -39,7 +40,7 @@ import com.sun.tools.internal.xjc.model.CElementInfo;
*
* @author Kohsuke Kawaguchi
*/
public abstract class ElementOutline {
public abstract class ElementOutline implements CustomizableOutline {
/**
* A {@link Outline} that encloses all the class outlines.
@ -69,4 +70,14 @@ public abstract class ElementOutline {
this.target = target;
this.implClass = implClass;
}
@Override
public CCustomizable getTarget() {
return target;
}
@Override
public JDefinedClass getImplClass() {
return implClass;
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,7 @@ import java.util.ArrayList;
import java.util.List;
import com.sun.codemodel.internal.JDefinedClass;
import com.sun.tools.internal.xjc.model.CCustomizable;
import com.sun.tools.internal.xjc.model.CEnumLeafInfo;
import com.sun.istack.internal.NotNull;
@ -40,7 +41,7 @@ import com.sun.istack.internal.NotNull;
*
* @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
*/
public abstract class EnumOutline {
public abstract class EnumOutline implements CustomizableOutline {
/**
* This {@link EnumOutline} holds information about this {@link CEnumLeafInfo}.
@ -74,4 +75,14 @@ public abstract class EnumOutline {
this.target = target;
this.clazz = clazz;
}
@Override
public JDefinedClass getImplClass() {
return clazz;
}
@Override
public CCustomizable getTarget() {
return target;
}
}

View File

@ -1,5 +1,5 @@
#
# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@ -23,7 +23,7 @@
# questions.
#
build-id=2.2.11-b150127.1410
build-version=JAX-WS RI 2.2.11-b150127.1410
build-id=2.2.11-b150402.1412
build-version=JAX-WS RI 2.2.11-b150402.1412
major-version=2.2.11
svn-revision=28121d09ed8ac02b76788709ccb4cdb66e03bbfa
svn-revision=f923291dedcf386c5f408263984a99d7cedf0012

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,8 @@
package com.sun.tools.internal.ws.wsdl.document.soap;
import com.sun.xml.internal.ws.encoding.soap.streaming.SOAPNamespaceConstants;
import javax.xml.namespace.QName;
/**
@ -35,9 +37,7 @@ import javax.xml.namespace.QName;
public interface SOAPConstants {
// namespace URIs
public static final String URI_ENVELOPE =
"http://schemas.xmlsoap.org/soap/envelope/";
public static final String URI_ENVELOPE = SOAPNamespaceConstants.ENVELOPE;
public static final String NS_WSDL_SOAP =
"http://schemas.xmlsoap.org/wsdl/soap/";
public static final String NS_SOAP_ENCODING = "http://schemas.xmlsoap.org/soap/encoding/";

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -78,7 +78,7 @@ public class Internalizer {
private static final ContextClassloaderLocal<XPathFactory> xpf = new ContextClassloaderLocal<XPathFactory>() {
@Override
protected XPathFactory initialValue() throws Exception {
return XPathFactory.newInstance();
return XmlUtil.newXPathFactory(true);
}
};
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,10 +25,10 @@
package com.sun.tools.internal.ws.wsdl.parser;
import com.sun.tools.internal.ws.util.xml.XmlUtil;
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtensible;
import com.sun.tools.internal.ws.api.wsdl.TWSDLExtension;
import com.sun.tools.internal.ws.api.wsdl.TWSDLParserContext;
import com.sun.tools.internal.ws.util.xml.XmlUtil;
import com.sun.tools.internal.ws.wsdl.document.*;
import com.sun.tools.internal.ws.wsdl.document.jaxws.CustomName;
import com.sun.tools.internal.ws.wsdl.document.jaxws.JAXWSBinding;
@ -57,7 +57,7 @@ public class JAXWSBindingExtensionHandler extends AbstractExtensionHandler {
private static final ContextClassloaderLocal<XPathFactory> xpf = new ContextClassloaderLocal<XPathFactory>() {
@Override
protected XPathFactory initialValue() throws Exception {
return XPathFactory.newInstance();
return XmlUtil.newXPathFactory(false);
}
};