summaryrefslogtreecommitdiffstats
path: root/libjava
diff options
context:
space:
mode:
authormkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-21 17:06:56 +0000
committermkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-21 17:06:56 +0000
commit8818c13b04fa4e674141c90eb3bdc14e315be4fc (patch)
treee94ec9e16b029a498d6cf1390e66064b4a0ab438 /libjava
parentefcc369ab281b97c5c28962fa52b57e49e63fdde (diff)
downloadppe42-gcc-8818c13b04fa4e674141c90eb3bdc14e315be4fc.tar.gz
ppe42-gcc-8818c13b04fa4e674141c90eb3bdc14e315be4fc.zip
2003-06-21 Michael Koch <konqueror@gmx.de>
* java/io/File.java (static): Load javaio lib if existing (only in classpath). (File): Revised documentation to show the correct argument name. (createTempFile): Partly merged with classpath. (compareTo): Simplified. (lastModified): Throw exception if time < 0. (deleteOnExit): Revised documentation. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@68310 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog10
-rw-r--r--libjava/java/io/File.java48
2 files changed, 38 insertions, 20 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 2386d53a01b..6d6ad1701ff 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,5 +1,15 @@
2003-06-21 Michael Koch <konqueror@gmx.de>
+ * java/io/File.java
+ (static): Load javaio lib if existing (only in classpath).
+ (File): Revised documentation to show the correct argument name.
+ (createTempFile): Partly merged with classpath.
+ (compareTo): Simplified.
+ (lastModified): Throw exception if time < 0.
+ (deleteOnExit): Revised documentation.
+
+2003-06-21 Michael Koch <konqueror@gmx.de>
+
* java/net/PlainSocketImpl.java:
Reformatted.
(PlainSocketImpl): Merged class documentaion with classpath.
diff --git a/libjava/java/io/File.java b/libjava/java/io/File.java
index da0a9c55f11..ba18a596c2a 100644
--- a/libjava/java/io/File.java
+++ b/libjava/java/io/File.java
@@ -40,6 +40,7 @@ package java.io;
import java.net.MalformedURLException;
import java.net.URL;
+import gnu.classpath.Configuration;
import gnu.gcj.runtime.FileDeleter;
/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3
@@ -111,7 +112,6 @@ public class File implements Serializable, Comparable
*/
public static final char pathSeparatorChar = pathSeparator.charAt(0);
-
static final String tmpdir = System.getProperty("java.io.tmpdir");
static int maxPathLen;
static boolean caseSensitive;
@@ -119,7 +119,12 @@ public class File implements Serializable, Comparable
static
{
- init_native();
+ if (Configuration.INIT_LOAD_LIBRARY)
+ {
+ System.loadLibrary ("javaio");
+ }
+
+ init_native ();
}
// Native function called at class initialization. This should should
@@ -345,7 +350,7 @@ public class File implements Serializable, Comparable
* name. If the directory path name ends in the separator string, another
* separator string will still be appended.
*
- * @param dirname The path to the directory the file resides in
+ * @param dirPath The path to the directory the file resides in
* @param name The name of the file
*/
public File (String dirPath, String name)
@@ -711,7 +716,6 @@ public class File implements Serializable, Comparable
* This native function actually produces the list of file in this
* directory
*/
-
private final native Object[] performList (FilenameFilter filter,
FileFilter fileFilter,
Class result_type);
@@ -984,21 +988,21 @@ public class File implements Serializable, Comparable
// Grab the system temp directory if necessary
if (directory == null)
{
- String dirname = tmpdir;
- if (dirname == null)
- throw
- new IOException ("Cannot determine system temporary directory");
+ String dirname = tmpdir;
+ if (dirname == null)
+ throw new IOException ("Cannot determine system temporary directory");
- directory = new File (dirname);
- if (!directory.exists ())
- throw new IOException ("System temporary directory "
- + directory.getName() + " does not exist.");
- if (!directory.isDirectory())
- throw new IOException ("System temporary directory "
- + directory.getName()
- + " is not really a directory.");
+ directory = new File (dirname);
+ if (!directory.exists ())
+ throw new IOException ("System temporary directory "
+ + directory.getName () + " does not exist.");
+ if (!directory.isDirectory ())
+ throw new IOException ("System temporary directory "
+ + directory.getName ()
+ + " is not really a directory.");
}
+ // Now process the prefix and suffix.
if (prefix.length () < 3)
throw new IllegalArgumentException ("Prefix too short: " + prefix);
@@ -1162,7 +1166,7 @@ public class File implements Serializable, Comparable
*
* @since 1.2
*/
- public int compareTo(File other)
+ public int compareTo (File other)
{
if (caseSensitive)
return path.compareTo (other.path);
@@ -1191,10 +1195,9 @@ public class File implements Serializable, Comparable
*
* @since 1.2
*/
- public int compareTo(Object o)
+ public int compareTo (Object obj)
{
- File other = (File) o;
- return compareTo (other);
+ return compareTo ((File) obj);
}
/*
@@ -1250,6 +1253,9 @@ public class File implements Serializable, Comparable
*/
public boolean setLastModified (long time)
{
+ if (time < 0)
+ throw new IllegalArgumentException("Negative modification time: " + time);
+
checkWrite ();
return performSetLastModified(time);
}
@@ -1276,6 +1282,8 @@ public class File implements Serializable, Comparable
* Add this File to the set of files to be deleted upon normal
* termination.
*
+ * @exception SecurityException If deleting of the file is not allowed
+ *
* @since 1.2
*/
// FIXME: This should use the ShutdownHook API once we implement that.
OpenPOWER on IntegriCloud