History log of /dalvik/libcore/luni/src/main/java/java/io/File.java
Revision Date Author Comments
fa2ad81d0b839083c711f5f0ef17030af3000f69 04-Mar-2010 Elliott Hughes <enh@google.com> Don't call a method that can be overridden from File's constructors.

Bug: 2486943
32177d7bf636e0ad9f00a963d4a73201f02cfdab 10-Dec-2009 Elliott Hughes <enh@google.com> More java.io.File cleanup.

Make File.list (and friends) cost one JNI call instead of four,
and move the conversion of UTF-8 byte sequences into the JNI, so
it returns String[] instead of byte[][].

Switch to readdir_r(3) so we don't need the JNI to be "static
synchronized".

Remove fixed-length buffers from the native code.

Fix leaks by introducing a "proper" native container (similar to
std::forward_list). We should still investigate either using
std::vector or passing in an ArrayList<String> and using JNI to
call ArrayList.add, but this is a step forward from the old
code anyway.

Bug: 2281992
03362c212cd530422efbd3e661f516fbfffe6438 06-Dec-2009 Elliott Hughes <enh@google.com> More java.io.File cleanup.

Remove the duplication between the various list and listFiles methods.
This also makes the variants that take a filter no less efficient than
those that don't, for the special case of the null filter.

The upstream code sometimes assumed returned filenames were UTF-8, and
at other times assumed returned filenames were in the platform encoding.
The new code always uses UTF-8, to match filenames sent to the operating
system, which were and are always sent as UTF-8 byte sequences.

This patch does not alter the native listImpl method. That's for the
next patch.

A couple of unrelated cosmetic changes have been made in this patch:
declarations of native methods have been moved next to the methods
they implement, and a minor simplification has been made to the
documentation of isAbsolute.

Bug: 2281992
33ec49a171b890d3ea98e625452cdcbed9656797 05-Dec-2009 Elliott Hughes <enh@google.com> More java.io.File cleanup.

Mostly cosmetic: improve documentation, factor out the code to join two
strings into a path, put fields in canonical order, defer to String (which
might be able to perform optimizations we can't), simplify the path
cleaning code.

Also remove more unused Windows support (since our File is already totally
broken on Windows anyway).

Bug: 2281992
16a92961179de4b75dd8999841e0603c8a42218c 05-Dec-2009 Elliott Hughes <enh@google.com> More java.io.File cleanup.

Two changes:

1. Change the createNewFile JNI to match the Java interface, so we can lose the
glue. (Also make the Java/JNI names match, and sort the table of native method
names alphabetically.)

2. Fix the caching of the path byte sequence so we're caching the exact byte
sequence we want to hand to JNI. Also switch to caching the byte[] at
construction time, rather than hiding it behind an accessor.

There's a deliberate functional change here too: previously we were inconsistent
about which encoding was in use. Sometimes it was explicitly UTF-8, other times
the default platform encoding (which happens to be UTF-8 on Android). Now we
always use UTF-8. (But note that the File.list methods, which I haven't got to
yet, still return a mix of UTF-8 and platform-encoded strings.)

Bug: 2281992
7006487c694842aa4993e5ac3bf5b1a753a65f8d 30-Nov-2009 Elliott Hughes <enh@google.com> More java.io.File improvements.

Three themes to this change: not making unnecessary native calls (like the
pointless "exists" check in canWrite), being consistent in our
treatment of the empty path, and removing unnecessary cruft from the native
code.

I'm sure there must be a better implementation for handling the empty
path (the few methods for which it *isn't* invalid should be the special
cases, not every single method), but in this patch I'm just interested
in correctness.

With this patch, we pass the jtreg empty path test (which we previously
failed) and we pass my more complete test (added to FileTest.java in this
patch).

Bug: 2281992
a951d2c899623b33aed01ae084881265a979ab85 26-Nov-2009 Elliott Hughes <enh@google.com> Fix File.isHidden and File.listRoots.

Not only were the old implementations of these methods over-complicated, they
were both incorrect. We now pass all our existing tests plus the jtreg tests.

Bug: 2281992
5b03ff72ef15f36d0fbf75acfefb2d540d00b65d 24-Nov-2009 Jesse Wilson <jessewilson@google.com> A few notes on why we don't cache canonical paths.
88e58db7405e0a7966a0d7e543498c227449af93 24-Nov-2009 Jesse Wilson <jessewilson@google.com> DO NOT MERGE: Removing the use of FileCanonPathCache.

Aside from being an unjustified optimization, users have reported
problems with this in the wild. This cache has already been removed
in master.
a171559499e05c4ab3c09a27fba41db99ea8d5bb 21-Nov-2009 Elliott Hughes <enh@google.com> Fix java.io.File's JNI's fixed-length buffers.

I've also removed most of the duplication, simplified a lot of the
implementation, and added loads of TODOs now it's possible to see
what's going on under all the obfuscation. (The native code is
roughly half its previous size, but more functional.)

I want to stop here rather than start fixing any of the TODOs
because this change is already large enough and the history will
be clearer if unrelated changes are kept separate (easy though many
of them are).

