diff --git a/metarParser-commons/src/main/java/io/github/mivek/utils/Converter.java b/metarParser-commons/src/main/java/io/github/mivek/utils/Converter.java index 3ba26e53..f5d81999 100644 --- a/metarParser-commons/src/main/java/io/github/mivek/utils/Converter.java +++ b/metarParser-commons/src/main/java/io/github/mivek/utils/Converter.java @@ -36,7 +36,7 @@ public static String degreesToDirection(final String degreesStr) { return Messages.getInstance().getString("Converter.VRB"); } - return Messages.getInstance().getString("Converter." + DIRECTIONS[(int) ((degrees + 11.5) / 22.5)]); + return Messages.getInstance().getString("Converter." + DIRECTIONS[(int) ((degrees + 11.5) / 22.5) % DIRECTIONS.length]); } /** diff --git a/metarParser-commons/src/test/java/io/github/mivek/utils/DegreesToDirectionTest.java b/metarParser-commons/src/test/java/io/github/mivek/utils/DegreesToDirectionTest.java index 38ab928a..d9721115 100644 --- a/metarParser-commons/src/test/java/io/github/mivek/utils/DegreesToDirectionTest.java +++ b/metarParser-commons/src/test/java/io/github/mivek/utils/DegreesToDirectionTest.java @@ -34,6 +34,7 @@ public static Collection data() { { "Converter.SW", "230" }, { "Converter.N", "2" }, { "Converter.NNW", "345" }, + { "Converter.N", "350" }, {"Converter.VRB","anyString"} }); }