private Enumeration instantiateBrowser() throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "instantiateBrowser");
        EnumImpl vEnum = null;

        try {
            DestinationType dt = DestinationType.QUEUE;
            String discrim = null;
            String mediation = null;
            boolean gather = false;

            // Establish the correct gatherMessages setting.
            String gatherStr = ((JmsQueue) theDestination).getGatherMessages();
            if (ApiJmsConstants.GATHER_MESSAGES_ON.equals(gatherStr))
                gather = true;

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(this, tc, " destName: " + jsDestName + ", destType: " + dt + ", discrim: " + discrim + ", mediation: " + mediation + ", gather: " + gather);

            // Need to create a selection criteria object for create browser call.
            SelectionCriteria selectionCriteria = null;
            try {
                selectionCriteria = selectionCriteriaFactory.createSelectionCriteria(discrim, // discriminator (topic)
                                                                                     theSelector, // selector string
                                                                                     SelectorDomain.JMS // selector domain
                );
            } catch (SIErrorException sice) {
                // No FFDC code needed
                // d238447 FFDC review. FFDC here is good.
                throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class,
                                                                "EXCEPTION_RECEIVED_CWSIA0144",
                                                                new Object[] { sice, "JmsQueueBrowserImpl.instantiateBrowser" },
                                                                sice,
                                                                "JmsQueueBrowserImpl.instantiateBrowser#1",
                                                                this,
                                                                tc
                                );
            }

            // Core API call to create the browser.
            BrowserSession bs = coreConnection.createBrowserSession(theDestination.getConsumerSIDestinationAddress(),
                                                                    dt,
                                                                    selectionCriteria,
                                                                    null, // alternateUserID
                                                                    gather // gatherMessages
            );

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(this, tc, "core BrowserSession created: " + bs);
            if (bs != null) {
                // Create an enumeration object to drive the bs.
                vEnum = new EnumImpl(bs);
                // Add the enum to the internal list.
                enums.add(vEnum);
            }
            else {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                    SibTr.debug(this, tc, "createBrowserSession returned null - internal error for coreAPI");
                // d238447 FFDC review. This was using the wrong version of newThrowable, presumably with
                // the intent of generating an FFDC, but the caughtThrowable param has to be non-null.
                // Changed to use the correct newThrowable method.
                throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class,
                                                                "FAILED_TO_CREATE_BSESSION_CWSIA0143",
                                                                null,
                                                                tc
                                );
            }

        } catch (SISelectorSyntaxException e) {
            // No FFDC code needed
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(this, tc, "An invalid selector was supplied to createBrowser", e);
            // d238447 modify to not throw FFDC
            throw (InvalidSelectorException) JmsErrorUtils.newThrowable(InvalidSelectorException.class,
                                                                        "INVALID_SELECTOR_CWSIA0147",
                                                                        null,
                                                                        e,
                                                                        null, // null probeId = no ffdc
                                                                        this,
                                                                        tc
                            );
        } catch (SINotAuthorizedException sinae) {
            // No FFDC code needed
            // d238447: app or config error, no ffdc required.
            throw (JMSSecurityException) JmsErrorUtils.newThrowable(JMSSecurityException.class,
                                                                    "BROWSER_AUTH_ERROR_CWSIA0149",
                                                                    null,
                                                                    sinae,
                                                                    null, // null probeId = no ffdc
                                                                    this,
                                                                    tc
                            );
        } catch (SINotPossibleInCurrentConfigurationException dwte) {
            // No FFDC code needed
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(this, tc, "failed to create browserSession", dwte);
            // We asked to connect to a queue and got a topic
            // d238447: app or config error, no ffdc required.
            throw (InvalidDestinationException) JmsErrorUtils.newThrowable(InvalidDestinationException.class,
                                                                           "BROWSE_FAILED_CWSIA0145",
                                                                           new Object[] { jsDestName },
                                                                           dwte,
                                                                           null, // null probeId = no ffdc
                                                                           this,
                                                                           tc
                            );
        } catch (SITemporaryDestinationNotFoundException tdnf) {
            // No FFDC code needed
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(this, tc, "failed to create browserSession", tdnf);
            // We asked to connect to a queue and got a topic
            // d238447: app or config error, no ffdc required.
            throw (InvalidDestinationException) JmsErrorUtils.newThrowable(InvalidDestinationException.class,
                                                                           "BROWSE_FAILED_CWSIA0145",
                                                                           new Object[] { jsDestName },
                                                                           tdnf,
                                                                           null, // no ffdc required
                                                                           this,
                                                                           tc
                            );
        } catch (SIException e) {
            // No FFDC code needed
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(this, tc, "Exception creating browser session", e);
            // d222942 review - default message ok for 'everything else' use
            // d238447 FFDC review - generate FFDC for this case
            throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class,
                                                            "EXCEPTION_RECEIVED_CWSIA0144",
                                                            new Object[] { e, "createBrowserSession" },
                                                            e,
                                                            "JmsQueueBrowserImpl.instantiateBrowser#7",
                                                            this,
                                                            tc
                            );
        } catch (Exception e) {
            // No FFDC code needed
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(this, tc, "Exception creating browser session", e);
            // d222942 review - default message ok for 'everything else' use
            // d238447 FFDC review - generate FFDC for this case
            throw (JMSException) JmsErrorUtils.newThrowable(JMSException.class,
                                                            "EXCEPTION_RECEIVED_CWSIA0144",
                                                            new Object[] { e, "createBrowserSession" },
                                                            e,
                                                            "JmsQueueBrowserImpl.instantiateBrowser#8",
                                                            this,
                                                            tc
                            );
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "instantiateBrowser", vEnum);
        return vEnum;
    }
