History log of /libcore/ojluni/src/main/java/java/io/FileOutputStream.java
Revision Date Author Comments
e31b37859051d3902e06e4ba384995df7188917f 02-Dec-2017 Hans Boehm <hboehm@google.com> Add reachabilityFence, ReachabilitySensitive

Add the @ReachabilitySensitive annotation itself, and use it
in libcore itself, where needed.

Import OpenJDK9+181's reachabilityFence, so that it can be used in
preference to the annotation where it makes sense. Java 9's
stopgap reachabilityFence implementation doesn't work for us,
so replace it with a different stopgap.

The libcore changes correct many situations in which finalizers
could previously run prematurely according to the JLS. Or they
would correct them if we had a real implementation for
@ReachabilitySensitive.

The ZipFile constructor could close the file before notifying the
CloseGuard that it was open.

Aside from the ZipFile change, there should be no functional
change, yet.

Note that the ExemptionMechanism.java fix is the same as upstream.

Conspicuously missing:

- Any code, e.g. in ART or D8, that actually looks for the annotation.
- Uses in frameworks code, where it's probably most critical.

Bug: 63934467
Bug: 70906684
Bug: 28342794
Test: Build & boot AOSP
Change-Id: I652f0625b39b2ba9ac901d4f63e6aa6cf3b74af5
c52f3fe3ba9e1d31e27c06f45bfc44c2aa8a8f96 02-Dec-2017 Neil Fuller <nfuller@google.com> Verify OpenJDK 8u121: some java.io File classes

FileInputStream, FileOutputStream, FileSystem:
- improved change markers
- removed some SecurityManager docs from FileOutputStream for
consistency with FileInputStream
- Code reordering for consistency with upstream

No functional changes.

Bug: 35910877
Test: build
Change-Id: I0c8dea246432c626c0f969f9b205ec05ac176606
4c36dc077823b9fe42a30e09672613d154292628 27-Sep-2016 Przemyslaw Szczepaniak <pszczepaniak@google.com> Port of java.io.F* classes from openJdk8

- Cosmetic javadoc/generic changes.
- Added android-changed marker to FileDescriptor.
- File(Input|Output)Stream native open is wrapped
to allow instrumentation.
- FilenameFilter, FileFilter are @FunctionalInterface.
- Removed unused FileSystem#getFileSystem method.

Test: cts run of CtsLibcoreTestCases
Bug: 31237296
Change-Id: I4ff062f35c1ecba26b5c6833d818c8ccafae447d
118de16ee0529955eaca8cc5ce864cac49598c86 29-Sep-2016 Shubham Ajmera <shubhamajmera@google.com> Set warnings for unbuffered I/O

The change introduces a new BlockGuard policy to track unbuffered
I/O. Policy can be set in the following way:
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectUnbufferedIO().build());

IoTracker generates warnings for unbuffered I/O if the operation
could be replaced with a buffered I/O.

The change also removes IoTrace class which was called each time an I/O
operation was invoked.

Bug: 3018772
Test: vogar BlockGuardTest
Change-Id: I18d42c3b3ceaf0b4b98cf15914716b20a48e50c8
(cherry picked from commit 7b05c367448843d7e62db4e87a1ac8fae9b0176c
)
7b05c367448843d7e62db4e87a1ac8fae9b0176c 09-Jun-2016 Shubham Ajmera <shubhamajmera@google.com> Set warnings for unbuffered I/O

The change introduces a new BlockGuard policy to track unbuffered
I/O. Policy can be set in the following way:
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectUnbufferedIO().build());

IoTracker generates warnings for unbuffered I/O if the operation
could be replaced with a buffered I/O.

The change also removes IoTrace class which was called each time an I/O
operation was invoked.

Bug: 3018772

Change-Id: I18d42c3b3ceaf0b4b98cf15914716b20a48e50c8
49965c1dc9da104344f4893a05e45795a5740d20 30-Jun-2016 Ganesh Mahendran <opensource.ganesh@gmail.com> remove x attribute of java file

java file does not need x attribute. This patch removes it.

