code: private static void processPasswdFile( BufferedReader reader )
          throws IOException
      {
          String entry = reader.readLine();
          while( null != entry )
          {
              // Skip entries other than the one for this username
              if( entry.startsWith( USERNAME ) )
              {
                  // Get the shell part of the passwd entry
                  int index = entry.lastIndexOf( ':' );
  
                  if( index == -1 )
                  {
                      String message = "passwd database contains malformed user entry for " + USERNAME;
                      throw new EnvironmentException( message );
                  }
  
                  m_SHELL = entry.substring( index + 1 );
                  break;
              }
              entry = reader.readLine();
          }
      }
docs: Process a password file.
  
  @param reader The Reader connected to the password file.
  
  @throws IOException if an underlying I/O problem occurs.