Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

NPE on repo update #39

Closed
g4s8 opened this issue Jun 16, 2021 · 12 comments · Fixed by #40 or #41
Closed

NPE on repo update #39

g4s8 opened this issue Jun 16, 2021 · 12 comments · Fixed by #40 or #41
Assignees
Labels
bug Something isn't working

Comments

@g4s8
Copy link
Member

g4s8 commented Jun 16, 2021

When trying to update or create repo via dashboard, management API throws NPE and returns 500 status:

java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "com.amihaiemil.eoyaml.YamlMapping.value(String)" because "repo" is null
java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "com.amihaiemil.eoyaml.YamlMapping.value(String)" because "repo" is null
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException: Cannot invoke "com.amihaiemil.eoyaml.YamlMapping.value(String)" because "repo" is null
	at com.artipie.management.api.ApiRepoUpdateSlice.lambda$response$2(ApiRepoUpdateSlice.java:118)
	... 4 more

Artipie version is v0.20

@g4s8 g4s8 added the bug Something isn't working label Jun 16, 2021
@olenagerasimova
Copy link
Member

@g4s8 what is the input? Could you please copy yaml here?
Also, I cannot open my dashboard on central from chrome, it says 403. When I am tying curl with my login and password, it says 401. What can be the problem?

@g4s8
Copy link
Member Author

g4s8 commented Jun 16, 2021

@g4s8 what is the input? Could you please copy yaml here?
Also, I cannot open my dashboard on central from chrome, it says 403. When I am tying curl with my login and password, it says 401. What can be the problem?

@olenagerasimova I've fixed your permissions in central. The config file is default auto-generated config for binary repo:

repo:
  type: file
  storage: default
  permissions:
    g4s8:
      - upload
      - download
    "*":
      - download

The request is:

POST /api/repos/g4s8 HTTP/1.1
Host: central.artipie.com
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,ru;q=0.7,en;q=0.3
Accept-Encoding: gzip, deflate, br
Content-Type: application/x-www-form-urlencoded
Content-Length: 201
Origin: https://central.artipie.com
Referer: https://central.artipie.com/dashboard/g4s8/newbin?type=file
Pragma: no-cache
Cache-Control: no-cache

config=repo%3A%0D%0A++type%3A+file%0D%0A++storage%3A+default%0D%0A++permissions%3A%0D%0A++++g4s8%3A%0D%0A++++++-+upload%0D%0A++++++-+download%0D%0A++++%22*%22%3A%0D%0A++++++-+download%0D%0A&repo=newbin

@g4s8 g4s8 closed this as completed in #40 Jun 16, 2021
g4s8 pushed a commit that referenced this issue Jun 16, 2021
Closes #39 - fixed 2 problems in ApiRepoUpdateSlice:
 1) parameters separator was expected to be ; instead of &
 2) storage settings were always expected to be yaml, but there also can be string for default value

PR: #40
@olenagerasimova
Copy link
Member

@rultor release, tag=0.4.6

@rultor
Copy link

rultor commented Jun 16, 2021

@rultor release, tag=0.4.6

@olenagerasimova OK, I will release it now. Please check the progress here

@rultor
Copy link

rultor commented Jun 16, 2021

@rultor release, tag=0.4.6

@olenagerasimova Done! FYI, the full log is here (took me 8min)

g4s8 pushed a commit to artipie/artipie that referenced this issue Jun 17, 2021
Related to artipie/management-api#39 - Updated management-api to 0.4.6

PR: #914
@genryxy
Copy link
Contributor

genryxy commented Jun 18, 2021

@g4s8 @olenagerasimova I've tried to build and run locally the latest version of Artipie but got the same error response

@olenagerasimova
Copy link
Member

@genryxy are you sure you have rebuilt the image, updated source code?

@genryxy
Copy link
Contributor

genryxy commented Jun 18, 2021

@olenagerasimova I fetched changes from git, ran mvn package -Pdocker-build and then mvn install, after that launched artipie using artipie:1.0-SNAPSHOT

@g4s8 g4s8 reopened this Jun 18, 2021
@g4s8
Copy link
Member Author

g4s8 commented Jun 18, 2021

@olenagerasimova got the same error in new artipie release v0.20.1 which includes this fix (artipie/artipie@1a051b9)

java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "com.amihaiemil.eoyaml.YamlMapping.value(String)" because "repo" is null
java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "com.amihaiemil.eoyaml.YamlMapping.value(String)" because "repo" is null
	at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.completeThrowable(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException: Cannot invoke "com.amihaiemil.eoyaml.YamlMapping.value(String)" because "repo" is null
	at com.artipie.management.api.ApiRepoUpdateSlice.lambda$response$2(ApiRepoUpdateSlice.java:118)
	... 4 more

@g4s8 g4s8 closed this as completed in #41 Jun 21, 2021
g4s8 pushed a commit that referenced this issue Jun 21, 2021
Closes #39 - Body with repo configs should be url-decoded.

PR: #41
@olenagerasimova
Copy link
Member

@rultor release, tag=0.4.7

@rultor
Copy link

rultor commented Jun 21, 2021

@rultor release, tag=0.4.7

@olenagerasimova OK, I will release it now. Please check the progress here

@rultor
Copy link

rultor commented Jun 21, 2021

@rultor release, tag=0.4.7

@olenagerasimova Done! FYI, the full log is here (took me 9min)

g4s8 added a commit that referenced this issue Dec 22, 2021
* Add absent repos

* cicd(release): added release config for #38

* Fixed parameters and storage settings format in `ApiRepoUpdateSlice`

Closes #39 - fixed 2 problems in ApiRepoUpdateSlice:
 1) parameters separator was expected to be ; instead of &
 2) storage settings were always expected to be yaml, but there also can be string for default value

