Loading ...
Sorry, an error occurred while loading the content.

I have met a error of "NullPointerexception" when i use manager tool

Expand Messages
  • leepf7211
    Hello,everbody I have met a error of NullPointerexception when i use manager tool ,and i have capture the error position in source code is as follow: public
    Message 1 of 2 , Nov 4, 2007
    View Source
    • 0 Attachment
      Hello,everbody
      I have met a error of "NullPointerexception" when i use manager tool
      ,and i have capture the error position in source code is as follow:
      public XMLDBMSMap createMapFromDTD(Properties dbProps, Properties
      configProps, String dtdFilename)
      throws XMLMiddlewareException, SQLException
      {
      DBInfo dbInfo;
      Connection conn;
      MapFactory_DTD factory;
      String order, databaseName, catalogName, schemaName;
      Hashtable namespaceURIs;

      if (dbProps == null) dbProps = emptyProps;
      if (configProps == null) configProps = emptyProps;
      // Create a new map factory.

      factory = new MapFactory_DTD();
      // Set the database properties, if any.

      dbInfo = getDBInfo(dbProps, false);
      if (dbInfo != null)
      {
      conn = dbInfo.dataSource.getConnection(dbInfo.user,
      dbInfo.password);
      factory.setConnection(conn);
      }

      // Set the order options, if any.

      order = configProps.getProperty(XMLDBMSProps.ORDERTYPE);

      if (order != null)
      {
      if (order.equals(XMLDBMSProps.FIXED))
      {
      System.out.println("I am here1");
      //when i put the statement at here,the error is occur and "I am here"
      do not come out¡£my version of jdk is 1.5.0_08
      factory.setOrderType(MapFactory_DTD.ORDER_FIXED);

      }
      else if (order.equals(XMLDBMSProps.NONE))
      {
      factory.setOrderType(MapFactory_DTD.ORDER_NONE);
      }
      else if (order.equals(XMLDBMSProps.COLUMNS))
      {
      factory.setOrderType(MapFactory_DTD.ORDER_COLUMNS);
      }
      else
      throw new IllegalArgumentException("Invalid value of " +
      XMLDBMSProps.ORDERTYPE + " property: " + order);
      }
      ......
    • rpbourret@rpbourret.com
      Hello, Sorry I haven t replied sooner. The statement does not print because you have not reached that section of the code. You did not supply a value for the
      Message 2 of 2 , Nov 6, 2007
      View Source
      • 0 Attachment
        Hello,

        Sorry I haven't replied sooner.

        The statement does not print because you have not reached that section of the
        code. You did not supply a value for the ORDERTYPE property, so order is null.
        Therefore, the code does not enter the if statement.

        Can you continue to test later in the method and see if you can find where the
        NullPointerException is occurring?

        Thank you for your patience.

        -- Ron

        leepf7211 wrote:

        > Hello,everbody
        > I have met a error of "NullPointerexception" when i use manager tool
        > ,and i have capture the error position in source code is as follow:
        > public XMLDBMSMap createMapFromDTD(Properties dbProps, Properties
        > configProps, String dtdFilename)
        > throws XMLMiddlewareException, SQLException
        > {
        > DBInfo dbInfo;
        > Connection conn;
        > MapFactory_DTD factory;
        > String order, databaseName, catalogName, schemaName;
        > Hashtable namespaceURIs;
        >
        > if (dbProps == null) dbProps = emptyProps;
        > if (configProps == null) configProps = emptyProps;
        > // Create a new map factory.
        >
        > factory = new MapFactory_DTD();
        > // Set the database properties, if any.
        >
        > dbInfo = getDBInfo(dbProps, false);
        > if (dbInfo != null)
        > {
        > conn = dbInfo.dataSource.getConnection(dbInfo.user,
        > dbInfo.password);
        > factory.setConnection(conn);
        > }
        >
        > // Set the order options, if any.
        >
        > order = configProps.getProperty(XMLDBMSProps.ORDERTYPE);
        >
        > if (order != null)
        > {
        > if (order.equals(XMLDBMSProps.FIXED))
        > {
        > System.out.println("I am here1");
        > //when i put the statement at here,the error is occur and "I am here"
        > do not come out¡£my version of jdk is 1.5.0_08
        > factory.setOrderType(MapFactory_DTD.ORDER_FIXED);
        >
        > }
        > else if (order.equals(XMLDBMSProps.NONE))
        > {
        > factory.setOrderType(MapFactory_DTD.ORDER_NONE);
        > }
        > else if (order.equals(XMLDBMSProps.COLUMNS))
        > {
        > factory.setOrderType(MapFactory_DTD.ORDER_COLUMNS);
        > }
        > else
        > throw new IllegalArgumentException("Invalid value of " +
        > XMLDBMSProps.ORDERTYPE + " property: " + order);
        > }
        > ......
      Your message has been successfully submitted and would be delivered to recipients shortly.