private Enumeration instantiateBrowser ( ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "instantiateBrowser" ) ; EnumImpl vEnum = null ; try { DestinationType dt = DestinationType . QUEUE ; String discrim = null ; String mediation = null ; boolean gather = false ; String gatherStr = ( ( JmsQueue ) theDestination ) . getGatherMessages ( ) ; if ( ApiJmsConstants . GATHER_MESSAGES_ON . equals ( gatherStr ) ) gather = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , " destName: " + jsDestName + ", destType: " + dt + ", discrim: " + discrim + ", mediation: " + mediation + ", gather: " + gather ) ; SelectionCriteria selectionCriteria = null ; try { selectionCriteria = selectionCriteriaFactory . createSelectionCriteria ( discrim , theSelector , SelectorDomain . JMS ) ; } catch ( SIErrorException sice ) { throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "EXCEPTION_RECEIVED_CWSIA0144" , new Object [ ] { sice , "JmsQueueBrowserImpl.instantiateBrowser" } , sice , "JmsQueueBrowserImpl.instantiateBrowser#1" , this , tc ) ; } BrowserSession bs = coreConnection . createBrowserSession ( theDestination . getConsumerSIDestinationAddress ( ) , dt , selectionCriteria , null , gather ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "core BrowserSession created: " + bs ) ; if ( bs != null ) { vEnum = new EnumImpl ( bs ) ; enums . add ( vEnum ) ; } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "createBrowserSession returned null - internal error for coreAPI" ) ; throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "FAILED_TO_CREATE_BSESSION_CWSIA0143" , null , tc ) ; } } catch ( SISelectorSyntaxException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "An invalid selector was supplied to createBrowser" , e ) ; throw ( InvalidSelectorException ) JmsErrorUtils . newThrowable ( InvalidSelectorException . class , "INVALID_SELECTOR_CWSIA0147" , null , e , null , this , tc ) ; } catch ( SINotAuthorizedException sinae ) { throw ( JMSSecurityException ) JmsErrorUtils . newThrowable ( JMSSecurityException . class , "BROWSER_AUTH_ERROR_CWSIA0149" , null , sinae , null , this , tc ) ; } catch ( SINotPossibleInCurrentConfigurationException dwte ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "failed to create browserSession" , dwte ) ; throw ( InvalidDestinationException ) JmsErrorUtils . newThrowable ( InvalidDestinationException . class , "BROWSE_FAILED_CWSIA0145" , new Object [ ] { jsDestName } , dwte , null , this , tc ) ; } catch ( SITemporaryDestinationNotFoundException tdnf ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "failed to create browserSession" , tdnf ) ; throw ( InvalidDestinationException ) JmsErrorUtils . newThrowable ( InvalidDestinationException . class , "BROWSE_FAILED_CWSIA0145" , new Object [ ] { jsDestName } , tdnf , null , this , tc ) ; } catch ( SIException e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Exception creating browser session" , e ) ; throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "EXCEPTION_RECEIVED_CWSIA0144" , new Object [ ] { e , "createBrowserSession" } , e , "JmsQueueBrowserImpl.instantiateBrowser#7" , this , tc ) ; } catch ( Exception e ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Exception creating browser session" , e ) ; throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "EXCEPTION_RECEIVED_CWSIA0144" , new Object [ ] { e , "createBrowserSession" } , e , "JmsQueueBrowserImpl.instantiateBrowser#8" , this , tc ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "instantiateBrowser" , vEnum ) ; return vEnum ; }
This method is responsible for instantiating the browser, and adding it
to the list of browsers that we current have associated with this JMS object.