I'm not sure if my last post went through because I didn't get it in my mail, and it did'nt go in the archive. But sorry if it did actually go through.
I'm having problems with a servlet that I have written. The problem occurs only SOMETIMES! , and I can't figure out why it works sometimes, and other times not. The getParameter is taking in a string representation of a URL based on input from the browser input. Such as http://localhost/servlet?url=http://anotherwebsite.com It works most of the time, but on some websites I get the Null Pointer exception, and sometimes I try again and it works. Also, I did a System.out.println(url) and it prints out as Null when I get the Null Pointer. Here is my code: import javax.servlet.*; import javax.servlet.http.*; import java.io.*; public class process extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response){ try{ String url = request.getParameter("url"); System.out.println(url); String pre_url = url.substring(7); int slash = pre_url.indexOf("/"); String new_url = pre_url.substring(0,slash); FileWriter fw = new FileWriter("/usr/share/squidGuard-1.1.4/db/adult/domains.diff"); PrintWriter pw = new PrintWriter(fw,true); System.out.println(new_url); pw.println("+" + new_url); Runtime.getRuntime().exec("squidGuard -u"); response.sendRedirect(url); } catch (IOException e){ System.err.println(e.getMessage()); } } } ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
