datasets icon indicating copy to clipboard operation
datasets copied to clipboard

Java Example Fails (NullPointerException)

Open acbart opened this issue 8 years ago • 1 comments

Example dataset: Airlines (https://think.cs.vt.edu/corgis/java/airlines/airlines.html)

When you compile and run this ExampleClass.java program described on that page (attached here), it compiles fine, but I get blown away with runtime exceptions of the form:

Could not convert the response to a Airport; a field was missing.
java.lang.NullPointerException
	at corgis.airlines.domain.Airport.<init>(Unknown Source)
	at corgis.airlines.domain.Airline.<init>(Unknown Source)
	at corgis.airlines.AirlinesLibrary.getReports(Unknown Source)
	at ExampleClass.main(ExampleClass.java:10)

ExampleClass:

import corgis.airlines.AirlinesLibrary;
import corgis.airlines.domain.*;
import java.util.ArrayList;

public class ExampleClass {
    public static void main(String[] args) {
        // Get access to the library
        AirlinesLibrary airlinesLibrary = new AirlinesLibrary();
        // Access data inside the library
        ArrayList<Airline> list_of_airline = airlinesLibrary.getReports(false);
    }
}

acbart avatar Nov 07 '17 15:11 acbart

Latest commits fixes this, but revealed that a few other libraries might be having issues (most of which are data errors in the library). Those should be fixed in the spring when we do our next sprint (tracked in #67).

acbart avatar Nov 07 '17 15:11 acbart