Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Stringe java problem - works in windows but not linux

807607Jan 1 2007 — edited Jan 2 2007
I have the follwing piece of code in my program:
try
    {
    URL url = new URL(link);
    BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
			int input;
			String line = "";
			while (in.ready())
                                                                {
				input = in.read();
				char a = (char)input;
				line = line + a;
				if(line.endsWith("<!-- S BO -->"))
				{
					while(!(line.endsWith("<!-- E BO -->")))
					{
						input = in.read();
						a = (char)input;
						line = line + a;
					}
					System.out.println("ended");
				}
				
			}
		}
catch(Exception e) {}
All it's doing is looking for the "<!-- S BO -->" tag in a piece of HTML, and then looking for the "<!-- E BO -->" tag.

This code works perfectly in Windows on my computer, but if I connect to a Linux server to test it, the code runs but doesn't print anything to indicate that it found the tags. It's running on exactly the same input.

Is there something wrong with the code, or is there something else going wrong?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 30 2007
Added on Jan 1 2007
40 comments
502 views