Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] GTAS doesn't parse PNR file without the SSR+DOCS in GR.2 #2082

Open
YumiSuki opened this issue Sep 23, 2021 · 0 comments
Open

[Bug] GTAS doesn't parse PNR file without the SSR+DOCS in GR.2 #2082

YumiSuki opened this issue Sep 23, 2021 · 0 comments

Comments

@YumiSuki
Copy link

YumiSuki commented Sep 23, 2021

Good morning everyone,

I have recently encountered some problem when parsing PNR file that doesn't contain SSR+DOCS in GR.2. The SSR+DOCS does appear in the GR.1 or GR.5 but GTAS just skip the file.

From IATA PNRGOV documentation, there is a note.

Notes:
1. SSR’s in GR.1 apply to all flights and may apply to all passengers or may apply to specific passenger based on the traveler reference number in SSR/9944 and TIF/9944.
2. SSR’s in GR.2 apply to the specific passenger.
3. SSR’s in GR.5 (per TVL) apply to a specific flight and may apply to all passengers or may apply to a specific passenger based on the traveler reference number in SSR/9944 and TIF/9944.
4. The Traveler Reference Number (9944) in the SSR segment in Gr.1 or Gr. 5 may be used to specify for which passenger this SSR applies. This is a reference number assigned by the sending system and should contain the same reference number as that found in the Traveler Reference number in the TIF in Gr.2.

In PnrGovParser.java:

private void processGroup2_Passenger(TIF tif) throws ParseException {
        ...

        REF ref = getConditionalSegment(REF.class);
		getConditionalSegment(EBD.class);

		for (;;) {
			FAR far = getConditionalSegment(FAR.class);
			if (far == null) {
				break;
			}
		}

		// SSR’s in GR.2 apply to the specific passenger.
		List<SSRDocs> ssrDocs = new ArrayList<>();
		List<SSRDoco> ssrDocos = new ArrayList<>();
		for (;;) {
			SSR ssr = getConditionalSegment(SSR.class);
			if (ssr == null) {
				break;
			}
                }

        ...
}

In EdifactParser.java:

    protected <S extends Segment> S getConditionalSegment(Class<S> clazz) throws ParseException {
		return getConditionalSegment(clazz, null);
	}

	protected <S extends Segment> S getConditionalSegment(Class<S> clazz, String segmentName) throws ParseException {
		S segment = getNextSegment(clazz, segmentName, false);
		if (segment != null) {
			return segment;
		}

		iter.previous();
		return null;
	}

	/**
	 * helper method for retrieving next segment from segment list.
	 */
	private <S extends Segment> S getNextSegment(Class<S> clazz, String segmentName, boolean mandatory)  throws ParseException {
		String expectedName = (segmentName != null) ? segmentName : clazz.getSimpleName();

		if (iter.hasNext()) {
			Segment s = iter.next();
			if (expectedName.equals(s.getName())) {
				S rv = segmentFactory.build(s, clazz);
				return rv;
			} else {
				if (mandatory) {
					throw new ParseException("Expected segment " + expectedName + " but got " + s.getName());
				}
			}
		}

		if (mandatory) {
			throw new ParseException("Expected segment " + expectedName + " but no more segments to process");
		}

		return null;
	}

The problem is, GTAS tries to locate REF first and then trying to find SSR+DOCS next and if it couldn't find the SSR+DOCS, it doesn't try to find SSR+DOCS below that and just return null and finish the process. But from IATA PNRGOV document, it should try finding SSR/9944 that match TIF/9944.

Note:

  • GTAS version: 1.14.0
  • PNR Version: 15:1
@YumiSuki YumiSuki changed the title GTAS doesn't parse PNR file without the SSR+DOCS in GR.2 [Bug] GTAS doesn't parse PNR file without the SSR+DOCS in GR.2 Sep 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant