Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
---
**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**
Solved! Go to Solution.
Hi @TB_10966080
What Windchill version do you use?
In my Windchill the helper does not contains the row with zeros. there is just null
Windchill 12.0.2.0 library
protected static Timestamp getLatestModifyTimestamp(Persistable var0) throws WTException {
Timestamp var1 = null;
ArrayList var2 = new ArrayList();
var2.add((LifeCycleManaged)var0);
HashMap var3 = LifeCycleHelper.service.getHistoryForIterations(var2);
if (!var3.isEmpty()) {
ArrayList var4 = (ArrayList)var3.values().toArray()[0];
for(int var5 = 0; var5 < var4.size(); ++var5) {
LifeCycleHistory var6 = (LifeCycleHistory)var4.get(var5);
if (var1 == null || var6.getModifyTimestamp().after(var1)) {
var1 = var6.getModifyTimestamp();
}
}
}
if (var1 == null) {
var1 = var0.getPersistInfo().getModifyStamp() != null ? var0.getPersistInfo().getModifyStamp() : var0.getPersistInfo().getCreateStamp();
}
return var1;
}
So you can copy the class from the WNCWEB.jar
recompile it
correct it
remove it from WNCWEB
place your class to the codebase correct place same as it was in the WNCWEB.jar
and everything will work 😄
PetrH
"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
no. bug is in windchill source code.we can't change its code.the version of jdk is 7.
Hi @TB_10966080
So what do you need from community if you refuse the help idea from @rleir
PS> you can change the code, but it is on your own risk.
PetrH
You didn't understand me. There is a problem with the WindChLL source code, not with the code I wrote myself. The code posted on it is the official WindHill source code, using JDK 7. Please help solve the problem
Hi @TB_10966080
If it is Windchill class you can decompile it change it and use it in the Windchill.
You have to overwrite OOTB files.
You can do it, but as I wrote, it is on your own risk.
PetrH
Hi @TB_10966080
What Windchill version do you use?
In my Windchill the helper does not contains the row with zeros. there is just null
Windchill 12.0.2.0 library
protected static Timestamp getLatestModifyTimestamp(Persistable var0) throws WTException {
Timestamp var1 = null;
ArrayList var2 = new ArrayList();
var2.add((LifeCycleManaged)var0);
HashMap var3 = LifeCycleHelper.service.getHistoryForIterations(var2);
if (!var3.isEmpty()) {
ArrayList var4 = (ArrayList)var3.values().toArray()[0];
for(int var5 = 0; var5 < var4.size(); ++var5) {
LifeCycleHistory var6 = (LifeCycleHistory)var4.get(var5);
if (var1 == null || var6.getModifyTimestamp().after(var1)) {
var1 = var6.getModifyTimestamp();
}
}
}
if (var1 == null) {
var1 = var0.getPersistInfo().getModifyStamp() != null ? var0.getPersistInfo().getModifyStamp() : var0.getPersistInfo().getCreateStamp();
}
return var1;
}
So you can copy the class from the WNCWEB.jar
recompile it
correct it
remove it from WNCWEB
place your class to the codebase correct place same as it was in the WNCWEB.jar
and everything will work 😄
PetrH