Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-6037

[classlib][portlib] bug of converting unicode to utf-8 in hyerrorhelpers.c::errorMessage

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 5.0M8
    • 5.0M9
    • Classlib
    • None

    Description

      after applying following patch:

      Index: modules/luni/src/main/native/luni/shared/OSFileSystem.c
      =====================================================================
      — modules/luni/src/main/native/luni/shared/OSFileSystem.c
      +++ modules/luni/src/main/native/luni/shared/OSFileSystem.c
      @@ -240,6 +240,9 @@ JNIEXPORT jlong JNICALL Java_org_apache_harmony_luni_platform_OSFileSystem_openI
      ioh_convertToPlatform (pathCopy);

      portFD = hyfile_open (pathCopy, flags, mode);
      + if (portFD < 0)

      { + throwNewExceptionByName(env, "java/io/FileNotFoundException", hyfile_error_message()); + }

      return (jlong)portFD;
      }

      and run the test in Harmony-6034, I got unrecognized characters, it should be Chinese characters

      I fond that, in hyerrorhelpers.c::errorMessage, need to convert unicode got from Windows to utf-8 for java use.
      When convert to multi-bytes ( > 0x80), the order of bytes is totally reversed.

      Attachments

        1. HARMONY-6037.diff
          1 kB
          Regis Xu

        Activity

          People

            tellison Tim Ellison
            regis_xu Regis Xu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: