...
This compliant solution avoids using the clone method. Instead, it creates a new java.util.Date
object that is subsequently used for access control checks and for insertion into the database.:
Code Block | ||
---|---|---|
| ||
private void storeDateinDB(java.util.Date date) throws SQLException { final java.util.Date copy = new java.util.Date(date.getTime()); if (validateValue(copy.getTime())) { Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://<HOST>:1433","<UID>","<PWD>"); PreparedStatement pstmt = con.prepareStatement("UPDATE ACCESSDB SET TIME = ?"); pstmt.setLong(1, copy.getTime()); // ... } } |
...