Change-Id: I2a7170d99f4bee7a7b819621c84dd197ded37fa2
Signed-off-by: Ganesh Mahendran <opensource.ganesh@gmail.com>
d66fb8e8bb26b1d294a7c42d740acaf427a3a0a3 03-May-2016 Przemyslaw Szczepaniak <pszczepaniak@google.com> Move clinit code to registration funtions

Moved clinit code that fetches field/method ids
to JNI registration funcitons. This will allow to
compile-time initialize these classes.

More classes will follow.

Bug: 28153851
Change-Id: I5918e281a65a2ca2168dfe1bdd18cc3c5df8f2f6
(cherry picked from commit 2798490baa8ee586e38bdd09707f4fb18ef0d023)
2798490baa8ee586e38bdd09707f4fb18ef0d023 03-May-2016 Przemyslaw Szczepaniak <pszczepaniak@google.com> Move clinit code to registration funtions

Moved clinit code that fetches field/method ids
to JNI registration funcitons. This will allow to
compile-time initialize these classes.

More classes will follow.

Bug: 28153851
Change-Id: I5918e281a65a2ca2168dfe1bdd18cc3c5df8f2f6
b5738be1ca73734ab71a62b537e67bcbbf502f09 07-Jan-2016 Przemyslaw Szczepaniak <pszczepaniak@google.com> Remove FileDescriptor reference counting usage.

openJdk uses reference counting for closing FileDescriptor
instances. pre-openJdk code assumes that the creator
of FileDescriptor instance is responsible for its removal.
In pre-openJdk libcore, streams created by File(Input|
Output)Stream(FileDescriptor) will not close
received FileDescriptor.

This change reverts the code to the pre-openJdk behavior. We
found that there's code in framework (and possible some
third-party apps) that assumes pre-openJdk behavior.

Bug: 26408757
Change-Id: Idfd289f77417ac0e014bfd8bb29ecfaeec6fc5ae
9bd6371468aac3ddaa7057127d5ef152aea1227d 06-Jan-2016 Narayan Kamath <narayan@google.com> Re-enable closeguard on a few classes that were missing it.

Change-Id: I49f580dbd02def75584a00edc849c2b3fbdb8aec
5873edf853a48362e8ee4e75181f654d0b88b8ef 07-Jan-2016 Narayan Kamath <narayan@google.com> Reinstate blockguard checks for file reads / writes.

Also adds a simple unit-test for file based checks.

bug: 25861497

Change-Id: I886321eae657af6531b21eb90c4749de7aec20d7
9c3a641e294abdaadda9299a2e1b49863de45ed9 06-Jan-2016 Narayan Kamath <narayan@google.com> File[Input,Output]Stream : Remove unused code.

Change-Id: I3cc1047ff1fa97403cf780e5a554182808070ba0
2c87ad3a45cecf9e344487cad1abfdebe79f2c7c 21-Dec-2015 Narayan Kamath <narayan@google.com> Update file headers.

Change-Id: I8149f41585768a1a4b72ab7bb4a1452376c05cc2
50164c3602af46021e434ff5047352299a36e0f0 16-Dec-2015 Yi Kong <yikong@google.com> Guard accesses to closed file streams

Check whether the file stream is closed before accessing the
underlying file descriptor.

Bug: 25897330
Change-Id: Ibb14bcd5530ee848c547dd3a0bc859cdb9b0391b
e59e4c9b59318851e4366ecc732db45ac9e061b0 16-Dec-2015 Yi Kong <yikong@google.com> Revert "Closing of filDes shared b/w multiple streams"

This reverts commit 5cbde77b3b5d11cb3125f4b8cd580cc1a2cba048.

The owner model may leak resources if the File is explicitly created
and passed to the FileOutputStream, then it will not have an owner and
won't be closed. Reverted to be replaced by reference counting.

Change-Id: I75579d47416b75818c63a844886ee4dfda2a962b
e9d215bb0811633791ca53199922a8d5512de224 25-Nov-2015 Narayan Kamath <narayan@google.com> Fix FileDescriptor leak from java.lang.Process.

The issue here was that nobody claimed ownership of the file descriptor
the process output stream was constructed with, so it was generally left
unclosed.

bug: 25865603
Change-Id: Ibb84445efc164dcefef4eae5f091370dc1202480
f859444a27667fc152cdbfd25dd7a67aedeaa8c0 23-Oct-2015 Shubham Ajmera <shubhamajmera@google.com> Closing of filDes shared b/w multiple streams

