呵   ,看到我估计就是因为你在读取时候,line 本来就不是null。

解决方案 »

  1.   

    可能是我这边的问题,具体是这样的。
    .....................................................................................
    public void setPath( String string )
    {
    path = string;
    } public void closeFileObject() throws Exception
    {
    if( FR != null ){
    FR.close();
    }
    if( BR != null ){
    BR.close();
    }
    } public boolean exitFAQ( String username ) throws Exception
    {
    FR = new FileReader( path );
    BR = new BufferedReader( FR );
    String line = "";
    boolean returnString = false;
    while( line != null )
    {
    if( line.indexOf( username ) >= 0 )
    {
    returnString = true;
    }
    line = BR.readLine();
    }
    return returnString;
    }
    ....................................................................................
    readDemo r = new readDemo();
    r.setPath( request.getRealPath( "/" ) + "data\\FAQ.txt" );
    if( r.exitFAQ( ( String )session.getAttribute( "login" ) ) ){
    //
    }
    ....................................................................................
    可能是我这边的问题,thx