Merge branch 'bugfix_branch'

bugfix_branch
Selim Eser 2024-06-18 07:15:31 +02:00
commit 7acdaf97a4
8 changed files with 573 additions and 257 deletions

View File

@ -225,6 +225,9 @@ public class System {
if (!new_password.equals(new_password_authentication))
return false;
if(old_password.equals(new_password))
return false;
for (int i = 0; i < this.all_user.size(); i++)
if (this.all_user.get(i).getUsername().equals(current_user.getUsername()))
this.all_user.remove(i);
@ -276,7 +279,8 @@ public class System {
String line;
while ((line = reader.readLine()) != null && zip_set.size() < 200) {
line = line.replace("\"", "");
if (line.split(";")[0].contains(hometown_or_zip) || line.split(";")[1].contains(hometown_or_zip))
if (line.split(";")[0].toUpperCase().startsWith(hometown_or_zip.toUpperCase())
|| line.split(";")[1].toUpperCase().startsWith(hometown_or_zip.toUpperCase()))
zip_set.add(line);
}
} catch (Exception e) {
@ -343,13 +347,24 @@ public class System {
try {
HttpClient http_client = HttpClient.newHttpClient();
HttpRequest get_request = HttpRequest.newBuilder()
HttpRequest get_request;
if(current_user.getZip().length()<5){
get_request = HttpRequest.newBuilder()
.uri(new URI("https://api.openweathermap.org/data/2.5/weather?q=" + current_user.getHometown()
+ ",de&appid=" + api_key + "&units=metric&lang=de"))
.GET()
.build();
}
else{
get_request = HttpRequest.newBuilder()
.uri(new URI("https://api.openweathermap.org/data/2.5/weather?zip=" + current_user.getZip()
+ ",de&appid=" + api_key + "&units=metric&lang=de"))
.GET()
.build();
}
HttpResponse<String> get_response = http_client.send(get_request, BodyHandlers.ofString());
JSONObject json = new JSONObject(get_response.body());
@ -409,13 +424,23 @@ public class System {
try {
HttpClient http_client = HttpClient.newHttpClient();
HttpRequest get_request = HttpRequest.newBuilder()
HttpRequest get_request;
if(destination_zip.length()<5){
get_request = HttpRequest.newBuilder()
.uri(new URI("https://api.openweathermap.org/data/2.5/forecast?q=" + search(destination_zip).get(0).split(";")[1]
+ ",de&appid=" + api_key + "&units=metric&lang=de"))
.GET()
.build();
}
else{
get_request = HttpRequest.newBuilder()
.uri(new URI("https://api.openweathermap.org/data/2.5/forecast?zip=" + destination_zip
+ ",de&appid=" + api_key + "&units=metric&lang=de"))
.GET()
.build();
}
HttpResponse<String> get_response = http_client.send(get_request, BodyHandlers.ofString());
JSONObject json = new JSONObject(get_response.body());

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB