Giter Club home page Giter Club logo

coinmarketcap-api's Introduction

  • ๐Ÿ‘‹ Hi, Iโ€™m @Camphul
  • ๐Ÿ‘€ Iโ€™m interested in Java, Golang, Docker, Kubernetes, Spring Boot, OpenIDConnect

coinmarketcap-api's People

Contributors

camphul avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

coinmarketcap-api's Issues

Call CoinMarketList.sort failed because it is sorting an UnmodifiableList

When I invoke CoinMarketList.sort() in my code, I saw exception:

java.lang.UnsupportedOperationException
	at java.util.Collections$UnmodifiableList.sort(Collections.java:1331)
	at com.lucadev.coinmarketcap.model.CoinMarketList.sort(CoinMarketList.java:133)

Then I found what it does in sort:

@Override public void sort(Comparator<? super CoinMarket> comparator) { marketList.sort(comparator); }

However marketList is an UnmodifiableList as it is instantiated by this.marketList = Collections.unmodifiableList(new ArrayList<>(markets));

Json serialization

Hi Lucas

nice job, thx !
I would be interested but i wonder why the api doesn't produce json formatted result like this:

{
"PriceQuote": {
"price": 7094.8268024,
"dayVolume": 3.9292290664E9,
"marketCap": 1.20927151089E11,
"hourChange": 0.28,
"dayChange": 0.45,
"weekChange": -3.03
}
}

It would be much easier to automatically deserialize the response in a java program !

MrIzi

Deploy to MavenCentral or JCenter

Your API looks nice, and it would reduce the friction between the user and the library if the artifact were released in a binary repository (either MavenCentral or JCenter).

Gives an error message

Exception in thread "main" javax.ws.rs.client.ResponseProcessingException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "attention" (class com.lucadev.coinmarketcap.model.CoinListingsApiResponse), not marked as ignorable (2 known properties: "data", "metadata"])
at [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@6d7fc27; line: 12629, column: 2] (through reference chain: com.lucadev.coinmarketcap.model.CoinListingsApiResponse["attention"])

Exception in thread "main" javax.ws.rs.client.ResponseProcessingException

After installing the library, i tried to test it but the following errors popped out.

Exception in thread "main" javax.ws.rs.client.ResponseProcessingException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "attention" (class com.lucadev.coinmarketcap.model.CoinMarketListApiResponse), not marked as ignorable (2 known properties: "data", "metadata"])
......

The fix is to add Jackson's class-level annotation to ignore non declared property at the CoinMarketListApiResponse file.

Support Jersey 2.26

In case if Jersey dependencies will be managed to version 2.26 we have this exception:

ava.lang.NullPointerException: null
	at com.lucadev.coinmarketcap.GlobalTicker.get(GlobalTicker.java:71)
	at ....refresh(....java:16)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.springframework.scheduling.support.ScheduledMethodRunnable.run(ScheduledMethodRunnable.java:65)
	at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

As an example of when this may be the problem is when we are using Spring Boot 2.0.0.RELEASE as maven parent, in this case many popular dependencies including Jersey are managed to latest stable versions.

As temporary workaround we can change version of Jersey dependencies back to 2.25.1 and then we will don't have this exception.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.