|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
using java hash table for MQ ENV gives warnings |
« View previous topic :: View next topic » |
Author |
Message
|
ivanachukapawn |
Posted: Tue Feb 18, 2014 7:25 am Post subject: using java hash table for MQ ENV gives warnings |
|
|
 Knight
Joined: 27 Oct 2003 Posts: 561
|
Following example code from IBM (2001 source) to use Java Hashtable for setting MQ ENV variables, I used this code:
Code: |
java.util.Hashtable env = new java.util.Hashtable();
env.put(MQConstants.CHANNEL_PROPERTY, "SVRCONN.ADMIN");
env.put(MQConstants.HOST_NAME_PROPERTY, "123.456.78.9");
env.put(MQConstants.PORT_PROPERTY, new Integer (1430));
|
Naturally, the compile yields a warning
Quote: |
java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details. |
Which when explicated via -Xlint:unchecked informs the Key and Value types for the Hashtable are not specified: But modifying the code as follows:
Code: |
java.util.Hashtable<String,String> env = new java.util.Hashtable<String,String>(); |
will not allow the setting of the PORT (Integer) as a Key Value in the Hashtable (Its not a String). I am guessing that there is no way to use a Hashtable without getting a warning if CHANNEL, HOST, and PORT need to be set - is that correct? |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Feb 18, 2014 1:33 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I think you should be fine if you did <String,Object>
haven't tested it. |
|
Back to top |
|
 |
ivanachukapawn |
Posted: Wed Feb 19, 2014 5:43 am Post subject: |
|
|
 Knight
Joined: 27 Oct 2003 Posts: 561
|
Thank you MQ Jeff !
I tested it and <String,Object> solved this problem. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|