Uploaded image for project: 'Immutant'
  1. Immutant
  2. IMMUTANT-633

Ring request map's .hashCode throws NPE if any key is nil

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 2.1.8
    • Fix Version/s: 2.1.9
    • Labels:
      None
    • Environment:

      [org.immutant/web "2.1.8"]
      [org.clojure/clojure "1.8.0"]

    • Steps to Reproduce:
      Hide

      (ns immutant-web-issue.core
        (:require immutant.web)
        (:gen-class))
       
      (defn -main []
        (future
          (immutant.web/run
            (fn [req]
              (println "getting the hashCode")
              ;; the next line blows up!
              (println (.hashCode req))
              ;; we never reach this line
              {:status 200
               :body "ok"})))
        (Thread/sleep 5000)
        (slurp "http://localhost:8080"))
       
       
      
      

      Show
      (ns immutant-web-issue.core (:require immutant.web) (:gen-class))   (defn -main [] (future (immutant.web/run (fn [req] (println "getting the hashCode") ;; the next line blows up! (println (.hashCode req)) ;; we never reach this line {:status 200 :body "ok"}))) (Thread/sleep 5000) (slurp "http://localhost:8080"))    

      Description

      See upstream patch: https://github.com/ztellman/potemkin/pull/53

      Essentially, anything that ends up calling .hashCode() on a LazyMap results in an NPE if any of the keys in the LazyMap are nil. Notably, the logging library timbre invokes .hashCode while formatting its log messages.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                emidln Brandon Adams
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: