Skip to content

Commit

Permalink
Merge remote-tracking branch 'la-vache/main' into colonoscopy
Browse files Browse the repository at this point in the history
  • Loading branch information
eggrobin committed Nov 22, 2024
2 parents dee2c6d + e38ac30 commit 89127da
Show file tree
Hide file tree
Showing 14 changed files with 53 additions and 70 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/icu4c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,10 @@ jobs:
uses: microsoft/setup-msbuild@v2
- name: Build Solution x64
if: contains(matrix.test_flags, 'arm Release')
run: msbuild icu4c/source/allinone/allinone.sln /p:Configuration=Release /p:Platform=x64
run: msbuild icu4c/source/allinone/allinone.sln /p:Configuration=Release /p:Platform=x64 /p:SkipUWP=true
- name: Build Solution
run: |
msbuild icu4c/source/allinone/allinone.sln ${{ matrix.build_flags }}
msbuild icu4c/source/allinone/allinone.sln ${{ matrix.build_flags }} /p:SkipUWP=true
- name: Run ${{ matrix.test_flags }} Tests (icucheck.bat)
if: contains(matrix.test_flags, 'arm Release') == false
run: |
Expand Down Expand Up @@ -433,9 +433,9 @@ jobs:
uses: microsoft/setup-msbuild@v2
- name: Build Solution x64
if: contains(matrix.win_ver, 'ARM64')
run: msbuild icu4c/source/allinone/allinone.sln /p:Configuration=Release /p:Platform=x64
run: msbuild icu4c/source/allinone/allinone.sln /p:Configuration=Release /p:Platform=x64 /p:SkipUWP=true
- name: Build Solution
run: msbuild icu4c/source/allinone/allinone.sln /p:Configuration=Release /p:Platform=${{ matrix.plat }}
run: msbuild icu4c/source/allinone/allinone.sln /p:Configuration=Release /p:Platform=${{ matrix.plat }} /p:SkipUWP=true
- name: Run Tests (icucheck.bat)
if: contains(matrix.win_ver, 'ARM64') == false
run: icu4c/source/allinone/icucheck.bat ${{ matrix.arch }} Release
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/icu_merge_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -843,11 +843,11 @@ jobs:
- name: Set up MSBuild
uses: microsoft/setup-msbuild@v2
- name: Build Solution
run: msbuild icu4c/source/allinone/allinone.sln /p:Configuration=${{ matrix.config }} /p:Platform=${{ matrix.platform }}
run: msbuild icu4c/source/allinone/allinone.sln /p:Configuration=${{ matrix.config }} /p:Platform=${{ matrix.platform }} /p:SkipUWP=true
- name: Run Tests (icucheck.bat)
run: icu4c/source/allinone/icucheck.bat ${{ matrix.arch }} ${{ matrix.config }}
- name: Build Sample Solution
run: msbuild icu4c/source/samples/all/all.sln /p:Configuration=${{ matrix.config }} /p:Platform=${{ matrix.arch }}
run: msbuild icu4c/source/samples/all/all.sln /p:Configuration=${{ matrix.config }} /p:Platform=${{ matrix.arch }} /p:SkipUWP=true
- name: Test Samples (samplecheck.bat)
run: icu4c/source/samples/all/samplecheck.bat ${{ matrix.arch }} ${{ matrix.config }}

Expand Down
3 changes: 1 addition & 2 deletions docs/userguide/datetime/calendar/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ classes.*
When a calendar object is created, via either `Calendar::create()`, or
`ucal_open()`, or indirectly within a date formatter, ICU looks up the 'default'
calendar type for that locale. At present, all locales default to a Gregorian
calendar, except for the compatibility locales th_TH_TRADITIONAL and
ja_JP_TRADITIONAL. If the "calendar" keyword is supplied, this value will
calendar. If the "calendar" keyword is supplied, this value will
override the default for that locale.

For instance, `Calendar::createInstance("fr_FR", status)` will create a Gregorian calendar,
Expand Down
6 changes: 1 addition & 5 deletions docs/userguide/locale/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -391,11 +391,7 @@ and `Locale::createCanonical`. The latter API exists in both C++ and Java.
es@collation=traditional, hi__DIRECT => hi@collation=direct, zh_TW_STROKE =>
zh_TW@collation=stroke, zh__PINYIN => zh@collation=pinyin.

9. Variants specifying a calendar are remapped to calendar keyword specifiers,
as follows: ja_JP_TRADITIONAL => ja_JP@calendar=japanese, th_TH_TRADITIONAL
=> th_TH@calendar=buddhist.

10. Special case: C => en_US_POSIX.
9. Special case: C => en_US_POSIX.

Certain other operations are not performed by either level 1 or level 2
canonicalization. These are listed here for completeness.
Expand Down
2 changes: 1 addition & 1 deletion docs/userguide/transforms/general/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ the position, for those cases:
The first rule will convert "x", when preceded by a vowel, into "ks". The
transform will then backup to the position before the vowel and continue. In the
next pass, the "ak" will match and be invoked. Thus, if the source text is "ax",
the result will be "ack".
the result will be "acks".

> :point_right: **Note**: *Although you can move the cursor forward or backward, it is limited in two
ways: (a) to the text that is matched, (b) within the original substring that is
Expand Down
27 changes: 2 additions & 25 deletions icu4c/source/test/intltest/dtptngts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void IntlTestDateTimePatternGeneratorAPI::runIndexedTest( int32_t index, UBool e
}
}

#define MAX_LOCALE 12
#define MAX_LOCALE 11

/**
* Test various generic API methods of DateTimePatternGenerator for API coverage.
Expand Down Expand Up @@ -93,7 +93,6 @@ void IntlTestDateTimePatternGeneratorAPI::testAPI(/*char *par*/)
{"zh", "TW", "", "calendar=roc"}, // 8
{"ru", "", "", ""}, // 9
{"zh", "", "", "calendar=chinese"}, // 10
{"ja", "JP", "TRADITIONAL", ""}, // 11
};

// For Weds, Jan 13, 1999, 23:58:59
Expand Down Expand Up @@ -328,28 +327,7 @@ void IntlTestDateTimePatternGeneratorAPI::testAPI(/*char *par*/)
UnicodeString("23:58"), // 16: JJmm
};

UnicodeString patternResults_ja_jp_traditional[] = {
// ja_JP_TRADITIONAL // 11 ja_JP_TRADITIONAL
u"AD1999/1", // 00: yM
u"西暦1999年1月", // 01: yMMM
u"1999年1月13日", // 02: yMd
u"西暦1999年1月13日", // 03: yMMMd
u"1/13", // 04: Md
u"1月13日", // 05: MMMd
u"1月13日", // 06: MMMMd
u"西暦1999/Q1", // 07: yQQQ
u"午後11:58", // 08: hhmm
u"23:58", // 09: HHmm
u"23:58", // 10: jjmm
u"58:59", // 11: mmss
u"西暦1999年1月", // 12: yyyyMMMM
u"1月13日(水)", // 13: MMMEd
u"13日(水)", // 14: Ed
u"23:58:59.123", // 15: jmmssSSS
u"23:58", // 16: JJmm
};

