提交 08dd6a42 编写于 作者: A andrew

Merge

......@@ -1020,3 +1020,5 @@ b2865f7f557fcaec84445b034b2de2b27456b6c5 jdk8u242-b05
034a65a05bfbfb06e14d3d39efa0c9f27683573a jdk8u242-b07
c63c2923e1f99c1f350bd24b42daf885023f18b7 jdk8u242-b08
c63c2923e1f99c1f350bd24b42daf885023f18b7 jdk8u242-ga
44c4cee50aeb94c4629e642681ff099ad9dcac12 jdk8u252-b00
4dd113d7811ea6651c1c96f9c641b8bec8e31669 jdk8u252-b01
......@@ -1712,10 +1712,60 @@ which may be included with JRE 8, JDK 8, and OpenJDK 8 source distributions.
--- begin of LICENSE ---
Mesa 3-D Graphics Library v19.2.1
Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Attention, Contributors
When contributing to the Mesa project you must agree to the licensing terms
of the component to which you're contributing.
The following section lists the primary components of the Mesa distribution
and their respective licenses.
Mesa Component Licenses
Component Location License
------------------------------------------------------------------
Main Mesa code src/mesa/ MIT
Device drivers src/mesa/drivers/* MIT, generally
Gallium code src/gallium/ MIT
Ext headers GL/glext.h Khronos
GL/glxext.h Khronos
GL/wglext.h Khronos
KHR/khrplatform.h Khronos
*****************************************************************************
----
include/GL/gl.h :
Mesa 3-D graphics library
Version: 5.0
Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
Copyright (C) 2009 VMware, Inc. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
......@@ -1730,9 +1780,67 @@ which may be included with JRE 8, JDK 8, and OpenJDK 8 source distributions.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*****************************************************************************
----
include/GL/glext.h
include/GL/glxext.h
include/GL/wglxext.h :
Copyright (c) 2013 - 2018 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Materials.
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*****************************************************************************
----
include/KHR/khrplatform.h :
Copyright (c) 2008 - 2018 The Khronos Group Inc.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and/or associated documentation files (the
"Materials"), to deal in the Materials without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Materials, and to
permit persons to whom the Materials are furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Materials.
THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*****************************************************************************
--- end of LICENSE ---
......
......@@ -39,6 +39,9 @@
* (see aix_close_init).
*
*/
#include <assert.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
......@@ -76,10 +79,35 @@ typedef struct {
static int sigWakeup = (SIGRTMAX - 1);
/*
* The fd table and the number of file descriptors
* fdTable holds one entry per file descriptor, up to a certain
* maximum.
* Theoretically, the number of possible file descriptors can get
* large, though usually it does not. Entries for small value file
* descriptors are kept in a simple table, which covers most scenarios.
* Entries for large value file descriptors are kept in an overflow
* table, which is organized as a sparse two dimensional array whose
* slabs are allocated on demand. This covers all corner cases while
* keeping memory consumption reasonable.
*/
/* Base table for low value file descriptors */
static fdEntry_t* fdTable = NULL;
/* Maximum size of base table (in number of entries). */
static const int fdTableMaxSize = 0x1000; /* 4K */
/* Actual size of base table (in number of entries) */
static int fdTableLen = 0;
/* Max. theoretical number of file descriptors on system. */
static int fdLimit = 0;
/* Overflow table, should base table not be large enough. Organized as
* an array of n slabs, each holding 64k entries.
*/
static fdEntry_t *fdTable = NULL;
static int fdCount = 0;
static fdEntry_t** fdOverflowTable = NULL;
/* Number of slabs in the overflow table */
static int fdOverflowTableLen = 0;
/* Number of entries in one slab */
static const int fdOverflowTableSlabSize = 0x10000; /* 64k */
pthread_mutex_t fdOverflowTableLock = PTHREAD_MUTEX_INITIALIZER;
/*
* Null signal handler
......@@ -98,42 +126,42 @@ void aix_close_init() {
struct rlimit nbr_files;
sigset_t sigset;
struct sigaction sa;
int i = 0;
/* Check already initialized */
if (fdCount > 0 && fdTable != NULL) {
return;
}
/*
* Allocate table based on the maximum number of
* file descriptors.
*/
/* Determine the maximum number of possible file descriptors. */
if (-1 == getrlimit(RLIMIT_NOFILE, &nbr_files)) {
fprintf(stderr, "library initialization failed - "
"unable to get max # of allocated fds\n");
abort();
}
fdCount = nbr_files.rlim_max;
/*
* We have a conceptual problem here, when the number of files is
* unlimited. As a kind of workaround, we ensure the table is big
* enough for handle even a large number of files. Since SAP itself
* recommends a limit of 32000 files, we just use 64000 as 'infinity'.
*/
if (nbr_files.rlim_max == RLIM_INFINITY) {
fdCount = 64000;
if (nbr_files.rlim_max != RLIM_INFINITY) {
fdLimit = nbr_files.rlim_max;
} else {
/* We just do not know. */
fdLimit = INT_MAX;
}
fdTable = (fdEntry_t *)calloc(fdCount, sizeof(fdEntry_t));
/* Allocate table for low value file descriptors. */
fdTableLen = fdLimit < fdTableMaxSize ? fdLimit : fdTableMaxSize;
fdTable = (fdEntry_t*) calloc(fdTableLen, sizeof(fdEntry_t));
if (fdTable == NULL) {
fprintf(stderr, "library initialization failed - "
"unable to allocate file descriptor table - out of memory");
abort();
} else {
for (i = 0; i < fdTableLen; i ++) {
pthread_mutex_init(&fdTable[i].lock, NULL);
}
}
{
int i;
for (i=0; i < fdCount; i++) {
pthread_mutex_init(&fdTable[i].lock, NULL);
/* Allocate overflow table, if needed */
if (fdLimit > fdTableMaxSize) {
fdOverflowTableLen = ((fdLimit - fdTableMaxSize) / fdOverflowTableSlabSize) + 1;
fdOverflowTable = (fdEntry_t**) calloc(fdOverflowTableLen, sizeof(fdEntry_t*));
if (fdOverflowTable == NULL) {
fprintf(stderr, "library initialization failed - "
"unable to allocate file descriptor overflow table - out of memory");
abort();
}
}
......@@ -151,17 +179,60 @@ void aix_close_init() {
}
/*
* Return the fd table for this fd or NULL is fd out
* of range.
* Return the fd table for this fd.
*/
static inline fdEntry_t *getFdEntry(int fd)
{
if (fd < 0 || fd >= fdCount) {
fdEntry_t* result = NULL;
if (fd < 0) {
return NULL;
}
return &fdTable[fd];
/* This should not happen. If it does, our assumption about
* max. fd value was wrong. */
assert(fd < fdLimit);
if (fd < fdTableMaxSize) {
/* fd is in base table. */
assert(fd < fdTableLen);
result = &fdTable[fd];
} else {
/* fd is in overflow table. */
const int indexInOverflowTable = fd - fdTableMaxSize;
const int rootindex = indexInOverflowTable / fdOverflowTableSlabSize;
const int slabindex = indexInOverflowTable % fdOverflowTableSlabSize;
fdEntry_t* slab = NULL;
assert(rootindex < fdOverflowTableLen);
assert(slabindex < fdOverflowTableSlabSize);
pthread_mutex_lock(&fdOverflowTableLock);
/* Allocate new slab in overflow table if needed */
if (fdOverflowTable[rootindex] == NULL) {
fdEntry_t* const newSlab =
(fdEntry_t*)calloc(fdOverflowTableSlabSize, sizeof(fdEntry_t));
if (newSlab == NULL) {
fprintf(stderr, "Unable to allocate file descriptor overflow"
" table slab - out of memory");
pthread_mutex_unlock(&fdOverflowTableLock);
abort();
} else {
int i;
for (i = 0; i < fdOverflowTableSlabSize; i ++) {
pthread_mutex_init(&newSlab[i].lock, NULL);
}
fdOverflowTable[rootindex] = newSlab;
}
}
pthread_mutex_unlock(&fdOverflowTableLock);
slab = fdOverflowTable[rootindex];
result = &slab[slabindex];
}
return result;
}
/*
* Start a blocking operation :-
* Insert thread onto thread list for the fd.
......
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -102,6 +102,8 @@ public final class KeychainStore extends KeyStoreSpi {
private static final int iterationCount = 1024;
private static final int SALT_LEN = 20;
private static final Debug debug = Debug.getInstance("keystore");
static {
AccessController.doPrivileged(
new PrivilegedAction<Void>() {
......@@ -771,6 +773,10 @@ public final class KeychainStore extends KeyStoreSpi {
entries.clear();
_scanKeychain();
if (debug != null) {
debug.println("KeychainStore load entry count: " +
entries.size());
}
}
}
......
/*
* Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -25,6 +25,8 @@
package com.sun.crypto.provider;
import sun.security.util.Debug;
import java.io.*;
import java.util.*;
import java.security.AccessController;
......@@ -62,6 +64,7 @@ import sun.misc.ObjectInputFilter;
public final class JceKeyStore extends KeyStoreSpi {
private static final Debug debug = Debug.getInstance("keystore");
private static final int JCEKS_MAGIC = 0xcececece;
private static final int JKS_MAGIC = 0xfeedfeed;
private static final int VERSION_1 = 0x01;
......@@ -683,6 +686,7 @@ public final class JceKeyStore extends KeyStoreSpi {
Hashtable<String, CertificateFactory> cfs = null;
ByteArrayInputStream bais = null;
byte[] encoded = null;
int trustedKeyCount = 0, privateKeyCount = 0, secretKeyCount = 0;
if (stream == null)
return;
......@@ -729,7 +733,7 @@ public final class JceKeyStore extends KeyStoreSpi {
tag = dis.readInt();
if (tag == 1) { // private-key entry
privateKeyCount++;
PrivateKeyEntry entry = new PrivateKeyEntry();
// read the alias
......@@ -774,7 +778,7 @@ public final class JceKeyStore extends KeyStoreSpi {
entries.put(alias, entry);
} else if (tag == 2) { // trusted certificate entry
trustedKeyCount++;
TrustedCertEntry entry = new TrustedCertEntry();
// read the alias
......@@ -808,7 +812,7 @@ public final class JceKeyStore extends KeyStoreSpi {
entries.put(alias, entry);
} else if (tag == 3) { // secret-key entry
secretKeyCount++;
SecretKeyEntry entry = new SecretKeyEntry();
// read the alias
......@@ -841,10 +845,18 @@ public final class JceKeyStore extends KeyStoreSpi {
entries.put(alias, entry);
} else {
throw new IOException("Unrecognized keystore entry");
throw new IOException("Unrecognized keystore entry: " +
tag);
}
}
if (debug != null) {
debug.println("JceKeyStore load: private key count: " +
privateKeyCount + ". trusted key count: " +
trustedKeyCount + ". secret key count: " +
secretKeyCount);
}
/*
* If a password has been provided, we check the keyed digest
* at the end. If this check fails, the store has been tampered
......
......@@ -48,6 +48,7 @@ import javax.security.auth.DestroyFailedException;
import sun.security.x509.AlgorithmId;
import sun.security.util.ObjectIdentifier;
import sun.security.util.SecurityProperties;
/**
* This class implements a protection mechanism for private keys. In JCE, we
......@@ -75,14 +76,39 @@ final class KeyProtector {
private static final String KEY_PROTECTOR_OID = "1.3.6.1.4.1.42.2.17.1.1";
private static final int MAX_ITERATION_COUNT = 5000000;
private static final int ITERATION_COUNT = 200000;
private static final int MIN_ITERATION_COUNT = 10000;
private static final int DEFAULT_ITERATION_COUNT = 200000;
private static final int SALT_LEN = 20; // the salt length
private static final int DIGEST_LEN = 20;
private static final int ITERATION_COUNT;
// the password used for protecting/recovering keys passed through this
// key protector
private char[] password;
/**
* {@systemProperty jdk.jceks.iterationCount} property indicating the
* number of iterations for password-based encryption (PBE) in JCEKS
* keystores. Values in the range 10000 to 5000000 are considered valid.
* If the value is out of this range, or is not a number, or is
* unspecified; a default of 200000 is used.
*/
static {
int iterationCount = DEFAULT_ITERATION_COUNT;
String ic = SecurityProperties.privilegedGetOverridable(
"jdk.jceks.iterationCount");
if (ic != null && !ic.isEmpty()) {
try {
iterationCount = Integer.parseInt(ic);
if (iterationCount < MIN_ITERATION_COUNT ||
iterationCount > MAX_ITERATION_COUNT) {
iterationCount = DEFAULT_ITERATION_COUNT;
}
} catch (NumberFormatException e) {}
}
ITERATION_COUNT = iterationCount;
}
KeyProtector(char[] password) {
if (password == null) {
throw new IllegalArgumentException("password can't be null");
......
......@@ -699,15 +699,15 @@ public final class XMLSignature extends SignatureElementProxy {
//create a SignatureAlgorithms from the SignatureMethod inside
//SignedInfo. This is used to validate the signature.
SignatureAlgorithm sa = si.getSignatureAlgorithm();
if (log.isLoggable(java.util.logging.Level.FINE)) {
log.log(java.util.logging.Level.FINE, "signatureMethodURI = " + sa.getAlgorithmURI());
log.log(java.util.logging.Level.FINE, "jceSigAlgorithm = " + sa.getJCEAlgorithmString());
log.log(java.util.logging.Level.FINE, "jceSigProvider = " + sa.getJCEProviderName());
log.log(java.util.logging.Level.FINE, "PublicKey = " + pk);
}
byte sigBytes[] = null;
try {
sa.initVerify(pk);
if (log.isLoggable(java.util.logging.Level.FINE)) {
log.log(java.util.logging.Level.FINE, "signatureMethodURI = " + sa.getAlgorithmURI());
log.log(java.util.logging.Level.FINE, "jceSigAlgorithm = " + sa.getJCEAlgorithmString());
log.log(java.util.logging.Level.FINE, "jceSigProvider = " + sa.getJCEProviderName());
log.log(java.util.logging.Level.FINE, "PublicKey = " + pk);
}
// Get the canonicalized (normalized) SignedInfo
SignerOutputStream so = new SignerOutputStream(sa);
......
......@@ -108,6 +108,7 @@ public class ResolverDirectHTTP extends ResourceResolverSpi {
@Override
public XMLSignatureInput engineResolveURI(ResourceResolverContext context)
throws ResourceResolverException {
InputStream inputStream = null;
try {
// calculate new URI
......@@ -139,7 +140,7 @@ public class ResolverDirectHTTP extends ResourceResolverSpi {
}
String mimeType = urlConnection.getHeaderField("Content-Type");
InputStream inputStream = urlConnection.getInputStream();
inputStream = urlConnection.getInputStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte buf[] = new byte[4096];
int read = 0;
......@@ -168,6 +169,16 @@ public class ResolverDirectHTTP extends ResourceResolverSpi {
throw new ResourceResolverException("generic.EmptyMessage", ex, context.attr, context.baseUri);
} catch (IllegalArgumentException e) {
throw new ResourceResolverException("generic.EmptyMessage", e, context.attr, context.baseUri);
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
if (log.isLoggable(java.util.logging.Level.FINE)) {
log.log(java.util.logging.Level.FINE, e.getMessage(), e);
}
}
}
}
}
......
......@@ -3348,8 +3348,8 @@ public final class Files {
// ensure lines is not null before opening file
Objects.requireNonNull(lines);
CharsetEncoder encoder = cs.newEncoder();
OutputStream out = newOutputStream(path, options);
try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, encoder))) {
try (OutputStream out = newOutputStream(path, options);
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, encoder))) {
for (CharSequence line: lines) {
writer.append(line);
writer.newLine();
......
......@@ -21,7 +21,7 @@
* under the License.
*/
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
*/
/*
* $Id: ApacheNodeSetData.java 1203890 2011-11-18 22:47:56Z mullan $
......@@ -47,7 +47,7 @@ public class ApacheNodeSetData implements ApacheData, NodeSetData {
this.xi = xi;
}
public Iterator iterator() {
public Iterator<Node> iterator() {
// If nodefilters are set, must execute them first to create node-set
if (xi.getNodeFilters() != null && !xi.getNodeFilters().isEmpty()) {
return Collections.unmodifiableSet
......
......@@ -21,7 +21,7 @@
* under the License.
*/
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
*/
/*
* $Id: DOMKeyInfo.java 1333869 2012-05-04 10:42:44Z coheigea $
......@@ -138,7 +138,7 @@ public final class DOMKeyInfo extends DOMStructure implements KeyInfo {
return id;
}
public List getContent() {
public List<XMLStructure> getContent() {
return keyInfoTypes;
}
......
......@@ -21,7 +21,7 @@
* under the License.
*/
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
*/
/*
* $Id: DOMKeyInfoFactory.java 1333869 2012-05-04 10:42:44Z coheigea $
......@@ -48,11 +48,12 @@ public final class DOMKeyInfoFactory extends KeyInfoFactory {
public DOMKeyInfoFactory() { }
@SuppressWarnings("rawtypes")
public KeyInfo newKeyInfo(List content) {
return newKeyInfo(content, null);
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public KeyInfo newKeyInfo(List content, String id) {
return new DOMKeyInfo(content, id);
}
......@@ -78,12 +79,12 @@ public final class DOMKeyInfoFactory extends KeyInfoFactory {
return newPGPData(keyId, null, null);
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public PGPData newPGPData(byte[] keyId, byte[] keyPacket, List other) {
return new DOMPGPData(keyId, keyPacket, other);
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public PGPData newPGPData(byte[] keyPacket, List other) {
return new DOMPGPData(keyPacket, other);
}
......@@ -92,7 +93,7 @@ public final class DOMKeyInfoFactory extends KeyInfoFactory {
return newRetrievalMethod(uri, null, null);
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public RetrievalMethod newRetrievalMethod(String uri, String type,
List transforms) {
if (uri == null) {
......@@ -101,7 +102,7 @@ public final class DOMKeyInfoFactory extends KeyInfoFactory {
return new DOMRetrievalMethod(uri, type, transforms);
}
@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
public X509Data newX509Data(List content) {
return new DOMX509Data(content);
}
......
......@@ -21,7 +21,7 @@
* under the License.
*/
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
*/
/*
* $Id: DOMKeyValue.java 1333415 2012-05-03 12:03:51Z coheigea $
......@@ -364,15 +364,16 @@ public abstract class DOMKeyValue extends DOMStructure implements KeyValue {
}
void getMethods() throws ClassNotFoundException, NoSuchMethodException {
Class c = Class.forName("sun.security.ec.ECParameters");
Class[] params = new Class[] { ECPoint.class, EllipticCurve.class };
Class<?> c = Class.forName("sun.security.ec.ECParameters");
Class<?>[] params = new Class<?>[] { ECPoint.class,
EllipticCurve.class };
encodePoint = c.getMethod("encodePoint", params);
params = new Class[] { ECParameterSpec.class };
params = new Class<?>[] { ECParameterSpec.class };
getCurveName = c.getMethod("getCurveName", params);
params = new Class[] { byte[].class, EllipticCurve.class };
params = new Class<?>[] { byte[].class, EllipticCurve.class };
decodePoint = c.getMethod("decodePoint", params);
c = Class.forName("sun.security.ec.NamedCurve");
params = new Class[] { String.class };
params = new Class<?>[] { String.class };
getECParameterSpec = c.getMethod("getECParameterSpec", params);
}
......
......@@ -128,7 +128,12 @@ public final class DOMManifest extends DOMStructure implements Manifest {
return id;
}
public List getReferences() {
@SuppressWarnings("unchecked")
static List<Reference> getManifestReferences(Manifest mf) {
return mf.getReferences();
}
public List<Reference> getReferences() {
return references;
}
......
......@@ -21,7 +21,7 @@
* under the License.
*/
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
*/
/*
* $Id: DOMPGPData.java 1203846 2011-11-18 21:18:17Z mullan $
......@@ -184,7 +184,7 @@ public final class DOMPGPData extends DOMStructure implements PGPData {
return (keyPacket == null ? null : (byte[])keyPacket.clone());
}
public List getExternalElements() {
public List<XMLStructure> getExternalElements() {
return externalElements;
}
......
......@@ -288,7 +288,7 @@ public final class DOMReference extends DOMStructure
return type;
}
public List getTransforms() {
public List<Transform> getTransforms() {
return Collections.unmodifiableList(allTransforms);
}
......@@ -638,7 +638,7 @@ public final class DOMReference extends DOMStructure
try {
final Set<Node> s = xsi.getNodeSet();
return new NodeSetData() {
public Iterator iterator() { return s.iterator(); }
public Iterator<Node> iterator() { return s.iterator(); }
};
} catch (Exception e) {
// log a warning
......
......@@ -178,7 +178,7 @@ public final class DOMRetrievalMethod extends DOMStructure
return type;
}
public List getTransforms() {
public List<Transform> getTransforms() {
return transforms;
}
......@@ -247,7 +247,7 @@ public final class DOMRetrievalMethod extends DOMStructure
if ((data instanceof NodeSetData) && Utils.secureValidation(context)
&& Policy.restrictRetrievalMethodLoops()) {
NodeSetData nsd = (NodeSetData)data;
Iterator i = nsd.iterator();
Iterator<?> i = nsd.iterator();
if (i.hasNext()) {
Node root = (Node)i.next();
if ("RetrievalMethod".equals(root.getLocalName())) {
......
......@@ -21,7 +21,7 @@
* under the License.
*/
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
*/
/*
* $Id: DOMSignatureProperties.java 1333415 2012-05-03 12:03:51Z coheigea $
......@@ -125,7 +125,7 @@ public final class DOMSignatureProperties extends DOMStructure
}
}
public List getProperties() {
public List<SignatureProperty> getProperties() {
return properties;
}
......
......@@ -21,7 +21,7 @@
* under the License.
*/
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
*/
/*
* $Id: DOMSignatureProperty.java 1333415 2012-05-03 12:03:51Z coheigea $
......@@ -123,7 +123,7 @@ public final class DOMSignatureProperty extends DOMStructure
}
}
public List getContent() {
public List<XMLStructure> getContent() {
return content;
}
......
......@@ -193,7 +193,7 @@ public final class DOMSignedInfo extends DOMStructure implements SignedInfo {
return id;
}
public List getReferences() {
public List<Reference> getReferences() {
return references;
}
......
......@@ -21,7 +21,7 @@
* under the License.
*/
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
*/
/*
* $Id$
......@@ -54,7 +54,7 @@ public class DOMSubTreeData implements NodeSetData {
this.excludeComments = excludeComments;
}
public Iterator iterator() {
public Iterator<Node> iterator() {
return new DelayedNodeIterator(root, excludeComments);
}
......
......@@ -21,7 +21,7 @@
* under the License.
*/
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
*/
/*
* $Id: DOMX509Data.java 1333415 2012-05-03 12:03:51Z coheigea $
......@@ -135,7 +135,7 @@ public final class DOMX509Data extends DOMStructure implements X509Data {
this.content = Collections.unmodifiableList(content);
}
public List getContent() {
public List<Object> getContent() {
return content;
}
......
......@@ -21,7 +21,7 @@
* under the License.
*/
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
*/
/*
* $Id: DOMXMLObject.java 1333415 2012-05-03 12:03:51Z coheigea $
......@@ -139,7 +139,7 @@ public final class DOMXMLObject extends DOMStructure implements XMLObject {
this.objectElem = objElem;
}
public List getContent() {
public List<XMLStructure> getContent() {
return content;
}
......
......@@ -21,7 +21,7 @@
* under the License.
*/
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
*/
/*
* ===========================================================================
......@@ -188,7 +188,7 @@ public final class DOMXMLSignature extends DOMStructure
return si;
}
public List getObjects() {
public List<XMLObject> getObjects() {
return objects;
}
......@@ -471,7 +471,8 @@ public final class DOMXMLSignature extends DOMStructure
digestReference((DOMReference)xs, signContext);
} else if (xs instanceof Manifest) {
Manifest man = (Manifest)xs;
List manRefs = man.getReferences();
List<Reference> manRefs =
DOMManifest.getManifestReferences(man);
for (int i = 0, size = manRefs.size(); i < size; i++) {
digestReference((DOMReference)manRefs.get(i),
signContext);
......
......@@ -58,7 +58,7 @@ public final class DOMXMLSignatureFactory extends XMLSignatureFactory {
return new DOMXMLSignature(si, ki, null, null, null);
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public XMLSignature newXMLSignature(SignedInfo si, KeyInfo ki,
List objects, String id, String signatureValueId) {
return new DOMXMLSignature(si, ki, objects, id, signatureValueId);
......@@ -68,13 +68,13 @@ public final class DOMXMLSignatureFactory extends XMLSignatureFactory {
return newReference(uri, dm, null, null, null);
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public Reference newReference(String uri, DigestMethod dm, List transforms,
String type, String id) {
return new DOMReference(uri, type, dm, transforms, id, getProvider());
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public Reference newReference(String uri, DigestMethod dm,
List appliedTransforms, Data result, List transforms, String type,
String id) {
......@@ -91,7 +91,7 @@ public final class DOMXMLSignatureFactory extends XMLSignatureFactory {
(uri, type, dm, appliedTransforms, result, transforms, id, getProvider());
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public Reference newReference(String uri, DigestMethod dm, List transforms,
String type, String id, byte[] digestValue) {
if (digestValue == null) {
......@@ -101,41 +101,41 @@ public final class DOMXMLSignatureFactory extends XMLSignatureFactory {
(uri, type, dm, null, null, transforms, id, digestValue, getProvider());
}
@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
public SignedInfo newSignedInfo(CanonicalizationMethod cm,
SignatureMethod sm, List references) {
return newSignedInfo(cm, sm, references, null);
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public SignedInfo newSignedInfo(CanonicalizationMethod cm,
SignatureMethod sm, List references, String id) {
return new DOMSignedInfo(cm, sm, references, id);
}
// Object factory methods
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public XMLObject newXMLObject(List content, String id, String mimeType,
String encoding) {
return new DOMXMLObject(content, id, mimeType, encoding);
}
@SuppressWarnings("unchecked")
@SuppressWarnings("rawtypes")
public Manifest newManifest(List references) {
return newManifest(references, null);
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public Manifest newManifest(List references, String id) {
return new DOMManifest(references, id);
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public SignatureProperties newSignatureProperties(List props, String id) {
return new DOMSignatureProperties(props, id);
}
@SuppressWarnings("unchecked")
@SuppressWarnings({ "unchecked", "rawtypes" })
public SignatureProperty newSignatureProperty
(List info, String target, String id) {
return new DOMSignatureProperty(info, target, id);
......
/*
* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -773,6 +773,8 @@ final class P11KeyStore extends KeyStoreSpi {
}
if (debug != null) {
dumpTokenMap();
debug.println("P11KeyStore load. Entry count: " +
aliasMap.size());
}
} catch (KeyStoreException | PKCS11Exception e) {
throw new IOException("load failed", e);
......
......@@ -2152,18 +2152,9 @@ public final class PKCS12KeyStore extends KeyStoreSpi {
}
if (debug != null) {
if (privateKeyCount > 0) {
debug.println("Loaded " + privateKeyCount +
" protected private key(s)");
}
if (secretKeyCount > 0) {
debug.println("Loaded " + secretKeyCount +
" protected secret key(s)");
}
if (certificateCount > 0) {
debug.println("Loaded " + certificateCount +
" certificate(s)");
}
debug.println("PKCS12KeyStore load: private key count: " +
privateKeyCount + ". secret key count: " + secretKeyCount +
". certificate count: " + certificateCount);
}
certEntries.clear();
......
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -35,6 +35,7 @@ import java.util.*;
import sun.misc.IOUtils;
import sun.security.pkcs.EncryptedPrivateKeyInfo;
import sun.security.pkcs12.PKCS12KeyStore;
import sun.security.util.Debug;
/**
* This class provides the keystore implementation referred to as "JKS".
......@@ -73,6 +74,7 @@ abstract class JavaKeyStore extends KeyStoreSpi {
}
}
private static final Debug debug = Debug.getInstance("keystore");
private static final int MAGIC = 0xfeedfeed;
private static final int VERSION_1 = 0x01;
private static final int VERSION_2 = 0x02;
......@@ -642,6 +644,7 @@ abstract class JavaKeyStore extends KeyStoreSpi {
Hashtable<String, CertificateFactory> cfs = null;
ByteArrayInputStream bais = null;
byte[] encoded = null;
int trustedKeyCount = 0, privateKeyCount = 0;
if (stream == null)
return;
......@@ -680,7 +683,7 @@ abstract class JavaKeyStore extends KeyStoreSpi {
tag = dis.readInt();
if (tag == 1) { // private key entry
privateKeyCount++;
KeyEntry entry = new KeyEntry();
// Read the alias
......@@ -729,7 +732,7 @@ abstract class JavaKeyStore extends KeyStoreSpi {
entries.put(alias, entry);
} else if (tag == 2) { // trusted certificate entry
trustedKeyCount++;
TrustedCertEntry entry = new TrustedCertEntry();
// Read the alias
......@@ -764,10 +767,16 @@ abstract class JavaKeyStore extends KeyStoreSpi {
entries.put(alias, entry);
} else {
throw new IOException("Unrecognized keystore entry");
throw new IOException("Unrecognized keystore entry: " +
tag);
}
}
if (debug != null) {
debug.println("JavaKeyStore load: private key count: " +
privateKeyCount + ". trusted key count: " + trustedKeyCount);
}
/*
* If a password has been provided, we check the keyed digest
* at the end. If this check fails, the store has been tampered
......
/*
* Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -1399,7 +1399,7 @@ final class ClientHandshaker extends Handshaker {
String sessionIdentityAlg =
session.getEndpointIdentificationAlgorithm();
if (!Objects.equals(identityAlg, sessionIdentityAlg)) {
if (!identityAlg.equalsIgnoreCase(sessionIdentityAlg)) {
if (debug != null && Debug.isOn("session")) {
System.out.println("%% can't resume, endpoint id" +
......
/*
* Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -705,7 +705,7 @@ final class ServerHandshaker extends Handshaker {
String sessionIdentityAlg =
previous.getEndpointIdentificationAlgorithm();
if (!Objects.equals(identityAlg, sessionIdentityAlg)) {
if (!identityAlg.equalsIgnoreCase(sessionIdentityAlg)) {
if (debug != null && Debug.isOn("session")) {
System.out.println("%% can't resume, endpoint id"
......
/*
* Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2020 Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -29,7 +29,7 @@ import java.util.*;
public class Worker extends Thread {
ArrayList<Runnable> jobs = new ArrayList<Runnable>();
private boolean stopped = false;
private volatile boolean stopped = false;
public Worker(String name) {
super("Worker-"+name);
......@@ -38,17 +38,17 @@ public class Worker extends Thread {
}
public void run() {
while (!isStopped()) {
while (!stopped) {
Runnable job;
synchronized(jobs) {
while (!isStopped() && jobs.size() == 0) {
while (!stopped && jobs.size() == 0) {
try {
jobs.wait();
} catch (InterruptedException ex) {
}
}
if(isStopped()) break;
if(stopped) break;
job = jobs.remove(0);
}
......@@ -56,11 +56,7 @@ public class Worker extends Thread {
}
}
private synchronized boolean isStopped() {
return stopped;
}
public synchronized void stopWorker() {
public void stopWorker() {
stopped = true;
synchronized(jobs) {
jobs.notify();
......
......@@ -242,6 +242,9 @@ public final class TimeZoneNames extends TimeZoneNamesBundle {
String TMT[] = new String[] {"Turkmenistan Time", "TMT",
"Turkmenistan Summer Time", "TMST",
"Turkmenistan Time", "TMT"};
String TRT[] = new String[] {"Turkey Time", "TRT",
"Turkey Summer Time", "TRST",
"Turkey Time", "TRT"};
String ULAT[]= new String[] {"Ulaanbaatar Time", "ULAT",
"Ulaanbaatar Summer Time", "ULAST",
"Ulaanbaatar Time", "ULAT"};
......@@ -639,7 +642,7 @@ public final class TimeZoneNames extends TimeZoneNamesBundle {
"Hovd Summer Time", "HOVST",
"Hovd Time", "HOVT"}},
{"Asia/Irkutsk", IRKT},
{"Asia/Istanbul", EET},
{"Asia/Istanbul", TRT},
{"Asia/Jakarta", WIT},
{"Asia/Jayapura", new String[] {"East Indonesia Time", "WIT",
"East Indonesia Summer Time", "EIST",
......@@ -819,7 +822,7 @@ public final class TimeZoneNames extends TimeZoneNamesBundle {
{"Europe/Guernsey", GMTBST},
{"Europe/Helsinki", EET},
{"Europe/Isle_of_Man", GMTBST},
{"Europe/Istanbul", EET},
{"Europe/Istanbul", TRT},
{"Europe/Jersey", GMTBST},
{"Europe/Kaliningrad", EET},
{"Europe/Kiev", EET},
......@@ -1021,7 +1024,7 @@ public final class TimeZoneNames extends TimeZoneNamesBundle {
{"SystemV/PST8PDT", PST},
{"SystemV/YST9", AKST},
{"SystemV/YST9YDT", AKST},
{"Turkey", EET},
{"Turkey", TRT},
{"UCT", UTC},
{"Universal", UTC},
{"US/Alaska", AKST},
......
......@@ -497,6 +497,7 @@ public class ZipFileSystem extends FileSystem {
boolean hasCreateNew = false;
boolean hasCreate = false;
boolean hasAppend = false;
boolean hasTruncate = false;
for (OpenOption opt: options) {
if (opt == READ)
throw new IllegalArgumentException("READ not allowed");
......@@ -506,7 +507,11 @@ public class ZipFileSystem extends FileSystem {
hasCreate = true;
if (opt == APPEND)
hasAppend = true;
if (opt == TRUNCATE_EXISTING)
hasTruncate = true;
}
if (hasAppend && hasTruncate)
throw new IllegalArgumentException("APPEND + TRUNCATE_EXISTING not allowed");
beginRead(); // only need a readlock, the "update()" will
try { // try to obtain a writelock when the os is
ensureOpen(); // being closed.
......@@ -558,6 +563,8 @@ public class ZipFileSystem extends FileSystem {
if (!(option instanceof StandardOpenOption))
throw new IllegalArgumentException();
}
if (options.contains(APPEND) && options.contains(TRUNCATE_EXISTING))
throw new IllegalArgumentException("APPEND + TRUNCATE_EXISTING not allowed");
}
// Returns a Writable/ReadByteChannel for now. Might consdier to use
......@@ -705,15 +712,19 @@ public class ZipFileSystem extends FileSystem {
if (forWrite) {
checkWritable();
if (e == null) {
if (!options.contains(StandardOpenOption.CREATE_NEW))
throw new NoSuchFileException(getString(path));
if (!options.contains(StandardOpenOption.CREATE) &&
!options.contains(StandardOpenOption.CREATE_NEW)) {
throw new NoSuchFileException(getString(path));
}
} else {
if (options.contains(StandardOpenOption.CREATE_NEW))
if (options.contains(StandardOpenOption.CREATE_NEW)) {
throw new FileAlreadyExistsException(getString(path));
}
if (e.isDir())
throw new FileAlreadyExistsException("directory <"
+ getString(path) + "> exists");
}
options = new HashSet<>(options);
options.remove(StandardOpenOption.CREATE_NEW); // for tmpfile
} else if (e == null || e.isDir()) {
throw new NoSuchFileException(getString(path));
......
......@@ -788,7 +788,7 @@ public class ZipPath implements Path {
{
if (options.length == 0)
return zfs.newOutputStream(getResolvedPath(),
CREATE_NEW, WRITE);
CREATE, TRUNCATE_EXISTING, WRITE);
return zfs.newOutputStream(getResolvedPath(), options);
}
......
......@@ -1002,6 +1002,16 @@ jdk.xml.dsig.secureValidationPolicy=\
jceks.key.serialFilter = java.lang.Enum;java.security.KeyRep;\
java.security.KeyRep$Type;javax.crypto.spec.SecretKeySpec;!*
# The iteration count used for password-based encryption (PBE) in JCEKS
# keystores. Values in the range 10000 to 5000000 are considered valid.
# If the value is out of this range, or is not a number, or is unspecified;
# a default of 200000 is used.
#
# If the system property jdk.jceks.iterationCount is also specified, it
# supersedes the security property value defined here.
#
#jdk.jceks.iterationCount = 200000
#
# Policies for distrusting Certificate Authorities (CAs).
#
......
......@@ -1008,6 +1008,16 @@ jdk.xml.dsig.secureValidationPolicy=\
jceks.key.serialFilter = java.lang.Enum;java.security.KeyRep;\
java.security.KeyRep$Type;javax.crypto.spec.SecretKeySpec;!*
# The iteration count used for password-based encryption (PBE) in JCEKS
# keystores. Values in the range 10000 to 5000000 are considered valid.
# If the value is out of this range, or is not a number, or is unspecified;
# a default of 200000 is used.
#
# If the system property jdk.jceks.iterationCount is also specified, it
# supersedes the security property value defined here.
#
#jdk.jceks.iterationCount = 200000
#
# Policies for distrusting Certificate Authorities (CAs).
#
......
......@@ -1006,6 +1006,16 @@ jdk.xml.dsig.secureValidationPolicy=\
jceks.key.serialFilter = java.lang.Enum;java.security.KeyRep;\
java.security.KeyRep$Type;javax.crypto.spec.SecretKeySpec;!*
# The iteration count used for password-based encryption (PBE) in JCEKS
# keystores. Values in the range 10000 to 5000000 are considered valid.
# If the value is out of this range, or is not a number, or is unspecified;
# a default of 200000 is used.
#
# If the system property jdk.jceks.iterationCount is also specified, it
# supersedes the security property value defined here.
#
#jdk.jceks.iterationCount = 200000
#
# Policies for distrusting Certificate Authorities (CAs).
#
......
......@@ -1005,6 +1005,16 @@ jdk.xml.dsig.secureValidationPolicy=\
jceks.key.serialFilter = java.lang.Enum;java.security.KeyRep;\
java.security.KeyRep$Type;javax.crypto.spec.SecretKeySpec;!*
# The iteration count used for password-based encryption (PBE) in JCEKS
# keystores. Values in the range 10000 to 5000000 are considered valid.
# If the value is out of this range, or is not a number, or is unspecified;
# a default of 200000 is used.
#
# If the system property jdk.jceks.iterationCount is also specified, it
# supersedes the security property value defined here.
#
#jdk.jceks.iterationCount = 200000
#
# Policies for distrusting Certificate Authorities (CAs).
#
......
......@@ -1006,6 +1006,16 @@ jdk.xml.dsig.secureValidationPolicy=\
jceks.key.serialFilter = java.lang.Enum;java.security.KeyRep;\
java.security.KeyRep$Type;javax.crypto.spec.SecretKeySpec;!*
# The iteration count used for password-based encryption (PBE) in JCEKS
# keystores. Values in the range 10000 to 5000000 are considered valid.
# If the value is out of this range, or is not a number, or is unspecified;
# a default of 200000 is used.
#
# If the system property jdk.jceks.iterationCount is also specified, it
# supersedes the security property value defined here.
#
#jdk.jceks.iterationCount = 200000
#
# Policies for distrusting Certificate Authorities (CAs).
#
......
......@@ -162,7 +162,7 @@ static unsigned long ReadTTFontFileFunc(FT_Stream stream,
*/
if (numBytes == 0) {
if (offset >= scalerInfo->fileSize) {
if (offset > scalerInfo->fileSize) {
return -1;
} else {
return 0;
......
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
#ifndef __khrplatform_h_
#define __khrplatform_h_
/*
** This file is available under and governed by the GNU General Public
** License version 2 only, as published by the Free Software Foundation.
** However, the following notice accompanied the original version of this
** file:
**
** Copyright (c) 2008-2018 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
/* Khronos platform-specific types and definitions.
*
* The master copy of khrplatform.h is maintained in the Khronos EGL
* Registry repository at https://github.com/KhronosGroup/EGL-Registry
* The last semantic modification to khrplatform.h was at commit ID:
* 67a3e0864c2d75ea5287b9f3d2eb74a745936692
*
* Adopters may modify this file to suit their platform. Adopters are
* encouraged to submit platform specific modifications to the Khronos
* group so that they can be included in future versions of this file.
* Please submit changes by filing pull requests or issues on
* the EGL Registry repository linked above.
*
*
* See the Implementer's Guidelines for information about where this file
* should be located on your system and for more details of its use:
* http://www.khronos.org/registry/implementers_guide.pdf
*
* This file should be included as
* #include <KHR/khrplatform.h>
* by Khronos client API header files that use its types and defines.
*
* The types in khrplatform.h should only be used to define API-specific types.
*
* Types defined in khrplatform.h:
* khronos_int8_t signed 8 bit
* khronos_uint8_t unsigned 8 bit
* khronos_int16_t signed 16 bit
* khronos_uint16_t unsigned 16 bit
* khronos_int32_t signed 32 bit
* khronos_uint32_t unsigned 32 bit
* khronos_int64_t signed 64 bit
* khronos_uint64_t unsigned 64 bit
* khronos_intptr_t signed same number of bits as a pointer
* khronos_uintptr_t unsigned same number of bits as a pointer
* khronos_ssize_t signed size
* khronos_usize_t unsigned size
* khronos_float_t signed 32 bit floating point
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
* nanoseconds
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
* khronos_boolean_enum_t enumerated boolean type. This should
* only be used as a base type when a client API's boolean type is
* an enum. Client APIs which use an integer or other type for
* booleans cannot use this as the base type for their boolean.
*
* Tokens defined in khrplatform.h:
*
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
*
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
*
* Calling convention macros defined in this file:
* KHRONOS_APICALL
* KHRONOS_APIENTRY
* KHRONOS_APIATTRIBUTES
*
* These may be used in function prototypes as:
*
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
* int arg1,
* int arg2) KHRONOS_APIATTRIBUTES;
*/
#if defined(__SCITECH_SNAP__) && !defined(KHRONOS_STATIC)
# define KHRONOS_STATIC 1
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APICALL
*-------------------------------------------------------------------------
* This precedes the return type of the function in the function prototype.
*/
#if defined(KHRONOS_STATIC)
/* If the preprocessor constant KHRONOS_STATIC is defined, make the
* header compatible with static linking. */
# define KHRONOS_APICALL
#elif defined(_WIN32)
# define KHRONOS_APICALL __declspec(dllimport)
#elif defined (__SYMBIAN32__)
# define KHRONOS_APICALL IMPORT_C
#elif (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 303) \
|| (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
/* KHRONOS_APIATTRIBUTES is not used by the client API headers yet */
# define KHRONOS_APICALL __attribute__((visibility("default")))
#else
# define KHRONOS_APICALL
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APIENTRY
*-------------------------------------------------------------------------
* This follows the return type of the function and precedes the function
* name in the function prototype.
*/
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(KHRONOS_STATIC)
/* Win32 but not WinCE */
# define KHRONOS_APIENTRY __stdcall
#else
# define KHRONOS_APIENTRY
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APIATTRIBUTES
*-------------------------------------------------------------------------
* This follows the closing parenthesis of the function prototype arguments.
*/
#if defined (__ARMCC_2__)
#define KHRONOS_APIATTRIBUTES __softfp
#else
#define KHRONOS_APIATTRIBUTES
#endif
/*-------------------------------------------------------------------------
* basic type definitions
*-----------------------------------------------------------------------*/
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
/*
* Using <stdint.h>
*/
#include <stdint.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(__VMS ) || defined(__sgi)
/*
* Using <inttypes.h>
*/
#include <inttypes.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
/*
* Win32
*/
typedef __int32 khronos_int32_t;
typedef unsigned __int32 khronos_uint32_t;
typedef __int64 khronos_int64_t;
typedef unsigned __int64 khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(__sun__) || defined(__digital__)
/*
* Sun or Digital
*/
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
#if defined(__arch64__) || defined(_LP64)
typedef long int khronos_int64_t;
typedef unsigned long int khronos_uint64_t;
#else
typedef long long int khronos_int64_t;
typedef unsigned long long int khronos_uint64_t;
#endif /* __arch64__ */
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif 0
/*
* Hypothetical platform with no float or int64 support
*/
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
#define KHRONOS_SUPPORT_INT64 0
#define KHRONOS_SUPPORT_FLOAT 0
#else
/*
* Generic fallback
*/
#include <stdint.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#endif
/*
* Types that are (so far) the same on all platforms
*/
typedef signed char khronos_int8_t;
typedef unsigned char khronos_uint8_t;
typedef signed short int khronos_int16_t;
typedef unsigned short int khronos_uint16_t;
/*
* Types that differ between LLP64 and LP64 architectures - in LLP64,
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
* to be the only LLP64 architecture in current use.
*/
#ifdef _WIN64
typedef signed long long int khronos_intptr_t;
typedef unsigned long long int khronos_uintptr_t;
typedef signed long long int khronos_ssize_t;
typedef unsigned long long int khronos_usize_t;
#else
typedef signed long int khronos_intptr_t;
typedef unsigned long int khronos_uintptr_t;
typedef signed long int khronos_ssize_t;
typedef unsigned long int khronos_usize_t;
#endif
#if KHRONOS_SUPPORT_FLOAT
/*
* Float type
*/
typedef float khronos_float_t;
#endif
#if KHRONOS_SUPPORT_INT64
/* Time types
*
* These types can be used to represent a time interval in nanoseconds or
* an absolute Unadjusted System Time. Unadjusted System Time is the number
* of nanoseconds since some arbitrary system event (e.g. since the last
* time the system booted). The Unadjusted System Time is an unsigned
* 64 bit value that wraps back to 0 every 584 years. Time intervals
* may be either signed or unsigned.
*/
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
typedef khronos_int64_t khronos_stime_nanoseconds_t;
#endif
/*
* Dummy value used to pad enum types to 32 bits.
*/
#ifndef KHRONOS_MAX_ENUM
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
#endif
/*
* Enumerated boolean type
*
* Values other than zero should be considered to be true. Therefore
* comparisons should not be made against KHRONOS_TRUE.
*/
typedef enum {
KHRONOS_FALSE = 0,
KHRONOS_TRUE = 1,
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
} khronos_boolean_enum_t;
#endif /* __khrplatform_h_ */
......@@ -1004,29 +1004,37 @@ public class XBaseWindow {
* InputEvent.BUTTON_DOWN_MASK.
* One more bit is reserved for FIRST_HIGH_BIT.
*/
if (xbe.get_button() > SunToolkit.MAX_BUTTONS_SUPPORTED) {
int theButton = xbe.get_button();
if (theButton > SunToolkit.MAX_BUTTONS_SUPPORTED) {
return;
}
int buttonState = 0;
buttonState = xbe.get_state() & XConstants.ALL_BUTTONS_MASK;
switch (xev.get_type()) {
case XConstants.ButtonPress:
if (buttonState == 0) {
XWindowPeer parent = getToplevelXWindow();
// See 6385277, 6981400.
if (parent != null && parent.isFocusableWindow()) {
// A click in a client area drops the actual focused window retaining.
parent.setActualFocusedWindow(null);
parent.requestWindowFocus(xbe.get_time(), true);
}
XAwtState.setAutoGrabWindow(this);
}
break;
case XConstants.ButtonRelease:
if (isFullRelease(buttonState, xbe.get_button())) {
XAwtState.setAutoGrabWindow(null);
boolean isWheel = (theButton == XConstants.MouseWheelUp ||
theButton == XConstants.MouseWheelDown);
// don't give focus if it's just the mouse wheel turning
if (!isWheel) {
switch (xev.get_type()) {
case XConstants.ButtonPress:
if (buttonState == 0) {
XWindowPeer parent = getToplevelXWindow();
// See 6385277, 6981400.
if (parent != null && parent.isFocusableWindow()) {
// A click in a client area drops the actual focused window retaining.
parent.setActualFocusedWindow(null);
parent.requestWindowFocus(xbe.get_time(), true);
}
XAwtState.setAutoGrabWindow(this);
}
break;
case XConstants.ButtonRelease:
if (isFullRelease(buttonState, xbe.get_button())) {
XAwtState.setAutoGrabWindow(null);
}
break;
}
break;
}
}
public void handleMotionNotify(XEvent xev) {
......
......@@ -206,6 +206,11 @@ final public class XConstants {
public static final int buttons [] = new int [] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24};
// those should probably be wrapped in a method or such
// as it may be possible to remap them via x11 configuration files
public static final int MouseWheelUp = buttons[3];
public static final int MouseWheelDown = buttons[4];
/* Notify modes */
public static final int NotifyNormal = 0 ;
......
......@@ -23,6 +23,8 @@
* questions.
*/
#include <assert.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/param.h>
......@@ -61,18 +63,35 @@ typedef struct {
static int sigWakeup = SIGIO;
/*
* The fd table and the number of file descriptors
* fdTable holds one entry per file descriptor, up to a certain
* maximum.
* Theoretically, the number of possible file descriptors can get
* large, though usually it does not. Entries for small value file
* descriptors are kept in a simple table, which covers most scenarios.
* Entries for large value file descriptors are kept in an overflow
* table, which is organized as a sparse two dimensional array whose
* slabs are allocated on demand. This covers all corner cases while
* keeping memory consumption reasonable.
*/
static fdEntry_t *fdTable;
static int fdCount;
/*
* This limit applies if getlimit() returns unlimited.
* Unfortunately, this means if someone wants a higher limit
* then they have to set an explicit limit, higher than this,
* which is probably counter-intuitive.
/* Base table for low value file descriptors */
static fdEntry_t* fdTable = NULL;
/* Maximum size of base table (in number of entries). */
static const int fdTableMaxSize = 0x1000; /* 4K */
/* Actual size of base table (in number of entries) */
static int fdTableLen = 0;
/* Max. theoretical number of file descriptors on system. */
static int fdLimit = 0;
/* Overflow table, should base table not be large enough. Organized as
* an array of n slabs, each holding 64k entries.
*/
#define MAX_FD_COUNT 4096
static fdEntry_t** fdOverflowTable = NULL;
/* Number of slabs in the overflow table */
static int fdOverflowTableLen = 0;
/* Number of entries in one slab */
static const int fdOverflowTableSlabSize = 0x10000; /* 64k */
pthread_mutex_t fdOverflowTableLock = PTHREAD_MUTEX_INITIALIZER;
/*
* Null signal handler
......@@ -88,26 +107,43 @@ static void __attribute((constructor)) init() {
struct rlimit nbr_files;
sigset_t sigset;
struct sigaction sa;
int i;
int i = 0;
/*
* Allocate table based on the maximum number of
* file descriptors.
*/
getrlimit(RLIMIT_NOFILE, &nbr_files);
if (nbr_files.rlim_max == RLIM_INFINITY) {
fdCount = MAX_FD_COUNT;
/* Determine the maximum number of possible file descriptors. */
if (-1 == getrlimit(RLIMIT_NOFILE, &nbr_files)) {
fprintf(stderr, "library initialization failed - "
"unable to get max # of allocated fds\n");
abort();
}
if (nbr_files.rlim_max != RLIM_INFINITY) {
fdLimit = nbr_files.rlim_max;
} else {
fdCount = nbr_files.rlim_max;
/* We just do not know. */
fdLimit = INT_MAX;
}
fdTable = (fdEntry_t *)calloc(fdCount, sizeof(fdEntry_t));
/* Allocate table for low value file descriptors. */
fdTableLen = fdLimit < fdTableMaxSize ? fdLimit : fdTableMaxSize;
fdTable = (fdEntry_t*) calloc(fdTableLen, sizeof(fdEntry_t));
if (fdTable == NULL) {
fprintf(stderr, "library initialization failed - "
"unable to allocate file descriptor table - out of memory");
abort();
} else {
for (i = 0; i < fdTableLen; i ++) {
pthread_mutex_init(&fdTable[i].lock, NULL);
}
}
for (i=0; i<fdCount; i++) {
pthread_mutex_init(&fdTable[i].lock, NULL);
/* Allocate overflow table, if needed */
if (fdLimit > fdTableMaxSize) {
fdOverflowTableLen = ((fdLimit - fdTableMaxSize) / fdOverflowTableSlabSize) + 1;
fdOverflowTable = (fdEntry_t**) calloc(fdOverflowTableLen, sizeof(fdEntry_t*));
if (fdOverflowTable == NULL) {
fprintf(stderr, "library initialization failed - "
"unable to allocate file descriptor overflow table - out of memory");
abort();
}
}
/*
......@@ -124,17 +160,60 @@ static void __attribute((constructor)) init() {
}
/*
* Return the fd table for this fd or NULL is fd out
* of range.
* Return the fd table for this fd.
*/
static inline fdEntry_t *getFdEntry(int fd)
{
if (fd < 0 || fd >= fdCount) {
fdEntry_t* result = NULL;
if (fd < 0) {
return NULL;
}
return &fdTable[fd];
/* This should not happen. If it does, our assumption about
* max. fd value was wrong. */
assert(fd < fdLimit);
if (fd < fdTableMaxSize) {
/* fd is in base table. */
assert(fd < fdTableLen);
result = &fdTable[fd];
} else {
/* fd is in overflow table. */
const int indexInOverflowTable = fd - fdTableMaxSize;
const int rootindex = indexInOverflowTable / fdOverflowTableSlabSize;
const int slabindex = indexInOverflowTable % fdOverflowTableSlabSize;
fdEntry_t* slab = NULL;
assert(rootindex < fdOverflowTableLen);
assert(slabindex < fdOverflowTableSlabSize);
pthread_mutex_lock(&fdOverflowTableLock);
/* Allocate new slab in overflow table if needed */
if (fdOverflowTable[rootindex] == NULL) {
fdEntry_t* const newSlab =
(fdEntry_t*)calloc(fdOverflowTableSlabSize, sizeof(fdEntry_t));
if (newSlab == NULL) {
fprintf(stderr, "Unable to allocate file descriptor overflow"
" table slab - out of memory");
pthread_mutex_unlock(&fdOverflowTableLock);
abort();
} else {
int i;
for (i = 0; i < fdOverflowTableSlabSize; i ++) {
pthread_mutex_init(&newSlab[i].lock, NULL);
}
fdOverflowTable[rootindex] = newSlab;
}
}
pthread_mutex_unlock(&fdOverflowTableLock);
slab = fdOverflowTable[rootindex];
result = &slab[slabindex];
}
return result;
}
/*
* Start a blocking operation :-
* Insert thread onto thread list for the fd.
......
......@@ -23,6 +23,8 @@
* questions.
*/
#include <assert.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
......@@ -59,10 +61,35 @@ typedef struct {
static int sigWakeup = (__SIGRTMAX - 2);
/*
* The fd table and the number of file descriptors
* fdTable holds one entry per file descriptor, up to a certain
* maximum.
* Theoretically, the number of possible file descriptors can get
* large, though usually it does not. Entries for small value file
* descriptors are kept in a simple table, which covers most scenarios.
* Entries for large value file descriptors are kept in an overflow
* table, which is organized as a sparse two dimensional array whose
* slabs are allocated on demand. This covers all corner cases while
* keeping memory consumption reasonable.
*/
static fdEntry_t *fdTable;
static int fdCount;
/* Base table for low value file descriptors */
static fdEntry_t* fdTable = NULL;
/* Maximum size of base table (in number of entries). */
static const int fdTableMaxSize = 0x1000; /* 4K */
/* Actual size of base table (in number of entries) */
static int fdTableLen = 0;
/* Max. theoretical number of file descriptors on system. */
static int fdLimit = 0;
/* Overflow table, should base table not be large enough. Organized as
* an array of n slabs, each holding 64k entries.
*/
static fdEntry_t** fdOverflowTable = NULL;
/* Number of slabs in the overflow table */
static int fdOverflowTableLen = 0;
/* Number of entries in one slab */
static const int fdOverflowTableSlabSize = 0x10000; /* 64k */
pthread_mutex_t fdOverflowTableLock = PTHREAD_MUTEX_INITIALIZER;
/*
* Null signal handler
......@@ -78,18 +105,43 @@ static void __attribute((constructor)) init() {
struct rlimit nbr_files;
sigset_t sigset;
struct sigaction sa;
int i = 0;
/*
* Allocate table based on the maximum number of
* file descriptors.
*/
getrlimit(RLIMIT_NOFILE, &nbr_files);
fdCount = nbr_files.rlim_max;
fdTable = (fdEntry_t *)calloc(fdCount, sizeof(fdEntry_t));
/* Determine the maximum number of possible file descriptors. */
if (-1 == getrlimit(RLIMIT_NOFILE, &nbr_files)) {
fprintf(stderr, "library initialization failed - "
"unable to get max # of allocated fds\n");
abort();
}
if (nbr_files.rlim_max != RLIM_INFINITY) {
fdLimit = nbr_files.rlim_max;
} else {
/* We just do not know. */
fdLimit = INT_MAX;
}
/* Allocate table for low value file descriptors. */
fdTableLen = fdLimit < fdTableMaxSize ? fdLimit : fdTableMaxSize;
fdTable = (fdEntry_t*) calloc(fdTableLen, sizeof(fdEntry_t));
if (fdTable == NULL) {
fprintf(stderr, "library initialization failed - "
"unable to allocate file descriptor table - out of memory");
abort();
} else {
for (i = 0; i < fdTableLen; i ++) {
pthread_mutex_init(&fdTable[i].lock, NULL);
}
}
/* Allocate overflow table, if needed */
if (fdLimit > fdTableMaxSize) {
fdOverflowTableLen = ((fdLimit - fdTableMaxSize) / fdOverflowTableSlabSize) + 1;
fdOverflowTable = (fdEntry_t**) calloc(fdOverflowTableLen, sizeof(fdEntry_t*));
if (fdOverflowTable == NULL) {
fprintf(stderr, "library initialization failed - "
"unable to allocate file descriptor overflow table - out of memory");
abort();
}
}
/*
......@@ -106,15 +158,57 @@ static void __attribute((constructor)) init() {
}
/*
* Return the fd table for this fd or NULL is fd out
* of range.
* Return the fd table for this fd.
*/
static inline fdEntry_t *getFdEntry(int fd)
{
if (fd < 0 || fd >= fdCount) {
fdEntry_t* result = NULL;
if (fd < 0) {
return NULL;
}
return &fdTable[fd];
/* This should not happen. If it does, our assumption about
* max. fd value was wrong. */
assert(fd < fdLimit);
if (fd < fdTableMaxSize) {
/* fd is in base table. */
assert(fd < fdTableLen);
result = &fdTable[fd];
} else {
/* fd is in overflow table. */
const int indexInOverflowTable = fd - fdTableMaxSize;
const int rootindex = indexInOverflowTable / fdOverflowTableSlabSize;
const int slabindex = indexInOverflowTable % fdOverflowTableSlabSize;
fdEntry_t* slab = NULL;
assert(rootindex < fdOverflowTableLen);
assert(slabindex < fdOverflowTableSlabSize);
pthread_mutex_lock(&fdOverflowTableLock);
/* Allocate new slab in overflow table if needed */
if (fdOverflowTable[rootindex] == NULL) {
fdEntry_t* const newSlab =
(fdEntry_t*)calloc(fdOverflowTableSlabSize, sizeof(fdEntry_t));
if (newSlab == NULL) {
fprintf(stderr, "Unable to allocate file descriptor overflow"
" table slab - out of memory");
pthread_mutex_unlock(&fdOverflowTableLock);
abort();
} else {
int i;
for (i = 0; i < fdOverflowTableSlabSize; i ++) {
pthread_mutex_init(&newSlab[i].lock, NULL);
}
fdOverflowTable[rootindex] = newSlab;
}
}
pthread_mutex_unlock(&fdOverflowTableLock);
slab = fdOverflowTable[rootindex];
result = &slab[slabindex];
}
return result;
}
/*
......
......@@ -22,7 +22,6 @@
* questions.
*/
/* $Id: glx.h,v 1.38 2002/10/14 13:52:27 brianp Exp $ */
/*
* This file is available under and governed by the GNU General Public
......@@ -31,9 +30,8 @@
* file:
*
* Mesa 3-D graphics library
* Version: 4.1
*
* Copyright (C) 1999-2002 Brian Paul All Rights Reserved.
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
......@@ -48,9 +46,10 @@
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
......@@ -58,31 +57,15 @@
#define GLX_H
#ifdef __VMS
#include <GL/vms_x_fix.h>
# ifdef __cplusplus
/* VMS Xlib.h gives problems with C++.
* this avoids a bunch of trivial warnings */
#pragma message disable nosimpint
#endif
#endif
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#ifdef __VMS
# ifdef __cplusplus
#pragma message enable nosimpint
#endif
#endif
/* modified for inclusion in Java 2D source tree */
/* #include <GL/gl.h> */
/* JDK modification of include path to be sure to pick up the correct file */
#include "J2D_GL/gl.h"
/*
#if defined(USE_MGL_NAMESPACE)
#include <GL/glx_mangle.h>
#include "glx_mangle.h"
#endif
*/
#ifdef __cplusplus
......@@ -146,8 +129,6 @@ extern "C" {
*/
#define GLX_CONFIG_CAVEAT 0x20
#define GLX_DONT_CARE 0xFFFFFFFF
#define GLX_SLOW_CONFIG 0x8001
#define GLX_NON_CONFORMANT_CONFIG 0x800D
#define GLX_X_VISUAL_TYPE 0x22
#define GLX_TRANSPARENT_TYPE 0x23
#define GLX_TRANSPARENT_INDEX_VALUE 0x24
......@@ -155,17 +136,6 @@ extern "C" {
#define GLX_TRANSPARENT_GREEN_VALUE 0x26
#define GLX_TRANSPARENT_BLUE_VALUE 0x27
#define GLX_TRANSPARENT_ALPHA_VALUE 0x28
#define GLX_MAX_PBUFFER_WIDTH 0x8016
#define GLX_MAX_PBUFFER_HEIGHT 0x8017
#define GLX_MAX_PBUFFER_PIXELS 0x8018
#define GLX_PRESERVED_CONTENTS 0x801B
#define GLX_LARGEST_PBUFFER 0x801C
#define GLX_WIDTH 0x801D
#define GLX_HEIGHT 0x801E
#define GLX_EVENT_MASK 0x801F
#define GLX_DRAWABLE_TYPE 0x8010
#define GLX_FBCONFIG_ID 0x8013
#define GLX_VISUAL_ID 0x800B
#define GLX_WINDOW_BIT 0x00000001
#define GLX_PIXMAP_BIT 0x00000002
#define GLX_PBUFFER_BIT 0x00000004
......@@ -177,10 +147,8 @@ extern "C" {
#define GLX_DEPTH_BUFFER_BIT 0x00000020
#define GLX_STENCIL_BUFFER_BIT 0x00000040
#define GLX_ACCUM_BUFFER_BIT 0x00000080
#define GLX_DRAWABLE_TYPE 0x8010
#define GLX_RENDER_TYPE 0x8011
#define GLX_X_RENDERABLE 0x8012
#define GLX_NONE 0x8000
#define GLX_SLOW_CONFIG 0x8001
#define GLX_TRUE_COLOR 0x8002
#define GLX_DIRECT_COLOR 0x8003
#define GLX_PSEUDO_COLOR 0x8004
......@@ -189,28 +157,33 @@ extern "C" {
#define GLX_STATIC_GRAY 0x8007
#define GLX_TRANSPARENT_RGB 0x8008
#define GLX_TRANSPARENT_INDEX 0x8009
#define GLX_VISUAL_ID 0x800B
#define GLX_SCREEN 0x800C
#define GLX_NON_CONFORMANT_CONFIG 0x800D
#define GLX_DRAWABLE_TYPE 0x8010
#define GLX_RENDER_TYPE 0x8011
#define GLX_X_RENDERABLE 0x8012
#define GLX_FBCONFIG_ID 0x8013
#define GLX_RGBA_TYPE 0x8014
#define GLX_COLOR_INDEX_TYPE 0x8015
#define GLX_COLOR_INDEX_BIT 0x00000002
#define GLX_RGBA_BIT 0x00000001
#define GLX_SCREEN 0x800C
#define GLX_PBUFFER_CLOBBER_MASK 0x08000000
#define GLX_MAX_PBUFFER_WIDTH 0x8016
#define GLX_MAX_PBUFFER_HEIGHT 0x8017
#define GLX_MAX_PBUFFER_PIXELS 0x8018
#define GLX_PRESERVED_CONTENTS 0x801B
#define GLX_LARGEST_PBUFFER 0x801C
#define GLX_WIDTH 0x801D
#define GLX_HEIGHT 0x801E
#define GLX_EVENT_MASK 0x801F
#define GLX_DAMAGED 0x8020
#define GLX_SAVED 0x8021
#define GLX_WINDOW 0x8022
#define GLX_PBUFFER 0x8023
/**
* REMIND: these values are backwards from Sun's OpenGL headers, so we
* swap them here if building on Solaris/Sparc
*/
#ifdef __sparc
#define GLX_PBUFFER_HEIGHT 0x8041
#define GLX_PBUFFER_WIDTH 0x8040
#else /* __sparc */
#define GLX_PBUFFER_HEIGHT 0x8040
#define GLX_PBUFFER_WIDTH 0x8041
#endif /* __sparc */
#define GLX_RGBA_BIT 0x00000001
#define GLX_COLOR_INDEX_BIT 0x00000002
#define GLX_PBUFFER_CLOBBER_MASK 0x08000000
/*
* GLX 1.4 and later:
......@@ -231,6 +204,16 @@ typedef XID GLXWindow;
typedef XID GLXPbuffer;
/*
** Events.
** __GLX_NUMBER_EVENTS is set to 17 to account for the BufferClobberSGIX
** event - this helps initialization if the server supports the pbuffer
** extension and the client doesn't.
*/
#define GLX_PbufferClobber 0
#define GLX_BufferSwapComplete 1
#define __GLX_NUMBER_EVENTS 17
extern XVisualInfo* glXChooseVisual( Display *dpy, int screen,
int *attribList );
......@@ -335,200 +318,158 @@ extern void glXSelectEvent( Display *dpy, GLXDrawable drawable,
extern void glXGetSelectedEvent( Display *dpy, GLXDrawable drawable,
unsigned long *mask );
/* GLX 1.4 and later */
extern void (*glXGetProcAddress(const GLubyte *procname))();
#ifndef GLX_GLXEXT_LEGACY
/* modified for inclusion in Java 2D source tree */
/* #include <GL/glxext.h> */
#include "J2D_GL/glxext.h"
#else
/* GLX 1.3 function pointer typedefs */
typedef GLXFBConfig * (* PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements);
typedef GLXFBConfig * (* PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
typedef int (* PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value);
typedef XVisualInfo * (* PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
typedef GLXWindow (* PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
typedef void (* PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win);
typedef GLXPixmap (* PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
typedef void (* PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap);
typedef GLXPbuffer (* PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list);
typedef void (* PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf);
typedef void (* PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
typedef GLXContext (* PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
typedef Bool (* PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
typedef GLXDrawable (* PFNGLXGETCURRENTREADDRAWABLEPROC) (void);
typedef Display * (* PFNGLXGETCURRENTDISPLAYPROC) (void);
typedef int (* PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value);
typedef void (* PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask);
typedef void (* PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
/*
* 28. GLX_EXT_visual_info extension
*/
#ifndef GLX_EXT_visual_info
#define GLX_EXT_visual_info 1
#define GLX_X_VISUAL_TYPE_EXT 0x22
#define GLX_TRANSPARENT_TYPE_EXT 0x23
#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24
#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25
#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26
#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27
#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28
#define GLX_TRUE_COLOR_EXT 0x8002
#define GLX_DIRECT_COLOR_EXT 0x8003
#define GLX_PSEUDO_COLOR_EXT 0x8004
#define GLX_STATIC_COLOR_EXT 0x8005
#define GLX_GRAY_SCALE_EXT 0x8006
#define GLX_STATIC_GRAY_EXT 0x8007
#define GLX_NONE_EXT 0x8000
#define GLX_TRANSPARENT_RGB_EXT 0x8008
#define GLX_TRANSPARENT_INDEX_EXT 0x8009
#endif /* 28. GLX_EXT_visual_info extension */
/*
* 41. GLX_SGI_video_sync
*/
#ifndef GLX_SGI_video_sync
#define GLX_SGI_video_sync 1
extern int glXGetVideoSyncSGI(unsigned int *count);
extern int glXWaitVideoSyncSGI(int divisor, int remainder, unsigned int *count);
#endif /* GLX_SGI_video_sync */
/*
* 42. GLX_EXT_visual_rating
*/
#ifndef GLX_EXT_visual_rating
#define GLX_EXT_visual_rating 1
#define GLX_VISUAL_CAVEAT_EXT 0x20
/*#define GLX_NONE_EXT 0x8000*/
#define GLX_SLOW_VISUAL_EXT 0x8001
#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D
#endif /* GLX_EXT_visual_rating */
/*
* 47. GLX_EXT_import_context
* ARB 2. GLX_ARB_get_proc_address
*/
#ifndef GLX_EXT_import_context
#define GLX_EXT_import_context 1
#define GLX_SHARE_CONTEXT_EXT 0x800A
#define GLX_VISUAL_ID_EXT 0x800B
#define GLX_SCREEN_EXT 0x800C
extern void glXFreeContextEXT(Display *dpy, GLXContext context);
extern GLXContextID glXGetContextIDEXT(const GLXContext context);
extern Display *glXGetCurrentDisplayEXT(void);
extern GLXContext glXImportContextEXT(Display *dpy, GLXContextID contextID);
extern int glXQueryContextInfoEXT(Display *dpy, GLXContext context,
int attribute,int *value);
#ifndef GLX_ARB_get_proc_address
#define GLX_ARB_get_proc_address 1
#endif /* GLX_EXT_import_context */
typedef void (*__GLXextFuncPtr)(void);
extern __GLXextFuncPtr glXGetProcAddressARB (const GLubyte *);
#endif /* GLX_ARB_get_proc_address */
/*
* 215. GLX_MESA_copy_sub_buffer
*/
#ifndef GLX_MESA_copy_sub_buffer
#define GLX_MESA_copy_sub_buffer 1
extern void glXCopySubBufferMESA( Display *dpy, GLXDrawable drawable,
int x, int y, int width, int height );
/* GLX 1.4 and later */
extern void (*glXGetProcAddress(const GLubyte *procname))( void );
#endif
/* GLX 1.4 function pointer typedefs */
typedef __GLXextFuncPtr (* PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName);
#ifndef GLX_GLXEXT_LEGACY
/*
* 216. GLX_MESA_pixmap_colormap
*/
#ifndef GLX_MESA_pixmap_colormap
#define GLX_MESA_pixmap_colormap 1
/* JDK modification of include path to be sure to pick up the correct file */
#include "J2D_GL/glxext.h"
extern GLXPixmap glXCreateGLXPixmapMESA( Display *dpy, XVisualInfo *visual,
Pixmap pixmap, Colormap cmap );
#endif /* GLX_GLXEXT_LEGACY */
#endif /* GLX_MESA_pixmap_colormap */
/**
** The following aren't in glxext.h yet.
**/
/*
* 217. GLX_MESA_release_buffers
* ???. GLX_NV_vertex_array_range
*/
#ifndef GLX_MESA_release_buffers
#define GLX_MESA_release_buffers 1
extern Bool glXReleaseBuffersMESA( Display *dpy, GLXDrawable d );
#ifndef GLX_NV_vertex_array_range
#define GLX_NV_vertex_array_range
#endif /* GLX_MESA_release_buffers */
extern void *glXAllocateMemoryNV(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
extern void glXFreeMemoryNV(GLvoid *pointer);
typedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
typedef void ( * PFNGLXFREEMEMORYNVPROC) (GLvoid *pointer);
#endif /* GLX_NV_vertex_array_range */
/*
* 218. GLX_MESA_set_3dfx_mode
* ARB ?. GLX_ARB_render_texture
* XXX This was never finalized!
*/
#ifndef GLX_MESA_set_3dfx_mode
#define GLX_MESA_set_3dfx_mode 1
#define GLX_3DFX_WINDOW_MODE_MESA 0x1
#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2
extern Bool glXSet3DfxModeMESA( int mode );
#ifndef GLX_ARB_render_texture
#define GLX_ARB_render_texture 1
#endif /* GLX_MESA_set_3dfx_mode */
extern Bool glXBindTexImageARB(Display *dpy, GLXPbuffer pbuffer, int buffer);
extern Bool glXReleaseTexImageARB(Display *dpy, GLXPbuffer pbuffer, int buffer);
extern Bool glXDrawableAttribARB(Display *dpy, GLXDrawable draw, const int *attribList);
#endif /* GLX_ARB_render_texture */
/*
* ARB 2. GLX_ARB_get_proc_address
* #?. GLX_MESA_swap_frame_usage
*/
#ifndef GLX_ARB_get_proc_address
#define GLX_ARB_get_proc_address 1
extern void (*glXGetProcAddressARB(const GLubyte *procName))();
#endif /* GLX_ARB_get_proc_address */
#ifndef GLX_MESA_swap_frame_usage
#define GLX_MESA_swap_frame_usage 1
extern int glXGetFrameUsageMESA(Display *dpy, GLXDrawable drawable, float *usage);
extern int glXBeginFrameTrackingMESA(Display *dpy, GLXDrawable drawable);
extern int glXEndFrameTrackingMESA(Display *dpy, GLXDrawable drawable);
extern int glXQueryFrameTrackingMESA(Display *dpy, GLXDrawable drawable, int64_t *swapCount, int64_t *missedFrames, float *lastMissedUsage);
typedef int (*PFNGLXGETFRAMEUSAGEMESAPROC) (Display *dpy, GLXDrawable drawable, float *usage);
typedef int (*PFNGLXBEGINFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable);
typedef int (*PFNGLXENDFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable);
typedef int (*PFNGLXQUERYFRAMETRACKINGMESAPROC)(Display *dpy, GLXDrawable drawable, int64_t *swapCount, int64_t *missedFrames, float *lastMissedUsage);
#endif /* GLX_GLXEXT_LEGACY */
#endif /* GLX_MESA_swap_frame_usage */
/**
** The following aren't in glxext.h yet.
**/
/*
* ???. GLX_NV_vertex_array_range
* #?. GLX_MESA_swap_control
*/
#ifndef GLX_NV_vertex_array_range
#define GLX_NV_vertex_array_range
#ifndef GLX_MESA_swap_control
#define GLX_MESA_swap_control 1
extern void *glXAllocateMemoryNV(GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
extern void glXFreeMemoryNV(GLvoid *pointer);
typedef void * ( * PFNGLXALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
typedef void ( * PFNGLXFREEMEMORYNVPROC) (GLvoid *pointer);
extern int glXSwapIntervalMESA(unsigned int interval);
extern int glXGetSwapIntervalMESA(void);
#endif /* GLX_NV_vertex_array_range */
typedef int (*PFNGLXSWAPINTERVALMESAPROC)(unsigned int interval);
typedef int (*PFNGLXGETSWAPINTERVALMESAPROC)(void);
#endif /* GLX_MESA_swap_control */
/*** Should these go here, or in another header? */
/*
* ???. GLX_MESA_agp_offset
*/
#ifndef GLX_MESA_agp_offset
#define GLX_MESA_agp_offset 1
extern GLuint glXGetAGPOffsetMESA(const GLvoid *pointer);
typedef GLuint (* PFNGLXGETAGPOFFSETMESAPROC) (const GLvoid *pointer);
#endif /* GLX_MESA_agp_offset */
** GLX Events
*/
typedef struct {
int event_type; /* GLX_DAMAGED or GLX_SAVED */
int draw_type; /* GLX_WINDOW or GLX_PBUFFER */
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came for SendEvent request */
Display *display; /* display the event was read from */
GLXDrawable drawable; /* XID of Drawable */
unsigned int buffer_mask; /* mask indicating which buffers are affected */
unsigned int aux_buffer; /* which aux buffer was affected */
int x, y;
int width, height;
int count; /* if nonzero, at least this many more */
} GLXPbufferClobberEvent;
typedef struct {
int type;
unsigned long serial; /* # of last request processed by server */
Bool send_event; /* true if this came from a SendEvent request */
Display *display; /* Display the event was read from */
Drawable drawable; /* drawable on which event was requested in event mask */
int event_type;
int64_t ust;
int64_t msc;
int64_t sbc;
} GLXBufferSwapComplete;
typedef union __GLXEvent {
GLXPbufferClobberEvent glxpbufferclobber;
GLXBufferSwapComplete glxbufferswapcomplete;
long pad[24];
} GLXEvent;
#ifdef __cplusplus
}
......
/*
* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -45,6 +45,8 @@ import java.util.*;
import sun.security.action.GetPropertyAction;
import sun.security.util.Debug;
/**
* Implementation of key store for Windows using the Microsoft Crypto API.
*
......@@ -186,6 +188,7 @@ abstract class KeyStore extends KeyStoreSpi {
private static final String KEYSTORE_COMPATIBILITY_MODE_PROP =
"sun.security.mscapi.keyStoreCompatibilityMode";
private final boolean keyStoreCompatibilityMode;
private static final Debug debug = Debug.getInstance("keystore");
/*
* The keystore entries.
......@@ -728,6 +731,11 @@ abstract class KeyStore extends KeyStoreSpi {
} catch (KeyStoreException e) {
throw new IOException(e);
}
if (debug != null) {
debug.println("MSCAPI keystore load: entry count: " +
entries.size());
}
}
/**
......
/*
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
......@@ -22,20 +22,23 @@
*/
/* @test
@bug 7156873
@bug 7156873 8028480 8034773
@summary ZipFileSystem regression tests
*/
import java.io.OutputStream;
import java.net.URI;
import java.nio.ByteBuffer;
import java.nio.channels.*;
import java.nio.file.*;
import java.util.Map;
import java.util.HashMap;
import java.nio.file.spi.*;
import java.util.*;
public class ZFSTests {
public static void main(String[] args) throws Throwable {
test7156873();
testOpenOptions();
}
static void test7156873() throws Throwable {
......@@ -53,4 +56,44 @@ public class ZFSTests {
Files.deleteIfExists(dir);
}
}
static void testOpenOptions() throws Throwable {
Path path = Paths.get("file.zip");
try {
URI uri = URI.create("jar:" + path.toUri());
Map<String, Object> env = new HashMap<String, Object>();
env.put("create", "true");
try (FileSystem fs = FileSystems.newFileSystem(uri, env)) {
FileSystemProvider fsp = fs.provider();
Set<? extends OpenOption> options;
Path p = fs.getPath("test.txt");
// 8028480
options = EnumSet.of(StandardOpenOption.CREATE,
StandardOpenOption.WRITE,
StandardOpenOption.APPEND);
try (FileChannel ch = fsp.newFileChannel(p, options)) {
ch.write(ByteBuffer.wrap("Hello!".getBytes("ASCII")));
}
// 8034773
try (OutputStream os = fsp.newOutputStream(p, new OpenOption[0])) {
os.write("Hello2!".getBytes("ASCII"));
}
if (!"Hello2!".equals(new String(
Files.readAllBytes(fs.getPath("test.txt"))))) {
throw new RuntimeException("failed to open as truncate_existing");
}
options = EnumSet.of(StandardOpenOption.CREATE,
StandardOpenOption.APPEND,
StandardOpenOption.TRUNCATE_EXISTING);
try (FileChannel ch = fsp.newFileChannel(p, options)) {
throw new RuntimeException("expected IAE not thrown!");
} catch (IllegalArgumentException x) {
// expected x.printStackTrace();
}
}
} finally {
Files.deleteIfExists(path);
}
}
}
此差异已折叠。
此差异已折叠。
......@@ -37,7 +37,7 @@
* 7003124 7085757 7028073 7171028 7189611 8000983 7195759 8004489 8006509
* 7114053 7074882 7040556 8013836 8021121 6192407 6931564 8027695 7090826
* 8017142 8037343 8055222 8042126 8074791 8075173 8080774 8129361 8145952
* 8164784 8187946 8195478 8193552 8202026 8204269 8208746 8209775
* 8164784 8187946 8195478 8193552 8202026 8204269 8208746 8209775 8234228
* @summary Verify locale data
*
*/
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册