You are viewing a plain text version of this content. The canonical link for it is here.
Posted to wsrp4j-dev@portals.apache.org by "Claire Chang (JIRA)" <ws...@ws.apache.org> on 2005/01/11 20:28:12 UTC

[jira] Created: (WSRP4J-54) PortletURLProviderImpl incorrectly assumes current mode is always view mode and current state is always normal

PortletURLProviderImpl incorrectly assumes current mode is always view mode and current state is always normal
--------------------------------------------------------------------------------------------------------------

         Key: WSRP4J-54
         URL: http://issues.apache.org/jira/browse/WSRP4J-54
     Project: WSRP4J
        Type: Bug
  Components: Producer  
 Environment: windows xp
    Reporter: Claire Chang
    Priority: Critical


as a result of this bug, all urls generated by PortletURLProviderImpl.toString() will have the effect of setting the mode to view and state to normal overriding the current state and current mode.

I fixed this by changing a few lines in toString method

   public String toString()
    {
        if (logger.isLogging(Logger.TRACE_HIGH))
        {
            logger.entry(Logger.TRACE_HIGH, "toString()");
        }

        if (mode == null)
        {
            //***Comment out this line***
            //mode = PortletMode.VIEW;
            if (logger.isLogging(Logger.TRACE_HIGH))
            {
                logger.text(Logger.TRACE_HIGH, "toString()", "PortletMode is null. Setting portlet mode to 'view'");
            }
        }

        if (state == null)
        {
            //***Comment out this line***
            //state = WindowState.NORMAL;

            if (logger.isLogging(Logger.TRACE_HIGH))
            {
                logger.text(Logger.TRACE_HIGH, "toString()", "WindowState is null. Setting window state to 'normal'");
            }
        }

        String url = "";
        URLComposer urlComposer = provider.getURLComposer();

        // create urls                                 
        if (action)
        {

            String actionStateStr = null;

            try
            {

                actionStateStr = Base64.encode(MapSerializer.serialize(parameters));

            } catch (IOException iox)
            {
                //TODO: pass exception to consumer
                
                logger.stackTrace(
                    Logger.ERROR,
                    "toString()",
                    "IOException occured during serialization of parameter map to interaction state.");
            }
            //TBD: introduce mode / state mapping class instead of string appending...
            //***add a condition to check if mode/state is null or not***
            url =
                urlComposer.createBlockingActionURL(
                    (mode != null) ? "wsrp:" + mode.toString() : null,
                    //"wsrp:" + mode.toString(),
                    actionStateStr,
                    (state != null) ? "wsrp:" + state.toString() : null,
   		    //"wsrp:" + state.toString(),
                    this.secure,
                    this.runtimeContext,
                    this.portletContext,
                    this.userContext);
        } else
        {
            String naviStateStr = null;
            try
            {

                naviStateStr = Base64.encode(MapSerializer.serialize(parameters));

            } catch (IOException iox)
            {
                //TODO: pass exception to consumer

                logger.stackTrace(
                    Logger.ERROR,
                    "toString()",
                    "IOException occured during serialization of parameter map to navigational state.");
            }
           
            //***add a condition to check if mode/state is null or not***
            url =
                urlComposer.createRenderURL(
                    (mode != null) ? "wsrp:" + mode.toString() : null,
		     //"wsrp:" + mode.toString(),
                    naviStateStr,
                    (state != null) ? "wsrp:" + state.toString() : null,
		     //"wsrp:" + state.toString(),
                    this.secure,
                    this.runtimeContext,
                    this.portletContext,
                    this.userContext);
        }

        if (logger.isLogging(Logger.TRACE_HIGH))
        {
            logger.exit(Logger.TRACE_HIGH, "toString()", url);
        }

        return url;
    }

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (WSRP4J-54) PortletURLProviderImpl incorrectly assumes current mode is always view mode and current state is always normal

Posted by "Julie MacNaught (JIRA)" <ws...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/WSRP4J-54?page=history ]
     
