This is an automated email from the ASF dual-hosted git repository.

alexoree pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/juddi.git


The following commit(s) were added to refs/heads/master by this push:
     new 8bc8f2d9d NOJIRA should resolve CI failures
8bc8f2d9d is described below

commit 8bc8f2d9dba18ff1b5d7c1d735cd6ad78dab9bfa
Author: Alex O'Ree <[email protected]>
AuthorDate: Sun May 15 22:48:02 2022 -0400

    NOJIRA should resolve CI failures
---
 .../apache/juddi/api/impl/UDDIReplicationImpl.java    | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git 
a/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIReplicationImpl.java 
b/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIReplicationImpl.java
index ddd17628b..49dc39113 100644
--- 
a/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIReplicationImpl.java
+++ 
b/juddi-core/src/main/java/org/apache/juddi/api/impl/UDDIReplicationImpl.java
@@ -1187,17 +1187,22 @@ public class UDDIReplicationImpl extends 
AuthenticatedService implements UDDIRep
                                         }
                                 }
                         }
-                        //dont forget this node
-                        Long id = (Long) em.createQuery("select (e.id) from 
ChangeRecord e where e.nodeID = :node  order by e.id desc")
-                                .setParameter("node", 
getNode()).setMaxResults(1).getSingleResult();
-                        if (id == null) {
-                                id = 0L;
-                        }
+                    //dont forget this node
+                        Query setMaxResults = em.createQuery("select (e.id) 
from ChangeRecord e where e.nodeID = :node  order by e.id desc")
+                                .setParameter("node", 
getNode()).setMaxResults(1);
+                        Long id =null;
+                        if (setMaxResults.getResultList().isEmpty()) {
+                            //this can happen at or near startup
+                            id = 0L;
+                        } else {
+                            id = (Long) em.createQuery("select (e.id) from 
ChangeRecord e where e.nodeID = :node  order by e.id desc")
+                                    .setParameter("node", 
getNode()).setMaxResults(1).getSingleResult();
+                        }    
                         ChangeRecordIDType x = new ChangeRecordIDType();
                         x.setNodeID(getNode());
                         x.setOriginatingUSN(id);
                         ret.add(x);
-
+                    
                         tx.rollback();
                         long procTime = System.currentTimeMillis() - startTime;
                         
serviceCounter.update(ReplicationQuery.GET_HIGHWATERMARKS, QueryStatus.SUCCESS, 
procTime);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to