Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4149633

BeanContextServicesSupport.getCurrentServiceSelectors throws Exception

XMLWordPrintable

    • 1.2fcs
    • sparc
    • solaris_2.5
    • Verified



      Name: sdC67446 Date: 06/17/98



      method
      java.beans.beancontext.BeanContextServicesSupport.
       getCurrentServiceSelectors(Class cl) always throws ClassCastException

      The doc says:
      --------------------------------------------------
      public Iterator getCurrentServiceSelectors(Class serviceClass)

            Description copied from interface:
             
            Specified by:
                  getCurrentServiceSelectors in interface BeanContextServices
            Returns:
                  an iterator for all the currently available service selectors
                  (if any) available for the specified service.
                  
      Here is the test demostrating the bug:
      --------------------------------------------------
      import java.beans.beancontext.*;
      import java.util.Iterator;

      public class Test implements BeanContextServiceProvider {
          
          public Object getService(BeanContextServices bcs,
                                   Object requestor,
                                   Class serviceClass,
                                   Object serviceSelector) {
              return null;
          }

          public void releaseService(BeanContextServices bcs,
                                     Object requestor,
                                     Object service) {
          }

          public Iterator getCurrentServiceSelectors(BeanContextServices bcs,
                                                     Class serviceClass) {
              return null;
          }

          public static void main(String[] args) {
              BeanContextServicesSupport bcss = new BeanContextServicesSupport();
              Class cl = (new Object()).getClass();
              Test bcsp = new Test();
              bcss.addService(cl,bcsp);

              try {
                  bcss.getCurrentServiceSelectors(cl);
                  System.out.println("OK.");
              } catch (ClassCastException e) {
                  e.printStackTrace();
              }
          }
      }

      Here is test's output:
      --------------------------------------------------
      java.lang.ClassCastException: java.beans.beancontext.BeanContextServicesSupport$BCSSServiceProvider
              at java.beans.beancontext.BeanContextServicesSupport.getCurrentServiceSelectors(Compiled Code)
              at Test.main(Compiled Code)
       
      --------------------------------------------------
      ======================================================================

            lcablesunw Larry Cable (Inactive)
            sdmitriesunw Sergei Dmitriev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: