This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
java.lang.StringIndexOutOfBoundsException: String index out of range: -729 at java.lang.String.substring(String.java:1503) at Proj.ReturnURL.ParsePage(ReturnURL.java:42) at Proj.ReturnURL.main(ReturnURL.java:50) Exception in thread "main" [ March 23, 2003: Message edited by: Anita Raj ]
Do you think it's very efficient to allocate an array of 1,000,000 bytes? Would it make more sense to wrap your FileInputStream with a BufferedInputStream so that you can do readLine()? And shouldn't you be using FileReader to read character data? What does your program do if it doesn't find the string it is searching for (either "a href=" or "/")? What does the indexOf return when it doesn't find a String? What effect would that have on your program? How do you ever get to the end of your while loop?