Casting Short to Integer

One Star

Casting Short to Integer

Passing an element from OracleInput to tmap I get the error;
Exception in component tMap_1
java.lang.ClassCastException: java.lang.Short cannot be cast to java.lang.Integer
at training_sh.address_0_1.Address.tMSSqlInput_1Process(Address.java:3433)
at training_sh.address_0_1.Address.tOracleConnection_2Process(Address.java:343)
at training_sh.address_0_1.Address.runJobInTOS(Address.java:4409)
at training_sh.address_0_1.Address.main(Address.java:4280)
Anyone got any idea on how I convert a small int (short) to an int such that this error message stops
One Star

Re: Casting Short to Integer

Hi,
To reconcile the types, use a "new Integer()" constructor on the Short object. For instance
Short num = new Short((short)1);
Integer num_i = new Integer(num); // in tMap: "new Integer(row1.numericValue)"
Alternatively, you can set all type schemas to use Integer.
-Carl