UnicodeString* patternResults[] = {
UnicodeString* patternResults[MAX_LOCALE] = {
patternResults_en_US, // 0
patternResults_en_US_japanese, // 1
patternResults_de_DE, // 2
Expand All @@ -361,7 +339,6 @@ void IntlTestDateTimePatternGeneratorAPI::testAPI(/*char *par*/)
patternResults_zh_TW_roc, // 8
patternResults_ru, // 9
patternResults_zh_chinese, // 10
patternResults_ja_jp_traditional, // 11
};

UnicodeString patternTests2[] = {
Expand Down
5 changes: 5 additions & 0 deletions icu4c/source/test/intltest/loctest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5923,6 +5923,11 @@ testLikelySubtagsLineFn(void *context,
return;
}

if ((uprv_strcmp(source.c_str(), "und-Latn-RS") == 0 )
&& THIS->logKnownIssue("ICU-22976", "unexpected likely subtags for und-Latn-RS")) {
return;
}

Locale actualMax(l);
actualMax.addLikelySubtags(*pErrorCode);
if (addLikely == "FAIL") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1441,7 +1441,7 @@ und-Latn-MQ ; fr-Latn-MQ ; fr-MQ ;
und-Latn-MR ; fr-Latn-MR ; fr-MR ;
und-Latn-MS ; en-Latn-MS ; en-MS ;
und-Latn-MT ; mt-Latn-MT ; mt ;
und-Latn-MU ; en-Latn-MU ; en-MU ;
und-Latn-MU ; mfe-Latn-MU ; mfe ;
und-Latn-MV ; en-Latn-MV ; en-MV ;
und-Latn-MW ; en-Latn-MW ; en-MW ;
und-Latn-MX ; es-Latn-MX ; es-MX ;
Expand Down Expand Up @@ -1484,7 +1484,7 @@ und-Latn-SH ; en-Latn-SH ; en-SH ;
und-Latn-SI ; sl-Latn-SI ; sl ;
und-Latn-SJ ; nb-Latn-SJ ; nb-SJ ;
und-Latn-SK ; sk-Latn-SK ; sk ;
und-Latn-SL ; en-Latn-SL ; en-SL ;
und-Latn-SL ; kri-Latn-SL ; kri ;
und-Latn-SM ; it-Latn-SM ; it-SM ;
und-Latn-SN ; fr-Latn-SN ; fr-SN ;
und-Latn-SO ; so-Latn-SO ; so ;
Expand All @@ -1498,7 +1498,7 @@ und-Latn-SZ ; en-Latn-SZ ; en-SZ ;
und-Latn-TC ; en-Latn-TC ; en-TC ;
und-Latn-TD ; fr-Latn-TD ; fr-TD ;
und-Latn-TG ; fr-Latn-TG ; fr-TG ;
und-Latn-TK ; en-Latn-TK ; en-TK ;
und-Latn-TK ; tkl-Latn-TK ; tkl ;
und-Latn-TL ; pt-Latn-TL ; pt-TL ;
und-Latn-TM ; tk-Latn-TM ; tk ;
und-Latn-TN ; fr-Latn-TN ; fr-TN ;
Expand All @@ -1524,7 +1524,7 @@ und-Latn-WS ; sm-Latn-WS ; sm ;
und-Latn-XK ; sq-Latn-XK ; sq-XK ;
und-Latn-YT ; fr-Latn-YT ; fr-YT ;
und-Latn-ZA ; en-Latn-ZA ; en-ZA ;
und-Latn-ZM ; en-Latn-ZM ; en-ZM ;
und-Latn-ZM ; bem-Latn-ZM ; bem ;
und-Latn-ZW ; sn-Latn-ZW ; sn ;
und-MA ; ar-Arab-MA ; ar-MA ;
und-MC ; fr-Latn-MC ; fr-MC ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private static BreakIterator createBreakInstance(ULocale locale, int kind) {
String typeKey = typeKeyExt.isEmpty() ? KIND_NAMES[kind] : KIND_NAMES[kind] + typeKeyExt;
brkfname = rb.getStringWithFallback("boundaries/" + typeKey);
String rulesFileName = ICUData.ICU_BRKITR_NAME+ '/' + brkfname;
bytes = ICUBinary.getData(rulesFileName);
bytes = ICUBinary.getRequiredData(rulesFileName);
}
catch (Exception e) {
throw new MissingResourceException(e.toString(),"","");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -576,26 +576,6 @@ public void TestBasic() {
new String[] {"Ed", "26\u65E5\u5468\u4E09"},
new String[] {"jmmssSSS", "23:58:59.123"},
new String[] {"JJmm", "23:58"},

new ULocale("ja_JP_TRADITIONAL"),
// TODO: This is different in C++ and Java.
new String[] {"yM", "1999/1",},
new String[] {"yMMM", "1999年1月"},
new String[] {"yMd", "1999/1/13"},
new String[] {"yMMMd", "1999年1月13日"},
new String[] {"Md", "1/13"},
new String[] {"MMMd", "1月13日"},
new String[] {"MMMMd", "1月13日"},
new String[] {"yQQQ", "1999/Q1"},
new String[] {"hhmm", "午後11:58"},
new String[] {"HHmm", "23:58"},
new String[] {"jjmm", "23:58"},
new String[] {"mmss", "58:59"},
new String[] {"yyyyMMMM", "1999年1月"},
new String[] {"MMMEd", "1月13日(水)"},
new String[] {"Ed", "13日(水)"},
new String[] {"jmmssSSS", "23:58:59.123"},
new String[] {"JJmm", "23:58"}
};

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1441,7 +1441,7 @@ und-Latn-MQ ; fr-Latn-MQ ; fr-MQ ;
und-Latn-MR ; fr-Latn-MR ; fr-MR ;
und-Latn-MS ; en-Latn-MS ; en-MS ;
und-Latn-MT ; mt-Latn-MT ; mt ;
und-Latn-MU ; en-Latn-MU ; en-MU ;
und-Latn-MU ; mfe-Latn-MU ; mfe ;
und-Latn-MV ; en-Latn-MV ; en-MV ;
und-Latn-MW ; en-Latn-MW ; en-MW ;
und-Latn-MX ; es-Latn-MX ; es-MX ;
Expand Down Expand Up @@ -1484,7 +1484,7 @@ und-Latn-SH ; en-Latn-SH ; en-SH ;
und-Latn-SI ; sl-Latn-SI ; sl ;
und-Latn-SJ ; nb-Latn-SJ ; nb-SJ ;
und-Latn-SK ; sk-Latn-SK ; sk ;
und-Latn-SL ; en-Latn-SL ; en-SL ;
und-Latn-SL ; kri-Latn-SL ; kri ;
und-Latn-SM ; it-Latn-SM ; it-SM ;
und-Latn-SN ; fr-Latn-SN ; fr-SN ;
und-Latn-SO ; so-Latn-SO ; so ;
Expand All @@ -1498,7 +1498,7 @@ und-Latn-SZ ; en-Latn-SZ ; en-SZ ;
und-Latn-TC ; en-Latn-TC ; en-TC ;
und-Latn-TD ; fr-Latn-TD ; fr-TD ;
und-Latn-TG ; fr-Latn-TG ; fr-TG ;
und-Latn-TK ; en-Latn-TK ; en-TK ;
und-Latn-TK ; tkl-Latn-TK ; tkl ;
und-Latn-TL ; pt-Latn-TL ; pt-TL ;
und-Latn-TM ; tk-Latn-TM ; tk ;
und-Latn-TN ; fr-Latn-TN ; fr-TN ;
Expand All @@ -1524,7 +1524,7 @@ und-Latn-WS ; sm-Latn-WS ; sm ;
und-Latn-XK ; sq-Latn-XK ; sq-XK ;
und-Latn-YT ; fr-Latn-YT ; fr-YT ;
und-Latn-ZA ; en-Latn-ZA ; en-ZA ;
und-Latn-ZM ; en-Latn-ZM ; en-ZM ;
und-Latn-ZM ; bem-Latn-ZM ; bem ;
und-Latn-ZW ; sn-Latn-ZW ; sn ;
und-MA ; ar-Arab-MA ; ar-MA ;
und-MC ; fr-Latn-MC ; fr-MC ;
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.XMLConstants;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
Expand Down Expand Up @@ -142,7 +143,16 @@ public static void main(String... args) {
private static Map<String, ReportEntry> parseReport(File reportXmlFile) {
try {
Map<String, ReportEntry> entries = new TreeMap<String, ReportEntry>();
DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
// Securely configure DocumentBuilderFactory
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
docFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
docFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
docFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
docFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
docFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
docFactory.setNamespaceAware(true);

DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
docBuilder.setEntityResolver(new EntityResolver() {
// Ignores JaCoCo report DTD
public InputSource resolveEntity(String publicId, String systemId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;

Expand Down Expand Up @@ -407,7 +408,22 @@ private void createRB(String xmlfileName) {

String urls = filenameToURL(xmlfileName);
DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
dfactory.setNamespaceAware(true);

try {
// Set secure processing features to avoid XXE attacks
dfactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
dfactory.setNamespaceAware(true);

// Disable access to external DTDs and entities to mitigate XXE attacks
dfactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
dfactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
dfactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
dfactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
} catch (ParserConfigurationException e) {
System.err.println("ERROR: Parser configuration error: " + e.getMessage());
System.exit(-1);
}

Document doc = null;

if (xliff10) {
Expand Down

0 comments on commit 89127da

Please sign in to comment.