From bf6b3236a325161ab2126bc789c3a9935564d66f Mon Sep 17 00:00:00 2001
From: Craig Cornelius <cwcornelius@gmail.com>
Date: Fri, 25 Feb 2022 13:45:16 -0800
Subject: [PATCH] ICU-21900 Fix ICU4C sample dtitvfmtsample segfault and update
 healthy code doc

---
 docs/processes/release/tasks/healthy-code.md  | 23 +++++++++++++++++++
 .../samples/dtitvfmtsample/dtitvfmtsample.cpp |  4 ++--
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/docs/processes/release/tasks/healthy-code.md b/docs/processes/release/tasks/healthy-code.md
index 68fcfd446b8..a3eb657e07d 100644
--- a/docs/processes/release/tasks/healthy-code.md
+++ b/docs/processes/release/tasks/healthy-code.md
@@ -469,6 +469,7 @@ make check
 
 ## Test ICU4C Samples and Demos
 
+### Windows build and test
 To build the ICU4C samples on Windows with Visual Studio, use the following
 steps:
 
@@ -489,6 +490,28 @@ steps:
 To test the sample programs, run the "source\\samples\\all\\samplecheck.bat"
 script for each configuration, and ensure that they are successful.
 
+### Linux /Unix build and test
+To build and test ICU4C samples:
+
+* In icu4c/source, run the configuration "./runConfigure Linux" (or appropriate system)
+* Build and install ICU4C.
+* Set PATH to include the bin directory of the installed ICU4c.
+* Set LD_LIBRARY_PATH to include the libs directory on the installed ICU4c.
+
+
+```
+cd icu4c/source
+cd samples
+# To clean all the test binaries
+make clean-samples-recursive
+# To rebuild them all
+make all-samples-recursive
+# To run all tests serially
+make check-samples-recursive
+
+```
+
+
 ## **Test ICU4C Demos via Docker**
 
 See <https://github.com/unicode-org/icu-demos/blob/main/icu-kube/README.md>
diff --git a/icu4c/source/samples/dtitvfmtsample/dtitvfmtsample.cpp b/icu4c/source/samples/dtitvfmtsample/dtitvfmtsample.cpp
index 1f160dcf367..3644fe01687 100644
--- a/icu4c/source/samples/dtitvfmtsample/dtitvfmtsample.cpp
+++ b/icu4c/source/samples/dtitvfmtsample/dtitvfmtsample.cpp
@@ -51,7 +51,7 @@ static void dtitvfmtPreDefined() {
             UnicodeString("yMMMd"),
             UnicodeString("MMMMd"),
             UnicodeString("jm"),
-            0,
+            UnicodeString("")
         };
     u_fprintf(out,"%-10s%-22s%-22s%-35s%-35s\n", "Skeleton","from","to","Date Interval in en_US","Date Interval in Ja");
     int i=0;
@@ -107,7 +107,7 @@ static void dtitvfmtCustomized() {
     UnicodeString skeletons[] = {
             UnicodeString("yMMMd"),
             UnicodeString("Hm"),
-            0,
+            UnicodeString("")
         };
         u_printf("%-10s%-22s%-22s%-45s%-35s\n", "Skeleton", "from","to", "Date Interval in en_US","Date Interval in Ja");
         // Create an empty DateIntervalInfo object
-- 
2.40.0