d95a908045486d862dfe0be056dd4ecfb3bd7693 |
|
25-Aug-2016 |
Przemyslaw Szczepaniak <pszczepaniak@google.com> |
Fix ZipFile exception for non-existent files This change fixes N regression in java.util.zip.ZipFile constructor. In previous android releases, for non-existent files, ZipFile constructor was throwing FileNotFoundException. Due to change in commit adc40417389a57bc7a831f55334bffcc07343eb9, N started to use ZipException in this case. This change reverts to pre-N behavior. Test: libcore.java.util.zip.ZipFileTest Bug: 31077136 Change-Id: I7c7240d0808552f4e0cf4ed4ccbda7537df2d2b1
|
36d074286912d876489c6ff21bc0c41016180dad |
|
18-Aug-2016 |
Narayan Kamath <narayan@google.com> |
ZipFile: Never change file offset during I/O operations. Use pread instead read and eliminate unnecessary calls to lseek. dalvik.system.VMClassLoader maintains a cache of JarFile objects that it creates whenever it loads resources from them. This cache may be populated in the zygote as a side effect of preloading classes. When processes are forked from the zygote, the file descriptors associated with these JarFile objects point to the same kernel file description and may end up stepping on each others toes. To avoid such issues, we never make any offset changes to the associated file. Note that we have a guarantee that the file will never be closed in any forked process because the associated JarFile objects can never be collected. test: run cts -m CtsLibcoreTestCases / ZipStressTest / manual testing to trigger the race condition. bug: 30407219 bug: 30904760 (cherry picked from commit 0393d3c84ed9bd24bcf0dac3782a1cc23400ace8) (cherry picked from commit 50c5924a4a1f78b7722d97dc958317027e25e214) Change-Id: I1d2be54e768f668616e5b53e038d80fab5aa7e18
|
d47251ed255544b60de615907eb83f64073dccfa |
|
18-Aug-2016 |
Narayan Kamath <narayan@google.com> |
ZipFile: Never change file offset during I/O operations. Use pread instead read and eliminate unnecessary calls to lseek. dalvik.system.VMClassLoader maintains a cache of JarFile objects that it creates whenever it loads resources from them. This cache may be populated in the zygote as a side effect of preloading classes. When processes are forked from the zygote, the file descriptors associated with these JarFile objects point to the same kernel file description and may end up stepping on each others toes. To avoid such issues, we never make any offset changes to the associated file. Note that we have a guarantee that the file will never be closed in any forked process because the associated JarFile objects can never be collected. test: run cts -m CtsLibcoreTestCases / ZipStressTest / manual testing to trigger the race condition. bug: 30407219 Change-Id: Ic770a6ab6aca7f123a90002327d7f0a321e9afef
|
50c5924a4a1f78b7722d97dc958317027e25e214 |
|
18-Aug-2016 |
Narayan Kamath <narayan@google.com> |
ZipFile: Never change file offset during I/O operations. Use pread instead read and eliminate unnecessary calls to lseek. dalvik.system.VMClassLoader maintains a cache of JarFile objects that it creates whenever it loads resources from them. This cache may be populated in the zygote as a side effect of preloading classes. When processes are forked from the zygote, the file descriptors associated with these JarFile objects point to the same kernel file description and may end up stepping on each others toes. To avoid such issues, we never make any offset changes to the associated file. Note that we have a guarantee that the file will never be closed in any forked process because the associated JarFile objects can never be collected. test: run cts -m CtsLibcoreTestCases / ZipStressTest / manual testing to trigger the race condition. bug: 30407219 (cherry picked from commit 0393d3c84ed9bd24bcf0dac3782a1cc23400ace8) Change-Id: Ic770a6ab6aca7f123a90002327d7f0a321e9afef
|
0393d3c84ed9bd24bcf0dac3782a1cc23400ace8 |
|
18-Aug-2016 |
Narayan Kamath <narayan@google.com> |
ZipFile: Never change file offset during I/O operations. Use pread instead read and eliminate unnecessary calls to lseek. dalvik.system.VMClassLoader maintains a cache of JarFile objects that it creates whenever it loads resources from them. This cache may be populated in the zygote as a side effect of preloading classes. When processes are forked from the zygote, the file descriptors associated with these JarFile objects point to the same kernel file description and may end up stepping on each others toes. To avoid such issues, we never make any offset changes to the associated file. Note that we have a guarantee that the file will never be closed in any forked process because the associated JarFile objects can never be collected. test: run cts -m CtsLibcoreTestCases / ZipStressTest / manual testing to trigger the race condition. bug: 30407219 Change-Id: Ic770a6ab6aca7f123a90002327d7f0a321e9afef
|
a128ef7c6913e8b5f2ef4678ade5f97d7f7f452f |
|
26-May-2016 |
Przemyslaw Szczepaniak <pszczepaniak@google.com> |
Fix java.util.zip.ZipFile with OPEN_DELETE. openJdk java.util.zip.ZipFile with OPEN_DELETE flag uses unlink to remove the file just after it's opened. This is causing trouble on /storage partition, we can read/write unlinked file easily, but lseek seems to fail with ENOENT. This change introduces alternative implementation that doesn't use unlink before closing the file. Bug: 28901232 Bug: 28950284 Change-Id: I871a84e9a14bc1b4b9d5b0faa207579e27bcfc81 (cherry picked from commit ae6b1b85c67401fc9d986c3ffb7d9e8a9c804c30)
|
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)
|
fa07c88938c939eea9770e52f4813476e4ba6f3b |
|
12-Feb-2016 |
Narayan Kamath <narayan@google.com> |
ZipFile: Improve performance for ZipFile.<init> Avoid thousands of JNI transitions in the constructor. We can quite easily check for invalid entry names and duplicates while parsing the central directory in native code. The benchmarks show that the median time for opening a file with 8192 entries decreased from 488ms to 120us. AFTER: Trial Report (1 of 3): Experiment {instrument=runtime, benchmarkMethod=timeZipFileOpen, vm=default, parameters={numEntries=128}} Results: runtime(ns): min=112794.57, 1st qu.=113238.72, median=114539.28, mean=119694.66, 3rd qu.=125191.84, max=143145.02 Trial Report (2 of 3): Experiment {instrument=runtime, benchmarkMethod=timeZipFileOpen, vm=default, parameters={numEntries=1024}} Results: runtime(ns): min=112868.04, 1st qu.=113582.70, median=115180.93, mean=117760.32, 3rd qu.=118067.87, max=137760.10 Trial Report (3 of 3): Experiment {instrument=runtime, benchmarkMethod=timeZipFileOpen, vm=default, parameters={numEntries=8192}} Results: runtime(ns): min=112417.27, 1st qu.=114630.16, median=117272.70, mean=119197.74, 3rd qu.=122742.84, max=135330.50 BEFORE: Trial Report (1 of 3): Experiment {instrument=runtime, benchmarkMethod=benchmarkZipFileOpen, vm=default, parameters={numEntries=128}} Results: runtime(ns): min=9360144.37, 1st qu.=9559712.86, median=9839983.50, mean=9816559.27, 3rd qu.=10057399.81, max=10170918.14 Trial Report (2 of 3): Experiment {instrument=runtime, benchmarkMethod=benchmarkZipFileOpen, vm=default, parameters={numEntries=1024}} Results: runtime(ns): min=60682471.64, 1st qu.=62388598.00, median=64319977.57, mean=66545494.60, 3rd qu.=72114121.64, max=77298980.57 Trial Report (3 of 3): Experiment {instrument=runtime, benchmarkMethod=benchmarkZipFileOpen, vm=default, parameters={numEntries=8192}} Results: runtime(ns): min=485804479.00, 1st qu.=487322656.00, median=488986250.00, mean=489820034.67, 3rd qu.=492383229.50, max=495372604.00 bug: 27145664 (cherry picked from commit 8c6a910cd20026c9181a46c8e800a4a566f14527) Change-Id: Ic1bfe934548f7baf8b8789f069f654725a4b228b
|
8c6a910cd20026c9181a46c8e800a4a566f14527 |
|
12-Feb-2016 |
Narayan Kamath <narayan@google.com> |
ZipFile: Improve performance for ZipFile.<init> Avoid thousands of JNI transitions in the constructor. We can quite easily check for invalid entry names and duplicates while parsing the central directory in native code. The benchmarks show that the median time for opening a file with 8192 entries decreased from 488ms to 120us. AFTER: Trial Report (1 of 3): Experiment {instrument=runtime, benchmarkMethod=timeZipFileOpen, vm=default, parameters={numEntries=128}} Results: runtime(ns): min=112794.57, 1st qu.=113238.72, median=114539.28, mean=119694.66, 3rd qu.=125191.84, max=143145.02 Trial Report (2 of 3): Experiment {instrument=runtime, benchmarkMethod=timeZipFileOpen, vm=default, parameters={numEntries=1024}} Results: runtime(ns): min=112868.04, 1st qu.=113582.70, median=115180.93, mean=117760.32, 3rd qu.=118067.87, max=137760.10 Trial Report (3 of 3): Experiment {instrument=runtime, benchmarkMethod=timeZipFileOpen, vm=default, parameters={numEntries=8192}} Results: runtime(ns): min=112417.27, 1st qu.=114630.16, median=117272.70, mean=119197.74, 3rd qu.=122742.84, max=135330.50 BEFORE: Trial Report (1 of 3): Experiment {instrument=runtime, benchmarkMethod=benchmarkZipFileOpen, vm=default, parameters={numEntries=128}} Results: runtime(ns): min=9360144.37, 1st qu.=9559712.86, median=9839983.50, mean=9816559.27, 3rd qu.=10057399.81, max=10170918.14 Trial Report (2 of 3): Experiment {instrument=runtime, benchmarkMethod=benchmarkZipFileOpen, vm=default, parameters={numEntries=1024}} Results: runtime(ns): min=60682471.64, 1st qu.=62388598.00, median=64319977.57, mean=66545494.60, 3rd qu.=72114121.64, max=77298980.57 Trial Report (3 of 3): Experiment {instrument=runtime, benchmarkMethod=benchmarkZipFileOpen, vm=default, parameters={numEntries=8192}} Results: runtime(ns): min=485804479.00, 1st qu.=487322656.00, median=488986250.00, mean=489820034.67, 3rd qu.=492383229.50, max=495372604.00 bug: 27145664 Change-Id: I510e923ac54d52082b9eafa0f151ad4f71826333
|
9bd6371468aac3ddaa7057127d5ef152aea1227d |
|
06-Jan-2016 |
Narayan Kamath <narayan@google.com> |
Re-enable closeguard on a few classes that were missing it. Change-Id: I49f580dbd02def75584a00edc849c2b3fbdb8aec
|
2c87ad3a45cecf9e344487cad1abfdebe79f2c7c |
|
21-Dec-2015 |
Narayan Kamath <narayan@google.com> |
Update file headers. Change-Id: I8149f41585768a1a4b72ab7bb4a1452376c05cc2
|
e8e4da2f84da30bbc11a63b7a87a153f62b1ce65 |
|
27-Nov-2015 |
Przemyslaw Szczepaniak <pszczepaniak@google.com> |
Remove StrictJarFile from ClassPathURLStreamHandler StrictJarFile was moved from libcore to framework/base (licensing reasons) and in no longer accessible in the ClassPathURLStreamHandler. I replaced it using JarFile class. + ZipFile compatibility fix, openjdk ZipFile#getInputStream was not fine with directory entries without "/" suffix (returning null), fixed a flag to deal with them like in previous impl. Bug: 25337946 Change-Id: I9832b34664bd331a96cd06aabb4cbf834c58f208
|
9c17d0241b1b974e5379949df2ff881d0fff3ef4 |
|
07-Aug-2015 |
Narayan Kamath <narayan@google.com> |
Throw IOException on all stream operations on closed ZipFiles. Change-Id: I0ade0cd2fab28203c0f0a78978ce1db46cdb3f5d
|
f7ab2bc37debba91864bfec6572a3e7bbe994c58 |
|
06-May-2015 |
Piotr Jastrzebski <haaawk@google.com> |
Use OpenJdk implementation of java.net.* - Add FileURLConnection. - NetworkUtilities : Update field names in JNI. - Suppress a few libcore tests that rely on internal implementation details. - Remove code that loads the net library (not needed on android). - DatagramSocket : Add setNetworkInterface method. - HttpCookie : make parse & field public - Inet4Address / Inet6Address : Add getAddressInternal. - InetAddress : Add methods required by frameworks/base, particularly those required to deal with net-ids and scope ids. - URI : Add UriCodec static members for AUTHORITY_ENCODER and friends. - URL : Add toUriLenient - URLStreamHandler : Add a toExternalForm variant that optionally escapes illegal chars. - Inet4AddressImpl.c : Unconditionally define HAS_GLIBC_GETHOSTBY_R Change-Id: Ic51f863941f5d954ed6cf86309cc610e711d54bd
|
adc40417389a57bc7a831f55334bffcc07343eb9 |
|
21-Apr-2015 |
Piotr Jastrzebski <haaawk@google.com> |
Fix unit tests from java.util.{zip, logging, prefs}.* - zip64 is now supported. - LogManager: use getResourceAsStream for logging.properties. - MemoryHandler : use context classloader for loading properties. - ZipEntry : Explicitly use UTF-8 for names and comments. - ZipFile : - Error out early if the file is too short.. - .. or if the file has zero zip entries. - .. or if the file has two entries with the same name. - .. or if any the entries have a C string terminator in their name. Change-Id: Ie0cdb3d9dd5f12181507b20fc239bba3b2b9b374
|
a8ed084745590c5e4a0e8559b5821809d60fe242 |
|
21-Apr-2015 |
Piotr Jastrzebski <haaawk@google.com> |
Use OpenJdk implementation of java.util.zip.* - Move some of the internal implementation details of libcore's zipfile into StrictJarFile. - TODO: Adler32 continues to use old native code from libcore, this must be switched over. - InflaterInputStream: |closed| becomes protected. - ZipFile : Always use mmap. - ZipEntry : Add a long dataOffset. - Switch all native code over to explicit registration. Change-Id: Id5519b4548ea1eb22fd182edfbd2c804dc6f3bb5
|
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
|