This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Splitting a string - Different behavior between win xp and linux  RSS feed

 
Rob Page
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, and (anyway) thanks for your time.
Maybe I'm not completely seeing what's going on in my sw because I obtain a different behavior from the same method running in two different machines: first one w/ win xp and the second w/ linux (CentOS).
My method has to split a string like the following:

"2010-08-11 16:55:15,336 123.123.123.123 "Mozilla/5.0 (iPad; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Release/3.0/12345 asdfghjklpoiu-123" abc 12345678"

I use a regex like this: "\\x20{2,}" in order to obtain tokens that are separated by 2 or more spaces.

Deployed on win xp it works, on linux not (same JVM).

Have you any suggestion.
Again thank you for your time.

Rob

 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16007
87
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

What exactly do you mean with "it works / it doesn't work"? What is exactly the output that you expect, and what happens in reality - and how do these two differ? Can you show us the source code and the exact difference between the outputs on the two OSes?
 
Rob Page
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for my poor description of the problem...
This is the code, I implemented a handler compliant with the architecture of Apache-MINA receivers:



On win xp I obtain:

splitString[0] = "2010-08-11"
splitString[1] = "16:55:15,336"
splitString[2] = "123.123.123.123"
splitString[3] = "'Mozilla/5.0 (iPad; U; CPU like Mac OS X; en) AppleWebKit/420+ (KHTML, like Gecko) Release/3.0/12345 asdfghjklpoiu-123'"
splitString[4] = "abc"
splitString[5] = "1234567"

On linux I obtain that the whole string is put in splitString[0]
Thanks

Rob
 
Rob Spoor
Sheriff
Posts: 21048
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure the input string is exactly the same? Is it perhaps not missing spaces that are sent in Windows, so there are no occurrences of 2 or more spaces?
 
Rob Page
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:Are you sure the input string is exactly the same? Is it perhaps not missing spaces that are sent in Windows, so there are no occurrences of 2 or more spaces?


Yes, I'm sure
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!