Current position:  Home > Default > IndexOf problem

IndexOf problem

Time:November 30
Hi guys I did use this code to read the html file and it work fine but when i try to add the restriction to it
(indexOf) i do get problem as it gives "String index out of range: -1" error
i am trying to return the string between any ">" and "<" in the html file ,which exists in the html file,
tanks in advance
public String  viewpageBody(String newURLStr)
      try {
         URL example = new URL (newURLStr);
      BufferedReader in = new BufferedReader(
                              new InputStreamReader(
      String Nexthtml="";
      String inputLine="";
      int sstar=1;
      while ( ( inputLine != null ) && ( aborted == false ))
                    inputLine = in.readLine().toLowerCase();
                   if ( inputLine != null )
                                  {      System.out.println(inputLine);
                                       int star=      inputLine.indexOf( ">",sstar);
                                int ref=       inputLine.indexOf("<",star);
             String Bodyweb =      inputLine.substring( star,ref);
                         //     inputLine = stopWord( Bodyweb ); // do some manipulation
                         //      System.out.println(inputLine);
                                   Nexthtml += Bodyweb; // add up string
  return Nexthtml;   
       catch (Exception e) {
            System.out.println("File error: "+e);
     return "";                     
what are the results of your System.out.println's? If one of your index is -1 then a failure could happen...