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

on 0.6.1 / 0.6.2 - java.lang.IllegalArgumentException: Key must be integer #65

Closed
ccfontes opened this issue Jun 15, 2013 · 1 comment
Closed

Comments

@ccfontes
Copy link

I get the exception below either with 0.6.1 or 0.6.2, but 0.6.0 is fine.
Running compojure 1.1.5 and clojure 1.4.0.

Also, my app handler:

(def app
  (noir.util.middleware/app-handler [private-routes routes]
        :middleware [wrap-bootstrap-resources wrap-exception]
        :access-rules
          [[{:redirect
              (fn []
                "/login")} private-pages]]))

Exception:

07:58:28 web.1     | java.lang.IllegalArgumentException: Key must be integer
07:58:28 web.1     |    at clojure.lang.APersistentVector.invoke(APersistentVector.java:261)
07:58:28 web.1     |    at noir.util.route$check_rules$fn__8497.invoke(route.clj:11)
07:58:28 web.1     |    at clojure.core$some.invoke(core.clj:2390)
07:58:28 web.1     |    at noir.util.route$check_rules.invoke(route.clj:11)
07:58:28 web.1     |    at clojure.lang.AFn.applyToHelper(AFn.java:163)
07:58:28 web.1     |    at clojure.lang.AFn.applyTo(AFn.java:151)
07:58:28 web.1     |    at clojure.core$apply.invoke(core.clj:603)
07:58:28 web.1     |    at clojure.core$partial$fn__4070.doInvoke(core.clj:2343)
07:58:28 web.1     |    at clojure.lang.RestFn.invoke(RestFn.java:408)
07:58:28 web.1     |    at clojure.core$map$fn__4087.invoke(core.clj:2434)
07:58:28 web.1     |    at clojure.lang.LazySeq.sval(LazySeq.java:42)
07:58:28 web.1     |    at clojure.lang.LazySeq.seq(LazySeq.java:60)
07:58:28 web.1     |    at clojure.lang.RT.seq(RT.java:473)
07:58:28 web.1     |    at clojure.core$seq.invoke(core.clj:133)
07:58:28 web.1     |    at clojure.core$filter$fn__4106.invoke(core.clj:2470)
07:58:28 web.1     |    at clojure.lang.LazySeq.sval(LazySeq.java:42)
07:58:28 web.1     |    at clojure.lang.LazySeq.seq(LazySeq.java:60)
07:58:28 web.1     |    at clojure.lang.LazySeq.first(LazySeq.java:82)
07:58:28 web.1     |    at clojure.lang.RT.first(RT.java:566)
07:58:28 web.1     |    at clojure.core$first.invoke(core.clj:55)
07:58:28 web.1     |    at noir.util.route$wrap_restricted$fn__8504.invoke(route.clj:19)
07:58:28 web.1     |    at compojure.response$eval1162$fn__1163.invoke(response.clj:27)
07:58:28 web.1     |    at compojure.response$eval1123$fn__1124$G__1114__1131.invoke(response.clj:10)
07:58:28 web.1     |    at compojure.core$make_route$fn__1290.invoke(core.clj:93)
07:58:28 web.1     |    at compojure.core$if_route$fn__1274.invoke(core.clj:39)
07:58:28 web.1     |    at compojure.core$if_method$fn__1267.invoke(core.clj:24)
07:58:28 web.1     |    at compojure.core$routing$fn__1296.invoke(core.clj:106)
07:58:28 web.1     |    at clojure.core$some.invoke(core.clj:2390)
07:58:28 web.1     |    at compojure.core$routing.doInvoke(core.clj:106)
07:58:28 web.1     |    at clojure.lang.RestFn.applyTo(RestFn.java:139)
07:58:28 web.1     |    at clojure.core$apply.invoke(core.clj:603)
07:58:28 web.1     |    at compojure.core$routes$fn__1300.invoke(core.clj:111)
07:58:28 web.1     |    at compojure.core$routing$fn__1296.invoke(core.clj:106)
07:58:28 web.1     |    at clojure.core$some.invoke(core.clj:2390)
07:58:28 web.1     |    at compojure.core$routing.doInvoke(core.clj:106)
07:58:28 web.1     |    at clojure.lang.RestFn.applyTo(RestFn.java:139)
07:58:28 web.1     |    at clojure.core$apply.invoke(core.clj:603)
07:58:28 web.1     |    at compojure.core$routes$fn__1300.invoke(core.clj:111)
07:58:28 web.1     |    at noir.util.middleware$wrap_request_map$fn__5215.invoke(middleware.clj:45)
07:58:28 web.1     |    at ring.middleware.keyword_params$wrap_keyword_params$fn__4190.invoke(keyword_params.clj:27)
07:58:28 web.1     |    at ring.middleware.nested_params$wrap_nested_params$fn__4232.invoke(nested_params.clj:65)
07:58:28 web.1     |    at ring.middleware.params$wrap_params$fn__1544.invoke(params.clj:55)
07:58:28 web.1     |    at ring.middleware.multipart_params$wrap_multipart_params$fn__5007.invoke(multipart_params.clj:103)
07:58:28 web.1     |    at compojure.core$routing$fn__1296.invoke(core.clj:106)
07:58:28 web.1     |    at clojure.core$some.invoke(core.clj:2390)
07:58:28 web.1     |    at compojure.core$routing.doInvoke(core.clj:106)
07:58:28 web.1     |    at clojure.lang.RestFn.applyTo(RestFn.java:139)
07:58:28 web.1     |    at clojure.core$apply.invoke(core.clj:603)
07:58:28 web.1     |    at compojure.core$routes$fn__1300.invoke(core.clj:111)
07:58:28 web.1     |    at app.exception$wrap_exception$fn__9269.invoke(exception.clj:57)
07:58:28 web.1     |    at noir.util.middleware$wrap_access_rules$fn__5229.invoke(middleware.clj:111)
07:58:28 web.1     |    at noir.validation$wrap_noir_validation$fn__5082.invoke(validation.clj:135)
07:58:28 web.1     |    at noir.cookies$noir_cookies$fn__5118.invoke(cookies.clj:66)
07:58:28 web.1     |    at ring.middleware.cookies$wrap_cookies$fn__4837.invoke(cookies.clj:160)
07:58:28 web.1     |    at noir.session$noir_flash$fn__5159.invoke(session.clj:141)
07:58:28 web.1     |    at ring.middleware.flash$wrap_flash$fn__5019.invoke(flash.clj:14)
07:58:28 web.1     |    at noir.session$noir_session$fn__5149.invoke(session.clj:96)
07:58:28 web.1     |    at ring.middleware.session$wrap_session$fn__4919.invoke(session.clj:43)
07:58:28 web.1     |    at ring.middleware.cookies$wrap_cookies$fn__4837.invoke(cookies.clj:160)
07:58:28 web.1     |    at clojure.lang.Var.invoke(Var.java:415)
07:58:28 web.1     |    at ring.middleware.refresh$wrap_with_script$fn__1620.invoke(refresh.clj:80)
07:58:28 web.1     |    at compojure.core$routing$fn__1296.invoke(core.clj:106)
07:58:28 web.1     |    at clojure.core$some.invoke(core.clj:2390)
07:58:28 web.1     |    at compojure.core$routing.doInvoke(core.clj:106)
07:58:28 web.1     |    at clojure.lang.RestFn.applyTo(RestFn.java:139)
07:58:28 web.1     |    at clojure.core$apply.invoke(core.clj:603)
07:58:28 web.1     |    at compojure.core$routes$fn__1300.invoke(core.clj:111)
07:58:28 web.1     |    at ring.middleware.params$wrap_params$fn__1544.invoke(params.clj:55)
07:58:28 web.1     |    at ring.middleware.reload$wrap_reload$fn__973.invoke(reload.clj:18)
07:58:28 web.1     |    at ring.middleware.stacktrace$wrap_stacktrace_log$fn__773.invoke(stacktrace.clj:15)
07:58:28 web.1     |    at ring.middleware.stacktrace$wrap_stacktrace_web$fn__825.invoke(stacktrace.clj:79)
07:58:28 web.1     |    at ring.adapter.jetty$proxy_handler$fn__86.invoke(jetty.clj:18)
07:58:28 web.1     |    at ring.adapter.jetty.proxy$org.eclipse.jetty.server.handler.AbstractHandler$0.handle(Unknown Source)
07:58:28 web.1     |    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)
07:58:28 web.1     |    at org.eclipse.jetty.server.Server.handle(Server.java:349)
07:58:28 web.1     |    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:452)
07:58:28 web.1     |    at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:884)
07:58:28 web.1     |    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:938)
07:58:28 web.1     |    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634)
07:58:28 web.1     |    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)
07:58:28 web.1     |    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)
07:58:28 web.1     |    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)
07:58:28 web.1     |    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)
07:58:28 web.1     |    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)
07:58:28 web.1     |    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)
@yogthos
Copy link
Contributor

yogthos commented Jun 15, 2013

There's been a breaking change regarding the access rules handling in 0.6.2. The change is documented here.

Using the 0.6.2 API the handler should look as follows:

    (def app
      (noir.util.middleware/app-handler [private-routes routes]
            :middleware [wrap-bootstrap-resources wrap-exception]
            :access-rules
              [{:redirect (fn [request] "/login") ;;this could also be just a string "/login" if fn isn't doing anything
                :rules [private-pages]}]))

Also, the restricted macro now wraps the handler instead of the route:

   (GET "/foo" [] (restricted foo-handler))

This was introduced to make it play nicer with things like context from Compojure.
Finally, the access-rule macro has been deprecated in favor of specifying rule groups directly in the :access-rules key.

@yogthos yogthos closed this as completed Jun 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants