• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Splitting a string - Different behavior between win xp and linux

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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

 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic