0

I'm taking a one string value from an object in a object list.

transitionName = transitionList.get(m).getTransitionName().toString();

And another string value from an object retrieved by a EJB query.

changeItem = changeItemFacade.getChangeItem(changeGroupList.get(1));
char tempNewString[] = changeItem.getNewstring();
newString=new String(tempNewString);

Now this Char[] to String comparison is because the Oracle Table which contains the changeItem have defined the coloumn NewString as a CLOB. And the ejb entity defines type of the variable 'NewString' as a Char[] array . So i have to convert it to a string before doing the comparison.

The problem is that this if statement always returns false and doesn't get executed.

if(transitionName.equalsIgnoreCase(newString)){}

When i try to Log the values (Logger.Debug) , It perfectly show the two (equal) string values in the Server Instance log.

Is there something wrong with the way i convert the char[] array?

I tried changing the type of the entity class variable to String(and of course also the getter and setter methods) but doesn't work either.

direndd
  • 642
  • 2
  • 16
  • 47

1 Answers1

1

Try trim() on strings before comparing. Also, look for character encoding differences. – Singularity

direndd
  • 642
  • 2
  • 16
  • 47