diff --git a/src/main/java/de/blau/android/Logic.java b/src/main/java/de/blau/android/Logic.java index 91e14fbc9..0cb2551a7 100644 --- a/src/main/java/de/blau/android/Logic.java +++ b/src/main/java/de/blau/android/Logic.java @@ -4161,21 +4161,24 @@ protected void onPostExecute(UploadResult result) { return; } if (!activity.isFinishing()) { - if (error == ErrorCodes.UPLOAD_CONFLICT) { - if (result.getOsmId() > 0) { - UploadConflict.showDialog(activity, result); - } else { - Log.e(DEBUG_TAG, "No OSM element found for conflict"); - ErrorAlert.showDialog(activity, ErrorCodes.UPLOAD_PROBLEM); - } - } else if (error == ErrorCodes.INVALID_LOGIN) { + switch (error) { + case ErrorCodes.UPLOAD_CONFLICT: + UploadConflict.showDialog(activity, result); + break; + case ErrorCodes.INVALID_LOGIN: InvalidLogin.showDialog(activity); - } else if (error == ErrorCodes.FORBIDDEN) { + break; + case ErrorCodes.FORBIDDEN: ForbiddenLogin.showDialog(activity, result.getMessage()); - } else if (error == ErrorCodes.BAD_REQUEST || error == ErrorCodes.NOT_FOUND || error == ErrorCodes.UNKNOWN_ERROR - || error == ErrorCodes.UPLOAD_PROBLEM || error == ErrorCodes.UPLOAD_LIMIT_EXCEEDED) { + break; + case ErrorCodes.BAD_REQUEST: + case ErrorCodes.NOT_FOUND: + case ErrorCodes.UNKNOWN_ERROR: + case ErrorCodes.UPLOAD_PROBLEM: + case ErrorCodes.UPLOAD_LIMIT_EXCEEDED: ErrorAlert.showDialog(activity, error, result.getMessage()); - } else if (error != 0) { + break; + default: ErrorAlert.showDialog(activity, error); } if (postUploadHandler != null) { diff --git a/src/main/java/de/blau/android/osm/Server.java b/src/main/java/de/blau/android/osm/Server.java index a60d521f4..9d4ba09f0 100644 --- a/src/main/java/de/blau/android/osm/Server.java +++ b/src/main/java/de/blau/android/osm/Server.java @@ -963,7 +963,7 @@ public void writeTo(BufferedSink sink) throws IOException { private static final Pattern ERROR_MESSAGE_PRECONDITION_STILL_USED = Pattern .compile("(?i)(?:Precondition failed: )?(Node|Way) ([0-9]+) is still used by (way|relation)[s]? ([0-9]+).*"); private static final Pattern ERROR_MESSAGE_PRECONDITION_REQUIRED_WAY_NODES = Pattern - .compile("(?i)(?:Precondition failed: )?Way ([0-9]+) requires the nodes with id in (([0-9]+,)+) which either do not exist, or are not visible."); + .compile("(?i)(?:Precondition failed: )?Way (-?[0-9]+) requires the nodes with id in (([0-9]+,)+) which either do not exist, or are not visible."); private static final Pattern ERROR_MESSAGE_PRECONDITION_RELATION_RELATION = Pattern .compile("(?i)(?:Precondition failed: )?The relation ([0-9]+) is used in relation ([0-9]+)."); public static final Pattern ERROR_MESSAGE_BAD_OAUTH_REQUEST = Pattern.compile("(?i)Bad OAuth request.*");