JC created JUDDI-970:
------------------------

             Summary: Code smell that ignores InvalidValueException
                 Key: JUDDI-970
                 URL: https://issues.apache.org/jira/browse/JUDDI-970
             Project: jUDDI
          Issue Type: Bug
            Reporter: JC
            Priority: Trivial


I've found a condition that is always false so InvalidValueException will not 
be thrown in all cases. (from recent github snapshot)

Path:juddi-core/src/main/java/org/apache/juddi/api/impl/UDDISubscriptionImpl.java

{code:java}
192                         if (body.getChunkToken() != null && 
body.getChunkToken().length() > 0) {
 193                                 SubscriptionChunkToken chunkToken = 
em.find(SubscriptionChunkToken.class, body.getChunkToken());
 194 
 195                                 if (chunkToken == null)
 196                                         throw new 
InvalidValueException(new 
ErrorMessage("errors.getsubscriptionresult.InvalidChunkToken", 
body.getChunkToken()));
 197                                 if 
(!chunkToken.getSubscriptionKey().equals(chunkToken.getSubscriptionKey()))
 198                                         throw new 
InvalidValueException(new 
ErrorMessage("errors.getsubscriptionresult.NonMatchingChunkToken", 
body.getChunkToken()));
 199                                 if (chunkToken.getStartPoint() != null && 
chunkToken.getStartPoint().getTime() != startPointDate.getTime())
 200                                         throw new 
InvalidValueException(new 
ErrorMessage("errors.getsubscriptionresult.NonMatchingChunkToken", 
body.getChunkToken()));
 201                                 if (chunkToken.getEndPoint() != null && 
chunkToken.getEndPoint().getTime() != endPointDate.getTime())
 202                                         throw new 
InvalidValueException(new 
ErrorMessage("errors.getsubscriptionresult.NonMatchingChunkToken", 
body.getChunkToken()));
 203                                 if 
(chunkToken.getExpiresAfter().before(new Date()))
 204                                         throw new 
InvalidValueException(new 
ErrorMessage("errors.getsubscriptionresult.ExpiredChunkToken", 
body.getChunkToken()));
 205 
 206                                 chunkData = chunkToken.getData();
 207                                 // We've got the data from the chunk 
token, now it is no longer needed (once it's called, it's used up)
 208                                 em.remove(chunkToken);
 209                         }
{code}

Line 197 has that condition. This might be a trivial issue but wanted to report 
just in case. 



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to