Reputation: 574
I have a static HashMap < String, Integer > with users' UUIDs and IDs. It is a static variable of UserBean. Saves a database hit to work that out.
For some reasons, in this circumstance only, I can't get the ID ( value ) for the corresponding UUID ( key ) It all works fine if instead of the String variable, I hardcode the its value.
I have used the same static HashMap elsewhere, without problems. The only difference is that this is in a RESTful service, but I don't think it's the cause of the problem. I am a one man band, so I have to ask here. Spent ages on this, there must be an awfully obvious error here, but I still don't have a clue.
@Path ( "/ScanOpenRequests" )
public class ScanOpenRequests
{
@POST
@Produces({"text/xml"})
public Response scanOpenRequest ( @FormParam ( "openSessionId" ) String openSessionId )
{
System.out.println ( "user UUID = >" + openSessionId + "<" );
System.out.println ( "user ID = " + UserBean.getOpenSessionIdAndUserIdMap().get ( "61d403dd326c4e2eac223a204ead828d" ) );
System.out.println ( "user ID = " + UserBean.getOpenSessionIdAndUserIdMap().get ( openSessionId ) );
UserBean user = new UserBean();
user.setId ( UserBean.getOpenSessionIdAndUserIdMap().get ( "61d403dd326c4e2eac223a204ead828d" ) );
new UserBL().getOpenLessonRequestsUserCanHelpWith ( user );
return Response.status ( 200 ).entity ( "" ).build ();
}
the printout is this:
user UUID = >"61d403dd326c4e2eac223a204ead828d"<
user ID = 749
user ID = null
Can anybody spot what I am doing wrong?
Upvotes: 0
Views: 250
Reputation: 393936
The value of openSessionId
is "61d403dd326c4e2eac223a204ead828d"
(including the quotes) which is different from the hard-coded value 61d403dd326c4e2eac223a204ead828d
.
Upvotes: 3