0

I have a string:

java.lang.IllegalArgumentException: local part cannot be "null" when creating a Qname

which I'm pulling from a log file on a unix server.

and I have this same exact string which I'm pulling from a windows .txt file to compare against the string from the unix server:

java.lang.IllegalArgumentException: local part cannot be "null" when creating a Qname

I'm trying to determine if they are equal, but the .equals() method in java is letting me know that they are not equal.

How can I go about determining that they are indeed equal?

  • @AntonBalaniuc I'm afraid not. I have attempted to use both the .equals() and Object.equals(a,b) approach. Both to no avail. I suspect this might have to do with each string having different line endings. – Camilo Riviere Mar 18 '18 at 20:40
  • Since the text appears the same, and you mention that they're on systems that use different line endings: do these strings include the line separator at the end? Does `a.trim().equals(b.trim())` work? [doc for String.trim()](https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#trim--) – Mike P Mar 18 '18 at 20:40
  • You may also want to strip line endings. – vandench Mar 18 '18 at 20:42
  • I'm afraid we'd probably just be speculating as to what the problem is. You should do some debugging to determine the differences between the strings (check their lengths, print them character by character, print the numeric values of the characters) - if you can tell us that, we can tell you how to compare them (if the aforementioned debugging doesn't already reveal the solution to you). – Bernhard Barker Mar 18 '18 at 20:45

0 Answers0