Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NumberFormatException on PAPE max_auth_age #190

Open
GoogleCodeExporter opened this issue Jun 4, 2015 · 0 comments
Open

NumberFormatException on PAPE max_auth_age #190

GoogleCodeExporter opened this issue Jun 4, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

A malformed PAPE request that sends max_auth_age as a non-integer causes 
PapeRequest.getMaxAuthAge() to throw a NumberFormatException , which is not 
declared in the method signature or mentioned in the javadoc.

Should either handle the error internally or make it obvious to API users about 
this behavior.  

Here is how I handle it:

Index: src/org/openid4java/message/pape/PapeRequest.java
===================================================================
--- src/org/openid4java/message/pape/PapeRequest.java   (revision 733)
+++ src/org/openid4java/message/pape/PapeRequest.java   (working copy)
@@ -160,9 +160,13 @@
     {
         String maxAuthAge = getParameterValue("max_auth_age");

-        if (maxAuthAge != null)
-            return Integer.parseInt(maxAuthAge);
-        else
+        if (maxAuthAge != null) {
+            try {
+                return Integer.parseInt(maxAuthAge);
+            } catch (NumberFormatException e) {
+                return -1;
+            }
+        } else
             return -1;
     }




Original issue reported on code.google.com by [email protected] on 8 Feb 2013 at 6:11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant