224 |
// Verify that we are allowed to create this file |
// Verify that we are allowed to create this file |
225 |
SecurityManager sm = System.getSecurityManager(); |
SecurityManager sm = System.getSecurityManager(); |
226 |
if (sm != null) |
if (sm != null) |
227 |
{ |
sm.checkWrite(f.getAbsolutePath()); |
|
// try |
|
|
// { |
|
|
sm.checkWrite(f.getAbsolutePath()); |
|
|
// } |
|
|
// catch(AccessControlException e) |
|
|
// { |
|
|
// throw new SecurityException(e.getMessage()) |
|
|
// } |
|
|
} |
|
228 |
|
|
229 |
// Now create the file and return our file object |
// Now create the file and return our file object |
230 |
createInternal(f.getAbsolutePath()); |
createInternal(f.getAbsolutePath()); |
563 |
public boolean |
public boolean |
564 |
canWrite() throws SecurityException |
canWrite() throws SecurityException |
565 |
{ |
{ |
|
// Test for existence. This is required by the spec |
|
|
if (!exists()) |
|
|
return(false); |
|
|
|
|
566 |
// We still need to do a SecurityCheck since exists() only checks |
// We still need to do a SecurityCheck since exists() only checks |
567 |
// for read access |
// for read access |
568 |
SecurityManager sm = System.getSecurityManager(); |
SecurityManager sm = System.getSecurityManager(); |
569 |
if (sm != null) |
if (sm != null) |
570 |
{ |
sm.checkWrite(path); |
|
// try |
|
|
// { |
|
|
sm.checkWrite(path); |
|
|
// } |
|
|
// catch(AccessControlException e) |
|
|
// { |
|
|
// throw new SecurityException(e.getMessage()) |
|
|
// } |
|
|
} |
|
571 |
|
|
572 |
|
// Test for existence. This is required by the spec |
573 |
|
if (!exists()) |
574 |
|
return(false); |
575 |
|
|
576 |
return(canWriteInternal(path)); |
return(canWriteInternal(path)); |
577 |
} |
} |
578 |
|
|
608 |
// for read access |
// for read access |
609 |
SecurityManager sm = System.getSecurityManager(); |
SecurityManager sm = System.getSecurityManager(); |
610 |
if (sm != null) |
if (sm != null) |
611 |
{ |
sm.checkWrite(path); |
|
// try |
|
|
// { |
|
|
sm.checkWrite(path); |
|
|
// } |
|
|
// catch(AccessControlException e) |
|
|
// { |
|
|
// throw new SecurityException(e.getMessage()) |
|
|
// } |
|
|
} |
|
612 |
|
|
613 |
return(setReadOnlyInternal(path)); |
return(setReadOnlyInternal(path)); |
614 |
} |
} |
636 |
// Check the SecurityManager |
// Check the SecurityManager |
637 |
SecurityManager sm = System.getSecurityManager(); |
SecurityManager sm = System.getSecurityManager(); |
638 |
if (sm != null) |
if (sm != null) |
639 |
{ |
sm.checkRead(path); |
|
// try |
|
|
// { |
|
|
sm.checkRead(path); |
|
|
// } |
|
|
// catch(AccessControlException e) |
|
|
// { |
|
|
// throw new SecurityException(e.getMessage()) |
|
|
// } |
|
|
} |
|
640 |
|
|
641 |
return(existsInternal(path)); |
return(existsInternal(path)); |
642 |
} |
} |
664 |
// Check the SecurityManager |
// Check the SecurityManager |
665 |
SecurityManager sm = System.getSecurityManager(); |
SecurityManager sm = System.getSecurityManager(); |
666 |
if (sm != null) |
if (sm != null) |
667 |
{ |
sm.checkRead(path); |
|
// try |
|
|
// { |
|
|
sm.checkRead(path); |
|
|
// } |
|
|
// catch(AccessControlException e) |
|
|
// { |
|
|
// throw new SecurityException(e.getMessage()) |
|
|
// } |
|
|
} |
|
668 |
|
|
669 |
return(isFileInternal(path)); |
return(isFileInternal(path)); |
670 |
} |
} |
694 |
// Check the SecurityManager |
// Check the SecurityManager |
695 |
SecurityManager sm = System.getSecurityManager(); |
SecurityManager sm = System.getSecurityManager(); |
696 |
if (sm != null) |
if (sm != null) |
697 |
{ |
sm.checkRead(path); |
|
// try |
|
|
// { |
|
|
sm.checkRead(path); |
|
|
// } |
|
|
// catch(AccessControlException e) |
|
|
// { |
|
|
// throw new SecurityException(e.getMessage()) |
|
|
// } |
|
|
} |
|
698 |
|
|
699 |
return(isDirectoryInternal(path)); |
return(isDirectoryInternal(path)); |
700 |
} |
} |
744 |
// Check the SecurityManager |
// Check the SecurityManager |
745 |
SecurityManager sm = System.getSecurityManager(); |
SecurityManager sm = System.getSecurityManager(); |
746 |
if (sm != null) |
if (sm != null) |
747 |
{ |
sm.checkRead(path); |
|
// try |
|
|
// { |
|
|
sm.checkRead(path); |
|
|
// } |
|
|
// catch(AccessControlException e) |
|
|
// { |
|
|
// throw new SecurityException(e.getMessage()) |
|
|
// } |
|
|
} |
|
748 |
|
|
749 |
return(lengthInternal(path)); |
return(lengthInternal(path)); |
750 |
} |
} |
778 |
// Check the SecurityManager |
// Check the SecurityManager |
779 |
SecurityManager sm = System.getSecurityManager(); |
SecurityManager sm = System.getSecurityManager(); |
780 |
if (sm != null) |
if (sm != null) |
781 |
{ |
sm.checkRead(path); |
|
// try |
|
|
// { |
|
|
sm.checkRead(path); |
|
|
// } |
|
|
// catch(AccessControlException e) |
|
|
// { |
|
|
// throw new SecurityException(e.getMessage()) |
|
|
// } |
|
|
} |
|
782 |
|
|
783 |
return(lastModifiedInternal(path)); |
return(lastModifiedInternal(path)); |
784 |
} |
} |
817 |
// Check the SecurityManager |
// Check the SecurityManager |
818 |
SecurityManager sm = System.getSecurityManager(); |
SecurityManager sm = System.getSecurityManager(); |
819 |
if (sm != null) |
if (sm != null) |
820 |
{ |
sm.checkWrite(path); |
|
// try |
|
|
// { |
|
|
sm.checkWrite(path); |
|
|
// } |
|
|
// catch(AccessControlException e) |
|
|
// { |
|
|
// throw new SecurityException(e.getMessage()) |
|
|
// } |
|
|
} |
|
821 |
|
|
822 |
return(setLastModifiedInternal(path, time)); |
return(setLastModifiedInternal(path, time)); |
823 |
} |
} |
851 |
{ |
{ |
852 |
SecurityManager sm = System.getSecurityManager(); |
SecurityManager sm = System.getSecurityManager(); |
853 |
if (sm != null) |
if (sm != null) |
854 |
{ |
sm.checkWrite(path); |
|
// try |
|
|
// { |
|
|
sm.checkWrite(path); |
|
|
// } |
|
|
// catch(AccessControlException e) |
|
|
// { |
|
|
// throw new SecurityException(e.getMessage()) |
|
|
// } |
|
|
} |
|
855 |
|
|
856 |
return(createInternal(getPath())); |
return(createInternal(getPath())); |
857 |
} |
} |
872 |
// Check the SecurityManager |
// Check the SecurityManager |
873 |
SecurityManager sm = System.getSecurityManager(); |
SecurityManager sm = System.getSecurityManager(); |
874 |
if (sm != null) |
if (sm != null) |
875 |
{ |
sm.checkDelete(path); |
|
// try |
|
|
// { |
|
|
sm.checkDelete(path); |
|
|
// } |
|
|
// catch(AccessControlException e) |
|
|
// { |
|
|
// throw new SecurityException(e.getMessage()) |
|
|
// } |
|
|
} |
|
876 |
|
|
877 |
return(deleteInternal(path)); |
return(deleteInternal(path)); |
878 |
} |
} |
900 |
// Check the SecurityManager |
// Check the SecurityManager |
901 |
SecurityManager sm = System.getSecurityManager(); |
SecurityManager sm = System.getSecurityManager(); |
902 |
if (sm != null) |
if (sm != null) |
903 |
{ |
sm.checkDelete(path); |
|
// try |
|
|
// { |
|
|
sm.checkDelete(path); |
|
|
// } |
|
|
// catch(AccessControlException e) |
|
|
// { |
|
|
// throw new SecurityException(e.getMessage()) |
|
|
// } |
|
|
} |
|
904 |
|
|
905 |
// Sounds like we need to do some VM specific stuff here. We could delete |
// Sounds like we need to do some VM specific stuff here. We could delete |
906 |
// the file in finalize() and set FinalizeOnExit to true, but delete on |
// the file in finalize() and set FinalizeOnExit to true, but delete on |
925 |
// Check the SecurityManager |
// Check the SecurityManager |
926 |
SecurityManager sm = System.getSecurityManager(); |
SecurityManager sm = System.getSecurityManager(); |
927 |
if (sm != null) |
if (sm != null) |
928 |
{ |
sm.checkWrite(path); |
|
// try |
|
|
// { |
|
|
sm.checkWrite(path); |
|
|
// } |
|
|
// catch(AccessControlException e) |
|
|
// { |
|
|
// throw new SecurityException(e.getMessage()) |
|
|
// } |
|
|
} |
|
929 |
|
|
930 |
String mk_path; |
String mk_path; |
931 |
mk_path = PlatformHelper.removeTailSeparator(path); |
mk_path = PlatformHelper.removeTailSeparator(path); |
988 |
// Check the SecurityManager |
// Check the SecurityManager |
989 |
SecurityManager sm = System.getSecurityManager(); |
SecurityManager sm = System.getSecurityManager(); |
990 |
if (sm != null) |
if (sm != null) |
991 |
{ |
sm.checkWrite(path); |
|
// try |
|
|
// { |
|
|
sm.checkWrite(path); |
|
|
// } |
|
|
// catch(AccessControlException e) |
|
|
// { |
|
|
// throw new SecurityException(e.getMessage()) |
|
|
// } |
|
|
} |
|
992 |
|
|
993 |
// Call our native rename method |
// Call our native rename method |
994 |
boolean rc = renameToInternal(path, dest.getPath()); |
boolean rc = renameToInternal(path, dest.getPath()); |
1060 |
// Check the SecurityManager |
// Check the SecurityManager |
1061 |
SecurityManager sm = System.getSecurityManager(); |
SecurityManager sm = System.getSecurityManager(); |
1062 |
if (sm != null) |
if (sm != null) |
1063 |
{ |
sm.checkRead(path); |
|
// try |
|
|
// { |
|
|
sm.checkRead(path); |
|
|
// } |
|
|
// catch(AccessControlException e) |
|
|
// { |
|
|
// throw new SecurityException(e.getMessage()) |
|
|
// } |
|
|
} |
|
1064 |
|
|
1065 |
// Get the list of files |
// Get the list of files |
1066 |
String list_path = PlatformHelper.removeTailSeparator(path); |
String list_path = PlatformHelper.removeTailSeparator(path); |
1067 |
|
|
|
|
|
1068 |
String files[] = listInternal(list_path); |
String files[] = listInternal(list_path); |
1069 |
if (files == null) |
if (files == null) |
1070 |
return(null); |
return(null); |
1150 |
listFiles(FilenameFilter filter) |
listFiles(FilenameFilter filter) |
1151 |
{ |
{ |
1152 |
String[] filelist = list(filter); |
String[] filelist = list(filter); |
1153 |
|
if (filelist == null) |
1154 |
|
return(null); |
1155 |
|
|
1156 |
File[] fobjlist = new File[filelist.length]; |
File[] fobjlist = new File[filelist.length]; |
1157 |
|
|
1158 |
for (int i = 0; i < filelist.length; i++) |
for (int i = 0; i < filelist.length; i++) |
1190 |
{ |
{ |
1191 |
File[] fobjlist = listFiles((FilenameFilter)null); |
File[] fobjlist = listFiles((FilenameFilter)null); |
1192 |
|
|
1193 |
|
if (fobjlist == null) |
1194 |
|
return(null); |
1195 |
|
|
1196 |
|
if (filter == null) |
1197 |
|
return(fobjlist); |
1198 |
|
|
1199 |
int count = 0; |
int count = 0; |
1200 |
for (int i = 0; i < fobjlist.length; i++) |
for (int i = 0; i < fobjlist.length; i++) |
1201 |
if (filter.accept(fobjlist[i]) == true) |
if (filter.accept(fobjlist[i]) == true) |