CLDR-17686 change enum.valueOf to enum.forString in a couple of places#3774
CLDR-17686 change enum.valueOf to enum.forString in a couple of places#3774srl295 merged 1 commit intounicode-org:mainfrom
Conversation
- these were causing odd compilation errors on one environment
|
Deleting maven cache seemed to make this error go away. |
| pageId = PageId.valueOf(args.page); | ||
| } catch (IllegalArgumentException iae) { | ||
| pageId = PageId.forString(args.page); | ||
| if (pageId == null) { |
There was a problem hiding this comment.
I guess this returns null if it catches the exception?
public static PageId forString(String name) {
try {
return PageIdNames.forString(name);
} catch (Exception e) {
throw new ICUException("No PageId for " + name, e);
}
}
There was a problem hiding this comment.
that's a feature of Java I wasn't familiar with
There was a problem hiding this comment.
Oh, right; I misread it. It catches IllegalArgumentException then throws ICUException.
So the removal of catch (Throwable t) means that searchPathheader may throw ICUException where before it wouldn't have. That goes beyond merely changing valueOf to forString. Here q comes from an http request, so it could be anything... Line 765 of SurveyAjax will catch it:
} catch (Throwable e) {
SurveyLog.logException(
logger, e, "Error in SurveyAjax?what=" + what + ": " + e.getMessage());
sendError(out, e);
}
I guess that's OK, though shouldn't searchPathheader then be declared to throw ICUException? It still silently catches other exceptions further below; it just seems a little arbitrary...
| pageId = PageId.valueOf(args.page); | ||
| } catch (IllegalArgumentException iae) { | ||
| pageId = PageId.forString(args.page); | ||
| if (pageId == null) { |
There was a problem hiding this comment.
Oh, right; I misread it. It catches IllegalArgumentException then throws ICUException.
So the removal of catch (Throwable t) means that searchPathheader may throw ICUException where before it wouldn't have. That goes beyond merely changing valueOf to forString. Here q comes from an http request, so it could be anything... Line 765 of SurveyAjax will catch it:
} catch (Throwable e) {
SurveyLog.logException(
logger, e, "Error in SurveyAjax?what=" + what + ": " + e.getMessage());
sendError(out, e);
}
I guess that's OK, though shouldn't searchPathheader then be declared to throw ICUException? It still silently catches other exceptions further below; it just seems a little arbitrary...
|
Please take a pass through PRs to make sure that they are merged before we branch (if there are other merges on the ticket) |
CLDR-17686
ALLOW_MANY_COMMITS=true