Strictly speaking, I haven't removed all the fixed-length buffers:
the File.list implementation still uses fixed-length buffers, but
as the new TODOs point out, I think we want to rewrite that code
to better match its callers, and doing so will make the fixed-length
buffers go away. There's no point polishing code that's already
scheduled for deletion.

Add a couple of basic tests, one that assumes that if Path copes
with long paths in a couple of File's methods, it works in all of
them; another that singles out our readlink(2) wrapper because
that's the only place so far where we cope with arbitrary-length
paths moving in the opposite direction (from kernel to JNI to Java).
72e93344b4d1ffc71e9c832ec23de0657e5b04a5 13-Nov-2009 Jean-Baptiste Queru <jbq@google.com> eclair snapshot
454b5de006a183d4eaa7bb8705bfc68d7d57a0a8 20-Oct-2009 Jesse Wilson <jessewilson@google.com> Removing caching of file canonical path caching, and fixing NIO tests.

I checked in some regressions in the NIO test cases with the NIO patch;
this addresses those problems.
09133811f94298bf72a3bf6ee605f60e7b1b2c81 10-Oct-2009 Jesse Wilson <jessewilson@google.com> Udating luni to Harmony r823222.

Highlights:
- InputStream.skip concurrency issue
- "better" messages in bound exceptions for streams and arrays
- prefer fewer writes to underlying streams (using byte[] buffers)
- Rename subclasses to not reuse names from their superclasses
- PlatformAddressFactory.allocMap bugfix

Plus some spelling fixes, style fixes, serial version UIDs and other
boilerplate improvements.
01021fcb0c9026e81ac2c262caf5e2ec830a7025 11-Aug-2009 Jesse Wilson <jessewilson@google.com> Update Luni to Harmony r802921.

Notable changes:
- replaced StringBuffer with StringBuilder in several places
- fixed a problem with BufferedInputStream's newline characters (EBCDIC)
- cleanup Timer's finalizer helper object
- new cache for the canonical path of a file
- fixed concurrency issue with ArrayList
- floating point parsing now trims length for very small numbers
- encoding specified "UTF-8" when converting some byte[]s to strings (JarURLConnection, Util, OSFileSystem)
- Harmony now implements floor and ceil in Java. We continue to use native code.
3819a76e7c1f49253f0e077bd497f149340c02b8 25-Jul-2009 Jesse Wilson <jessewilson@google.com> Integrate luni module (but not tests) to Harmony r772995.

Notable changes
- Stripped "@since Android 1.0" from many files. Most files
are now 100% the same in Dalvik and Harmony.
- AbstractStringBuilder.reverse() supports surrogates
- AbstractStringBuilder shares less to waste less memory
- Bitset optimized
- BufferedInputStream changed to support unsynchronized close()
- BufferedOutputStream does flushInternal
- BufferedReader supports EBCDIC NEL
- Collections.synchronizedList().indexOf() does a copy for more concurrency
- Classes in nio module changed: DatagramChannelImpl, SocketChannelImpl
and ServerSocketChannelImpl (these depend on internal APIs changed in
this update)
- DataInputStream/DataOutputStream now use a small buffer to limit the
number of times the underlying stream is accessed
- Date now has a minutes offset, more efficient toString()
- ExposedByteArrayInputStream: new internal class
- DeleteOnExit moved to top-level class
- FileDescriptor.isValid() now non-native
- Float, Double lessThan optimized (fix for compare(-0.0F, 0.0F) still pending)
- FileURLConnection now guesses content types from streams
- HashMap iterator changes
- Hashtable iterator changes
- INetworkSystem
- removes bind2(), createMulticastSocket, sendStream(),
- renames createSocket to createStreamSocket
- JarURLConnection rewritten
- LinkedHashMap: new iterator
- Locale, Currency, TimeZone: now use ICU in Harmony, plain Java in Dalvik
- ObjectInputStream: Accessor objects in Harmony, direct native in Dalvik
- ProxyClassFile - many changes
- String - optimized ascii for toLowerCase, toUpperCase, compare
- Timer - rewritten
- TreeMap - rewritten
- URLClassLoader - new
- URLConnection - new guessContentTypeFromStream(), uses org.apache.harmony.awt.www.content
to lookup content type handlers
f6c387128427e121477c1b32ad35cdcaa5101ba3 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
f72d5de56a522ac3be03873bdde26f23a5eeeb3c 04-Mar-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //depot/cupcake/@135843
cc05ad238516f1303687aba4a978e24e57c0c07a 10-Jan-2009 The Android Open Source Project <initial-contribution@android.com> auto import from //branches/cupcake/...@125939
89c1feb0a69a7707b271086e749975b3f7acacf7 18-Dec-2008 The Android Open Source Project <initial-contribution@android.com> Code drop from //branches/cupcake/...@124589
2ad60cfc28e14ee8f0bb038720836a4696c478ad 21-Oct-2008 The Android Open Source Project <initial-contribution@android.com> Initial Contribution