Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Odd problem with linux code
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Aram Mirzadeh  
View profile  
 More options Jan 20 2011, 12:23 am
From: Aram Mirzadeh <aram...@gmail.com>
Date: Thu, 20 Jan 2011 00:23:23 -0500
Local: Thurs, Jan 20 2011 12:23 am
Subject: Re: [CSVChat] Re: Odd problem with linux code

Oh I didn't realize that was still in there when I copied and pasted the
code.

Yes that was just a test, as the problem was working in Windows and not in
Linux I figured I would try it.

I did have it set to \r as the end record.   That doesn't seem to fix the
problem in linux.

Aram

On Wed, Jan 19, 2011 at 9:31 PM, shriop <shr...@hotmail.com> wrote:
> You're doing some odd things with the line separators and apparently
> have some odd line separators in the file. The point of
> System.getProperty("line.separator") is that it returns different
> values on different operating systems. In Windows, that should return
> \r\n, of which you're only grabbing \r for some odd reason. In Linux,
> that should return just \n. So I would expect you to get the result
> you're getting if the file is \r record delimited and has \n's in the
> data of your multiline record. If this file is always going to be in
> this format, so always \r record delimited and only having \n's in the
> data, then just set the RecordDelimiter property to \r always instead
> of having it change based on the operating system, and then it should
> at least work the same in both environments.

> Bruce Dunwiddie

> On Jan 19, 8:05 pm, Aram <aram...@gmail.com> wrote:
> > I have a code which is working fine in my development env (windows
> > vista) however when I deploy it to Linux it breaks.  The problem is a
> > multi-line entry in the CSV file, but there are no ^M variable in it
> > until the end.

> > I have:

> >                 reader.setSkipEmptyRecords(true);
> >                 reader.setTrimWhitespace(true);
> >                 reader.setDelimiter('|');
> >                 reader.setTrimWhitespace(true);

> reader.setRecordDelimiter(System.getProperty("line.separator").charAt(0));

> > The csv is | delimited, with ^M at the end of the record.

> > Here is the record in question, this is all one record

> > 2305|Universiteit Leiden|xxxx
> > F9500
> > FSSC|LEIDEN||2300 RA|NL|Europe|Netherlands|^M

> > In windows the insert statement is built without issue, in Linux:

> > 20:58:55,237 DEBUG Feed:151 - INSERT INTO `DDD` ('2305','Universiteit
> > Leiden','xxxx','','','','','','','0000-00-00');

> > Exception in thread "main" java.lang.NumberFormatException: For input
> > string: "FSSC"
> >         at

> java.lang.NumberFormatException.forInputString(NumberFormatException.java:
> > 48)
> >         at java.lang.Integer.parseInt(Integer.java:449)
> >         at java.lang.Integer.parseInt(Integer.java:499)
> >         at com.admin.Feed.processInput(DirectFeed.java:135)
> >         at com.admin.Feed.main(DirectFeed.java:88)

> > Any ideas?

> --
> You received this message because you are subscribed to the Google Groups
> "CSVChat" group.
> To post to this group, send email to csvchat@googlegroups.com.
> To unsubscribe from this group, send email to
> csvchat+unsubscribe@googlegroups.com<csvchat%2Bunsubscribe@googlegroups.com >
> .
> For more options, visit this group at
> http://groups.google.com/group/csvchat?hl=en.

--
Aram Mirzadeh
a...@TranquilPhotos.com
Phone: (631) 627-1236
Sports, Events, Fine Art Photography

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.