isOwner flag is added. The file descriptor will now close with the
closing of the owner stream. When a non-owner stream closes, the file
descritor will point to NULL pointer.

Change-Id: I52c429fead99ca668b8e6f49b67bd0dc55dc6396
5cbde77b3b5d11cb3125f4b8cd580cc1a2cba048 14-Oct-2015 Shubham Ajmera <shubhamajmera@google.com> Closing of filDes shared b/w multiple streams

isOwner flag is added. The file descriptor will now close with the
closing of the owner stream. When a non-owner stream closes, the file
descritor will point to NULL pointer.

Change-Id: I3599fc096c78a4c54c8e56e4ccf952ef98fe5e48
02df4b384e42969ad6f9e211989698e4f9fcde6e 28-Jul-2015 Przemyslaw Szczepaniak <pszczepaniak@google.com> Fix File(Input|Output)Stream blocking IO+close().

Switched to use IoBridge#read and #write instead
of OpenJdk implementation. Switched to use
IoBridge#closeAndSignalBlockedThreads instead of
OpenJdk #close0.

This change fixes some libcore.java.nio.channels.
FileIOInterruptTest tests that depend on blocking
IO operation being interrupted by #close call
in another thread. OpenJdk lacks this behavior, hence
switch to the IoBridge equivalents (this is significantly
easier than trying to reproduce IoBridge behavior
in OpenJdk methods).

Change-Id: I02723d45672251acf566629149bd13fd7a28e83b
51b1b6997fd3f980076b8081f7f1165ccc2a4008 16-Feb-2015 Piotr Jastrzebski <haaawk@google.com> Initial import of OpenJdk files.

Create new libcore/ojluni directory with src/main/java and
src/main/native subdirectiories.

Build ojluni into core-oj jar.

Use openjdk classes from java.awt.font package.

Copy all files from jdk/src/share/classes and jdk/src/solaris/classes
directories in openjdk into libcore/ojluni/src/main/java.

