harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexei Zakharov" <alexei.zakha...@gmail.com>
Subject Re: [jira] Closed: (HARMONY-517) [classlib][luni] File.listFiles returns empty list but should return null
Date Thu, 31 May 2007 15:38:17 GMT
Hi Paulex,

Thanks for your attention. About the fix. Please look carefully at my
commit [1]:

 I_32
 getPlatformIsWriteOnly (JNIEnv * env, char *path)
 {
+  HANDLE fHandle = CreateFile(path, GENERIC_READ, FILE_SHARE_READ,
+      NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
+
+  if (fHandle == INVALID_HANDLE_VALUE) {
+    return 1;
+  }
+
+  CloseHandle(fHandle);
   return 0;
 }

The difference is in the function name. I've patched the
"getPlatformIsWriteOnly" function that checks "if the file is
write-only - i.e. *NOT* readable".  So IMO it is quite logical to
return 1 if we can't read from the file and 0 otherwise. Did I miss
something?

Regards,

[1] http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/native/luni/windows/helpers.c?p2=%2Fharmony%2Fenhanced%2Fclasslib%2Ftrunk%2Fmodules%2Fluni%2Fsrc%2Fmain%2Fnative%2Fluni%2Fwindows%2Fhelpers.c&p1=%2Fharmony%2Fenhanced%2Fclasslib%2Ftrunk%2Fmodules%2Fluni%2Fsrc%2Fmain%2Fnative%2Fluni%2Fwindows%2Fhelpers.c&r1=541367&r2=541366&view=diff&pathrev=541367

2007/5/31, Yang Paulex <paulex.yang@gmail.com>:
> Alexei,
>
> I got some problems on windows after this fix, seems the return value in
> patch below should be reversed?
>
>  I_32
>  getPlatformIsReadable (JNIEnv * env, char *path)
>  {
> -  return 1;
> +  HANDLE fHandle = CreateFile(path, GENERIC_READ, FILE_SHARE_READ,
> +      NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
> +
> +  if (fHandle == INVALID_HANDLE_VALUE) {
> +    return 1; //Paulex: seems should return 0 here, which means not
> readable.
> +  }
> +
> +  CloseHandle(fHandle);
> +  return 0; //Paulex: seems should return 1 here, which means readable.
>  }
>
> 2007/5/30, Alexei Zakharov (JIRA) <jira@apache.org>:
> >
> >
> >      [
> > https://issues.apache.org/jira/browse/HARMONY-517?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel]
> >
> > Alexei Zakharov closed HARMONY-517.
> > -----------------------------------
> >
> >
> > Fix was verified by Ruth. Issue closed.
> >
> > > [classlib][luni] File.listFiles returns empty list but should return
> > null
> > >
> > -------------------------------------------------------------------------
> > >
> > >                 Key: HARMONY-517
> > >                 URL: https://issues.apache.org/jira/browse/HARMONY-517
> > >             Project: Harmony
> > >          Issue Type: Bug
> > >          Components: Classlib
> > >            Reporter: Mark Hindess
> > >            Assignee: Alexei Zakharov
> > >            Priority: Minor
> > >         Attachments: Harmony-517.diff, reading.chmod.0.directory.diff
> > >
> > >
> > > On unix, if I create a directory and then change the permissions to make
> > it unreadable ("chmod 0 dir") then File.listFiles() on that directory on
> > RI returns null but on Harmony it returns the empty list.
> >
> > --
> > This message is automatically generated by JIRA.
> > -
> > You can reply to this email to add a comment to the issue online.
> >
> >
>
>
> --
> Paulex Yang
> China Software Development laboratory
> IBM
>


-- 
Alexei Zakharov,
Intel ESSD

Mime
View raw message