Skip to content

NullPointerException when requesting null private code in TransModel API #6581

Open
@vpaturet

Description

@vpaturet

When querying service journeys in the TransModel API with a filter list of private codes that contains a null entry, an NPE is triggered.

Exmple query:

query GetDepartureStops($authorities: [String], $privateCodes: [String], $dateYesterday: Date, $date: Date) {
  serviceJourneys(
    authorities: $authorities,
    privateCodes: $privateCodes,
    activeDates: [$dateYesterday, $date]
  ) {
    id
    stopsYesterday: estimatedCalls(
      date: $dateYesterday
    ) {
      quay {
        name
      }
      date
      aimedDepartureTime
      expectedDepartureTime
      expectedArrivalTime
      forAlighting
    }
    stopsToday: estimatedCalls(
      date: $date
    ) {
      quay {
        name
      }
      date
      aimedDepartureTime
      expectedDepartureTime
      expectedArrivalTime
      forAlighting
    }
  }
}

parameters:

{
  "authorities": [
    "VYG:Authority:VYT",
    "VYG:Authority:TAG",
    "VYG:Authority:VY",
    "GJB:Authority:GJB",
    "NSB:Authority:NSB",
    "SJN:Authority:SJN",
    "GOA:Authority:GOA",
    "FLT:Authority:FLT"
  ],
  "privateCodes": [
    null,
    "3808",
    "3810",
    "3812",
    "3814",
    "3816",
    "3818",
    "3702",
    "3704",
    "3706",
    "3708",
    "3710",
    "3712",
    "3714",
    "3716",
    "3718",
    "3720",
    "3722",
    "3724",
    "3726",
    "3728",
    "3730",
    "3732",
    "3734",
    "3736",
    "3738",
    "3740",
    "3742",
    "3744",
    "3746",
    "3748",
    "3750",
    "3752",
    "3754",
    "3756",
    "3758",
    "3760",
    "3762",
    "3764",
    "3766",
    "3768",
    "3770",
    "3772",
    "3774",
    "3776",
    "3778",
    "3780",
    "3782",
    "3784",
    "3786",
    "3788",
    "3790",
    "3792",
    "3794",
    "3796",
    "3798",
    "3800",
    "3802",
    "3804",
    "3806"
  ],
  "dateYesterday": "2025-03-27",
  "date": "2025-03-28"
}

https://api.staging.entur.io/graphql-explorer/journey-planner-v3?query=query%20GetDepartureStops%28%24authorities%3A%5BString%5D%24privateCodes%3A%5BString%5D%24dateYesterday%3ADate%24date%3ADate%29%7BserviceJourneys%28authorities%3A%24authorities%20privateCodes%3A%24privateCodes%20activeDates%3A%5B%24dateYesterday%24date%5D%29%7Bid%20stopsYesterday%3AestimatedCalls%28date%3A%24dateYesterday%29%7Bquay%7Bname%7Ddate%20aimedDepartureTime%20expectedDepartureTime%20expectedArrivalTime%20forAlighting%7DstopsToday%3AestimatedCalls%28date%3A%24date%29%7Bquay%7Bname%7Ddate%20aimedDepartureTime%20expectedDepartureTime%20expectedArrivalTime%20forAlighting%7D%7D%7D&variables=%7B%0A%20%20%22authorities%22%3A%20%5B%0A%20%20%20%20%22VYG%3AAuthority%3AVYT%22%2C%0A%20%20%20%20%22VYG%3AAuthority%3ATAG%22%2C%0A%20%20%20%20%22VYG%3AAuthority%3AVY%22%2C%0A%20%20%20%20%22GJB%3AAuthority%3AGJB%22%2C%0A%20%20%20%20%22NSB%3AAuthority%3ANSB%22%2C%0A%20%20%20%20%22SJN%3AAuthority%3ASJN%22%2C%0A%20%20%20%20%22GOA%3AAuthority%3AGOA%22%2C%0A%20%20%20%20%22FLT%3AAuthority%3AFLT%22%0A%20%20%5D%2C%0A%20%20%22privateCodes%22%3A%20%5B%0A%20%20%20%20null%2C%0A%20%20%20%20%223808%22%2C%0A%20%20%20%20%223810%22%2C%0A%20%20%20%20%223812%22%2C%0A%20%20%20%20%223814%22%2C%0A%20%20%20%20%223816%22%2C%0A%20%20%20%20%223818%22%2C%0A%20%20%20%20%223702%22%2C%0A%20%20%20%20%223704%22%2C%0A%20%20%20%20%223706%22%2C%0A%20%20%20%20%223708%22%2C%0A%20%20%20%20%223710%22%2C%0A%20%20%20%20%223712%22%2C%0A%20%20%20%20%223714%22%2C%0A%20%20%20%20%223716%22%2C%0A%20%20%20%20%223718%22%2C%0A%20%20%20%20%223720%22%2C%0A%20%20%20%20%223722%22%2C%0A%20%20%20%20%223724%22%2C%0A%20%20%20%20%223726%22%2C%0A%20%20%20%20%223728%22%2C%0A%20%20%20%20%223730%22%2C%0A%20%20%20%20%223732%22%2C%0A%20%20%20%20%223734%22%2C%0A%20%20%20%20%223736%22%2C%0A%20%20%20%20%223738%22%2C%0A%20%20%20%20%223740%22%2C%0A%20%20%20%20%223742%22%2C%0A%20%20%20%20%223744%22%2C%0A%20%20%20%20%223746%22%2C%0A%20%20%20%20%223748%22%2C%0A%20%20%20%20%223750%22%2C%0A%20%20%20%20%223752%22%2C%0A%20%20%20%20%223754%22%2C%0A%20%20%20%20%223756%22%2C%0A%20%20%20%20%223758%22%2C%0A%20%20%20%20%223760%22%2C%0A%20%20%20%20%223762%22%2C%0A%20%20%20%20%223764%22%2C%0A%20%20%20%20%223766%22%2C%0A%20%20%20%20%223768%22%2C%0A%20%20%20%20%223770%22%2C%0A%20%20%20%20%223772%22%2C%0A%20%20%20%20%223774%22%2C%0A%20%20%20%20%223776%22%2C%0A%20%20%20%20%223778%22%2C%0A%20%20%20%20%223780%22%2C%0A%20%20%20%20%223782%22%2C%0A%20%20%20%20%223784%22%2C%0A%20%20%20%20%223786%22%2C%0A%20%20%20%20%223788%22%2C%0A%20%20%20%20%223790%22%2C%0A%20%20%20%20%223792%22%2C%0A%20%20%20%20%223794%22%2C%0A%20%20%20%20%223796%22%2C%0A%20%20%20%20%223798%22%2C%0A%20%20%20%20%223800%22%2C%0A%20%20%20%20%223802%22%2C%0A%20%20%20%20%223804%22%2C%0A%20%20%20%20%223806%22%0A%20%20%5D%2C%0A%20%20%22dateYesterday%22%3A%20%222025-03-27%22%2C%0A%20%20%22date%22%3A%20%222025-03-28%22%0A%7D

Expected behavior

A meaningful error message is sent back to the API client

Observed behavior

The response contains the following error message:
errors": [
{
"message": "Exception while fetching data (/serviceJourneys) : Cannot invoke "Object.equals(Object)" because "this.value" is null",

Version of OTP used (exact commit hash or JAR name)

dev-2.x

Data sets in use (links to GTFS and OSM PBF files)

Norwegian data

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions