raiderrobotix / blue-alliance-api-java-library Goto Github PK
View Code? Open in Web Editor NEWJava library for The Blue Alliance APIv3
Home Page: http://raiderrobotix.github.io/blue-alliance-api-java-library
License: MIT License
Java library for The Blue Alliance APIv3
Home Page: http://raiderrobotix.github.io/blue-alliance-api-java-library
License: MIT License
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String com.thebluealliance.api.v3.requests.APIResponse.getJson()' on a null object reference
My code:
TBA tba = new TBA("key");
Team robot = new Team();
TeamRequest c = tba.teamRequest;
Event[] e = c.getEvents(2658);(the error seems to be directed to this line)
robot = c.getTeam(2658);
When calling getTeams
on an EventRequest
, the JSON parser will invoke the wrong constructor for Team
and result in an IllegalAccessException
.
https://github.com/RaiderRobotix/blue-alliance-api-java-library/blob/master/src/main/java/com/thebluealliance/api/v3/requests/EventRequest.java#L57
https://github.com/RaiderRobotix/blue-alliance-api-java-library/blob/master/src/main/java/com/thebluealliance/api/v3/models/Team.java#L17
java.lang.RuntimeException: Failed to invoke com.thebluealliance.api.v3.models.Team() throws java.lang.IllegalAccessException with no args
at com.google.gson.internal.ConstructorConstructor$3.construct(ConstructorConstructor.java:118)
Caused by: java.lang.IllegalAccessException: You've called the constructor of Team
at com.thebluealliance.api.v3.models.Team.<init>(Team.java:17)
When passing in a team number to TeamRequest.getTeam()
, the method .getJson()
is called on the API response, which will cause a NullPointerException if the team number does not exist. The same result will happen if an invalid event code is provided, or any other similar invalid parameter. Since the method does not handle the exception, there is no way for the implementer to handle the exception. Perhaps the methods should throw NullPointerException, that way the implementer can catch the Exception in the event the team number does not exist.
It appears that the TeamEventStatus
class should have the @Value
annotation in order to automatically generated getter methods. The values of that model class are currently not able to be accessed outside of the package.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.