2 Replies Latest reply on Mar 20, 2003 7:44 AM by 843834

    Trying Example 6 from JAXB examples . . .

    843834
      Hi!

      I have downloaded JWSDP-1.1 and was trying Example 6 MyDatatypeConverter which is in JWSDP-1.1\jaxb-1.0\examples\users-guide\SampleApp6. I modifyed code so it looks like this:

      import java.math.BigInteger;
      import javax.xml.bind.DatatypeConverter;

      public class MyDatatypeConverter {

      public static void main(String args[]){
           System.out.println(printShortToInteger((short)12));
      }

      public static String printShortToInteger(short value) {
      BigInteger result = BigInteger.valueOf(value);
      return DatatypeConverter.printInteger(result);
      }

      }

      And when I compile and run it, i get this Exception:

      Exception in thread "main" java.lang.NullPointerException
      at javax.xml.bind.DatatypeConverter.printInteger(DatatypeConverter.java:381)
      at MyDatatypeConverter.printShortToInteger(MyDatatypeConverter.java:52)
      at MyDatatypeConverter.main(MyDatatypeConverter.java:47)

      Can You explain why I get that Error?

      Thanks,
      Vitali Petrov.