PR: #40

* Repo config should be url decoded

Closes #39 - Body with repo configs should be url-decoded.

PR: #41

* Improved updating storage settings functionality (#43)

Closes #42 - simplified and fixed updating storage scenario in ApiRepoUpdateSlice.

On dashboard we always work with whole yaml repo settings, so there is no need to update section by section, we can simply rewrite the whole file after checking that required fields (type and storage) are present in the new version.

* fix: added repository configuration descriptions

Added description for several repositories.

Issue: artipie/artipie#317
PR: #44

* fix: handle errors in `ApiRepoUpdateSlice` (#45)

Handle errors in `ApiRepoUpdateSlice` (#45)

Closes: artipie/artipie#320

* feat(conda): added conda repository to dashboard (#46)

Added anaconda repository option to dashboard and configuration description.

Ticket: artipie/artipie#317

* doc: verbose link name

Clarified API reference link name.

Closes: #47

* fix: add rq line to get users in `FromRqLine` (#48)

Part of artipie/artipie#965
Added rq line to get users in FromRqLine, corresponding test and updated http and asto.

* feat: added slice for repo delete (#49)

Add slice to delete a repo. Added disabled test for this slice as it is necessary to implement delete operation in FakeConfigFile class.

Ticket: artipie/artipie#321

* feat: add slice for routing `POST` requests (#51)

Added slice ApiRepoPostRtSlice for routing post requests by parsing body content. This class will be used in artipie module. Test will be added in next PR.

Ticket: artipie/artipie#321

* deps: bumped ppom and other deps (#53)

 * Bumped ppom from 0.5.1 to 1.1.0
 * Bumped asto from v1.9.0 to v1.10.0
 * Bumped http-client from 0.3.2 to 0.3.6
 * Bumped vert-server from 0.4 to 0.5

* refactor: extract class for body parsing (#52)

Extract class for parsing body content for receiving some content.

Close: #50

* test: enable test for delete and add for postRt (#55)

Enable and a bit extend test for ApiRepoDeleteSlice and add test for ApiRepoPostRtSlice.

Ref: artipie/artipie#321

* refactor: use storages instead of settings storage

Co-authored-by: Kirill <g4s8.public@gmail.com>
Co-authored-by: Alena <olena.gerasimova@gmail.com>
g4s8 added a commit that referenced this issue Dec 27, 2021
* Add absent repos

* cicd(release): added release config for #38

* Fixed parameters and storage settings format in `ApiRepoUpdateSlice`

Closes #39 - fixed 2 problems in ApiRepoUpdateSlice:
 1) parameters separator was expected to be ; instead of &
 2) storage settings were always expected to be yaml, but there also can be string for default value

PR: #40

* Repo config should be url decoded

Closes #39 - Body with repo configs should be url-decoded.

PR: #41

* Improved updating storage settings functionality (#43)

Closes #42 - simplified and fixed updating storage scenario in ApiRepoUpdateSlice.

On dashboard we always work with whole yaml repo settings, so there is no need to update section by section, we can simply rewrite the whole file after checking that required fields (type and storage) are present in the new version.

* fix: added repository configuration descriptions

Added description for several repositories.

Issue: artipie/artipie#317
PR: #44

* fix: handle errors in `ApiRepoUpdateSlice` (#45)

Handle errors in `ApiRepoUpdateSlice` (#45)

Closes: artipie/artipie#320

* feat(conda): added conda repository to dashboard (#46)

Added anaconda repository option to dashboard and configuration description.

Ticket: artipie/artipie#317

* doc: verbose link name

Clarified API reference link name.

Closes: #47

* fix: add rq line to get users in `FromRqLine` (#48)

Part of artipie/artipie#965
Added rq line to get users in FromRqLine, corresponding test and updated http and asto.

* feat: added slice for repo delete (#49)

Add slice to delete a repo. Added disabled test for this slice as it is necessary to implement delete operation in FakeConfigFile class.

Ticket: artipie/artipie#321

* feat: add slice for routing `POST` requests (#51)

Added slice ApiRepoPostRtSlice for routing post requests by parsing body content. This class will be used in artipie module. Test will be added in next PR.

Ticket: artipie/artipie#321

* deps: bumped ppom and other deps (#53)

 * Bumped ppom from 0.5.1 to 1.1.0
 * Bumped asto from v1.9.0 to v1.10.0
 * Bumped http-client from 0.3.2 to 0.3.6
 * Bumped vert-server from 0.4 to 0.5

* refactor: extract class for body parsing (#52)

Extract class for parsing body content for receiving some content.

Close: #50

* test: enable test for delete and add for postRt (#55)

Enable and a bit extend test for ApiRepoDeleteSlice and add test for ApiRepoPostRtSlice.

Ref: artipie/artipie#321

* fix: delete from items from substorage

Co-authored-by: Kirill <g4s8.public@gmail.com>
Co-authored-by: Alena <olena.gerasimova@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
4 participants