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

Issue with clj-add-project-dependency - NullPointerException #382

Closed
mukundzare opened this issue Jun 12, 2022 · 5 comments
Closed

Issue with clj-add-project-dependency - NullPointerException #382

mukundzare opened this issue Jun 12, 2022 · 5 comments

Comments

@mukundzare
Copy link

Expected behavior

Add missing dependency using cljr-add-project-dependency should show me a list of dependencies to add.

Actual behavior

I get an error:

Retrieving list of available libraries...
cljr--get-error-value: Error in nrepl-refactor: java.util.concurrent.ExecutionException: java.lang.NullPointerException: Cannot invoke "String.length()" because "s" is null
 at java.util.concurrent.FutureTask.report (FutureTask.java:122)
    java.util.concurrent.FutureTask.get (FutureTask.java:191)
    clojure.core$deref_future.invokeStatic (core.clj:2304)
    clojure.core$future_call$reify__8477.deref (core.clj:6976)
    clojure.core$deref.invokeStatic (core.clj:2324)
    clojure.core$deref.invoke (core.clj:2310)
    refactor_nrepl.artifacts$update_artifact_cache_BANG_.invokeStatic (artifacts.clj:126)
    refactor_nrepl.artifacts$update_artifact_cache_BANG_.invoke (artifacts.clj:122)
    refactor_nrepl.artifacts$artifact_list.invokeStatic (artifacts.clj:137)
    refactor_nrepl.artifacts$artifact_list.invoke (artifacts.clj:134)
    clojure.lang.Var.invoke (Var.java:384)
    refactor_nrepl.middleware$artifact_list_reply$fn__3335.invoke (middleware.clj:121)
    refactor_nrepl.ns.libspec_allowlist$with_memoized_libspec_allowlist_STAR_.invokeStatic (libspec_allowlist.clj:28)
    refactor_nrepl.ns.libspec_allowlist$with_memoized_libspec_allowlist_STAR_.invoke (libspec_allowlist.clj:26)
    refactor_nrepl.middleware$artifact_list_reply.invokeStatic (middleware.clj:121)
    refactor_nrepl.middleware$artifact_list_reply.invoke (middleware.clj:120)
    refactor_nrepl.middleware$wrap_refactor$fn__3418.invoke (middleware.clj:221)
    nrepl.middleware$wrap_conj_descriptor$fn__1221.invoke (middleware.clj:16)
    cider.nrepl$wrap_classpath$fn__3585.invoke (nrepl.clj:137)
    nrepl.middleware$wrap_conj_descriptor$fn__1221.invoke (middleware.clj:16)
    nrepl.middleware.session$session$fn__1660.invoke (session.clj:325)
    nrepl.middleware$wrap_conj_descriptor$fn__1221.invoke (middleware.clj:16)
    nrepl.server$default_handler$fn__2228.invoke (server.clj:141)
    nrepl.server$handle_STAR_.invokeStatic (server.clj:24)
    nrepl.server$handle_STAR_.invoke (server.clj:21)
    nrepl.server$handle$fn__2196.invoke (server.clj:41)
    clojure.core$binding_conveyor_fn$fn__5772.invoke (core.clj:2034)
    clojure.lang.AFn.call (AFn.java:18)
    java.util.concurrent.FutureTask.run (FutureTask.java:264)
    java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1130)
    java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:630)
    java.lang.Thread.run (Thread.java:831)
Caused by: java.lang.NullPointerException: Cannot invoke "String.length()" because "s" is null
 at java.io.StringReader.<init> (StringReader.java:50)
    refactor_nrepl.inlined_deps.datajson.v2v3v1.clojure.data.json$read_str.invokeStatic (json.clj:416)
    refactor_nrepl.inlined_deps.datajson.v2v3v1.clojure.data.json$read_str.doInvoke (json.clj:408)
    clojure.lang.RestFn.invoke (RestFn.java:439)
    refactor_nrepl.artifacts$get_mvn_artifacts_BANG_.invokeStatic (artifacts.clj:76)
    refactor_nrepl.artifacts$get_mvn_artifacts_BANG_.invoke (artifacts.clj:69)
    refactor_nrepl.artifacts$get_artifacts_from_mvn_central_BANG_$fn__5479.invoke (artifacts.clj:102)
    clojure.core$map$fn__5884.invoke (core.clj:2759)
    clojure.lang.LazySeq.sval (LazySeq.java:42)
    clojure.lang.LazySeq.seq (LazySeq.java:51)
    clojure.lang.RT.seq (RT.java:535)
    clojure.core$seq__5419.invokeStatic (core.clj:139)
    clojure.core$apply.invokeStatic (core.clj:662)
    clojure.core$mapcat.invokeStatic (core.clj:2787)
    clojure.core$mapcat.doInvoke (core.clj:2787)
    clojure.lang.RestFn.invoke (RestFn.java:423)
    refactor_nrepl.artifacts$get_artifacts_from_mvn_central_BANG_.invokeStatic (artifacts.clj:101)
    refactor_nrepl.artifacts$get_artifacts_from_mvn_central_BANG_.invoke (artifacts.clj:98)
    refactor_nrepl.artifacts$update_artifact_cache_BANG_$fn__5511.invoke (artifacts.clj:125)
    clojure.core$binding_conveyor_fn$fn__5772.invoke (core.clj:2034)
    clojure.lang.AFn.call (AFn.java:18)
    java.util.concurrent.FutureTask.run (FutureTask.java:264)
    java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1130)
    java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:630)
    java.lang.Thread.run (Thread.java:831)

Steps to reproduce the problem

Follow the steps as shown in the video here: https://www.youtube.com/watch?v=aWJPlRVZX90 . The place where the author @magnars adds a project dependency is where I am getting the error -- at mark 2:40.

Environment & Version information

clj-refactor.el version information

clj-refactor 3.5.2 (package: 20220315.2251), refactor-nrepl 3.5.2

CIDER version information

;; CIDER 1.4.0 (Kyiv), nREPL 0.9.0
;; Clojure 1.10.3, Java 16.0.1

Leiningen or Boot version

Leiningen 2.9.6

Emacs version

28.1 (Native compilation)

Operating system

Ubuntu 20.04

@vemv
Copy link
Member

vemv commented Jun 14, 2022

Hi, could you verify if this is an intermittent issue?

I think sometimes these http requests just fail, there's some retry logic but if the http endpoint is down there's not much we can do

@mukundzare
Copy link
Author

@vemv, nope. It never worked I have been trying it every few hours but it just fails.

@vemv
Copy link
Member

vemv commented Jun 14, 2022

Alright! I'll have a look when I can.

@vemv vemv transferred this issue from clojure-emacs/clj-refactor.el Jul 5, 2022
vemv added a commit that referenced this issue Jul 5, 2022
vemv added a commit that referenced this issue Jul 5, 2022
vemv added a commit that referenced this issue Jul 5, 2022
@vemv vemv closed this as completed in beaa226 Jul 5, 2022
@vemv
Copy link
Member

vemv commented Jul 5, 2022

I've created clj-refactor.el v3.5.4 just now. It will be available in melpa within a few hours.

It features better error handling if anything unexpected happens while fetching these deps over http. It also applies a timeout.

If it still doesn't work the issue might be deeper. But it works on my repl and in CI. There's a proxy-opts setting.

Cheers - V

@mukundzare
Copy link
Author

Thank @vemv : I will check this out!

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