changeset 31109 | a542f8dcbbf8 |
parent 29839 | 6d5d546e953b |
child 31501 | 1b48499c9e1c |
31008:5b500c93ce48 | 31109:a542f8dcbbf8 |
---|---|
43 * <p>A client application normally obtains new instances of this class using |
43 * <p>A client application normally obtains new instances of this class using |
44 * one of these two styles for newInstance methods, although there are other |
44 * one of these two styles for newInstance methods, although there are other |
45 * specialized forms of the method available: |
45 * specialized forms of the method available: |
46 * |
46 * |
47 * <ul> |
47 * <ul> |
48 * <li>{@link #newInstance(String,ClassLoader) JAXBContext.newInstance( "com.acme.foo:com.acme.bar" )} <br> |
48 * <li>{@link #newInstance(String, ClassLoader) JAXBContext.newInstance( "com.acme.foo:com.acme.bar" )} <br> |
49 * The JAXBContext instance is initialized from a list of colon |
49 * The JAXBContext instance is initialized from a list of colon |
50 * separated Java package names. Each java package contains |
50 * separated Java package names. Each java package contains |
51 * JAXB mapped classes, schema-derived classes and/or user annotated |
51 * JAXB mapped classes, schema-derived classes and/or user annotated |
52 * classes. Additionally, the java package may contain JAXB package annotations |
52 * classes. Additionally, the java package may contain JAXB package annotations |
53 * that must be processed. (see JLS, Section 7.4.1 "Named Packages"). |
53 * that must be processed. (see JLS, Section 7.4.1 "Named Packages"). |
54 * </li> |
54 * </li> |
55 * <li>{@link #newInstance(Class...) JAXBContext.newInstance( com.acme.foo.Foo.class )} <br> |
55 * <li>{@link #newInstance(Class...) JAXBContext.newInstance( com.acme.foo.Foo.class )} <br> |
56 * The JAXBContext instance is initialized with class(es) |
56 * The JAXBContext instance is initialized with class(es) |
57 * passed as parameter(s) and classes that are statically reachable from |
57 * passed as parameter(s) and classes that are statically reachable from |
58 * these class(es). See {@link #newInstance(Class...)} for details. |
58 * these class(es). See {@link #newInstance(Class...)} for details. |
59 * </li> |
59 * </li> |
60 * </ul> |
60 * </ul> |
61 * |
|
62 * <p> |
|
63 * <i><B>SPEC REQUIREMENT:</B> the provider must supply an implementation |
|
64 * class containing the following method signatures:</i> |
|
65 * |
|
66 * <pre>{@code |
|
67 * public static JAXBContext createContext( String contextPath, ClassLoader classLoader, Map<String,Object> properties ) throws JAXBException |
|
68 * public static JAXBContext createContext( Class[] classes, Map<String,Object> properties ) throws JAXBException |
|
69 * }</pre> |
|
70 * |
61 * |
71 * <p><i> |
62 * <p><i> |
72 * The following JAXB 1.0 requirement is only required for schema to |
63 * The following JAXB 1.0 requirement is only required for schema to |
73 * java interface/implementation binding. It does not apply to JAXB annotated |
64 * java interface/implementation binding. It does not apply to JAXB annotated |
74 * classes. JAXB Providers must generate a <tt>jaxb.properties</tt> file in |
65 * classes. JAXB Providers must generate a <tt>jaxb.properties</tt> file in |
107 * context should be namespace independent. This means that a client |
98 * context should be namespace independent. This means that a client |
108 * application is able to unmarshal XML documents that are instances of |
99 * application is able to unmarshal XML documents that are instances of |
109 * any of the schemas listed in the <tt>contextPath</tt>. For example: |
100 * any of the schemas listed in the <tt>contextPath</tt>. For example: |
110 * |
101 * |
111 * <pre> |
102 * <pre> |
112 * JAXBContext jc = JAXBContext.newInstance( "com.acme.foo:com.acme.bar" ); |
103 * JAXBContext jc = JAXBContext.newInstance( "com.acme.foo:com.acme.bar" ); |
113 * Unmarshaller u = jc.createUnmarshaller(); |
104 * Unmarshaller u = jc.createUnmarshaller(); |
114 * FooObject fooObj = (FooObject)u.unmarshal( new File( "foo.xml" ) ); // ok |
105 * FooObject fooObj = (FooObject)u.unmarshal( new File( "foo.xml" ) ); // ok |
115 * BarObject barObj = (BarObject)u.unmarshal( new File( "bar.xml" ) ); // ok |
106 * BarObject barObj = (BarObject)u.unmarshal( new File( "bar.xml" ) ); // ok |
116 * BazObject bazObj = (BazObject)u.unmarshal( new File( "baz.xml" ) ); // error, "com.acme.baz" not in contextPath |
107 * BazObject bazObj = (BazObject)u.unmarshal( new File( "baz.xml" ) ); // error, "com.acme.baz" not in contextPath |
117 * </pre> |
108 * </pre> |
118 * |
109 * |
119 * <p> |
110 * <p> |
120 * The client application may also generate Java content trees explicitly rather |
111 * The client application may also generate Java content trees explicitly rather |
121 * than unmarshalling existing XML data. For all JAXB-annotated value classes, |
112 * than unmarshalling existing XML data. For all JAXB-annotated value classes, |
144 * <p> |
135 * <p> |
145 * For more information on the generated <tt>ObjectFactory</tt> classes, see |
136 * For more information on the generated <tt>ObjectFactory</tt> classes, see |
146 * Section 4.2 <i>Java Package</i> of the specification. |
137 * Section 4.2 <i>Java Package</i> of the specification. |
147 * |
138 * |
148 * <p> |
139 * <p> |
149 * <i><B>SPEC REQUIREMENT:</B> the provider must generate a class in each |
140 * <i>The provider must generate a class in each |
150 * package that contains all of the necessary object factory methods for that |
141 * package that contains all of the necessary object factory methods for that |
151 * package named ObjectFactory as well as the static |
142 * package named ObjectFactory as well as the static |
152 * <tt>newInstance( javaContentInterface )</tt> method</i> |
143 * <tt>newInstance( javaContentInterface )</tt> method</i> |
153 * |
144 * |
154 * <h3>Marshalling</h3> |
145 * <h3>Marshalling</h3> |
212 * <p> |
203 * <p> |
213 * When one of the <tt>newInstance</tt> methods is called, a JAXB implementation is discovered |
204 * When one of the <tt>newInstance</tt> methods is called, a JAXB implementation is discovered |
214 * by the following steps. |
205 * by the following steps. |
215 * |
206 * |
216 * <ol> |
207 * <ol> |
208 * |
|
217 * <li> |
209 * <li> |
218 * For each package/class explicitly passed in to the {@link #newInstance} method, in the order they are specified, |
210 * For each package/class explicitly passed in to the {@link #newInstance} method, in the order they are specified, |
219 * <tt>jaxb.properties</tt> file is looked up in its package, by using the associated classloader — |
211 * <tt>jaxb.properties</tt> file is looked up in its package, by using the associated classloader — |
220 * this is {@link Class#getClassLoader() the owner class loader} for a {@link Class} argument, and for a package |
212 * this is {@link Class#getClassLoader() the owner class loader} for a {@link Class} argument, and for a package |
221 * the specified {@link ClassLoader}. |
213 * the specified {@link ClassLoader}. |
222 * |
214 * |
223 * <p> |
215 * <p> |
224 * If such a file is discovered, it is {@link Properties#load(InputStream) loaded} as a property file, and |
216 * If such a file is discovered, it is {@link Properties#load(InputStream) loaded} as a property file, and |
225 * the value of the {@link #JAXB_CONTEXT_FACTORY} key will be assumed to be the provider factory class. |
217 * the value of the {@link #JAXB_CONTEXT_FACTORY} key will be assumed to be the provider factory class. |
226 * This class is then loaded by the associated classloader discussed above. |
218 * This class is then loaded by the associated class loader discussed above. |
227 * |
219 * |
228 * <p> |
220 * <p> |
229 * This phase of the look up allows some packages to force the use of a certain JAXB implementation. |
221 * This phase of the look up allows some packages to force the use of a certain JAXB implementation. |
230 * (For example, perhaps the schema compiler has generated some vendor extension in the code.) |
222 * (For example, perhaps the schema compiler has generated some vendor extension in the code.) |
231 * |
223 * |
232 * <li> |
224 * <li> |
233 * If the system property {@link #JAXB_CONTEXT_FACTORY} exists, then its value is assumed to be the provider |
225 * If the system property {@link #JAXB_CONTEXT_FACTORY} exists, then its value is assumed to be the provider |
234 * factory class. This phase of the look up enables per-JVM override of the JAXB implementation. |
226 * factory class. This phase of the look up enables per-JVM override of the JAXB implementation. |
235 * |
227 * |
236 * <li> |
228 * <li> |
237 * Look for <tt>/META-INF/services/javax.xml.bind.JAXBContext</tt> file in the associated classloader. |
229 * Provider of {@link javax.xml.bind.JAXBContextFactory} is loaded using the service-provider loading |
238 * This file follows the standard service descriptor convention, and if such a file exists, its content |
230 * facilities, defined by the {@link java.util.ServiceLoader} class, to attempt |
239 * is assumed to be the provider factory class. This phase of the look up is for automatic discovery. |
231 * to locate and load an implementation of the service using the {@linkplain |
240 * It allows users to just put a JAXB implementation in a classpath and use it without any furhter configuration. |
232 * java.util.ServiceLoader#load(java.lang.Class) default loading mechanism}: the service-provider loading facility |
233 * will use the {@linkplain java.lang.Thread#getContextClassLoader() current thread's context class loader} |
|
234 * to attempt to load the context factory. If the context class loader is null, the |
|
235 * {@linkplain ClassLoader#getSystemClassLoader() system class loader} will be used. |
|
236 * <br> |
|
237 * In case of {@link java.util.ServiceConfigurationError service |
|
238 * configuration error} a {@link javax.xml.bind.JAXBException} will be thrown. |
|
239 * </li> |
|
240 * |
|
241 * <li> |
|
242 * Look for resource {@code /META-INF/services/javax.xml.bind.JAXBContext} using provided class loader. |
|
243 * Methods without class loader parameter use {@code Thread.currentThread().getContextClassLoader()}. |
|
244 * If such a resource exists, its content is assumed to be the provider factory class and must supply |
|
245 * an implementation class containing the following method signatures: |
|
246 * |
|
247 * <pre> |
|
248 * |
|
249 * public static JAXBContext createContext( |
|
250 * String contextPath, |
|
251 * ClassLoader classLoader, |
|
252 * Map<String,Object> properties throws JAXBException |
|
253 * |
|
254 * public static JAXBContext createContext( |
|
255 * Class[] classes, |
|
256 * Map<String,Object> properties ) throws JAXBException |
|
257 * </pre> |
|
258 * This configuration method is deprecated. |
|
241 * |
259 * |
242 * <li> |
260 * <li> |
243 * Finally, if all the steps above fail, then the rest of the look up is unspecified. That said, |
261 * Finally, if all the steps above fail, then the rest of the look up is unspecified. That said, |
244 * the recommended behavior is to simply look for some hard-coded platform default JAXB implementation. |
262 * the recommended behavior is to simply look for some hard-coded platform default JAXB implementation. |
245 * This phase of the look up is so that JavaSE can have its own JAXB implementation as the last resort. |
263 * This phase of the look up is so that JavaSE can have its own JAXB implementation as the last resort. |
246 * </ol> |
264 * </ol> |
247 * |
265 * |
248 * <p> |
266 * <p> |
249 * Once the provider factory class is discovered, its |
267 * Once the provider factory class {@link javax.xml.bind.JAXBContextFactory} is discovered, one of its methods |
250 * <tt>public static JAXBContext createContext(String,ClassLoader,Map)</tt> method |
268 * {@link javax.xml.bind.JAXBContextFactory#createContext(String, ClassLoader, java.util.Map)} or |
251 * (see {@link #newInstance(String, ClassLoader, Map)} for the parameter semantics.) |
269 * {@link javax.xml.bind.JAXBContextFactory#createContext(Class[], java.util.Map)} is invoked |
252 * or <tt>public static JAXBContext createContet(Class[],Map)</tt> method |
|
253 * (see {@link #newInstance(Class[], Map)} for the parameter semantics) are invoked |
|
254 * to create a {@link JAXBContext}. |
270 * to create a {@link JAXBContext}. |
255 * |
271 * |
256 * @author <ul><li>Ryan Shoemaker, Sun Microsystems, Inc.</li><li>Kohsuke Kawaguchi, Sun Microsystems, Inc.</li><li>Joe Fialli, Sun Microsystems, Inc.</li></ul> |
272 * <p/> |
273 * |
|
274 * @apiNote |
|
275 * <p>Service discovery method using file /META-INF/services/javax.xml.bind.JAXBContext (described in step 4) |
|
276 * and leveraging provider's static methods is supported only to allow backwards compatibility, but it is strongly |
|
277 * recommended to migrate to standard ServiceLoader mechanism (described in step 3). |
|
278 * |
|
279 * @implNote |
|
280 * Within the last step, if Glassfish AS environment detected, its specific service loader is used to find factory class. |
|
281 * |
|
282 * @author <ul><li>Ryan Shoemaker, Sun Microsystems, Inc.</li> |
|
283 * <li>Kohsuke Kawaguchi, Sun Microsystems, Inc.</li> |
|
284 * <li>Joe Fialli, Sun Microsystems, Inc.</li></ul> |
|
285 * |
|
257 * @see Marshaller |
286 * @see Marshaller |
258 * @see Unmarshaller |
287 * @see Unmarshaller |
259 * @see <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-7.html#jls-7.4.1">S 7.4.1 "Named Packages" in Java Language Specification</a> |
288 * @see <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-7.html#jls-7.4.1">S 7.4.1 "Named Packages" |
289 * in Java Language Specification</a> |
|
290 * |
|
260 * @since 1.6, JAXB 1.0 |
291 * @since 1.6, JAXB 1.0 |
261 */ |
292 */ |
262 public abstract class JAXBContext { |
293 public abstract class JAXBContext { |
263 |
294 |
264 /** |
295 /** |
265 * The name of the property that contains the name of the class capable |
296 * The name of the property that contains the name of the class capable |
266 * of creating new <tt>JAXBContext</tt> objects. |
297 * of creating new <tt>JAXBContext</tt> objects. |
267 */ |
298 */ |
268 public static final String JAXB_CONTEXT_FACTORY = |
299 public static final String JAXB_CONTEXT_FACTORY = "javax.xml.bind.JAXBContextFactory"; |
269 "javax.xml.bind.context.factory"; |
|
270 |
|
271 |
300 |
272 protected JAXBContext() { |
301 protected JAXBContext() { |
273 } |
302 } |
274 |
303 |
275 |
304 |
276 /** |
305 /** |
277 * <p> |
306 * <p> |
278 * Obtain a new instance of a <tt>JAXBContext</tt> class. |
307 * Create a new instance of a <tt>JAXBContext</tt> class. |
279 * |
308 * |
280 * <p> |
309 * <p> |
281 * This is a convenience method to invoke the |
310 * This is a convenience method to invoke the |
282 * {@link #newInstance(String,ClassLoader)} method with |
311 * {@link #newInstance(String,ClassLoader)} method with |
283 * the context class loader of the current thread. |
312 * the context class loader of the current thread. |
298 return newInstance( contextPath, getContextClassLoader()); |
327 return newInstance( contextPath, getContextClassLoader()); |
299 } |
328 } |
300 |
329 |
301 /** |
330 /** |
302 * <p> |
331 * <p> |
303 * Obtain a new instance of a <tt>JAXBContext</tt> class. |
332 * Create a new instance of a <tt>JAXBContext</tt> class. |
304 * |
333 * |
305 * <p> |
334 * <p> |
306 * The client application must supply a context path which is a list of |
335 * The client application must supply a context path which is a list of |
307 * colon (':', \u005Cu003A) separated java package names that contain |
336 * colon (':', \u005Cu003A) separated java package names that contain |
308 * schema-derived classes and/or fully qualified JAXB-annotated classes. |
337 * schema-derived classes and/or fully qualified JAXB-annotated classes. |
394 return newInstance(contextPath,classLoader,Collections.<String,Object>emptyMap()); |
423 return newInstance(contextPath,classLoader,Collections.<String,Object>emptyMap()); |
395 } |
424 } |
396 |
425 |
397 /** |
426 /** |
398 * <p> |
427 * <p> |
399 * Obtain a new instance of a <tt>JAXBContext</tt> class. |
428 * Create a new instance of a <tt>JAXBContext</tt> class. |
400 * |
429 * |
401 * <p> |
430 * <p> |
402 * This is mostly the same as {@link JAXBContext#newInstance(String, ClassLoader)}, |
431 * This is mostly the same as {@link JAXBContext#newInstance(String, ClassLoader)}, |
403 * but this version allows you to pass in provider-specific properties to configure |
432 * but this version allows you to pass in provider-specific properties to configure |
404 * the instantiation of {@link JAXBContext}. |
433 * the instantiation of {@link JAXBContext}. |
423 * <li>failure to locate a value for the context factory provider property</li> |
452 * <li>failure to locate a value for the context factory provider property</li> |
424 * <li>mixing schema derived packages from different providers on the same contextPath</li> |
453 * <li>mixing schema derived packages from different providers on the same contextPath</li> |
425 * </ol> |
454 * </ol> |
426 * @since 1.6, JAXB 2.0 |
455 * @since 1.6, JAXB 2.0 |
427 */ |
456 */ |
428 public static JAXBContext newInstance( String contextPath, ClassLoader classLoader, Map<String,?> properties ) |
457 public static JAXBContext newInstance( String contextPath, |
429 throws JAXBException { |
458 ClassLoader classLoader, |
459 Map<String,?> properties ) throws JAXBException { |
|
430 |
460 |
431 return ContextFinder.find( |
461 return ContextFinder.find( |
432 /* The default property name according to the JAXB spec */ |
462 /* The default property name according to the JAXB spec */ |
433 JAXB_CONTEXT_FACTORY, |
463 JAXB_CONTEXT_FACTORY, |
434 |
464 |
441 } |
471 } |
442 |
472 |
443 // TODO: resurrect this once we introduce external annotations |
473 // TODO: resurrect this once we introduce external annotations |
444 // /** |
474 // /** |
445 // * <p> |
475 // * <p> |
446 // * Obtain a new instance of a <tt>JAXBContext</tt> class. |
476 // * Create a new instance of a <tt>JAXBContext</tt> class. |
447 // * |
477 // * |
448 // * <p> |
478 // * <p> |
449 // * The client application must supply a list of classes that the new |
479 // * The client application must supply a list of classes that the new |
450 // * context object needs to recognize. |
480 // * context object needs to recognize. |
451 // * |
481 // * |
477 // * list of java classes to be recognized by the new {@link JAXBContext}. |
507 // * list of java classes to be recognized by the new {@link JAXBContext}. |
478 // * Can be empty, in which case a {@link JAXBContext} that only knows about |
508 // * Can be empty, in which case a {@link JAXBContext} that only knows about |
479 // * spec-defined classes will be returned. |
509 // * spec-defined classes will be returned. |
480 // * |
510 // * |
481 // * @return |
511 // * @return |
482 // * A new instance of a <tt>JAXBContext</tt>. Always non-null valid object. |
512 // * A new instance of a <tt>JAXBContext</tt>. |
483 // * |
513 // * |
484 // * @throws JAXBException |
514 // * @throws JAXBException |
485 // * if an error was encountered while creating the |
515 // * if an error was encountered while creating the |
486 // * <tt>JAXBContext</tt>, such as (but not limited to): |
516 // * <tt>JAXBContext</tt>, such as (but not limited to): |
487 // * <ol> |
517 // * <ol> |
515 // return ContextFinder.find(externalBindings,classesToBeBound); |
545 // return ContextFinder.find(externalBindings,classesToBeBound); |
516 // } |
546 // } |
517 |
547 |
518 /** |
548 /** |
519 * <p> |
549 * <p> |
520 * Obtain a new instance of a <tt>JAXBContext</tt> class. |
550 * Create a new instance of a <tt>JAXBContext</tt> class. |
521 * |
551 * |
522 * <p> |
552 * <p> |
523 * The client application must supply a list of classes that the new |
553 * The client application must supply a list of classes that the new |
524 * context object needs to recognize. |
554 * context object needs to recognize. |
525 * |
555 * |
557 * list of java classes to be recognized by the new {@link JAXBContext}. |
587 * list of java classes to be recognized by the new {@link JAXBContext}. |
558 * Can be empty, in which case a {@link JAXBContext} that only knows about |
588 * Can be empty, in which case a {@link JAXBContext} that only knows about |
559 * spec-defined classes will be returned. |
589 * spec-defined classes will be returned. |
560 * |
590 * |
561 * @return |
591 * @return |
562 * A new instance of a <tt>JAXBContext</tt>. Always non-null valid object. |
592 * A new instance of a <tt>JAXBContext</tt>. |
563 * |
593 * |
564 * @throws JAXBException |
594 * @throws JAXBException |
565 * if an error was encountered while creating the |
595 * if an error was encountered while creating the |
566 * <tt>JAXBContext</tt>, such as (but not limited to): |
596 * <tt>JAXBContext</tt>, such as (but not limited to): |
567 * <ol> |
597 * <ol> |
576 * @throws IllegalArgumentException |
606 * @throws IllegalArgumentException |
577 * if the parameter contains {@code null} (i.e., {@code newInstance(null);}) |
607 * if the parameter contains {@code null} (i.e., {@code newInstance(null);}) |
578 * |
608 * |
579 * @since 1.6, JAXB 2.0 |
609 * @since 1.6, JAXB 2.0 |
580 */ |
610 */ |
581 public static JAXBContext newInstance( Class... classesToBeBound ) |
611 public static JAXBContext newInstance( Class<?> ... classesToBeBound ) |
582 throws JAXBException { |
612 throws JAXBException { |
583 |
613 |
584 return newInstance(classesToBeBound,Collections.<String,Object>emptyMap()); |
614 return newInstance(classesToBeBound,Collections.<String,Object>emptyMap()); |
585 } |
615 } |
586 |
616 |
587 /** |
617 /** |
588 * <p> |
618 * <p> |
589 * Obtain a new instance of a <tt>JAXBContext</tt> class. |
619 * Create a new instance of a <tt>JAXBContext</tt> class. |
590 * |
620 * |
591 * <p> |
621 * <p> |
592 * An overloading of {@link JAXBContext#newInstance(Class...)} |
622 * An overloading of {@link JAXBContext#newInstance(Class...)} |
593 * to configure 'properties' for this instantiation of {@link JAXBContext}. |
623 * to configure 'properties' for this instantiation of {@link JAXBContext}. |
594 * |
624 * |
603 * @param properties |
633 * @param properties |
604 * provider-specific properties. Can be null, which means the same thing as passing |
634 * provider-specific properties. Can be null, which means the same thing as passing |
605 * in an empty map. |
635 * in an empty map. |
606 * |
636 * |
607 * @return |
637 * @return |
608 * A new instance of a <tt>JAXBContext</tt>. Always non-null valid object. |
638 * A new instance of a <tt>JAXBContext</tt>. |
609 * |
639 * |
610 * @throws JAXBException |
640 * @throws JAXBException |
611 * if an error was encountered while creating the |
641 * if an error was encountered while creating the |
612 * <tt>JAXBContext</tt>, such as (but not limited to): |
642 * <tt>JAXBContext</tt>, such as (but not limited to): |
613 * <ol> |
643 * <ol> |
622 * @throws IllegalArgumentException |
652 * @throws IllegalArgumentException |
623 * if the parameter contains {@code null} (i.e., {@code newInstance(null,someMap);}) |
653 * if the parameter contains {@code null} (i.e., {@code newInstance(null,someMap);}) |
624 * |
654 * |
625 * @since 1.6, JAXB 2.0 |
655 * @since 1.6, JAXB 2.0 |
626 */ |
656 */ |
627 public static JAXBContext newInstance( Class[] classesToBeBound, Map<String,?> properties ) |
657 public static JAXBContext newInstance( Class<?>[] classesToBeBound, Map<String,?> properties ) |
628 throws JAXBException { |
658 throws JAXBException { |
629 |
659 |
630 if (classesToBeBound == null) { |
660 if (classesToBeBound == null) { |
631 throw new IllegalArgumentException(); |
661 throw new IllegalArgumentException(); |
632 } |
662 } |
754 |
784 |
755 private static ClassLoader getContextClassLoader() { |
785 private static ClassLoader getContextClassLoader() { |
756 if (System.getSecurityManager() == null) { |
786 if (System.getSecurityManager() == null) { |
757 return Thread.currentThread().getContextClassLoader(); |
787 return Thread.currentThread().getContextClassLoader(); |
758 } else { |
788 } else { |
759 return (ClassLoader) java.security.AccessController.doPrivileged( |
789 return java.security.AccessController.doPrivileged( |
760 new java.security.PrivilegedAction() { |
790 new java.security.PrivilegedAction<ClassLoader>() { |
761 public java.lang.Object run() { |
791 public ClassLoader run() { |
762 return Thread.currentThread().getContextClassLoader(); |
792 return Thread.currentThread().getContextClassLoader(); |
763 } |
793 } |
764 }); |
794 }); |
765 } |
795 } |
766 } |
796 } |