@@ -71,6 +71,14 @@ static Properties load(File f) {
7171 }
7272
7373
74+ /*
75+ * This is the formatting applied when exporting values from Tomcat to POE.
76+ *
77+ * The values have been read from Tomcat's property files (so the input is the actual value with none of the
78+ * escaping required to represent that value in a property file) and are being written back out in a single file to
79+ * be imported into POEditor. The padding for blank lines needs to be added followed by the common formatting
80+ * required to convert a property value to the representation of that value in a file.
81+ */
7482 static String formatValueExport (String in ) {
7583 String result ;
7684
@@ -84,6 +92,14 @@ static String formatValueExport(String in) {
8492 }
8593
8694
95+ /*
96+ * This is the formatting applied when importing values to Tomcat from POE.
97+ *
98+ * The values have been read from POE's property files (so the input is the actual value with none of the
99+ * escaping required to represent that value in a property file) and are being written back out to individual files
100+ * in Tomcat. The padding for blank lines needs to be removed followed by the common formatting required to convert
101+ * a property value to the representation of that value in a file.
102+ */
87103 static String formatValueImport (String in ) {
88104 String result ;
89105
@@ -111,7 +127,13 @@ static String fixUnnecessaryEscaping(String key, String value) {
111127
112128
113129 /*
114- * Common formatting to convert a String for storage as a value in a property file.
130+ * Common formatting to convert a String value for storage as a value in a property file. Values that contain
131+ * line-breaks need the line-break in the value to be replaced with the correct representation of a line-break in a
132+ * property file. Leading space needs to be escaped with a '\' and horizontal tabs need to be converted to "\t".
133+ *
134+ * Note that a single '\' needs to be escaped both in a Java string and in a property file so if a property value
135+ * needs to contain a single `\` (e.g. to escape white space at the start of a line) that will appear as "\\\\" in
136+ * the Java code.
115137 */
116138 static String formatValueCommon (String in ) {
117139 String result = in .replace ("\n " , "\\ n\\ \n " );
0 commit comments