提交 d50c3829 编写于 作者: M mfang

Merge

......@@ -319,3 +319,4 @@ c67acfb24eed87629887128df51007218ddf1f60 jdk8u40-b03
dde62d949f7847469b2ede2ca4190c95066adc91 jdk8u40-b04
d587834579dadd18cb8b096e61d92e2dbccc2782 jdk8u40-b05
25788892a6723c0742a24050cc25ab103d9804de jdk8u40-b06
07f0e22b5c238dd7b89fedbed35f02ac6b392c96 jdk8u40-b07
......@@ -37,6 +37,7 @@ import java.security.cert.CertificateException;
* @author Vincent Ryan
*/
@jdk.Exported
public abstract class ContentSigner {
/**
......
/*
* Copyright (c) 2014, 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
* 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.
*/
/**
* This package comprises the interfaces and classes used to define the
* signing mechanism used by the <tt>jarsigner</tt> tool.
* <p>
* Clients may override the default signing mechanism of the <tt>jarsigner</tt>
* tool by supplying an alternative implementation of
* {@link com.sun.jarsigner.ContentSigner}.
*/
@jdk.Exported
package com.sun.jarsigner;
<html>
<!--
Copyright (c) 2003, 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
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.
-->
<head>
<title>Jarsigner Signing Mechanism Package</title>
</head>
<body>
This package comprises the interfaces and classes used to define the
signing mechanism used by the <tt>jarsigner</tt> tool.
<p>
Clients may override the default signing mechanism of the <tt>jarsigner</tt>
tool by supplying an alternative implementation of
{@link com.sun.jarsigner.ContentSigner}.
</body>
</html>
......@@ -62,7 +62,7 @@ class InvokerBytecodeGenerator {
private static final String CLL_SIG = "(L" + CLS + ";L" + OBJ + ";)L" + OBJ + ";";
/** Name of its super class*/
private static final String superName = LF;
private static final String superName = OBJ;
/** Name of new class */
private final String className;
......@@ -97,7 +97,7 @@ class InvokerBytecodeGenerator {
if (DUMP_CLASS_FILES) {
className = makeDumpableClassName(className);
}
this.className = superName + "$" + className;
this.className = LF + "$" + className;
this.sourceFile = "LambdaForm$" + className;
this.lambdaForm = lambdaForm;
this.invokerName = invokerName;
......
......@@ -356,8 +356,9 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
protected Class<?> findClass(final String name)
throws ClassNotFoundException
{
final Class<?> result;
try {
return AccessController.doPrivileged(
result = AccessController.doPrivileged(
new PrivilegedExceptionAction<Class<?>>() {
public Class<?> run() throws ClassNotFoundException {
String path = name.replace('.', '/').concat(".class");
......@@ -369,13 +370,17 @@ public class URLClassLoader extends SecureClassLoader implements Closeable {
throw new ClassNotFoundException(name, e);
}
} else {
throw new ClassNotFoundException(name);
return null;
}
}
}, acc);
} catch (java.security.PrivilegedActionException pae) {
throw (ClassNotFoundException) pae.getException();
}
if (result == null) {
throw new ClassNotFoundException(name);
}
return result;
}
/*
......
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, 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
......@@ -33,6 +33,7 @@ import java.security.Provider.Service;
import sun.security.jca.*;
import sun.security.jca.GetInstance.Instance;
import sun.security.util.Debug;
/**
* The KeyPairGenerator class is used to generate pairs of
......@@ -126,6 +127,11 @@ import sun.security.jca.GetInstance.Instance;
public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
private static final Debug pdebug =
Debug.getInstance("provider", "Provider");
private static final boolean skipDebug =
Debug.isOn("engine=") && !Debug.isOn("keypairgenerator");
private final String algorithm;
// The provider
......@@ -167,6 +173,12 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
kpg = new Delegate(spi, algorithm);
}
kpg.provider = instance.provider;
if (!skipDebug && pdebug != null) {
pdebug.println("KeyPairGenerator." + algorithm +
" algorithm from: " + kpg.provider.getName());
}
return kpg;
}
......@@ -557,6 +569,11 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi {
provider = instance.provider;
this.serviceIterator = serviceIterator;
initType = I_NONE;
if (!skipDebug && pdebug != null) {
pdebug.println("KeyPairGenerator." + algorithm +
" algorithm from: " + provider.getName());
}
}
/**
......
......@@ -37,6 +37,8 @@ import javax.crypto.SecretKey;
import javax.security.auth.DestroyFailedException;
import javax.security.auth.callback.*;
import sun.security.util.Debug;
/**
* This class represents a storage facility for cryptographic
* keys and certificates.
......@@ -177,6 +179,11 @@ import javax.security.auth.callback.*;
public class KeyStore {
private static final Debug pdebug =
Debug.getInstance("provider", "Provider");
private static final boolean skipDebug =
Debug.isOn("engine=") && !Debug.isOn("keystore");
/*
* Constant to lookup in the Security properties file to determine
* the default keystore type.
......@@ -801,6 +808,11 @@ public class KeyStore {
this.keyStoreSpi = keyStoreSpi;
this.provider = provider;
this.type = type;
if (!skipDebug && pdebug != null) {
pdebug.println("KeyStore." + type.toUpperCase() + " type from: " +
this.provider.getName());
}
}
/**
......
......@@ -35,6 +35,8 @@ import java.io.ByteArrayInputStream;
import java.nio.ByteBuffer;
import sun.security.util.Debug;
/**
* This MessageDigest class provides applications the functionality of a
* message digest algorithm, such as SHA-1 or SHA-256.
......@@ -103,6 +105,11 @@ import java.nio.ByteBuffer;
public abstract class MessageDigest extends MessageDigestSpi {
private static final Debug pdebug =
Debug.getInstance("provider", "Provider");
private static final boolean skipDebug =
Debug.isOn("engine=") && !Debug.isOn("messagedigest");
private String algorithm;
// The state of this digest
......@@ -156,18 +163,23 @@ public abstract class MessageDigest extends MessageDigestSpi {
public static MessageDigest getInstance(String algorithm)
throws NoSuchAlgorithmException {
try {
MessageDigest md;
Object[] objs = Security.getImpl(algorithm, "MessageDigest",
(String)null);
if (objs[0] instanceof MessageDigest) {
MessageDigest md = (MessageDigest)objs[0];
md.provider = (Provider)objs[1];
return md;
md = (MessageDigest)objs[0];
} else {
MessageDigest delegate =
new Delegate((MessageDigestSpi)objs[0], algorithm);
delegate.provider = (Provider)objs[1];
return delegate;
md = new Delegate((MessageDigestSpi)objs[0], algorithm);
}
md.provider = (Provider)objs[1];
if (!skipDebug && pdebug != null) {
pdebug.println("MessageDigest." + algorithm +
" algorithm from: " + md.provider.getName());
}
return md;
} catch(NoSuchProviderException e) {
throw new NoSuchAlgorithmException(algorithm + " not found");
}
......
......@@ -32,6 +32,7 @@ import java.security.Provider.Service;
import sun.security.jca.*;
import sun.security.jca.GetInstance.Instance;
import sun.security.util.Debug;
/**
* This class provides a cryptographically strong random number
......@@ -92,6 +93,11 @@ import sun.security.jca.GetInstance.Instance;
public class SecureRandom extends java.util.Random {
private static final Debug pdebug =
Debug.getInstance("provider", "Provider");
private static final boolean skipDebug =
Debug.isOn("engine=") && !Debug.isOn("securerandom");
/**
* The provider.
*
......@@ -234,6 +240,11 @@ public class SecureRandom extends java.util.Random {
this.secureRandomSpi = secureRandomSpi;
this.provider = provider;
this.algorithm = algorithm;
if (!skipDebug && pdebug != null) {
pdebug.println("SecureRandom." + algorithm +
" algorithm from: " + this.provider.getName());
}
}
/**
......
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, 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
......@@ -121,6 +121,11 @@ public abstract class Signature extends SignatureSpi {
private static final Debug debug =
Debug.getInstance("jca", "Signature");
private static final Debug pdebug =
Debug.getInstance("provider", "Provider");
private static final boolean skipDebug =
Debug.isOn("engine=") && !Debug.isOn("signature");
/*
* The algorithm for this signature object.
* This value is used to map an OID to the particular algorithm.
......@@ -451,6 +456,11 @@ public abstract class Signature extends SignatureSpi {
throws InvalidKeyException {
engineInitVerify(publicKey);
state = VERIFY;
if (!skipDebug && pdebug != null) {
pdebug.println("Signature." + algorithm +
" verification algorithm from: " + this.provider.getName());
}
}
/**
......@@ -495,6 +505,11 @@ public abstract class Signature extends SignatureSpi {
PublicKey publicKey = certificate.getPublicKey();
engineInitVerify(publicKey);
state = VERIFY;
if (!skipDebug && pdebug != null) {
pdebug.println("Signature." + algorithm +
" verification algorithm from: " + this.provider.getName());
}
}
/**
......@@ -511,6 +526,11 @@ public abstract class Signature extends SignatureSpi {
throws InvalidKeyException {
engineInitSign(privateKey);
state = SIGN;
if (!skipDebug && pdebug != null) {
pdebug.println("Signature." + algorithm +
" signing algorithm from: " + this.provider.getName());
}
}
/**
......@@ -529,6 +549,11 @@ public abstract class Signature extends SignatureSpi {
throws InvalidKeyException {
engineInitSign(privateKey, random);
state = SIGN;
if (!skipDebug && pdebug != null) {
pdebug.println("Signature." + algorithm +
" signing algorithm from: " + this.provider.getName());
}
}
/**
......
......@@ -297,15 +297,22 @@ public abstract class ForkJoinTask<V> implements Future<V>, Serializable {
}
/**
* Tries to set SIGNAL status unless already completed. Used by
* ForkJoinPool. Other variants are directly incorporated into
* externalAwaitDone etc.
* If not done, sets SIGNAL status and performs Object.wait(timeout).
* This task may or may not be done on exit. Ignores interrupts.
*
* @return true if successful
* @param timeout using Object.wait conventions.
*/
final boolean trySetSignal() {
int s = status;
return s >= 0 && U.compareAndSwapInt(this, STATUS, s, s | SIGNAL);
final void internalWait(long timeout) {
int s;
if ((s = status) >= 0 && // force completer to issue notify
U.compareAndSwapInt(this, STATUS, s, s | SIGNAL)) {
synchronized (this) {
if (status >= 0)
try { wait(timeout); } catch (InterruptedException ie) { }
else
notifyAll();
}
}
}
/**
......@@ -313,15 +320,10 @@ public abstract class ForkJoinTask<V> implements Future<V>, Serializable {
* @return status upon completion
*/
private int externalAwaitDone() {
int s;
ForkJoinPool cp = ForkJoinPool.common;
if ((s = status) >= 0) {
if (cp != null) {
if (this instanceof CountedCompleter)
s = cp.externalHelpComplete((CountedCompleter<?>)this, Integer.MAX_VALUE);
else if (cp.tryExternalUnpush(this))
s = doExec();
}
int s = ((this instanceof CountedCompleter) ? // try helping
ForkJoinPool.common.externalHelpComplete(
(CountedCompleter<?>)this, 0) :
ForkJoinPool.common.tryExternalUnpush(this) ? doExec() : 0);
if (s >= 0 && (s = status) >= 0) {
boolean interrupted = false;
do {
......@@ -329,7 +331,7 @@ public abstract class ForkJoinTask<V> implements Future<V>, Serializable {
synchronized (this) {
if (status >= 0) {
try {
wait();
wait(0L);
} catch (InterruptedException ie) {
interrupted = true;
}
......@@ -342,7 +344,6 @@ public abstract class ForkJoinTask<V> implements Future<V>, Serializable {
if (interrupted)
Thread.currentThread().interrupt();
}
}
return s;
}
......@@ -351,25 +352,25 @@ public abstract class ForkJoinTask<V> implements Future<V>, Serializable {
*/
private int externalInterruptibleAwaitDone() throws InterruptedException {
int s;
ForkJoinPool cp = ForkJoinPool.common;
if (Thread.interrupted())
throw new InterruptedException();
if ((s = status) >= 0 && cp != null) {
if (this instanceof CountedCompleter)
cp.externalHelpComplete((CountedCompleter<?>)this, Integer.MAX_VALUE);
else if (cp.tryExternalUnpush(this))
doExec();
}
if ((s = status) >= 0 &&
(s = ((this instanceof CountedCompleter) ?
ForkJoinPool.common.externalHelpComplete(
(CountedCompleter<?>)this, 0) :
ForkJoinPool.common.tryExternalUnpush(this) ? doExec() :
0)) >= 0) {
while ((s = status) >= 0) {
if (U.compareAndSwapInt(this, STATUS, s, s | SIGNAL)) {
synchronized (this) {
if (status >= 0)
wait();
wait(0L);
else
notifyAll();
}
}
}
}
return s;
}
......@@ -386,7 +387,7 @@ public abstract class ForkJoinTask<V> implements Future<V>, Serializable {
((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) ?
(w = (wt = (ForkJoinWorkerThread)t).workQueue).
tryUnpush(this) && (s = doExec()) < 0 ? s :
wt.pool.awaitJoin(w, this) :
wt.pool.awaitJoin(w, this, 0L) :
externalAwaitDone();
}
......@@ -399,7 +400,8 @@ public abstract class ForkJoinTask<V> implements Future<V>, Serializable {
int s; Thread t; ForkJoinWorkerThread wt;
return (s = doExec()) < 0 ? s :
((t = Thread.currentThread()) instanceof ForkJoinWorkerThread) ?
(wt = (ForkJoinWorkerThread)t).pool.awaitJoin(wt.workQueue, this) :
(wt = (ForkJoinWorkerThread)t).pool.
awaitJoin(wt.workQueue, this, 0L) :
externalAwaitDone();
}
......@@ -577,7 +579,7 @@ public abstract class ForkJoinTask<V> implements Future<V>, Serializable {
Throwable ex;
if (e == null || (ex = e.ex) == null)
return null;
if (false && e.thrower != Thread.currentThread().getId()) {
if (e.thrower != Thread.currentThread().getId()) {
Class<? extends Throwable> ec = ex.getClass();
try {
Constructor<?> noArgCtor = null;
......@@ -587,14 +589,18 @@ public abstract class ForkJoinTask<V> implements Future<V>, Serializable {
Class<?>[] ps = c.getParameterTypes();
if (ps.length == 0)
noArgCtor = c;
else if (ps.length == 1 && ps[0] == Throwable.class)
return (Throwable)(c.newInstance(ex));
else if (ps.length == 1 && ps[0] == Throwable.class) {
Throwable wx = (Throwable)c.newInstance(ex);
return (wx == null) ? ex : wx;
}
}
if (noArgCtor != null) {
Throwable wx = (Throwable)(noArgCtor.newInstance());
if (wx != null) {
wx.initCause(ex);
return wx;
}
}
} catch (Exception ignore) {
}
}
......@@ -1017,67 +1023,40 @@ public abstract class ForkJoinTask<V> implements Future<V>, Serializable {
*/
public final V get(long timeout, TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutException {
int s;
long nanos = unit.toNanos(timeout);
if (Thread.interrupted())
throw new InterruptedException();
// Messy in part because we measure in nanosecs, but wait in millisecs
int s; long ms;
long ns = unit.toNanos(timeout);
ForkJoinPool cp;
if ((s = status) >= 0 && ns > 0L) {
long deadline = System.nanoTime() + ns;
ForkJoinPool p = null;
ForkJoinPool.WorkQueue w = null;
if ((s = status) >= 0 && nanos > 0L) {
long d = System.nanoTime() + nanos;
long deadline = (d == 0L) ? 1L : d; // avoid 0
Thread t = Thread.currentThread();
if (t instanceof ForkJoinWorkerThread) {
ForkJoinWorkerThread wt = (ForkJoinWorkerThread)t;
p = wt.pool;
w = wt.workQueue;
p.helpJoinOnce(w, this); // no retries on failure
}
else if ((cp = ForkJoinPool.common) != null) {
if (this instanceof CountedCompleter)
cp.externalHelpComplete((CountedCompleter<?>)this, Integer.MAX_VALUE);
else if (cp.tryExternalUnpush(this))
doExec();
}
boolean canBlock = false;
boolean interrupted = false;
try {
while ((s = status) >= 0) {
if (w != null && w.qlock < 0)
cancelIgnoringExceptions(this);
else if (!canBlock) {
if (p == null || p.tryCompensate(p.ctl))
canBlock = true;
}
else {
s = wt.pool.awaitJoin(wt.workQueue, this, deadline);
}
else if ((s = ((this instanceof CountedCompleter) ?
ForkJoinPool.common.externalHelpComplete(
(CountedCompleter<?>)this, 0) :
ForkJoinPool.common.tryExternalUnpush(this) ?
doExec() : 0)) >= 0) {
long ns, ms; // measure in nanosecs, but wait in millisecs
while ((s = status) >= 0 &&
(ns = deadline - System.nanoTime()) > 0L) {
if ((ms = TimeUnit.NANOSECONDS.toMillis(ns)) > 0L &&
U.compareAndSwapInt(this, STATUS, s, s | SIGNAL)) {
synchronized (this) {
if (status >= 0) {
try {
wait(ms);
} catch (InterruptedException ie) {
if (p == null)
interrupted = true;
}
}
if (status >= 0)
wait(ms); // OK to throw InterruptedException
else
notifyAll();
}
}
if ((s = status) < 0 || interrupted ||
(ns = deadline - System.nanoTime()) <= 0L)
break;
}
}
} finally {
if (p != null && canBlock)
p.incrementActiveCount();
}
if (interrupted)
throw new InterruptedException();
}
if (s >= 0)
s = status;
if ((s &= DONE_MASK) != NORMAL) {
Throwable ex;
if (s == CANCELLED)
......
......@@ -66,7 +66,7 @@ public class ForkJoinWorkerThread extends Thread {
* owning thread.
*
* Support for (non-public) subclass InnocuousForkJoinWorkerThread
* requires that we break quite a lot of encapulation (via Unsafe)
* requires that we break quite a lot of encapsulation (via Unsafe)
* both here and in the subclass to access and set Thread fields.
*/
......@@ -118,7 +118,7 @@ public class ForkJoinWorkerThread extends Thread {
* @return the index number
*/
public int getPoolIndex() {
return workQueue.poolIndex >>> 1; // ignore odd/even tag bit
return workQueue.getPoolIndex();
}
/**
......@@ -171,7 +171,7 @@ public class ForkJoinWorkerThread extends Thread {
}
/**
* Erases ThreadLocals by nulling out Thread maps
* Erases ThreadLocals by nulling out Thread maps.
*/
final void eraseThreadLocals() {
U.putObject(this, THREADLOCALS, null);
......@@ -246,8 +246,8 @@ public class ForkJoinWorkerThread extends Thread {
/**
* Returns a new group with the system ThreadGroup (the
* topmost, parentless group) as parent. Uses Unsafe to
* traverse Thread group and ThreadGroup parent fields.
* topmost, parent-less group) as parent. Uses Unsafe to
* traverse Thread.group and ThreadGroup.parent fields.
*/
private static ThreadGroup createThreadGroup() {
try {
......@@ -274,4 +274,3 @@ public class ForkJoinWorkerThread extends Thread {
}
}
......@@ -402,6 +402,14 @@ public class FileHandler extends StreamHandler {
openFiles();
}
private boolean isParentWritable(Path path) {
Path parent = path.getParent();
if (parent == null) {
parent = path.toAbsolutePath().getParent();
}
return parent != null && Files.isWritable(parent);
}
/**
* Open the set of output files, based on the configured
* instance variables.
......@@ -458,7 +466,7 @@ public class FileHandler extends StreamHandler {
// Note that this is a situation that may happen,
// but not too frequently.
if (Files.isRegularFile(lockFilePath, LinkOption.NOFOLLOW_LINKS)
&& Files.isWritable(lockFilePath.getParent())) {
&& isParentWritable(lockFilePath)) {
try {
channel = FileChannel.open(lockFilePath,
WRITE, APPEND);
......
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, 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
......@@ -167,6 +167,11 @@ public class Cipher {
private static final Debug debug =
Debug.getInstance("jca", "Cipher");
private static final Debug pdebug =
Debug.getInstance("provider", "Provider");
private static final boolean skipDebug =
Debug.isOn("engine=") && !Debug.isOn("cipher");
/**
* Constant used to initialize cipher to encryption mode.
*/
......@@ -1110,6 +1115,21 @@ public class Cipher {
}
}
private static String getOpmodeString(int opmode) {
switch (opmode) {
case ENCRYPT_MODE:
return "encryption";
case DECRYPT_MODE:
return "decryption";
case WRAP_MODE:
return "key wrapping";
case UNWRAP_MODE:
return "key unwrapping";
default:
return "";
}
}
/**
* Initializes this cipher with a key.
*
......@@ -1235,6 +1255,12 @@ public class Cipher {
initialized = true;
this.opmode = opmode;
if (!skipDebug && pdebug != null) {
pdebug.println("Cipher." + transformation + " " +
getOpmodeString(opmode) + " algorithm from: " +
this.provider.getName());
}
}
/**
......@@ -1372,6 +1398,12 @@ public class Cipher {
initialized = true;
this.opmode = opmode;
if (!skipDebug && pdebug != null) {
pdebug.println("Cipher." + transformation + " " +
getOpmodeString(opmode) + " algorithm from: " +
this.provider.getName());
}
}
/**
......@@ -1509,6 +1541,12 @@ public class Cipher {
initialized = true;
this.opmode = opmode;
if (!skipDebug && pdebug != null) {
pdebug.println("Cipher." + transformation + " " +
getOpmodeString(opmode) + " algorithm from: " +
this.provider.getName());
}
}
/**
......@@ -1693,6 +1731,12 @@ public class Cipher {
initialized = true;
this.opmode = opmode;
if (!skipDebug && pdebug != null) {
pdebug.println("Cipher." + transformation + " " +
getOpmodeString(opmode) + " algorithm from: " +
this.provider.getName());
}
}
/**
......
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, 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
......@@ -78,6 +78,11 @@ public class KeyAgreement {
private static final Debug debug =
Debug.getInstance("jca", "KeyAgreement");
private static final Debug pdebug =
Debug.getInstance("provider", "Provider");
private static final boolean skipDebug =
Debug.isOn("engine=") && !Debug.isOn("keyagreement");
// The provider
private Provider provider;
......@@ -468,6 +473,11 @@ public class KeyAgreement {
throw new InvalidKeyException(e);
}
}
if (!skipDebug && pdebug != null) {
pdebug.println("KeyAgreement." + algorithm + " algorithm from: " +
this.provider.getName());
}
}
/**
......@@ -524,6 +534,11 @@ public class KeyAgreement {
} else {
chooseProvider(I_PARAMS, key, params, random);
}
if (!skipDebug && pdebug != null) {
pdebug.println("KeyAgreement." + algorithm + " algorithm from: " +
this.provider.getName());
}
}
/**
......
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, 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
......@@ -33,6 +33,7 @@ import java.security.spec.*;
import sun.security.jca.*;
import sun.security.jca.GetInstance.Instance;
import sun.security.util.Debug;
/**
* This class provides the functionality of a secret (symmetric) key generator.
......@@ -108,6 +109,11 @@ import sun.security.jca.GetInstance.Instance;
public class KeyGenerator {
private static final Debug pdebug =
Debug.getInstance("provider", "Provider");
private static final boolean skipDebug =
Debug.isOn("engine=") && !Debug.isOn("keygenerator");
// see java.security.KeyPairGenerator for failover notes
private final static int I_NONE = 1;
......@@ -145,6 +151,11 @@ public class KeyGenerator {
this.spi = keyGenSpi;
this.provider = provider;
this.algorithm = algorithm;
if (!skipDebug && pdebug != null) {
pdebug.println("KeyGenerator." + algorithm + " algorithm from: " +
this.provider.getName());
}
}
private KeyGenerator(String algorithm) throws NoSuchAlgorithmException {
......@@ -158,6 +169,11 @@ public class KeyGenerator {
throw new NoSuchAlgorithmException
(algorithm + " KeyGenerator not available");
}
if (!skipDebug && pdebug != null) {
pdebug.println("KeyGenerator." + algorithm + " algorithm from: " +
this.provider.getName());
}
}
/**
......
/*
* Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2014, 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
......@@ -77,6 +77,11 @@ public class Mac implements Cloneable {
private static final Debug debug =
Debug.getInstance("jca", "Mac");
private static final Debug pdebug =
Debug.getInstance("provider", "Provider");
private static final boolean skipDebug =
Debug.isOn("engine=") && !Debug.isOn("mac");
// The provider
private Provider provider;
......@@ -413,6 +418,11 @@ public class Mac implements Cloneable {
throw new InvalidKeyException("init() failed", e);
}
initialized = true;
if (!skipDebug && pdebug != null) {
pdebug.println("Mac." + algorithm + " algorithm from: " +
this.provider.getName());
}
}
/**
......@@ -435,6 +445,11 @@ public class Mac implements Cloneable {
chooseProvider(key, params);
}
initialized = true;
if (!skipDebug && pdebug != null) {
pdebug.println("Mac." + algorithm + " algorithm from: " +
this.provider.getName());
}
}
/**
......
......@@ -56,6 +56,7 @@ import java.io.ObjectInputStream;
import java.io.IOException;
import java.io.ObjectInputValidation;
import java.io.InvalidObjectException;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.swing.border.*;
import javax.swing.event.*;
......@@ -352,7 +353,8 @@ public abstract class JComponent extends Container implements Serializable,
private static final int AUTOSCROLLS_SET = 25;
private static final int FOCUS_TRAVERSAL_KEYS_FORWARD_SET = 26;
private static final int FOCUS_TRAVERSAL_KEYS_BACKWARD_SET = 27;
private static final int REVALIDATE_RUNNABLE_SCHEDULED = 28;
private transient AtomicBoolean revalidateRunnableScheduled = new AtomicBoolean(false);
/**
* Temporary rectangles.
......@@ -4859,16 +4861,11 @@ public abstract class JComponent extends Container implements Serializable,
// To avoid a flood of Runnables when constructing GUIs off
// the EDT, a flag is maintained as to whether or not
// a Runnable has been scheduled.
synchronized(this) {
if (getFlag(REVALIDATE_RUNNABLE_SCHEDULED)) {
if (revalidateRunnableScheduled.getAndSet(true)) {
return;
}
setFlag(REVALIDATE_RUNNABLE_SCHEDULED, true);
}
SunToolkit.executeOnEventHandlerThread(this, () -> {
synchronized(JComponent.this) {
setFlag(REVALIDATE_RUNNABLE_SCHEDULED, false);
}
revalidateRunnableScheduled.set(false);
revalidate();
});
}
......@@ -5508,6 +5505,7 @@ public abstract class JComponent extends Container implements Serializable,
ToolTipManager.sharedInstance().registerComponent(this);
}
setWriteObjCounter(this, (byte)0);
revalidateRunnableScheduled = new AtomicBoolean(false);
}
......
......@@ -2895,6 +2895,14 @@ search:
return comp;
}
if (flavor1.isFlavorTextType()) {
return 1;
}
if (flavor2.isFlavorTextType()) {
return -1;
}
// Next, look for application/x-java-* types. Prefer unknown
// MIME types because if the user provides his own data flavor,
// it will likely be the most descriptive one.
......
......@@ -523,13 +523,6 @@ public class SpNegoContext implements GSSContextSpi {
valid = false;
}
// get the mechanism token
byte[] mechToken = initToken.getMechToken();
if (mechToken == null) {
throw new GSSException(GSSException.FAILURE, -1,
"mechToken is missing");
}
/*
* Select the best match between the list of mechs
* that the initiator requested and the list that
......@@ -545,7 +538,19 @@ public class SpNegoContext implements GSSContextSpi {
internal_mech = mech_wanted;
// get the token for mechanism
byte[] accept_token = GSS_acceptSecContext(mechToken);
byte[] accept_token;
if (mechList[0].equals(mech_wanted)) {
// get the mechanism token
byte[] mechToken = initToken.getMechToken();
if (mechToken == null) {
throw new GSSException(GSSException.FAILURE, -1,
"mechToken is missing");
}
accept_token = GSS_acceptSecContext(mechToken);
} else {
accept_token = null;
}
// verify MIC
if (!GSSUtil.useMSInterop() && valid) {
......@@ -594,9 +599,27 @@ public class SpNegoContext implements GSSContextSpi {
retVal = targToken.getEncoded();
} else if (state == STATE_IN_PROCESS) {
// read data
byte[] token = new byte[is.available()];
SpNegoToken.readFully(is, token);
if (DEBUG) {
System.out.println("SpNegoContext.acceptSecContext: " +
"receiving token = " +
SpNegoToken.getHexBytes(token));
}
// read the SPNEGO token
// token will be validated when parsing
NegTokenTarg inputToken = new NegTokenTarg(token);
if (DEBUG) {
System.out.println("SpNegoContext.acceptSecContext: " +
"received token of type = " +
SpNegoToken.getTokenName(inputToken.getType()));
}
// read the token
byte[] client_token = new byte[is.available()];
SpNegoToken.readFully(is, client_token);
byte[] client_token = inputToken.getResponseToken();
byte[] accept_token = GSS_acceptSecContext(client_token);
if (accept_token == null) {
valid = false;
......@@ -1055,7 +1078,7 @@ public class SpNegoContext implements GSSContextSpi {
* This is only valid on the acceptor side of the context.
* @return GSSCredentialSpi object for the delegated credential
* @exception GSSException
* @see GSSContext#getDelegCredState
* @see GSSContext#getCredDelegState
*/
public final GSSCredentialSpi getDelegCred() throws GSSException {
if (state != STATE_IN_PROCESS && state != STATE_DONE)
......
......@@ -336,7 +336,7 @@ public class Resources extends java.util.ListResourceBundle {
{"New.prompt.", "New {0}: "},
{"Passwords.must.differ", "Passwords must differ"},
{"Re.enter.new.prompt.", "Re-enter new {0}: "},
{"Re.enter.passpword.", "Re-enter password: "},
{"Re.enter.password.", "Re-enter password: "},
{"Re.enter.new.password.", "Re-enter new password: "},
{"They.don.t.match.Try.again", "They don't match. Try again"},
{"Enter.prompt.alias.name.", "Enter {0} alias name: "},
......
......@@ -336,7 +336,7 @@ public class Resources_de extends java.util.ListResourceBundle {
{"New.prompt.", "Neues {0}: "},
{"Passwords.must.differ", "Kennw\u00F6rter m\u00FCssen sich unterscheiden"},
{"Re.enter.new.prompt.", "Neues {0} erneut eingeben: "},
{"Re.enter.passpword.", "Geben Sie das Kennwort erneut ein: "},
{"Re.enter.password.", "Geben Sie das Kennwort erneut ein: "},
{"Re.enter.new.password.", "Neues Kennwort erneut eingeben: "},
{"They.don.t.match.Try.again", "Keine \u00DCbereinstimmung. Wiederholen Sie den Vorgang"},
{"Enter.prompt.alias.name.", "{0}-Aliasnamen eingeben: "},
......
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2014, 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
......@@ -336,7 +336,7 @@ public class Resources_es extends java.util.ListResourceBundle {
{"New.prompt.", "Nuevo {0}: "},
{"Passwords.must.differ", "Las contrase\u00F1as deben ser distintas"},
{"Re.enter.new.prompt.", "Vuelva a escribir el nuevo {0}: "},
{"Re.enter.passpword.", "Vuelva a introducir la contrase\u00F1a: "},
{"Re.enter.password.", "Vuelva a introducir la contrase\u00F1a: "},
{"Re.enter.new.password.", "Volver a escribir la contrase\u00F1a nueva: "},
{"They.don.t.match.Try.again", "No coinciden. Int\u00E9ntelo de nuevo"},
{"Enter.prompt.alias.name.", "Escriba el nombre de alias de {0}: "},
......
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2014, 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
......@@ -336,7 +336,7 @@ public class Resources_fr extends java.util.ListResourceBundle {
{"New.prompt.", "Nouveau {0} : "},
{"Passwords.must.differ", "Les mots de passe doivent diff\u00E9rer"},
{"Re.enter.new.prompt.", "Indiquez encore le nouveau {0} : "},
{"Re.enter.passpword.", "R\u00E9p\u00E9tez le mot de passe : "},
{"Re.enter.password.", "R\u00E9p\u00E9tez le mot de passe : "},
{"Re.enter.new.password.", "Ressaisissez le nouveau mot de passe : "},
{"They.don.t.match.Try.again", "Ils sont diff\u00E9rents. R\u00E9essayez."},
{"Enter.prompt.alias.name.", "Indiquez le nom d''alias {0} : "},
......
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2014, 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
......@@ -336,7 +336,7 @@ public class Resources_it extends java.util.ListResourceBundle {
{"New.prompt.", "Nuova {0}: "},
{"Passwords.must.differ", "Le password non devono coincidere"},
{"Re.enter.new.prompt.", "Reimmettere un nuovo valore per {0}: "},
{"Re.enter.passpword.", "Reimmettere la password: "},
{"Re.enter.password.", "Reimmettere la password: "},
{"Re.enter.new.password.", "Immettere nuovamente la nuova password: "},
{"They.don.t.match.Try.again", "Non corrispondono. Riprovare."},
{"Enter.prompt.alias.name.", "Immettere nome alias {0}: "},
......
......@@ -336,7 +336,7 @@ public class Resources_ja extends java.util.ListResourceBundle {
{"New.prompt.", "\u65B0\u898F{0}: "},
{"Passwords.must.differ", "\u30D1\u30B9\u30EF\u30FC\u30C9\u306F\u7570\u306A\u3063\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059"},
{"Re.enter.new.prompt.", "\u65B0\u898F{0}\u3092\u518D\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044: "},
{"Re.enter.passpword.", "\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u518D\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044: "},
{"Re.enter.password.", "\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u518D\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044: "},
{"Re.enter.new.password.", "\u65B0\u898F\u30D1\u30B9\u30EF\u30FC\u30C9\u3092\u518D\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044: "},
{"They.don.t.match.Try.again", "\u4E00\u81F4\u3057\u307E\u305B\u3093\u3002\u3082\u3046\u4E00\u5EA6\u5B9F\u884C\u3057\u3066\u304F\u3060\u3055\u3044"},
{"Enter.prompt.alias.name.", "{0}\u306E\u5225\u540D\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044: "},
......
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2014, 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
......@@ -336,7 +336,7 @@ public class Resources_ko extends java.util.ListResourceBundle {
{"New.prompt.", "\uC0C8 {0}: "},
{"Passwords.must.differ", "\uBE44\uBC00\uBC88\uD638\uB294 \uB2EC\uB77C\uC57C \uD569\uB2C8\uB2E4."},
{"Re.enter.new.prompt.", "\uC0C8 {0} \uB2E4\uC2DC \uC785\uB825: "},
{"Re.enter.passpword.", "\uBE44\uBC00\uBC88\uD638 \uB2E4\uC2DC \uC785\uB825: "},
{"Re.enter.password.", "\uBE44\uBC00\uBC88\uD638 \uB2E4\uC2DC \uC785\uB825: "},
{"Re.enter.new.password.", "\uC0C8 \uBE44\uBC00\uBC88\uD638 \uB2E4\uC2DC \uC785\uB825: "},
{"They.don.t.match.Try.again", "\uC77C\uCE58\uD558\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC2ED\uC2DC\uC624."},
{"Enter.prompt.alias.name.", "{0} \uBCC4\uCE6D \uC774\uB984 \uC785\uB825: "},
......
......@@ -336,7 +336,7 @@ public class Resources_pt_BR extends java.util.ListResourceBundle {
{"New.prompt.", "Nova {0}: "},
{"Passwords.must.differ", "As senhas devem ser diferentes"},
{"Re.enter.new.prompt.", "Informe novamente a nova {0}: "},
{"Re.enter.passpword.", "Redigite a senha: "},
{"Re.enter.password.", "Redigite a senha: "},
{"Re.enter.new.password.", "Informe novamente a nova senha: "},
{"They.don.t.match.Try.again", "Elas n\u00E3o correspondem. Tente novamente"},
{"Enter.prompt.alias.name.", "Informe o nome do alias {0}: "},
......
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2014, 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
......@@ -336,7 +336,7 @@ public class Resources_sv extends java.util.ListResourceBundle {
{"New.prompt.", "Nytt {0}: "},
{"Passwords.must.differ", "L\u00F6senorden m\u00E5ste vara olika"},
{"Re.enter.new.prompt.", "Ange nytt {0} igen: "},
{"Re.enter.passpword.", "Ange l\u00F6senord igen: "},
{"Re.enter.password.", "Ange l\u00F6senord igen: "},
{"Re.enter.new.password.", "Ange det nya l\u00F6senordet igen: "},
{"They.don.t.match.Try.again", "De matchar inte. F\u00F6rs\u00F6k igen"},
{"Enter.prompt.alias.name.", "Ange aliasnamn f\u00F6r {0}: "},
......
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2014, 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
......@@ -336,7 +336,7 @@ public class Resources_zh_CN extends java.util.ListResourceBundle {
{"New.prompt.", "\u65B0{0}: "},
{"Passwords.must.differ", "\u53E3\u4EE4\u4E0D\u80FD\u76F8\u540C"},
{"Re.enter.new.prompt.", "\u91CD\u65B0\u8F93\u5165\u65B0{0}: "},
{"Re.enter.passpword.", "\u518D\u6B21\u8F93\u5165\u53E3\u4EE4: "},
{"Re.enter.password.", "\u518D\u6B21\u8F93\u5165\u53E3\u4EE4: "},
{"Re.enter.new.password.", "\u518D\u6B21\u8F93\u5165\u65B0\u53E3\u4EE4: "},
{"They.don.t.match.Try.again", "\u5B83\u4EEC\u4E0D\u5339\u914D\u3002\u8BF7\u91CD\u8BD5"},
{"Enter.prompt.alias.name.", "\u8F93\u5165{0}\u522B\u540D: "},
......
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2014, 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
......@@ -336,7 +336,7 @@ public class Resources_zh_TW extends java.util.ListResourceBundle {
{"New.prompt.", "\u65B0 {0}: "},
{"Passwords.must.differ", "\u5FC5\u9808\u662F\u4E0D\u540C\u7684\u5BC6\u78BC"},
{"Re.enter.new.prompt.", "\u91CD\u65B0\u8F38\u5165\u65B0 {0}: "},
{"Re.enter.passpword.", "\u91CD\u65B0\u8F38\u5165\u5BC6\u78BC:"},
{"Re.enter.password.", "\u91CD\u65B0\u8F38\u5165\u5BC6\u78BC:"},
{"Re.enter.new.password.", "\u91CD\u65B0\u8F38\u5165\u65B0\u5BC6\u78BC: "},
{"They.don.t.match.Try.again", "\u5B83\u5011\u4E0D\u76F8\u7B26\u3002\u8ACB\u91CD\u8A66"},
{"Enter.prompt.alias.name.", "\u8F38\u5165 {0} \u5225\u540D\u540D\u7A31: "},
......
/*
* Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2014, 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
......@@ -104,7 +104,15 @@ public class Debug {
System.err.println("codebase=<URL>");
System.err.println(" only dump output if specified codebase");
System.err.println(" is being checked");
System.err.println();
System.err.println("The following can be used with provider:");
System.err.println();
System.err.println("engine=<engines>");
System.err.println(" only dump output for the specified list");
System.err.println(" of JCA engines. Supported values:");
System.err.println(" Cipher, KeyAgreement, KeyGenerator,");
System.err.println(" KeyPairGenerator, KeyStore, Mac,");
System.err.println(" MessageDigest, SecureRandom, Signature.");
System.err.println();
System.err.println("Note: Separate multiple options with a comma");
System.exit(0);
......
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2014, 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
......@@ -154,18 +154,18 @@ public class FormatData extends ParallelListResourceBundle {
},
{ "MonthNarrows",
new String[] {
"J",
"F",
"M",
"A",
"M",
"J",
"J",
"A",
"S",
"O",
"N",
"D",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
"",
}
},
......
/*
* Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2014, 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
......@@ -53,6 +53,23 @@ public class FormatData_en extends ParallelListResourceBundle {
// define this method as follows:
// return new Object[][] { };
return new Object[][] {
{ "MonthNarrows",
new String[] {
"J",
"F",
"M",
"A",
"M",
"J",
"J",
"A",
"S",
"O",
"N",
"D",
"",
}
},
{ "NumberPatterns",
new String[] {
"#,##0.###;-#,##0.###", // decimal pattern
......
/*
* Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2014, 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
......@@ -46,7 +46,8 @@ class XRootWindow extends XBaseWindow {
}
private XRootWindow() {
super(new XCreateWindowParams(new Object[] {DELAYED, Boolean.TRUE}));
super(new XCreateWindowParams(new Object[] { DELAYED, Boolean.TRUE,
EVENT_MASK, XConstants.StructureNotifyMask }));
}
public void postInit(XCreateWindowParams params){
......
......@@ -2354,9 +2354,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
private static XEventDispatcher oops_waiter;
private static boolean oops_updated;
private static boolean oops_failed;
private XAtom oops;
private static final long WORKAROUND_SLEEP = 100;
private static boolean oops_move;
/**
* @inheritDoc
......@@ -2367,52 +2365,33 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
if (oops_waiter == null) {
oops_waiter = new XEventDispatcher() {
public void dispatchEvent(XEvent e) {
if (e.get_type() == XConstants.SelectionNotify) {
XSelectionEvent pe = e.get_xselection();
if (pe.get_property() == oops.getAtom()) {
if (e.get_type() == XConstants.ConfigureNotify) {
// OOPS ConfigureNotify event catched
oops_updated = true;
awtLockNotifyAll();
} else if (pe.get_selection() == XAtom.get("WM_S0").getAtom() &&
pe.get_target() == XAtom.get("VERSION").getAtom() &&
pe.get_property() == 0 &&
XlibWrapper.XGetSelectionOwner(getDisplay(), XAtom.get("WM_S0").getAtom()) == 0)
{
// WM forgot to acquire selection or there is no WM
oops_failed = true;
awtLockNotifyAll();
}
}
}
};
}
if (oops == null) {
oops = XAtom.get("OOPS");
}
awtLock();
try {
addEventDispatcher(win.getWindow(), oops_waiter);
oops_updated = false;
oops_failed = false;
// Wait for selection notify for oops on win
long event_number = getEventNumber();
XAtom atom = XAtom.get("WM_S0");
if (eventLog.isLoggable(PlatformLogger.Level.FINER)) {
eventLog.finer("WM_S0 selection owner {0}", XlibWrapper.XGetSelectionOwner(getDisplay(), atom.getAtom()));
}
XlibWrapper.XConvertSelection(getDisplay(), atom.getAtom(),
XAtom.get("VERSION").getAtom(), oops.getAtom(),
win.getWindow(), XConstants.CurrentTime);
// Generate OOPS ConfigureNotify event
XlibWrapper.XMoveWindow(getDisplay(), win.getWindow(), oops_move ? 0 : 1, 0);
// Change win position each time to avoid system optimization
oops_move = !oops_move;
XSync();
eventLog.finer("Requested OOPS");
eventLog.finer("Generated OOPS ConfigureNotify event");
long start = System.currentTimeMillis();
while (!oops_updated && !oops_failed) {
while (!oops_updated) {
try {
// Wait for OOPS ConfigureNotify event
awtLockWait(timeout);
} catch (InterruptedException e) {
throw new RuntimeException(e);
......@@ -2423,20 +2402,8 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
throw new OperationTimedOut(Long.toString(System.currentTimeMillis() - start));
}
}
if (oops_failed && getEventNumber() - event_number == 1) {
// If selection update failed we can simply wait some time
// hoping some events will arrive
awtUnlock();
eventLog.finest("Emergency sleep");
try {
Thread.sleep(WORKAROUND_SLEEP);
} catch (InterruptedException ie) {
throw new RuntimeException(ie);
} finally {
awtLock();
}
}
return getEventNumber() - event_number > 2;
// Don't take into account OOPS ConfigureNotify event
return getEventNumber() - event_number > 1;
} finally {
removeEventDispatcher(win.getWindow(), oops_waiter);
eventLog.finer("Exiting syncNativeQueue");
......
......@@ -52,6 +52,8 @@
*/
extern XErrorHandler current_native_xerror_handler;
Window get_xawt_root_shell(JNIEnv *env);
#endif /* !HEADLESS */
#ifndef INTERSECTS
......
......@@ -2011,10 +2011,14 @@ static Bool exitSecondaryLoop = True;
* Toolkit thread to process PropertyNotify or SelectionNotify events.
*/
static Bool
secondary_loop_event(Display* dpy, XEvent* event, char* arg) {
return (event->type == SelectionNotify ||
secondary_loop_event(Display* dpy, XEvent* event, XPointer xawt_root_window) {
return (
event->type == SelectionNotify ||
event->type == SelectionClear ||
event->type == PropertyNotify) ? True : False;
event->type == PropertyNotify ||
(event->type == ConfigureNotify
&& event->xany.window == *(Window*) xawt_root_window)
) ? True : False;
}
......@@ -2025,8 +2029,11 @@ Java_sun_awt_X11_XlibWrapper_XNextSecondaryLoopEvent(JNIEnv *env, jclass clazz,
AWT_CHECK_HAVE_LOCK_RETURN(JNI_FALSE);
exitSecondaryLoop = False;
Window xawt_root_window = get_xawt_root_shell(env);
while (!exitSecondaryLoop) {
if (XCheckIfEvent((Display*) jlong_to_ptr(display), (XEvent*) jlong_to_ptr(ptr), secondary_loop_event, NULL)) {
if (XCheckIfEvent((Display*) jlong_to_ptr(display),
(XEvent*) jlong_to_ptr(ptr), secondary_loop_event, (XPointer) &xawt_root_window)) {
return JNI_TRUE;
}
timeout = (timeout < AWT_SECONDARY_LOOP_TIMEOUT) ? (timeout << 1) : AWT_SECONDARY_LOOP_TIMEOUT;
......
......@@ -670,7 +670,7 @@ Java_sun_java2d_windows_GDIRenderer_doFillPoly
if (ypoints != NULL) {
pPoints = TransformPoly(xpoints, ypoints, transx, transy,
tmpPts, &npoints, FALSE, FALSE);
env->ReleasePrimitiveArrayCritical(ypointsarray, xpoints, JNI_ABORT);
env->ReleasePrimitiveArrayCritical(ypointsarray, ypoints, JNI_ABORT);
}
env->ReleasePrimitiveArrayCritical(xpointsarray, xpoints, JNI_ABORT);
}
......
......@@ -23,6 +23,7 @@
* questions.
*/
#include <windows.h>
#include <Sddl.h>
#include <string.h>
#include "jni.h"
......@@ -258,6 +259,25 @@ JNIEXPORT jlong JNICALL Java_sun_tools_attach_WindowsVirtualMachine_createPipe
HANDLE hPipe;
char name[MAX_PIPE_NAME_LENGTH];
SECURITY_ATTRIBUTES sa;
LPSECURITY_ATTRIBUTES lpSA = NULL;
// Custom Security Descriptor is required here to "get" Medium Integrity Level.
// In order to allow Medium Integrity Level clients to open
// and use a NamedPipe created by an High Integrity Level process.
TCHAR *szSD = TEXT("D:") // Discretionary ACL
TEXT("(A;OICI;GRGW;;;WD)") // Allow read/write to Everybody
TEXT("(A;OICI;GA;;;SY)") // Allow full control to System
TEXT("(A;OICI;GA;;;BA)"); // Allow full control to Administrators
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.bInheritHandle = FALSE;
sa.lpSecurityDescriptor = NULL;
if (ConvertStringSecurityDescriptorToSecurityDescriptor
(szSD, SDDL_REVISION_1, &(sa.lpSecurityDescriptor), NULL)) {
lpSA = &sa;
}
jstring_to_cstring(env, pipename, name, MAX_PIPE_NAME_LENGTH);
hPipe = CreateNamedPipe(
......@@ -270,7 +290,9 @@ JNIEXPORT jlong JNICALL Java_sun_tools_attach_WindowsVirtualMachine_createPipe
128, // output buffer size
8192, // input buffer size
NMPWAIT_USE_DEFAULT_WAIT, // client time-out
NULL); // default security attribute
lpSA); // security attributes
LocalFree(sa.lpSecurityDescriptor);
if (hPipe == INVALID_HANDLE_VALUE) {
JNU_ThrowIOExceptionWithLastError(env, "CreateNamedPipe failed");
......
......@@ -57,17 +57,11 @@ public:
static size_t GetALength(JNIEnv* env, jstring jStr, size_t maxlen);
LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
static LRESULT CALLBACK EditProc(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam);
MsgRouting WmEnable(BOOL fEnabled);
MsgRouting WmContextMenu(HWND hCtrl, UINT xPos, UINT yPos);
MsgRouting WmNotify(UINT notifyCode);
MsgRouting WmNcHitTest(UINT x, UINT y, LRESULT &retVal);
MsgRouting HandleEvent(MSG *msg, BOOL synthetic);
INLINE void SetIgnoreEnChange(BOOL b) { m_bIgnoreEnChange = b; }
virtual BOOL InheritsNativeMouseWheelBehavior();
virtual void Reshape(int x, int y, int w, int h);
......@@ -81,22 +75,7 @@ public:
protected:
void EditSetSel(CHARRANGE &cr);
void EditGetSel(CHARRANGE &cr);
private:
// RichEdit 1.0 control generates EN_CHANGE notifications not only
// on text changes, but also on any character formatting change.
// This flag is true when the latter case is detected.
BOOL m_bIgnoreEnChange;
// RichEdit 1.0 control undoes a character formatting change
// if it is the latest. We don't create our own undo buffer,
// but just prohibit undo in case if the latest operation
// is a formatting change.
BOOL m_bCanUndo;
HWND m_hEditCtrl;
static WNDPROC sm_pDefWindowProc;
LONG m_lHDeltaAccum;
LONG m_lVDeltaAccum;
......
......@@ -47,6 +47,8 @@ public:
static AwtTextComponent* Create(jobject self, jobject parent, BOOL isMultiline);
virtual void Dispose();
virtual LPCTSTR GetClassName();
LRESULT WindowProc(UINT message, WPARAM wParam, LPARAM lParam);
......@@ -83,6 +85,8 @@ public:
MsgRouting HandleEvent(MSG *msg, BOOL synthetic);
MsgRouting WmPaste();
INLINE void SetIgnoreEnChange(BOOL b) { m_bIgnoreEnChange = b; }
virtual BOOL IsFocusingMouseMessage(MSG *pMsg);
/* To be fully implemented in a future release
......@@ -115,11 +119,24 @@ public:
INLINE VOID SetEndSelectionPos(LONG lPos) { m_lEndPos = lPos; }
INLINE VOID SetLastSelectionPos(LONG lPos) { m_lLastPos = lPos; }
void EditGetSel(CHARRANGE &cr);
// Used to prevent untrusted code from synthesizing a WM_PASTE message
// by posting a <CTRL>-V KeyEvent
BOOL m_synthetic;
LONG EditGetCharFromPos(POINT& pt);
// RichEdit 1.0 control generates EN_CHANGE notifications not only
// on text changes, but also on any character formatting change.
// This flag is true when the latter case is detected.
BOOL m_bIgnoreEnChange;
// RichEdit 1.0 control undoes a character formatting change
// if it is the latest. We don't create our own undo buffer,
// but just prohibit undo in case if the latest operation
// is a formatting change.
BOOL m_bCanUndo;
/*****************************************************************
* Inner class OleCallback declaration.
*/
......@@ -166,6 +183,13 @@ private:
static OleCallback sm_oleCallback;
static WNDPROC sm_pDefWindowProc;
HWND m_hEditCtrl;
static LRESULT CALLBACK EditProc(HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam);
MsgRouting WmContextMenu(HWND hCtrl, UINT xPos, UINT yPos);
//
// Accessibility support
//
......
......@@ -249,13 +249,7 @@ AwtTextField::HandleEvent(MSG *msg, BOOL synthetic)
}
}
/*
* Store the 'synthetic' parameter so that the WM_PASTE security check
* happens only for synthetic events.
*/
m_synthetic = synthetic;
returnVal = AwtComponent::HandleEvent(msg, synthetic);
m_synthetic = FALSE;
returnVal = AwtTextComponent::HandleEvent(msg, synthetic);
if(systemBeeperEnabled){
SystemParametersInfo(SPI_SETBEEP, 1, NULL, 0);
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册