[vigicrues] Fix few code analysis findings (#13639)

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
lolodomo 2022-11-01 15:30:29 +01:00 committed by GitHub
parent 894668ffce
commit 7728bbc232
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -71,28 +71,28 @@ public class ApiHandler {
} }
public InfoVigiCru getTronconStatus(String tronconId) throws VigiCruesException { public InfoVigiCru getTronconStatus(String tronconId) throws VigiCruesException {
final String BASE_URL = "https://www.vigicrues.gouv.fr/services/1/InfoVigiCru.jsonld/?TypEntVigiCru=8&CdEntVigiCru=%s"; final String baseUrl = "https://www.vigicrues.gouv.fr/services/1/InfoVigiCru.jsonld/?TypEntVigiCru=8&CdEntVigiCru=%s";
return execute(String.format(BASE_URL, tronconId), InfoVigiCru.class); return execute(String.format(baseUrl, tronconId), InfoVigiCru.class);
} }
public TronEntVigiCru getTroncon(String stationId) throws VigiCruesException { public TronEntVigiCru getTroncon(String stationId) throws VigiCruesException {
final String BASE_URL = "https://www.vigicrues.gouv.fr/services/1/TronEntVigiCru.jsonld/?TypEntVigiCru=8&CdEntVigiCru=%s"; final String baseUrl = "https://www.vigicrues.gouv.fr/services/1/TronEntVigiCru.jsonld/?TypEntVigiCru=8&CdEntVigiCru=%s";
return execute(String.format(BASE_URL, stationId), TronEntVigiCru.class); return execute(String.format(baseUrl, stationId), TronEntVigiCru.class);
} }
public TerEntVigiCru getTerritoire(String stationId) throws VigiCruesException { public TerEntVigiCru getTerritoire(String stationId) throws VigiCruesException {
final String BASE_URL = "https://www.vigicrues.gouv.fr/services/1/TerEntVigiCru.jsonld/?TypEntVigiCru=5&CdEntVigiCru=%s"; final String baseUrl = "https://www.vigicrues.gouv.fr/services/1/TerEntVigiCru.jsonld/?TypEntVigiCru=5&CdEntVigiCru=%s";
return execute(String.format(BASE_URL, stationId), TerEntVigiCru.class); return execute(String.format(baseUrl, stationId), TerEntVigiCru.class);
} }
public CdStationHydro getStationDetails(String stationId) throws VigiCruesException { public CdStationHydro getStationDetails(String stationId) throws VigiCruesException {
final String BASE_URL = "https://www.vigicrues.gouv.fr/services/station.json/index.php?CdStationHydro=%s"; final String baseUrl = "https://www.vigicrues.gouv.fr/services/station.json/index.php?CdStationHydro=%s";
return execute(String.format(BASE_URL, stationId), CdStationHydro.class); return execute(String.format(baseUrl, stationId), CdStationHydro.class);
} }
public OpenDatasoftResponse getMeasures(String stationId) throws VigiCruesException { public OpenDatasoftResponse getMeasures(String stationId) throws VigiCruesException {
final String BASE_URL = "https://public.opendatasoft.com/api/records/1.0/search/?dataset=vigicrues&sort=timestamp&q=%s"; final String baseUrl = "https://public.opendatasoft.com/api/records/1.0/search/?dataset=vigicrues&sort=timestamp&q=%s";
return execute(String.format(BASE_URL, stationId), OpenDatasoftResponse.class); return execute(String.format(baseUrl, stationId), OpenDatasoftResponse.class);
} }
public HubEauResponse discoverStations(PointType location, int range) throws VigiCruesException { public HubEauResponse discoverStations(PointType location, int range) throws VigiCruesException {