I know that Strings in Java should be compared using .equals()
and not using ==
operator.
But in the given below code there is a primaryObserverId
which has a value of ""
The given below if
condition runs fine on Java 6 but fails on Java 7
String primaryObserverId = request.getParameter("primary_observer_id");
if(primaryObserverId == null || primaryObserverId=="")
primaryObserverId = RoleMap.getUserIdForThisSession(session.getId());
Need to know why this code was working on Java 6 and not on Java 7.
I know how the concept of String Pool works for string literals in java , just want to know the reason this abrupt behavior.
Can using different version of GlassFish may cause any issue as I am using GlassFish-2.1 with Java 6 and GlassFish-4.1 with Java 7