Re: BufferedReader.readLine() hangs

From: David B. Held (dave.held_at_arrayservicesgrp.com)
Date: 02/01/05


Date: 1 Feb 2005 06:50:15 -0800

Others have answered my question, but they haven't solved the problem.
I was suspicious about BufferedReader.ready(), but I don't have much
experience with Java, and I inherited the code that originally called
it. I changed my test code to eliminate calls to ready(), but it still
hangs. Here is the revised version:

import java.io.BufferedReader;
import java.io.FileReader;

public class ReadTest
{
public static void main(String[] args)
{
try
{
BufferedReader in = new BufferedReader(new
FileReader(args[0]));
while (ReadTest.getRow(in));
}
catch (Exception e)
{
e.printStackTrace();
}
}

public static boolean getRow(BufferedReader in) throws Exception
{
for (int i = 0; i != 10; ++i)
{
String s = in.readLine();
if (s == null) return false;
System.out.println(s);
}
return true;
}
}

I'm testing it on a 3.8 MB file, but any suitably large file will do.
Obviously, the contents shouldn't matter, but just in case someone
thinks it does, I just captured the output of ps and appended the file
to itself many times. I would appreciate it if someone else tried it
on their server to see if they can reproduce the issue. Like I said,
it only occurs with the server VM, so far as I can tell.

Dave



Relevant Pages

  • Re: JAVA works C# not !!!!!!!
    ... The server is the same nothing changed, I have no server codes, it is ... works on JAVA. ... I don't know where I need to check permissions and if it is for write ... permission why throw this kind of exception? ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: RMI & connection refused
    ... java -Djava.security.policy=policy RMIServer localhost 1099 & ... the client machine, telnet to port 1099 on the server machine. ... server thread; nested exception is: ...
    (comp.lang.java.programmer)
  • RMI tutorial - got "acceenied" exception
    ... I got the exception below when trying the client with commandline ... java -classpath ".;compute.jar;%CLASSPATH%" ... which is the codebase used by the server. ... ComputePi exception: error unmarshalling return; ...
    (comp.lang.java.programmer)
  • JAVA RMI register problem
    ... Im making aplication with Java RMI ... ... Today i started to run server and i cant make it:((once ... d exception is: ...
    (comp.lang.java.programmer)
  • RE: Backup & Monitoring not working!
    ... Error message in Windows Small Business Server 2003: ... Microsoft CSS Online Newsgroup Support ... This newsgroup only focuses on SBS technical issues. ... An unhandled exception occurred during the execution of the ...
    (microsoft.public.windows.server.sbs)