|
17 | 17 |
|
18 | 18 | import java.io.BufferedWriter; |
19 | 19 | import java.io.BufferedReader; |
| 20 | +import java.io.ByteArrayOutputStream; |
20 | 21 | import java.io.File; |
21 | 22 | import java.io.FileWriter; |
22 | 23 | import java.io.IOException; |
@@ -204,15 +205,17 @@ public void startElement(String nameSpaceURI, String localName, |
204 | 205 | desc = ""; |
205 | 206 | result = new Result(); |
206 | 207 |
|
207 | | - // Set default value of warning to Zero, because |
| 208 | + // Set default value of warning to 1, because |
| 209 | + // - The test suite ran by upstream uses the javasript at autotest/client/buildtest.js, |
| 210 | + // and the default value of warning is 1. |
208 | 211 | // - if the GET request to the servlet doesn't define a warning, it will be 0 (as per the |
209 | 212 | // ApplContext class default values). |
210 | 213 | // - on the contrary, the default value for the warning of the CLI is 2. |
211 | | - // So we have to set he default value to 0 here, so that when the warning is not defined |
212 | | - // it means 0. This is required to harmonize test result between call to jar and call to servlet. |
213 | | - warning = "0"; |
214 | | - profile = null; |
215 | | - medium = null; |
| 214 | + // So we have to set the default value to 1 here, so that when the warning is not defined |
| 215 | + // it means 1. This is required to harmonize test result between call to jar and call to servlet. |
| 216 | + warning = "1"; // Set to same default value as in autotest/client/buildtest.js |
| 217 | + profile = "css21"; // Set to same default value as in autotest/client/buildtest.js |
| 218 | + medium = "all"; // Set to same default value as in autotest/client/buildtest.js |
216 | 219 | for (int i = 0; i < attributs.getLength(); i++) { |
217 | 220 | String currentAttr = attributs.getLocalName(i); |
218 | 221 | if (currentAttr.equals("warning")) { |
@@ -351,8 +354,13 @@ public void endElement(String nameSpaceURI, String localName, String rawName) |
351 | 354 | .getClassLoader() |
352 | 355 | .getResourceAsStream(urlString); |
353 | 356 | byte[] textBytes = new byte[content.available()]; |
354 | | - content.read(textBytes, 0, textBytes.length); |
355 | | - text = createValidURL(new String(textBytes)); |
| 357 | + ByteArrayOutputStream result = new ByteArrayOutputStream(); |
| 358 | + for (int length; (length = content.read(textBytes)) != -1; ) { |
| 359 | + result.write(textBytes, 0, length); |
| 360 | + } |
| 361 | + // Files are encoded in ISO-8859-1 |
| 362 | + // ie. "testsuite/properties/positive/content/css3/001.css" |
| 363 | + text = createValidURL(result.toString("ISO-8859-1")); |
356 | 364 | } catch (IOException e) { |
357 | 365 | System.err.println(e.getMessage()); |
358 | 366 | } |
@@ -761,6 +769,8 @@ public String createValidURL(String url) { |
761 | 769 | res = res.replaceAll("~'", "%7E"); |
762 | 770 | res = res.replaceAll("\\\n", ""); |
763 | 771 | res = res.replaceAll("\\\r", ""); |
| 772 | + // 'à' character is present in 'testsuite/properties/positive/content/css2/001.css' |
| 773 | + res = res.replaceAll("à", "%C3%A0"); |
764 | 774 | return res; |
765 | 775 | } |
766 | 776 |
|
|
0 commit comments