cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

windchill official code bug

TB_10966080
4-Participant

windchill official code bug

 

 

---

**Issue in `TimelineHistoryHelper.getLatestModifyTimestamp`**

The `Timestamp timestamp = Timestamp.valueOf("0000-00-00 00:00:00.000000000");` line consistently triggers an error.

Code snippet:
```java
protected static Timestamp getLatestModifyTimestamp(Persistable paramPersistable) throws WTException {
Timestamp timestamp = Timestamp.valueOf("0000-00-00 00:00:00.000000000");
ArrayList<LifeCycleManaged> arrayList = new ArrayList();
arrayList.add((LifeCycleManaged) paramPersistable);
HashMap hashMap = LifeCycleHelper.service.getHistoryForIterations(arrayList);
if (!hashMap.isEmpty()) {
ArrayList<LifeCycleHistory> arrayList1 = (ArrayList) hashMap.values().toArray()[0];
for (byte b = 0; b < arrayList1.size(); b++) {
LifeCycleHistory lifeCycleHistory = arrayList1.get(b);
if (lifeCycleHistory.getModifyTimestamp().after(timestamp))
timestamp = lifeCycleHistory.getModifyTimestamp();
}
}
return timestamp;
}
```

**How to resolve the above issue**

 

 

1 REPLY 1
rleir
17-Peridot
(To:TB_10966080)

"Today you should not (normally) have a need for a Timestamp object. The java.sql.Timestamp class is long outdated. Once we used it for transferring timestamp values with nanosecond precision to and from SQL databases. Today we use the Instant class for this instead. Instant is one of the classes of java.time, "  

https://stackoverflow.com/questions/49809816/timestamp-valueof-method

 

Top Tags