ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » using java hash table for MQ ENV gives warnings

Post new topic  Reply to topic
 using java hash table for MQ ENV gives warnings « View previous topic :: View next topic » 
Author Message
ivanachukapawn
PostPosted: Tue Feb 18, 2014 7:25 am    Post subject: using java hash table for MQ ENV gives warnings Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Tue Feb 18, 2014 1:33 pm    Post subject: Reply with quote

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
View user's profile Send private message
ivanachukapawn
PostPosted: Wed Feb 19, 2014 5:43 am    Post subject: Reply with quote

Knight

Joined: 27 Oct 2003
Posts: 561

Thank you MQ Jeff !

I tested it and <String,Object> solved this problem.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » using java hash table for MQ ENV gives warnings
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.