Question: I am starting to work on a Fairly standard Jsp application. (Jsp,Oracle backend).

The security of the application is important. So what are the common(also uncommon ) Pitfalls that I should avoid as a novice.

Basically, Its just a few forms to get user input and some session management to display data according to user roles.

This discussion could serve as reference to future users also.

regards

Answer: 
The code you've got works for me. As a short but complete program:

```
import java.util.*;
import java.sql.*;

public class Test {
    public static void main(String[] args) {
        long retryDate = System.currentTimeMillis();

        int sec = 600;

        Timestamp original = new Timestamp(retryDate);
        Calendar cal = Calendar.getInstance();
        cal.setTimeInMillis(original.getTime());
        cal.add(Calendar.SECOND, sec);
        Timestamp later = new Timestamp(cal.getTime().getTime());

        System.out.println(original);
        System.out.println(later);
    }
}

```

Output:

```
2011-11-07 10:27:45.302
2011-11-07 10:37:45.302

```

Note the difference of 10 minutes, i.e. 600 seconds.

Of course you lose the sub-millisecond precision this way, which may well not be ideal - and it goes against what I'm normally use a timestamp for in the first place - but it *does* add the seconds...

Another option would be to just use `Timestamp` directly:

```
Timestamp original = ...;
Timestamp later = new Timestamp(original.getTime() + (sec * 1000L));
later.setNanos(original.getNanos());

```
```
Timestamp.from(dto.getTimeModified().toInstant().plusSeconds(600))

```