Skip to content

Commit

Permalink
CLDR-17686 change enum.valueOf to enum.forString in a couple of places
Browse files Browse the repository at this point in the history
- these were causing odd compilation errors on one environment
  • Loading branch information
srl295 committed Jun 3, 2024
1 parent c1dc8c7 commit e661796
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,7 @@ public void addGeneralStats(SurveyJSONWrapper r) {
r.put("time_now", System.currentTimeMillis());
}

private JSONArray searchResults(String q, CLDRLocale l) {
private JSONArray searchResults(String q, CLDRLocale l) throws JSONException {
JSONArray results = new JSONArray();

if (q != null) {
Expand Down Expand Up @@ -938,21 +938,20 @@ private void searchLocales(JSONArray results, String q) {
}
}

private void searchPathheader(JSONArray results, CLDRLocale l, String q) {
private void searchPathheader(JSONArray results, CLDRLocale l, String q) throws JSONException {
if (l == null) {
return; // don't search with no locale
}
try {
PathHeader.PageId page = PathHeader.PageId.valueOf(q);
PathHeader.PageId page = PathHeader.PageId.forString(q);
if (page != null) {
results.put(
new JSONObject()
.put("page", page.name())
.put("section", page.getSectionId().name()));
} catch (Throwable t) {
//
}

try {
PathHeader.SectionId section = PathHeader.SectionId.valueOf(q);
PathHeader.SectionId section = PathHeader.SectionId.forString(q);
results.put(new JSONObject().put("section", section.name()));
} catch (Throwable t) {
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,8 @@ public static RowResponse getRowsResponse(
String xp = null;

if (args.xpstrid == null && args.page != null) {
try {
pageId = PageId.valueOf(args.page);
} catch (IllegalArgumentException iae) {
pageId = PageId.forString(args.page);
if (pageId == null) {
throw new SurveyException(ErrorCode.E_BAD_SECTION);
}
if (pageId.getSectionId() == org.unicode.cldr.util.PathHeader.SectionId.Special) {
Expand Down

0 comments on commit e661796

Please sign in to comment.