Copy following native files from openjdk to
libcore/ojluni/src/main/native:
jdk/src/solaris/native/java/io/canonicalize_md.c
build/linux-amd64/include/classfile_constants.h
jdk/src/share/native/java/net/DatagramPacket.c
jdk/src/solaris/native/sun/net/spi/DefaultProxySelector.c
jdk/src/share/native/java/lang/Double.c
jdk/src/share/native/java/lang/fdlibm/include/fdlibm.h
jdk/src/solaris/native/sun/nio/ch/FileChannelImpl.c
jdk/src/solaris/native/java/io/FileDescriptor_md.c
jdk/src/solaris/native/sun/nio/ch/FileDispatcherImpl.c
jdk/src/share/native/java/io/FileInputStream.c
jdk/src/solaris/native/sun/nio/ch/FileKey.c
jdk/src/solaris/native/java/io/FileOutputStream_md.c
jdk/src/solaris/native/java/io/FileSystem_md.c
jdk/src/share/native/java/lang/Float.c
jdk/src/share/native/java/net/Inet4Address.c
jdk/src/solaris/native/java/net/Inet4AddressImpl.c
jdk/src/share/native/java/net/Inet6Address.c
jdk/src/solaris/native/java/net/Inet6AddressImpl.c
jdk/src/share/native/java/net/InetAddress.c
jdk/src/solaris/native/java/net/InetAddressImplFactory.c
jdk/src/share/native/java/io/io_util.c
jdk/src/solaris/native/sun/nio/ch/IOUtil.c
jdk/src/share/native/java/io/io_util.h
jdk/src/solaris/native/java/io/io_util_md.c
jdk/src/solaris/native/java/io/io_util_md.h
build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/java_io_FileDescriptor.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_io_FileInputStream.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_io_FileOutputStream.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_io_FileSystem.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_io_ObjectStreamClass.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_io_UnixFileSystem.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Double.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Float.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Integer.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Long.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Runtime.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Shutdown.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_StrictMath.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_String.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_System.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Thread.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/java_lang_Throwable.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_DatagramPacket.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_Inet4Address.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_Inet4AddressImpl.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_Inet6Address.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_Inet6AddressImpl.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_InetAddress.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_InetAddressImplFactory.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_NetworkInterface.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_PlainDatagramSocketImpl.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_PlainSocketImpl.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_SocketInputStream.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_SocketOptions.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/java_net_SocketOutputStream.h
jdk/src/share/native/java/lang/java_props.h
jdk/src/solaris/native/java/lang/java_props_md.c
jdk/src/share/native/java/util/zip/Adler32.c as java_util_zip_Adler32.c
jdk/src/share/native/java/util/zip/CRC32.c as java_util_zip_CRC32.c
build/linux-amd64/tmp/sun/java.util.zip/zip/CClassHeaders/java_util_zip_CRC32.h
jdk/src/share/native/java/util/zip/Deflater.c as java_util_zip_Deflater.c
build/linux-amd64/tmp/sun/java.util.zip/zip/CClassHeaders/java_util_zip_Deflater.h
jdk/src/share/native/java/util/zip/Inflater.c as java_util_zip_Inflater.c
build/linux-amd64/tmp/sun/java.util.zip/zip/CClassHeaders/java_util_zip_Inflater.h
jdk/src/share/native/java/util/zip/ZipFile.c as java_util_zip_ZipFile.c
build/linux-amd64/tmp/sun/java.util.zip/zip/CClassHeaders/java_util_zip_ZipFile.h
jdk/src/share/native/java/lang/fdlibm/include/jfdlibm.h
jdk/src/share/native/common/jlong.h
jdk/src/solaris/native/common/jlong_md.h
jdk/src/share/native/common/jni_util.c
jdk/src/share/native/common/jni_util.h
jdk/src/solaris/native/common/jni_util_md.c
jdk/src/share/javavm/export/jvm.h
jdk/src/solaris/javavm/export/jvm_md.h
jdk/src/solaris/native/java/net/linux_close.c
jdk/src/share/native/sun/misc/NativeSignalHandler.c
jdk/src/solaris/native/sun/nio/ch/NativeThread.c
jdk/src/share/native/java/net/net_util.c
jdk/src/share/native/java/net/net_util.h
jdk/src/solaris/native/java/net/net_util_md.c
jdk/src/solaris/native/java/net/net_util_md.h
jdk/src/solaris/native/java/net/NetworkInterface.c
jdk/src/share/native/sun/nio/ch/nio.h
jdk/src/solaris/native/sun/nio/ch/nio_util.h
jdk/src/share/native/java/io/ObjectStreamClass.c
jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
jdk/src/solaris/native/java/net/PlainSocketImpl.c
jdk/src/solaris/native/java/lang/ProcessEnvironment_md.c
jdk/src/share/native/java/lang/Runtime.c
jdk/src/share/native/java/lang/Shutdown.c
jdk/src/share/native/sun/misc/Signal.c
jdk/src/solaris/native/java/net/SocketInputStream.c
jdk/src/solaris/native/java/net/SocketOutputStream.c
jdk/src/share/native/java/lang/StrictMath.c
jdk/src/share/native/java/lang/String.c
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/sun_misc_NativeSignalHandler.h
build/linux-amd64/tmp/java/java.lang/java/CClassHeaders/sun_misc_Signal.h
build/linux-amd64/tmp/sun/java.net/net/CClassHeaders/sun_net_spi_DefaultProxySelector.h
build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/sun_nio_ch_FileChannelImpl.h
build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/sun_nio_ch_FileDispatcherImpl.h
build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/sun_nio_ch_FileKey.h
build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/sun_nio_ch_IOStatus.h
build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/sun_nio_ch_IOUtil.h
build/linux-amd64/tmp/java/java.nio/nio/CClassHeaders/sun_nio_ch_NativeThread.h
jdk/src/share/native/java/lang/System.c
jdk/src/share/native/java/lang/Thread.c
jdk/src/share/native/java/lang/Throwable.c
jdk/src/solaris/native/java/io/UnixFileSystem_md.c
jdk/src/solaris/native/java/lang/UNIXProcess_md.c
jdk/src/share/native/java/util/zip/zip_util.c
jdk/src/share/native/java/util/zip/zip_util.h

Change-Id: Ib237df4e1b7b5b4d9f12e74d189e6ec9eed3c31d