Note that there are some explanatory texts on larger screens.

plurals
  1. POclojure.tools.logging EvalReader use?
    text
    copied!<p>I think this is a bug in <code>clojure/tools.logging</code>. I have the following <code>db.clj</code> file. What it does is unimportant. The important part is that for safety I have disabled the <code>*read-eval*</code>. I invoke <code>db/start</code> with no problems. However, if I uncomment the <code>#_(log/info "Failed to bootstrap")</code> form, it throws an <code>EvalReader not allowed</code> error. I've tried all sorts of combinations for the <code>log/info</code> call. If it's outside of the <code>try</code> block, it's fine. Inside the <code>try</code> block anywhere, whether it's in the body, <code>catch</code>, or <code>finally</code>, it raises this exception. However, when I wrap a <code>try</code> around <code>log/info</code> elsewhere, it's fine.</p> <p>What gives?</p> <pre><code>(ns extenium.db (:require [clojure.tools.logging :as log] [clojure.java.io :as io]) (:import com.thinkaurelius.titan.core.TitanGraph com.thinkaurelius.titan.core.TitanFactory)) (def ^:private sentinel- (Object.)) (def ^:private db- (atom nil)) ... (defn start [^String path] (locking sentinel- (log/info "Starting database at path" path) (let [exists (.exists (io/file path)) ^TitanGraph db_ (TitanFactory/open path)] (if exists (log/info "Path" path "exists") (log/info "Path" path "does not exist")) (log/info "Starting database engine") (swap! db- (constantly db_)) (log/info "Started database engine") (if (not exists) (try (bootstrap-) (catch Throwable t #_(log/info "Failed to bootstrap") (stop) (.delete (io/file path)) (throw t))))) (log/info "Started database") true)) </code></pre> <p>EDIT: Trimmed down code per @alex-taggart. bootstrap- implementation not shown. I had originally included everything because this seemed like a context-specific bug and I felt it was safer to provide as much context as possible.</p> <p>EDIT: Per @chouser, added how I'm disabling <code>*read-eval*</code>. This is the template that is generated by <code>lein new app</code>.</p> <pre><code>(defn -main "The main entry point into Extenium." [&amp; args] ;; Prevent arbitrary eval injection (alter-var-root #'*read-eval* (constantly false)) ;; Initialize system settings from the command line and configuration file (init!- args) ;; Start the service (start!-)) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload