Code Monkey home page Code Monkey logo

three4j's People

Contributors

marchof avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

three4j's Issues

Missing values in Gateway.Capability

General Description:

  • It seams like Threema has updated the possible capabilities and now Gateway.Capability is missing some values.

Way to reproduce:

  • When I try to request the capabilities of my ThreemaId with Gateway#getCapabilities(ThreemaId threemaid) I receive the following exception:
Exception in thread "main" java.lang.IllegalArgumentException: No enum constant com.mountainminds.three4j.Gateway.Capability.ballot
	at java.base/java.lang.Enum.valueOf(Enum.java:273)
	at com.mountainminds.three4j.Gateway$Capability.valueOf(Gateway.java:232)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:197)
	at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:992)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
	at com.mountainminds.three4j.Gateway.getCapabilities(Gateway.java:248)

Reason

  • The reason is that the result of the request contains ballot,call,videocall,image,file,text,video,audio,pfs,group,groupcall and the enum only contains text, image, video, audio, file.

Suggestions

  • The missing values should be added to the enum
  • Instead of using Capability::valueOf some other mapping method should be used that doesn't throw an exception when trying to map to Gateway.Capability
    Example:
stream(result.split(","))
           .map(str -> Arrays.stream(Capability.values()).filter(cap -> cap.name().equals(str)).findFirst())
           .filter(Optional::isPresent)
           .map(Optional::get)
           .collect(toSet());

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.