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] Humidity value must be in [0, 100] range error #59

Open
boblepepeur opened this issue Feb 13, 2025 · 8 comments
Open

[BUG] Humidity value must be in [0, 100] range error #59

boblepepeur opened this issue Feb 13, 2025 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@boblepepeur
Copy link

boblepepeur commented Feb 13, 2025

Sometimes, when its raining, calling the free & onecall api cause an exception

CurrentWeatherData forecast = this.owm
			.oneCall3()
			.current()
			.byCoordinate(Coordinate.of(position.lat, position.lng))
			.unitSystem(UnitSystem.METRIC)
			.exclude(OneCallResultOptions.DAILY, OneCallResultOptions.MINUTELY, OneCallResultOptions.ALERTS)
			.retrieve()
			.asJava();
at com.github.prominence.openweathermap.api.request.forecast.free.FiveDayThreeHourStepForecastRequestTerminator$asJava.call(Unknown Source)
2025-02-13T05:29:41.432961206Z stderr F 	at com.github.prominence.openweathermap.api.request.forecast.free.FiveDayThreeHourStepForecastRequestTerminator.asJava(FiveDayThreeHourStepForecastRequestTerminator.java:47)
2025-02-13T05:29:41.43295702Z stderr F 	at com.github.prominence.openweathermap.api.mapper.FiveDayThreeHourStepForecastResponseMapper.mapToForecast(FiveDayThreeHourStepForecastResponseMapper.java:112)
2025-02-13T05:29:41.432953116Z stderr F 	at com.github.prominence.openweathermap.api.mapper.FiveDayThreeHourStepForecastResponseMapper.mapToForecast(FiveDayThreeHourStepForecastResponseMapper.java:127)
2025-02-13T05:29:41.432949039Z stderr F 	at java.lang.Iterable.forEach(Iterable.java:75)

2025-02-13T05:29:41.432944624Z stderr F 	at com.github.prominence.openweathermap.api.mapper.FiveDayThreeHourStepForecastResponseMapper.lambda$mapToForecast$0(FiveDayThreeHourStepForecastResponseMapper.java:127)
2025-02-13T05:29:41.432933149Z stderr F 	at com.github.prominence.openweathermap.api.mapper.FiveDayThreeHourStepForecastResponseMapper.parseWeatherForecast(FiveDayThreeHourStepForecastResponseMapper.java:145)
2025-02-13T05:29:41.432927668Z stderr F 	at com.github.prominence.openweathermap.api.mapper.FiveDayThreeHourStepForecastResponseMapper.parseHumidity(FiveDayThreeHourStepForecastResponseMapper.java:212)
2025-02-13T05:29:41.432903262Z stderr F 	at com.github.prominence.openweathermap.api.model.Humidity.withValue(Humidity.java:53)
2025-02-13T05:29:41.432470066Z stderr F java.lang.IllegalArgumentException: Humidity value must be in [0, 100] range.
@boblepepeur boblepepeur added the bug Something isn't working label Feb 13, 2025
@Prominence
Copy link
Owner

Hello @boblepepeur . Do you have information on what value is passed to that method?

@boblepepeur
Copy link
Author

Hey hey Prominence, just a gps position, nothing more

@boblepepeur
Copy link
Author

boblepepeur commented Feb 13, 2025

The exceptoin is here ->

throw new IllegalArgumentException("Humidity value must be in [0, 100] range.");

I just make the call with rest api, it appear that openweather call sometimes set 101 in humidity
Image

I recommend to fix it by include 101 in the if at ligne 52 or include all value over 100 = 100

@Prominence
Copy link
Owner

The exceptoin is here ->

throw new IllegalArgumentException("Humidity value must be in [0, 100] range.");

I just make the call with rest api, it appear that openweather call sometimes set 101 in humidity
Image

Strange behavior. 101 percent? I'll recheck their documentation.

@Prominence
Copy link
Owner

@boblepepeur Hello. Do you have exact request parameters for this issue? Or maybe full response logs?

@Prominence Prominence self-assigned this Feb 25, 2025
@Prominence
Copy link
Owner

Their support said that it is not a normal response. It must be from 0 to 100%.

So, if it is possible, can you share detailed information that I asked above?

@boblepepeur
Copy link
Author

@Prominence Hello, i just did this call when its a rainy forecast -> https://api.openweathermap.org/data/3.0/onecall?lat=46.2368511111&lon=6.7914966667&appid=?

@Prominence
Copy link
Owner

OWM support answer:

Hello, thank you for contacting us.

Thank you for the feedback, it looks like the issue is not present anymore, but I will still ask the developer team to take a look at the local weather sources incase there is a fault with one of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants