You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@juddi.apache.org by "Alex O'Ree (JIRA)" <ju...@ws.apache.org> on 2017/09/23 00:52:04 UTC
[jira] [Commented] (JUDDI-970) Code smell that ignores
InvalidValueException
[ https://issues.apache.org/jira/browse/JUDDI-970?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16177397#comment-16177397 ]
Alex O'Ree commented on JUDDI-970:
----------------------------------
meant to reply earlier when i first saw this, good find!
> 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.4.14#64029)