castor
  1. castor
  2. CASTOR-3213

When i try to add the mapping file as input source to xmlContext it throw exception as org.castor.core.util.PropertiesException Properties value can not be converted to boolean: org.exolab.castor.xml.strictelements=false

    Details

    • Type: Task Task
    • Status: Resolved Resolved
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.3.1
    • Fix Version/s: 1.3.3
    • Component/s: Ant task
    • Labels:
      None
    • Environment:
      unix
    • Number of attachments :
      0

      Description

      URL mappingFile = new URL("http://secureweb.abc.com/common/req/ABCMapping/mapping.xml");

      // Load Mapping
      /* Mapping mapping = new Mapping();
      mapping.loadMapping(mappingFile);*/

      URLConnection con = mappingFile.openConnection();

      // Setting the doInput flag to true
      con.setDoInput(true);

      InputStream strmMapping = con.getInputStream();
      InputSource srcMapping = new InputSource(strmMapping);

      Mapping mapping = new Mapping();
      mapping.loadMapping(srcMapping);

      // initialize and configure XMLContext
      XMLContext context = new XMLContext();

      log.debug("the context"+context);
      context.addMapping(mapping);

      // Create a new Unmarshaller
      Unmarshaller unmarshaller = context.createUnmarshaller();
      unmarshaller.setClass(HotelShoppingResponse.class);
      unmarshaller.addNamespaceToPackageMapping("http://ws.orbitz.com/schemas/2008/Common", "com.travwell.TravelEngine.translator.orbitz.data.OrbitzHotelShopping.common");
      unmarshaller.addNamespaceToPackageMapping("http://ws.orbitz.com/schemas/2008/Hotel", "com.travwell.TravelEngine.translator.orbitz.data.OrbitzHotelShopping");
      unmarshaller.setValidation(false);
      // unmarshaller.setMapping(mapping);
      // unmarshaller.setProperty("org.exolab.castor.xml.strictelements",null);
      hotelShoppingResponse = (HotelShoppingResponse)unmarshaller.unmarshal(new StringReader(message));
      } catch (MarshalException e)

      { // TODO Auto-generated catch block e.printStackTrace(); } catch (ValidationException e) { // TODO Auto-generated catch block e.printStackTrace(); }

      catch (MalformedURLException e)

      { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }

      Can some plz help me with this.

      Thanks,
      Surendra

        Activity

        Hide
        Werner Guttmann added a comment -

        The uncommented

        unmarshaller.setProperty("org.exolab.castor.xml.strictelements",null);

        seems to indicate that you are trying to change this property. Now, it is actually commented out, but setting it to 'null' would definitely be wrong.

        Given that this code is commented, are you tryint to pass a custom property file to Castor and have you modified the properties included with Castor ?

        Show
        Werner Guttmann added a comment - The uncommented unmarshaller.setProperty("org.exolab.castor.xml.strictelements",null); seems to indicate that you are trying to change this property. Now, it is actually commented out, but setting it to 'null' would definitely be wrong. Given that this code is commented, are you tryint to pass a custom property file to Castor and have you modified the properties included with Castor ?
        Hide
        surendra added a comment -

        Thanks for quick replay.

        i do not have any custom property file and i did not modify any properties included in the castor.when i got that exception i tired to overwrite the property even than i am getting the same error.i tired to set that property to true,false and null in all the cases i got the same error.

        i really appreciate if you can help me with this.

        Thanks,
        Surendra

        Show
        surendra added a comment - Thanks for quick replay. i do not have any custom property file and i did not modify any properties included in the castor.when i got that exception i tired to overwrite the property even than i am getting the same error.i tired to set that property to true,false and null in all the cases i got the same error. i really appreciate if you can help me with this. Thanks, Surendra
        Hide
        surendra added a comment -

        plz find the complete exception trace when umarshalling using both static method and creating unmarshaller form the context i get the same exception.

        Static unmarshall method:

        org.castor.core.util.PropertiesException: Properties value can not be converted to boolean: org.exolab.castor.xml.strictelements=false
        at org.castor.core.util.AbstractProperties.getBoolean(AbstractProperties.java:393)
        at org.castor.xml.AbstractInternalContext.strictElements(AbstractInternalContext.java:650)
        at org.exolab.castor.xml.Unmarshaller.deriveProperties(Unmarshaller.java:975)
        at org.exolab.castor.xml.Unmarshaller.setInternalContext(Unmarshaller.java:964)
        at org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:256)
        at org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:223)
        at org.exolab.castor.xml.XMLContext.createUnmarshaller(XMLContext.java:180)
        at org.exolab.castor.xml.Unmarshaller.createUnmarshaller(Unmarshaller.java:852)
        at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:839)
        at com.travwell.TravelEngine.translator.farelogix.data.HotelSearchRS.HotelSearchRS.unmarshalHotelSearchRS(HotelSearchRS.java:1363)
        at com.travwell.TravelEngine.translator.hotel.FlxListHotelTx.parseResponse(FlxListHotelTx.java:342)
        at com.travwell.TravelEngine.facade.Sender.run(Sender.java:169)
        at java.lang.Thread.run(Thread.java:595)

        using unmarshall created form xmlContext:

        org.castor.core.util.PropertiesException: Properties value can not be converted to boolean: org.exolab.castor.xml.strictelements=false
        at org.castor.core.util.AbstractProperties.getBoolean(AbstractProperties.java:393)
        at org.castor.xml.AbstractInternalContext.strictElements(AbstractInternalContext.java:650)
        at org.exolab.castor.xml.Unmarshaller.deriveProperties(Unmarshaller.java:975)
        at org.exolab.castor.xml.Unmarshaller.setInternalContext(Unmarshaller.java:964)
        at org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:256)
        at org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:235)
        at org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:209)
        at org.castor.mapping.MappingUnmarshaller.loadMappingInternal(MappingUnmarshaller.java:239)
        at org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmarshaller.java:155)
        at org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmarshaller.java:130)
        at org.exolab.castor.xml.XMLContext.addMapping(XMLContext.java:82)
        at com.travwell.TravelEngine.translator.hotel.orbitz.OrbitzListHotelTx.parseResponse(OrbitzListHotelTx.java:128)
        at com.travwell.TravelEngine.facade.OrbitzFacade.send(OrbitzFacade.java:256)
        at com.travwell.TravelEngine.facade.OrbitzFacade.list(OrbitzFacade.java:189)
        at com.travwell.TravelEngine.facade.ParallelFacade$HotelListRunner.run(ParallelFacade.java:322)
        at java.lang.Thread.run(Thread.java:595)

        Thanks,
        Surendra

        Show
        surendra added a comment - plz find the complete exception trace when umarshalling using both static method and creating unmarshaller form the context i get the same exception. Static unmarshall method: org.castor.core.util.PropertiesException: Properties value can not be converted to boolean: org.exolab.castor.xml.strictelements=false at org.castor.core.util.AbstractProperties.getBoolean(AbstractProperties.java:393) at org.castor.xml.AbstractInternalContext.strictElements(AbstractInternalContext.java:650) at org.exolab.castor.xml.Unmarshaller.deriveProperties(Unmarshaller.java:975) at org.exolab.castor.xml.Unmarshaller.setInternalContext(Unmarshaller.java:964) at org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:256) at org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:223) at org.exolab.castor.xml.XMLContext.createUnmarshaller(XMLContext.java:180) at org.exolab.castor.xml.Unmarshaller.createUnmarshaller(Unmarshaller.java:852) at org.exolab.castor.xml.Unmarshaller.unmarshal(Unmarshaller.java:839) at com.travwell.TravelEngine.translator.farelogix.data.HotelSearchRS.HotelSearchRS.unmarshalHotelSearchRS(HotelSearchRS.java:1363) at com.travwell.TravelEngine.translator.hotel.FlxListHotelTx.parseResponse(FlxListHotelTx.java:342) at com.travwell.TravelEngine.facade.Sender.run(Sender.java:169) at java.lang.Thread.run(Thread.java:595) using unmarshall created form xmlContext: org.castor.core.util.PropertiesException: Properties value can not be converted to boolean: org.exolab.castor.xml.strictelements=false at org.castor.core.util.AbstractProperties.getBoolean(AbstractProperties.java:393) at org.castor.xml.AbstractInternalContext.strictElements(AbstractInternalContext.java:650) at org.exolab.castor.xml.Unmarshaller.deriveProperties(Unmarshaller.java:975) at org.exolab.castor.xml.Unmarshaller.setInternalContext(Unmarshaller.java:964) at org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:256) at org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:235) at org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:209) at org.castor.mapping.MappingUnmarshaller.loadMappingInternal(MappingUnmarshaller.java:239) at org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmarshaller.java:155) at org.castor.mapping.MappingUnmarshaller.getMappingLoader(MappingUnmarshaller.java:130) at org.exolab.castor.xml.XMLContext.addMapping(XMLContext.java:82) at com.travwell.TravelEngine.translator.hotel.orbitz.OrbitzListHotelTx.parseResponse(OrbitzListHotelTx.java:128) at com.travwell.TravelEngine.facade.OrbitzFacade.send(OrbitzFacade.java:256) at com.travwell.TravelEngine.facade.OrbitzFacade.list(OrbitzFacade.java:189) at com.travwell.TravelEngine.facade.ParallelFacade$HotelListRunner.run(ParallelFacade.java:322) at java.lang.Thread.run(Thread.java:595) Thanks, Surendra
        Hide
        surendra added a comment -

        Werner,

        your correct we have that property overwritten custom castor.properties but iam not sure why we cannot overwrite.

        any ways for i just commented and it works for me know.

        Thanks,
        Surendra

        Show
        surendra added a comment - Werner, your correct we have that property overwritten custom castor.properties but iam not sure why we cannot overwrite. any ways for i just commented and it works for me know. Thanks, Surendra
        Hide
        Werner Guttmann added a comment -

        Great. Though, by all means, you should be able to override that property. Can I see the value you used in your custom property file ?

        Show
        Werner Guttmann added a comment - Great. Though, by all means, you should be able to override that property. Can I see the value you used in your custom property file ?
        Hide
        surendra added a comment - - edited

        this what i have in the property file

        # $Id: castor.properties,v 1.4 2004/07/09 19:18:48 pbacon Exp $
        #
        
        # org.exolab.castor.indent
        # set this to true to pretty print the generated XML.
        # set it to false to conserve space and print XML on one line.
        #
        org.exolab.castor.indent=false
        
        # True if should produce verbose messages
        #
        org.exolab.castor.debug=false
        
        # This property allows one to specify the super class of *all*
        # generated classes
        #
        #org.exolab.castor.builder.superclass=com.xyz.BaseObject
        
        org.exolab.castor.xml.strictelements=false 
        
        Show
        surendra added a comment - - edited this what i have in the property file # $Id: castor.properties,v 1.4 2004/07/09 19:18:48 pbacon Exp $ # # org.exolab.castor.indent # set this to true to pretty print the generated XML. # set it to false to conserve space and print XML on one line. # org.exolab.castor.indent= false # True if should produce verbose messages # org.exolab.castor.debug= false # This property allows one to specify the super class of *all* # generated classes # #org.exolab.castor.builder.superclass=com.xyz.BaseObject org.exolab.castor.xml.strictelements= false

          People

          • Assignee:
            Werner Guttmann
            Reporter:
            surendra
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: