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

MetarParseException processing remarks (quantity and height token) #3

Open
pasniak opened this issue Dec 29, 2017 · 0 comments
Open

Comments

@pasniak
Copy link

pasniak commented Dec 29, 2017

net.sf.jweather.metar.MetarParseException: Uncaught Exception during parse. Report: OMAL 290441Z 14005KT 1200 0600N R01/0900U R19/0400V0650U BCFG SCT002 13/13 Q1021 BECMG 5000 HZ Cause: java.lang.IndexOutOfBoundsException: Index: 14, Size: 14

Caused by: java.lang.IndexOutOfBoundsException: Index: 14, Size: 14
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at net.sf.jweather.metar.MetarParser.parseReport(MetarParser.java:1386)
... 31 more

tokens = {ArrayList@962} size = 14
0 = "OMAL"
1 = "290441Z"
2 = "14005KT"
3 = "1200"
4 = "0600N"
5 = "R01/0900U"
6 = "R19/0400V0650U"
7 = "BCFG"
8 = "SCT002"
9 = "13/13"
10 = "Q1021"
11 = "BECMG"
12 = "5000"
13 = "HZ"

possible fix :

                        // we have a quantity and height too
                        if (index<tokens.size() && (
                                ((String) tokens.get(index))
                                        .startsWith(MetarConstants.METAR_FEW)
                                || ((String) tokens.get(index))
                                        .startsWith(MetarConstants.METAR_SCATTERED)
                                || ((String) tokens.get(index))
                                        .startsWith(MetarConstants.METAR_BROKEN)
                                || ((String) tokens.get(index))
                                        .startsWith(MetarConstants.METAR_OVERCAST))
                                ) {
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