There are elements in this code I would like for someone explain if possible.
Please.
_int();
and the ? and the : in the code throw e instanceof FacesException ? (FacesException) e : new FacesException(e);

public void init() {
        // Perform initializations inherited from our superclass
        super.init();
        try {
            _init();
        } catch (Exception e) {
            log("SessionBean1 Initialization Failure", e);
            throw e instanceof FacesException ? (FacesException) e : new FacesException(e);
        }
        // Fill in the personOptions[]
        buildPersonOptions();
        // Perform application initialization that must complete
        // *before* managed components are initialized
        // TODO - add your own initialiation code here

        // <editor-fold defaultstate="collapsed" desc="Managed Component Initialization">
        // Initialize automatically managed components
        // *Note* - this logic should NOT be modified
        try {
            [B]_init();[/B]
        } catch (Exception e) {
            log("SessionBean1 Initialization Failure", e);
           [B] throw e instanceof FacesException ? (FacesException) e : new FacesException(e);[/B]
        }

    // </editor-fold>
    // Perform application initialization that must complete
    // *after* managed components are initialized
    // TODO - add your own initialization code here
    }

Thanks
-Steve

Recommended Answers

All 2 Replies

the _init() method is no doubt defined in some superclass.
The ?: statement is a threeway conditional.
Equivalent to "if e instanceof FacesException throw (FacesException) e; else throw new FacesException(e);"
It's shorter, cleaner, than the long form for short things like this.

I like it a lot, use it a lot (maybe too much).
You know you're in trouble when you're writing things like

return a > b ? b > c ? c : b : a;

lol ok.so; If a > b then return c else b >c than return a ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.