{"thread":{"id":"17830","subject":"[JGIT PATCH v2] Fixed QuotedStringGitPathStyleTest.testDequote_OctalAll test that generated incorrect UTF-8 escape sequences","startedAt":"2009-02-16T18:50:21Z","lastAt":"2009-02-18T15:46:20Z","messageCount":2,"participants":["Constantine Plotnikov","Shawn O. Pearce"],"isPatch":true,"patchVersion":2,"patchTotal":null},"messages":[{"id":"104993","messageId":"85647ef50902161050i43b478d4kb7faaa211dee727d@mail.gmail.com","threadId":"17830","inReplyTo":null,"subject":"[JGIT PATCH v2] Fixed QuotedStringGitPathStyleTest.testDequote_OctalAll test that generated incorrect UTF-8 escape sequences","fromName":"Constantine Plotnikov","fromEmail":"constantine.plotnikov@gmail.com","sentAt":"2009-02-16T18:50:21Z","receivedAt":"2009-02-16T18:50:21Z","isPatch":true,"sender":{"key":"constantine.plotnikov@gmail.com","avatar":null},"body":"The test was failing on the system that use a encoding different\nfrom ISO-8859-1. The reason was that invalid UTF-8 bytes were\ngenerated for codepoints greater than U+7F, and in this case\nthe method RawParseUtils.decodeNoFallback falls backs to the\ndefault system encoding.\n\nSigned-off-by: Constantine Plotnikov <Constantine.Plotnikov@jetbrains.com>\n---\n\nThe bug was causing failure for the maven build on the windows\nenvironment that uses Cp1251 as a system encoding. However the test\nworked from Eclipse until I have specified jvm option\n-Dfile.ecoding=Cp1251, in the test case started to fail in Eclipse as\nwell.\n\n .../jgit/util/QuotedStringGitPathStyleTest.java    |   21 ++++++++++++++-----\n 1 files changed, 15 insertions(+), 6 deletions(-)\n\ndiff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/util/QuotedStringGitPathStyleTest.java\nb/org.spearce.jgit.test/tst/org/spearce/jgit/util/QuotedStringGitPathStyleTest.java\nindex 54fbd31..7d29f21 100644\n--- a/org.spearce.jgit.test/tst/org/spearce/jgit/util/QuotedStringGitPathStyleTest.java\n+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/util/QuotedStringGitPathStyleTest.java\n@@ -127,13 +127,22 @@ public void testDequote_NamedEscapes() {\n \t}\n\n \tpublic void testDequote_OctalAll() {\n-\t\tfor (int i = 0; i < 256; i++) {\n-\t\t\tString s = Integer.toOctalString(i);\n-\t\t\twhile (s.length() < 3) {\n-\t\t\t\ts = \"0\" + s;\n-\t\t\t}\n-\t\t\tassertDequote(\"\" + (char) i, \"\\\\\" + s);\n+\t\tfor (int i = 0; i < 127; i++) {\n+\t\t\tassertDequote(\"\" + (char) i, octalEscape(i));\n \t\t}\n+\t\tfor (int i = 128; i < 256; i++) {\n+\t\t\tint f = 0xC0 | (i >> 6);\n+\t\t\tint s = 0x80 | (i & 0x3f);\n+\t\t\tassertDequote(\"\" + (char) i, octalEscape(f)+octalEscape(s));\n+\t\t}\n+\t}\n+\n+\tprivate String octalEscape(int i) {\n+\t\tString s = Integer.toOctalString(i);\n+\t\twhile (s.length() < 3) {\n+\t\t\ts = \"0\" + s;\n+\t\t}\n+\t\treturn \"\\\\\"+s;\n \t}\n\n \tpublic void testQuote_OctalAll() {\n-- \n1.6.1.2\n"},{"id":"105319","messageId":"20090218154620.GA22848@spearce.org","threadId":"17830","inReplyTo":"85647ef50902161050i43b478d4kb7faaa211dee727d@mail.gmail.com","subject":"Re: [JGIT PATCH v2] Fixed QuotedStringGitPathStyleTest.testDequote_OctalAll test that generated incorrect UTF-8 escape sequences","fromName":"Shawn O. Pearce","fromEmail":"spearce@spearce.org","sentAt":"2009-02-18T15:46:20Z","receivedAt":"2009-02-18T15:46:20Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Constantine Plotnikov <constantine.plotnikov@gmail.com> wrote:\n> The test was failing on the system that use a encoding different\n> from ISO-8859-1. The reason was that invalid UTF-8 bytes were\n> generated for codepoints greater than U+7F, and in this case\n> the method RawParseUtils.decodeNoFallback falls backs to the\n> default system encoding.\n> \n> Signed-off-by: Constantine Plotnikov <Constantine.Plotnikov@jetbrains.com>\n\nThanks.\n\n> The bug was causing failure for the maven build on the windows\n> environment that uses Cp1251 as a system encoding. However the test\n> worked from Eclipse until I have specified jvm option\n> -Dfile.ecoding=Cp1251, in the test case started to fail in Eclipse as\n> well.\n\n-- \nShawn.\n"}]}