You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Ovidiu Predescu <ov...@cup.hp.com> on 2001/06/07 00:48:04 UTC

[PATCH] [C2] BrowserImpl.xsl

This patch fixes a null pointer exception when passing browser
capabilities to the stylesheet, for browsers which are not described
in the XML database.

-- 
Ovidiu Predescu <ov...@cup.hp.com>
http://orion.nsr.hp.com/ (inside HP's firewall only)
http://www.geocities.com/SiliconValley/Monitor/7464/ (GNU, Emacs, other stuff)


Index: src/org/apache/cocoon/components/browser/BrowserImpl.xsl
===================================================================
RCS file: /Repository/Cocoon2/src/org/apache/cocoon/components/browser/BrowserImpl.xsl,v
retrieving revision 1.1.1.1
diff -u -I'\$Id:.*\$' -I'\$Author:.*\$' -I'\$Revision:.*\$' -r1.1.1.1 BrowserImpl.xsl
--- BrowserImpl.xsl	2001/05/08 18:42:19	1.1.1.1
+++ BrowserImpl.xsl	2001/06/06 22:30:44
@@ -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>
 
@@ -151,6 +151,9 @@
    * @return a <code>String</code> value */
   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()) {

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


AW: [PATCH] [C2] BrowserImpl.xsl

Posted by Carsten Ziegeler <cz...@sundn.de>.
Hi Ovidiu ,

thanks! I applied your patch - please cross check.


Carsten 

Open Source Group                        sunShine - b:Integrated
================================================================
Carsten Ziegeler, S&N AG, Klingenderstrasse 5, D-33100 Paderborn
www.sundn.de                          mailto: cziegeler@sundn.de 
================================================================


> -----Ursprungliche Nachricht-----
> Von: ovidiu@orion.nsr.hp.com [mailto:ovidiu@orion.nsr.hp.com]Im Auftrag
> von Ovidiu Predescu
> Gesendet: Donnerstag, 7. Juni 2001 00:48
> An: cocoon-dev@xml.apache.org
> Betreff: [PATCH] [C2] BrowserImpl.xsl
> 
> 
> This patch fixes a null pointer exception when passing browser
> capabilities to the stylesheet, for browsers which are not described
> in the XML database.
> 
> -- 
> Ovidiu Predescu <ov...@cup.hp.com>
> http://orion.nsr.hp.com/ (inside HP's firewall only)
> http://www.geocities.com/SiliconValley/Monitor/7464/ (GNU, Emacs, 
> other stuff)
> 
> 
> Index: src/org/apache/cocoon/components/browser/BrowserImpl.xsl
> ===================================================================
> RCS file: 
> /Repository/Cocoon2/src/org/apache/cocoon/components/browser/Brows
> erImpl.xsl,v
> retrieving revision 1.1.1.1
> diff -u -I'\$Id:.*\$' -I'\$Author:.*\$' -I'\$Revision:.*\$' 
> -r1.1.1.1 BrowserImpl.xsl
> --- BrowserImpl.xsl	2001/05/08 18:42:19	1.1.1.1
> +++ BrowserImpl.xsl	2001/06/06 22:30:44
> @@ -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>
>  
> @@ -151,6 +151,9 @@
>     * @return a <code>String</code> value */
>    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()) {
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
> For additional commands, email: cocoon-dev-help@xml.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org