5 |
import java.sql.PreparedStatement; |
import java.sql.PreparedStatement; |
6 |
import java.sql.ResultSet; |
import java.sql.ResultSet; |
7 |
import java.sql.SQLException; |
import java.sql.SQLException; |
8 |
|
import java.util.logging.Level; |
9 |
|
import java.util.logging.Logger; |
10 |
|
|
11 |
import javax.servlet.ServletException; |
import javax.servlet.ServletException; |
12 |
import javax.servlet.http.HttpServlet; |
import javax.servlet.http.HttpServlet; |
21 |
public class LocateStations extends HttpServlet { |
public class LocateStations extends HttpServlet { |
22 |
private static final long serialVersionUID = 1L; |
private static final long serialVersionUID = 1L; |
23 |
|
|
24 |
|
Logger logger = Logger.getLogger( LocateStations.class.toString() ); |
25 |
|
|
26 |
/** |
/** |
27 |
* @see HttpServlet#HttpServlet() |
* @see HttpServlet#HttpServlet() |
28 |
*/ |
*/ |
77 |
stmt.setString(1, "%" + name + "%"); |
stmt.setString(1, "%" + name + "%"); |
78 |
break; |
break; |
79 |
default: |
default: |
80 |
throw new SQLException("not enough parameters"); |
// This should not be possible |
81 |
|
logger.severe("getStations(): default switch case"); |
82 |
} |
} |
83 |
|
|
84 |
|
|
144 |
|
|
145 |
conn.close(); |
conn.close(); |
146 |
conn = null; |
conn = null; |
147 |
|
|
148 |
} catch (Exception e) { |
} catch (Exception e) { |
149 |
throw new ServletException(e); |
logger.log(Level.SEVERE, "Exception while finding stations", e); |
150 |
|
response.sendError(500); |
151 |
} finally { |
} finally { |
152 |
try { |
try { |
153 |
if (conn != null) |
if (conn != null) |