Julie MacNaught resolved WSRP4J-54:
-----------------------------------

      Assign To: Julie MacNaught
     Resolution: Fixed
    Fix Version: current (nightly)

Fixed per suggested patch.

> PortletURLProviderImpl incorrectly assumes current mode is always view mode and current state is always normal
> --------------------------------------------------------------------------------------------------------------
>
>          Key: WSRP4J-54
>          URL: http://issues.apache.org/jira/browse/WSRP4J-54
>      Project: WSRP4J
>         Type: Bug
>   Components: Producer
>  Environment: windows xp
>     Reporter: Claire Chang
>     Assignee: Julie MacNaught
>     Priority: Critical
>      Fix For: current (nightly)

>
> as a result of this bug, all urls generated by PortletURLProviderImpl.toString() will have the effect of setting the mode to view and state to normal overriding the current state and current mode.
> I fixed this by changing a few lines in toString method
>    public String toString()
>     {
>         if (logger.isLogging(Logger.TRACE_HIGH))
>         {
>             logger.entry(Logger.TRACE_HIGH, "toString()");
>         }
>         if (mode == null)
>         {
>             //***Comment out this line***
>             //mode = PortletMode.VIEW;
>             if (logger.isLogging(Logger.TRACE_HIGH))
>             {
>                 logger.text(Logger.TRACE_HIGH, "toString()", "PortletMode is null. Setting portlet mode to 'view'");
>             }
>         }
>         if (state == null)
>         {
>             //***Comment out this line***
>             //state = WindowState.NORMAL;
>             if (logger.isLogging(Logger.TRACE_HIGH))
>             {
>                 logger.text(Logger.TRACE_HIGH, "toString()", "WindowState is null. Setting window state to 'normal'");
>             }
>         }
>         String url = "";
>         URLComposer urlComposer = provider.getURLComposer();
>         // create urls                                 
>         if (action)
>         {
>             String actionStateStr = null;
>             try
>             {
>                 actionStateStr = Base64.encode(MapSerializer.serialize(parameters));
>             } catch (IOException iox)
>             {
>                 //TODO: pass exception to consumer
>                 
>                 logger.stackTrace(
>                     Logger.ERROR,
>                     "toString()",
>                     "IOException occured during serialization of parameter map to interaction state.");
>             }
>             //TBD: introduce mode / state mapping class instead of string appending...
>             //***add a condition to check if mode/state is null or not***
>             url =
>                 urlComposer.createBlockingActionURL(
>                     (mode != null) ? "wsrp:" + mode.toString() : null,
>                     //"wsrp:" + mode.toString(),
>                     actionStateStr,
>                     (state != null) ? "wsrp:" + state.toString() : null,
>    		    //"wsrp:" + state.toString(),
>                     this.secure,
>                     this.runtimeContext,
>                     this.portletContext,
>                     this.userContext);
>         } else
>         {
>             String naviStateStr = null;
>             try
>             {
>                 naviStateStr = Base64.encode(MapSerializer.serialize(parameters));
>             } catch (IOException iox)
>             {
>                 //TODO: pass exception to consumer
>                 logger.stackTrace(
>                     Logger.ERROR,
>                     "toString()",
>                     "IOException occured during serialization of parameter map to navigational state.");
>             }
>            
>             //***add a condition to check if mode/state is null or not***
>             url =
>                 urlComposer.createRenderURL(
>                     (mode != null) ? "wsrp:" + mode.toString() : null,
> 		     //"wsrp:" + mode.toString(),
>                     naviStateStr,
>                     (state != null) ? "wsrp:" + state.toString() : null,
> 		     //"wsrp:" + state.toString(),
>                     this.secure,
>                     this.runtimeContext,
>                     this.portletContext,
>                     this.userContext);
>         }
>         if (logger.isLogging(Logger.TRACE_HIGH))
>         {
>             logger.exit(Logger.TRACE_HIGH, "toString()", url);
>         }
>         return url;
>     }

-- 
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
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira