Alex,

Thanks for bring all those issues to our attention. I've applied your patch
and also replaced all the System.out and System.err by logger calls in
Base64.

Best regards,
Jerome  

> -----Message d'origine-----
> De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] De la 
> part de Alex Milowski
> Envoyé : jeudi 16 août 2007 00:40
> À : [email protected]
> Objet : Null pointer exception with Grizzy Connector
> 
> I was testing grizzy when I ran into a null pointer exception while
> parsing credentials.
> 
> Here's the fix:
> 
> Index: SecurityUtils.java
> ===================================================================
> --- SecurityUtils.java  (revision 2136)
> +++ SecurityUtils.java  (working copy)
> @@ -292,8 +292,12 @@
> 
>                  if 
> (result.getScheme().equals(ChallengeScheme.HTTP_BASIC)) {
>                      try {
> -                        credentials = new String(Base64.decode(result
> -                                .getCredentials()), "US-ASCII");
> +                        byte [] credentialsEncoded =
> Base64.decode(result.getCredentials());
> +                        if (credentialsEncoded==null) {
> +                           logger.warning("Cannot decode credentials:
> "+result.getCredentials());
> +                           return null;
> +                       }
> +                        credentials = new String(credentialsEncoded,
> "US-ASCII");
>                          int separator = credentials.indexOf(':');
> 
> 
> Unfortunately, this error is cause by the authorization header being
> mangled somehow
> in the grizzly connector.  I haven't located the problem yet.
> 
> BTW, there are some System.out and System.err uses in 
> Base64.java that would be
> better served as either an exception or being set to a Logger 
> instance.
> 
> --Alex Milowski

Reply via email to