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

Sending a business key for getServiceDetail causing a class cast exception

    Details

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

      Description

      probably should trap this and handle it correctly...

      Caused by: java.lang.ClassCastException: org.apache.juddi.model.BusinessEntity cannot be cast to org.apache.juddi.model.BusinessService
       at org.apache.juddi.api.impl.UDDIInquiryImpl.getServiceDetail(UDDIInquiryImpl.java:472)

      1. boomer.java
        10 kB
        Alex O'Ree

        Issue Links

          Activity

          Hide
          kurtstam Kurt T Stam added a comment - - edited

          I believe the issue was passing in a businessKey in the serviceKey field on a GetServiceDetail. We should trap this and return a nice error.

          Show
          kurtstam Kurt T Stam added a comment - - edited I believe the issue was passing in a businessKey in the serviceKey field on a GetServiceDetail. We should trap this and return a nice error.
          Hide
          kurtstam Kurt T Stam added a comment -

          Hi Alex,

          I don't know how to reproduce the issue - line 472 says:

          org.apache.juddi.model.BusinessService modelBusinessService = em.find(org.apache.juddi.model.BusinessService.class, serviceKey);

          and if I pass in a businessKey, it simply does not find the BusinessService, and returns null. Also WE are not doing any casting in this line; this is straight JPA and the first argument we pass in is the class we are looking for.

          Can it be you used the same key for both service and business?, or something like it... I mean you copied in the stack trace - so the error surely happened. I'm just trying to see how we can reproduce it - and how to fix it.

          --Kurt

          Show
          kurtstam Kurt T Stam added a comment - Hi Alex, I don't know how to reproduce the issue - line 472 says: org.apache.juddi.model.BusinessService modelBusinessService = em.find(org.apache.juddi.model.BusinessService.class, serviceKey); and if I pass in a businessKey, it simply does not find the BusinessService, and returns null. Also WE are not doing any casting in this line; this is straight JPA and the first argument we pass in is the class we are looking for. Can it be you used the same key for both service and business?, or something like it... I mean you copied in the stack trace - so the error surely happened. I'm just trying to see how we can reproduce it - and how to fix it. --Kurt
          Hide
          spyhunter99 Alex O'Ree added a comment -

          Sorry, try a service key for getBusinessDetails.

          Show
          spyhunter99 Alex O'Ree added a comment - Sorry, try a service key for getBusinessDetails.
          Hide
          kurtstam Kurt T Stam added a comment -

          Hibernate returns null on an invalid Key; OpenJPA can throw a ClassCast, which we now catch so that we throw an InvalidKeyException in both cases.

          Show
          kurtstam Kurt T Stam added a comment - Hibernate returns null on an invalid Key; OpenJPA can throw a ClassCast, which we now catch so that we throw an InvalidKeyException in both cases.
          Hide
          spyhunter99 Alex O'Ree added a comment -

          at r1466229

          Show
          spyhunter99 Alex O'Ree added a comment - at r1466229

            People

            • Assignee:
              kurtstam Kurt T Stam
              Reporter:
              spyhunter99 Alex O'Ree
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development