~ubuntu-branches/ubuntu/precise/classpath/precise

« back to all changes in this revision

Viewing changes to java/io/FilePermission.java

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch
  • Date: 2006-05-27 16:11:15 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060527161115-h6e39eposdt5snb6
Tags: 2:0.91-3
* Install header files to /usr/include/classpath.
* debian/control: classpath: Conflict with jamvm < 1.4.3 and
  cacao < 0.96 (Closes: #368172).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* FilePermission.java --
2
 
   Copyright (C) 1998, 2000, 2003, 2004, 2005  Free Software Foundation, Inc.
 
2
   Copyright (C) 1998, 2000, 2003, 2004, 2005, 2006
 
3
   Free Software Foundation, Inc.
3
4
 
4
5
This file is part of GNU Classpath.
5
6
 
44
45
{
45
46
  private static final long serialVersionUID = 7930732926638008763L;
46
47
 
47
 
  private static final String CURRENT_DIRECTORY = 
48
 
    System.getProperty("user.dir");
49
 
 
50
48
  private static final String ALL_FILES = "<<ALL FILES>>";
51
49
 
52
50
  private boolean readPerm = false;
213
211
    FilePermission fp = (FilePermission) p;
214
212
    String f2 = fp.getName();
215
213
 
216
 
    if (f1.charAt(0) != File.separatorChar)
217
 
      f1 = CURRENT_DIRECTORY + f1;
218
 
    if (f2.charAt(0) != File.separatorChar)
219
 
      f2 = CURRENT_DIRECTORY + f2;
 
214
    if (f2.equals(ALL_FILES))
 
215
      return false;
 
216
 
 
217
    try
 
218
      {
 
219
        f1 = new File(f1).getCanonicalPath();
 
220
        f2 = new File(f2).getCanonicalPath();
 
221
      }
 
222
    catch (IOException ioe)
 
223
      {
 
224
        return false;
 
225
      }
220
226
 
221
227
    String sub1;
222
228
 
278
284
        break;
279
285
      }
280
286
 
281
 
    if (readPerm && ! fp.readPerm)
282
 
      return false;
283
 
    if (writePerm && ! fp.writePerm)
284
 
      return false;
285
 
    if (executePerm && ! fp.executePerm)
286
 
      return false;
287
 
    if (deletePerm && ! fp.deletePerm)
 
287
    if (fp.readPerm && ! readPerm)
 
288
      return false;
 
289
    if (fp.writePerm && ! writePerm)
 
290
      return false;
 
291
    if (fp.executePerm && ! executePerm)
 
292
      return false;
 
293
    if (fp.deletePerm && ! deletePerm)
288
294
      return false;
289
295
    
290
296
    return true;