harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Deven You <devyo...@gmail.com>
Subject Re: [classlib][luni] question about File.fixSlashes
Date Mon, 23 Mar 2009 07:53:22 GMT
I think only return tempPath is ok.

2009/3/23 Regis <xu.regis@gmail.com>

> Hi,
>
> I noticed some code in File.fixSlashes:
>
>        String tempPath = new String(newPath, 0, newLength);
>        // If it's the same keep it identical for SecurityManager purposes
>        if (!tempPath.equals(origPath)) {
>            return tempPath;
>        }
>        return origPath;
>
> It could be simplified in logic as
>
> return new String(newPath, 0, newLength);
>
> But comments said it's for security reason, I'm not familiar with security,
> are there any cases we must keep the same String reference?
>
> --
> Best Regards,
> Regis.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message