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-17736 Update approximate widths #3808

Merged
Merged
Show file tree
Hide file tree
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 @@ -376,7 +376,7 @@ public CheckCLDR handleCheck(
CheckStatus item =
new CheckStatus()
.setCause(this)
.setMainType(CheckStatus.errorType)
.setMainType(errorOrIfBuildWarning())
.setSubtype(Subtype.abbreviatedDateFieldTooWide)
.setMessage(
"Abbreviated value \"{0}\" can't be longer than the corresponding wide value \"{1}\"",
Expand Down Expand Up @@ -468,7 +468,7 @@ && isTooMuchWiderThan(value, abbrValue)
CheckStatus item =
new CheckStatus()
.setCause(this)
.setMainType(CheckStatus.errorType)
.setMainType(errorOrIfBuildWarning())
.setSubtype(Subtype.shortDateFieldInconsistentLength)
.setMessage(message, value, compareValue);
result.add(item);
Expand All @@ -481,7 +481,7 @@ && isTooMuchWiderThan(value, abbrValue)
CheckStatus item =
new CheckStatus()
.setCause(this)
.setMainType(CheckStatus.errorType)
.setMainType(errorOrIfBuildWarning())
.setSubtype(Subtype.narrowDateFieldTooWide)
.setMessage(
"Narrow value \"{0}\" can't be longer than the corresponding abbreviated value \"{1}\"",
Expand All @@ -496,7 +496,7 @@ && isTooMuchWiderThan(value, abbrValue)
CheckStatus item =
new CheckStatus()
.setCause(this)
.setMainType(CheckStatus.errorType)
.setMainType(errorOrIfBuildWarning())
.setSubtype(Subtype.abbreviatedDateFieldTooWide)
.setMessage(
"Abbreviated value \"{0}\" can't be longer than the corresponding wide value \"{1}\"",
Expand All @@ -510,7 +510,7 @@ && isTooMuchWiderThan(value, abbrValue)
result.add(
new CheckStatus()
.setCause(this)
.setMainType(CheckStatus.errorType)
.setMainType(errorOrIfBuildWarning())
.setSubtype(Subtype.illegalDatePattern)
.setMessage(failure));
}
Expand Down Expand Up @@ -729,6 +729,10 @@ && isTooMuchWiderThan(value, abbrValue)
return this;
}

public org.unicode.cldr.test.CheckCLDR.CheckStatus.Type errorOrIfBuildWarning() {
return getPhase() != Phase.BUILD ? CheckStatus.errorType : CheckStatus.warningType;
}

private boolean isTooMuchWiderThan(String shortString, String longString) {
// We all 1/3 the width of the reference character as a "fudge factor" in determining the
// allowable width
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,17 @@ private int getMetrics(int cp) {
// result = 1;
// adjusted.add(cp);
// }
if (result > 31 || result < -2) { // just to catch odd results
throw new IllegalArgumentException("Value too large " + result);
if (result > 31 || result < 0) { // just to catch odd results
System.out.println(
"Code point: "
+ Utility.hex(cp)
+ "; Value out of bounds (0..31)"
+ result);
if (result > 31) {
result = 31;
} else if (result < 0) {
result = 0;
}
}
return result;
}
Expand Down
Loading
Loading