CVS Update: xmlpull-api-v1/src/java/api/org/xmlpull/v1

Aleksander Andrzej Slominski <[email protected]>
Newsgroups gmane.text.xml.xmlpull.devel
Message-ID <[email protected]>
aslom       02/07/15 13:02:49

  Modified:    src/java/api/org/xmlpull/v1 XmlPullParserFactory.java
  Log:
  fixed bug in XmlPullParserFactory that prevented it from
  creating XmlSerializer instances that class names were obtained
  from class resource (or system property)
  
  Revision  Changes    Path
  1.15      +17 -11    xmlpull-api-v1/src/java/api/org/xmlpull/v1/XmlPullParserFactory.java
  
  Index: XmlPullParserFactory.java
  ===================================================================
  RCS file: /l/extreme/cvspub/xmlpull-api-v1/src/java/api/org/xmlpull/v1/XmlPullParserFactory.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -b -t -w -r1.14 -r1.15
  --- XmlPullParserFactory.java	2002/07/08 17:31:09	1.14
  +++ XmlPullParserFactory.java	2002/07/15 18:02:49	1.15
  @@ -161,6 +161,9 @@
   
       public XmlPullParser newPullParser() throws XmlPullParserException {
   
  +        if (parserClasses == null) throw new XmlPullParserException
  +                ("Factory initialization was incomplete - has not tried "+classNamesLocation);
  +
           if (parserClasses.size() == 0) throw new XmlPullParserException
                   ("No valid parser classes found in "+classNamesLocation);
   
  @@ -203,6 +206,8 @@
   
       public XmlSerializer newSerializer() throws XmlPullParserException {
   
  +        if (serializerClasses == null) throw new XmlPullParserException
  +                ("Factory initialization incomplete - has not tried "+classNamesLocation);
           if (serializerClasses.size() == 0) throw new XmlPullParserException
                   ("No valid serializer classes found in "+classNamesLocation);
   
  @@ -302,15 +307,15 @@
   
               if (candidate != null) {
                   boolean recognized = false;
  -                if (instance instanceof XmlPullParser) {
  +                if (XmlPullParser.class.isAssignableFrom(candidate) ) {
                       parserClasses.addElement (candidate);
                       recognized = true;
                   }
  -                if (instance instanceof XmlSerializer) {
  +                if (XmlSerializer.class.isAssignableFrom(candidate)) {
                       serializerClasses.addElement (candidate);
                       recognized = true;
                   }
  -                if (instance instanceof XmlPullParserFactory) {
  +                if (XmlPullParserFactory.class.isAssignableFrom(candidate)) {
                       if (factory == null) {
                           factory = (XmlPullParserFactory) instance;
                       }
  @@ -325,6 +330,7 @@
   
           if (factory == null) factory = new XmlPullParserFactory ();
           factory.parserClasses = parserClasses;
  +        factory.serializerClasses = serializerClasses;
           factory.classNamesLocation = classNamesLocation;
           return factory;
       }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.