Uploaded image for project: 'jUDDI'
  1. jUDDI
  2. JUDDI-970

Code smell that ignores InvalidValueException

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.3.5
    • Component/s: None
    • Labels:
      None

      Description

      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

      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                         }
      

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

        Attachments

          Activity

            People

            • Assignee:
              spyhunter99 Alex O'Ree
              Reporter:
              lifove JC
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: