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

CLDR-16532 Follow-up: define constant FIRST_DB_VERSION for magic number 42 #2835

Merged
merged 1 commit into from
Apr 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ public class ReviewHide {
private final int userId;
private final String localeId;

/**
* The first Survey Tool version with a (versionless) table named "cldr_dash_hide" is 42.
* Earlier versions had versioned table names like "cldr_dash_hide_41" or "cldr_review_hide_38", not
* supported by the current code. Silently ignore exceptions for earlier versions, to enable testing
* other features than hidden notifications.
*/
private final int FIRST_DB_VERSION = 42;

public ReviewHide(int userId, String localeId) {
this.userId = userId;
this.localeId = localeId;
Expand Down Expand Up @@ -103,8 +111,7 @@ private void getData() {
this.hiddenNotifications.put(subtype, xpstrid, val);
}
} catch (SQLException sqe) {
// first version with cldr_dash_hide table is 42; silently ignore exceptions for earlier versions
if (Integer.parseInt(SurveyMain.getNewVersion()) >= 42) {
if (Integer.parseInt(SurveyMain.getNewVersion()) >= FIRST_DB_VERSION) {
SurveyLog.logException(sqe, "Getting hidden notifications for uid#" + userId + " in " + localeId, null);
throw new InternalError("Error getting hidden notifications: " + sqe.getMessage());
}
Expand Down