cziegeler    01/06/07 03:56:14

  Modified:    src/org/apache/cocoon/components/browser BrowserImpl.xsl
  Log:
  Applied patch from Ovidiu Predescu <[EMAIL PROTECTED]>. It fixes a NPE if the 
browser is not described
  
  Revision  Changes    Path
  1.2       +8 -3      
xml-cocoon2/src/org/apache/cocoon/components/browser/BrowserImpl.xsl
  
  Index: BrowserImpl.xsl
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/components/browser/BrowserImpl.xsl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BrowserImpl.xsl   2001/05/09 20:49:48     1.1
  +++ BrowserImpl.xsl   2001/06/07 10:56:09     1.2
  @@ -87,7 +87,7 @@
       output markup for this browser. Note that this may also affect the
       DOCTYPE that's placed in the resulting XML document.</li>
   
  -    <li><code>has-access-key</code> - whether the browser understands
  +    <li><code>has-accesskey</code> - whether the browser understands
       the <code>accesskey</code> attribute as part of a
       <code>anchor</code> tag.</li>
   
  @@ -142,15 +142,20 @@
   
   <![CDATA[
     /**
  -   * <code>getMedia</code> returns a media type based on the user
  +   * <code>getMedia</code> returns a browser description based on the user
      * agent or on the Accept: header. This is used later by the XSLT
      * processor to select the stylesheet to apply on a given XML file.
      *
      * @param userAgent a <code>String</code> value
      * @param acceptHeader a <code>String</code> value
  -   * @return a <code>String</code> value */
  +   * @return a <code>HashMap</code> value containing the browser
  +   *         description or <code>null</code>
  +   */
     public HashMap getBrowser(String userAgent, String acceptHeader)
     {
  +    if (userAgent == null || userAgent.equals(""))
  +      return new HashMap();
  +
       /* First search for a matching user agent */
       Iterator iter = byUserAgent.iterator();
       while (iter.hasNext()) {
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to