[ http://issues.apache.org/jira/browse/BEEHIVE-734?page=all ]
     
Jeremiah Johnson reopened BEEHIVE-734:
--------------------------------------

     Assign To: Eddie O'Neil  (was: Jeremiah Johnson)

The logic for lookupCategoryNames isn't quite right:

--- SharedFlow.java
    private String[] lookupCategoryNames() {
        ServletContext servletContext = getServletContext();
        Object obj = servletContext.getAttribute(ATTR_CATEGORY_NAMES);
        String[] categoryNames = null;
        if(obj == null) {
            assert _catalogControl != null : "Found a null CategoryControl";
            Category[] categories = _catalogControl.getCategoryList();
            categoryNames = new String[categories.length];
            for(int i = 0; i < categories.length; i++)
                categoryNames[i] = categories[i].getCatId();

            servletContext.setAttribute(ATTR_CATEGORY_NAMES, categoryNames);
        }
        else {
            assert categoryNames instanceof String[] :
                "Found ServletContext \"" + ATTR_CATEGORY_NAMES + "\" that is 
not a String[]";
            categoryNames = (String[])obj;
        }

        assert categoryNames != null : "Found null category names";
        return categoryNames;
    }
---

At the point that categoryNames is checked in the assert, it is still null.  
That check needs to be on obj:

        else {
            assert obj instanceof String[] :
                "Found ServletContext \"" + ATTR_CATEGORY_NAMES + "\" that is 
not a String[]";
            categoryNames = (String[])obj;

With the code as is, you can still get a failure with the following steps:

init DB
enter store
sign in
my account
list orders
my account

> petstoreWeb My Account link / button giving error
> -------------------------------------------------
>
>          Key: BEEHIVE-734
>          URL: http://issues.apache.org/jira/browse/BEEHIVE-734
>      Project: Beehive
>         Type: Bug
>   Components: Samples
>     Versions: V1Beta
>  Environment: Beehive SVN 170195
>     Reporter: Jeremiah Johnson
>     Assignee: Eddie O'Neil
>     Priority: Minor
>      Fix For: V1
>  Attachments: myAccountError.png, myAccountError2.png
>
> When I click on My Account from the link at the top (after I have signed in) 
> or from the 'list orders' page after committing a sale, I get an error.
> The easiest repro is to build / deploy the petstore, init the DB, enter the 
> pet store, sign in (the standard user is fine), and then click on the new My 
> Account link at the top of the page.
> - jeremiah  

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to