commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject cvs commit: jakarta-commons/betwixt/src/java/org/apache/commons/betwixt XMLIntrospector.java
Date Tue, 02 Jul 2002 16:35:42 GMT
mvdb        2002/07/02 09:35:42

  Modified:    betwixt/src/java/org/apache/commons/betwixt
                        XMLIntrospector.java
  Log:
  Sun provides a default BeanInfoComponent in one of their sun packages, which prohibits betwixt
from doing his work correctly when a component tag is used. 
  This is a real nasty one and I don't know if it has any consequences for swing programs,
since the searchpath is temporarily cleared via the java.bean.Introspector.
  I restore the values after betwixt is finished processing the xml file.
  Since the Introspector is static, I couldn't find any other solution to get this solved.
  Appreciate feedback on this.
  
  Revision  Changes    Path
  1.6       +14 -1     jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/XMLIntrospector.java
  
  Index: XMLIntrospector.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/betwixt/src/java/org/apache/commons/betwixt/XMLIntrospector.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XMLIntrospector.java	2 Jul 2002 11:24:49 -0000	1.5
  +++ XMLIntrospector.java	2 Jul 2002 16:35:42 -0000	1.6
  @@ -91,7 +91,14 @@
     * This means that the first time that a request is made for a <code>XMLBeanInfo</code>
     * for a particular class, the <code>XMLBeanInfo</code> is cached.
     * Later requests for the same class will return the cached value.</p>
  -  *
  +  * 
  +  * <p>Note :</p>
  +  * <p>This class makes use of the <code>java.bean.Introspector</code>
  +  * class, which comtains a BeanInfoSearchPath. To make sure betwixt can
  +  * do his work correctly, this searchpath is completely ignored during 
  +  * processing. The original values will be restored after processing finished
  +  * </p>
  +  * 
     * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
     * @author <a href="mailto:martin@mvdb.net">Martin van den Bemt</a>
     * @version $Id$
  @@ -186,6 +193,10 @@
           associated with the bean.        
         */
       public XMLBeanInfo introspect(Class aClass) throws IntrospectionException {
  +        // we first reset the beaninfo searchpath.
  +        String[] searchPath = Introspector.getBeanInfoSearchPath();
  +        Introspector.setBeanInfoSearchPath(new String[] { });
  +        
           XMLBeanInfo xmlInfo = null;
           if ( cachingEnabled ) {
               // if caching is enabled, try in caching first
  @@ -213,6 +224,8 @@
           if (log.isTraceEnabled()) {
               log.trace(xmlInfo);
           }
  +        // we restore the beaninfo searchpath.
  +        Introspector.setBeanInfoSearchPath(searchPath);
           
           return xmlInfo;
       }
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message