ipfs-shipyard / java-ipfs-http-client

A Java implementation of the HTTP IPFS API
MIT License
536 stars 244 forks source link

Exception thrown for ipfs.key.list() #190

Closed javaspeak closed 1 year ago

javaspeak commented 2 years ago

Exception thrown for ipfs.key.list()

io.ipfs.cid.Cid$CidEncodingException: Invalid cid bytes: 0172002408011220739f55f9afc90aa8f6529026941280b520652ff5c89b78e198b1bf37a5c8b280 at io.ipfs.cid.Cid.cast(Cid.java:157) at io.ipfs.cid.Cid.decode(Cid.java:139) at io.ipfs.api.KeyInfo.fromJson(KeyInfo.java:42) at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195) at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1624) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474) at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578) at io.ipfs.api.IPFS$Key.list(IPFS.java:236)

When debugging it goes into this code:

public static Codec lookup(long c) { if (!lookup.containsKey(c)) throw new IllegalStateException("Unknown Codec type: " + c); return lookup.get(c); }

The value of c is: 114

When debugging the json coming back, it looks fine and very similar to running the following on the command line:

json when debugging:

{"Keys":[{"Name":"self","Id":"k51qzi5uqu5dj2bzd3tlqzpi3uwvikm261xax1recqzqu6zxx4x8gxyxvpalxc"},{"Name":"jd","Id":"k51qzi5uqu5dgc883u0idpp6u8iyv4rh7hxgubrpflgi6vhgq1miyab6v4ayn4"}]}

ipfs key list -l

It is falling over on trying to parse the codec to get the CID.

Is this project supported anymore?

Should we use the code or is it dead and out of date?

Thank you

javaspeak commented 2 years ago

Noticed this ticket:

 https://github.com/ipfs-shipyard/java-ipfs-http-client/issues/182

Does that mean we need to wait for a new release for cid to work properly?

javaspeak commented 2 years ago

I cloned java-cid and changed pom to:

v1.3.2

Then I ran:

mvn package

Then I added the following to my pom.xml:

`

com.github.ipld java-cid v1.3.2

`

I basically overid the version of cid dragged in via java-ipfs-http-client and its java-multiaddr

Now it works.

This has wasted some time.

Who can release a new release of java-cid with the master code and then update the poms of:

 java-multiaddr

and dependencies?

Basically the production releases are broken.

The master of java-cid fixes the issue but a new release is required to absorb the fix. Who can do another release - big please ;-)

kevodwyer commented 1 year ago

Resolved in recent release