Merge
This commit is contained in:
commit
36d744e77b
@ -62,7 +62,8 @@ EXCLUDE_PROPWARN_PKGS += sun.dyn
|
||||
# This is an interim solution until the ct.sym is replaced
|
||||
# with a new module system (being discussed for JDK 7).
|
||||
#
|
||||
EXPORTED_PRIVATE_PKGS = com.sun.servicetag
|
||||
EXPORTED_PRIVATE_PKGS = com.sun.servicetag \
|
||||
com.oracle.net
|
||||
|
||||
# 64-bit solaris has a few special cases. We define the variable
|
||||
# SOLARIS64 for use in this Makefile to easily test those cases
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
# Copyright (c) 2007, 2011, 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,7 +45,7 @@ else
|
||||
JAVA_MEM_FLAGS += -Xms$(MIN_VM_MEMORY)m -XX:PermSize=32m -XX:MaxPermSize=160m
|
||||
endif
|
||||
|
||||
#
|
||||
#
|
||||
# All java tools (javac, javah, and javadoc) run faster with certain java
|
||||
# options, this macro should be used with all these tools.
|
||||
# In particular, the client VM makes these tools run faster when
|
||||
@ -122,6 +122,17 @@ ifeq ($(JAVAC_WARNINGS_FATAL), true)
|
||||
JAVACFLAGS += -Werror
|
||||
endif
|
||||
|
||||
#
|
||||
# Some licensees do not get the Security Source bundles. We will
|
||||
# fall back on the prebuilt jce.jar so that we can do a best
|
||||
# attempt at building. If sources exist, we always want to
|
||||
# build/use the most recent source instead of an older jce.jar, whether
|
||||
# built implicitly/explicitly.
|
||||
#
|
||||
ifeq ($(wildcard $(SHARE_SRC)/classes/javax/crypto/Cipher.java),)
|
||||
JCEFLAGS = $(CLASSPATH_SEPARATOR)$(LIBDIR)/jce.jar
|
||||
endif
|
||||
|
||||
# Add the source level
|
||||
SOURCE_LANGUAGE_VERSION = 7
|
||||
LANGUAGE_VERSION = -source $(SOURCE_LANGUAGE_VERSION)
|
||||
@ -132,11 +143,11 @@ TARGET_CLASS_VERSION = 7
|
||||
CLASS_VERSION = -target $(TARGET_CLASS_VERSION)
|
||||
JAVACFLAGS += $(CLASS_VERSION)
|
||||
JAVACFLAGS += -encoding ascii
|
||||
JAVACFLAGS += "-Xbootclasspath:$(CLASSBINDIR)"
|
||||
JAVACFLAGS += "-Xbootclasspath:$(CLASSBINDIR)$(JCEFLAGS)"
|
||||
JAVACFLAGS += $(OTHER_JAVACFLAGS)
|
||||
|
||||
# Needed for javah
|
||||
JAVAHFLAGS += -bootclasspath $(CLASSBINDIR)
|
||||
JAVAHFLAGS += -bootclasspath "$(CLASSBINDIR)$(JCEFLAGS)"
|
||||
|
||||
# Needed for javadoc to ensure it builds documentation
|
||||
# against the newly built classes
|
||||
|
@ -91,8 +91,6 @@ SCTPAPI_PKGS = com.sun.nio.sctp
|
||||
TRACING_PKGS = com.sun.tracing \
|
||||
com.sun.tracing.dtrace
|
||||
|
||||
ORACLENET_PKGS = com.oracle.net
|
||||
|
||||
# non-core packages in rt.jar
|
||||
NON_CORE_PKGS = $(DOMAPI_PKGS) \
|
||||
$(MGMT_PKGS) \
|
||||
@ -103,6 +101,5 @@ NON_CORE_PKGS = $(DOMAPI_PKGS) \
|
||||
$(HTTPSERVER_PKGS) \
|
||||
$(SMARTCARDIO_PKGS) \
|
||||
$(TRACING_PKGS) \
|
||||
$(SCTPAPI_PKGS) \
|
||||
$(ORACLENET_PKGS)
|
||||
$(SCTPAPI_PKGS)
|
||||
|
||||
|
@ -466,7 +466,6 @@ JAVA_JAVA_java = \
|
||||
java/security/ProtectionDomain.java \
|
||||
java/net/URLClassLoader.java \
|
||||
java/net/URLConnection.java \
|
||||
sun/misc/BootClassLoaderHook.java \
|
||||
sun/misc/Launcher.java \
|
||||
sun/misc/MetaIndex.java \
|
||||
sun/misc/URLClassPath.java \
|
||||
|
@ -368,7 +368,7 @@ else
|
||||
FONTCONFIGS_SRC = $(CLOSED_SRC)/solaris/classes/sun/awt/fontconfigs
|
||||
_FONTCONFIGS = \
|
||||
fontconfig.properties \
|
||||
fontconfig.RedHat.properties \
|
||||
fontconfig.RedHat.5.5.properties \
|
||||
fontconfig.Turbo.properties \
|
||||
fontconfig.SuSE.10.properties \
|
||||
fontconfig.SuSE.11.properties
|
||||
|
@ -424,6 +424,7 @@ SUNWprivate_1.1 {
|
||||
Java_sun_java2d_xr_XRSurfaceData_initXRPicture;
|
||||
Java_sun_java2d_xr_XRSurfaceData_initIDs;
|
||||
Java_sun_java2d_xr_XRSurfaceData_XRInitSurface;
|
||||
Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture;
|
||||
Java_sun_java2d_xr_XRBackendNative_initIDs;
|
||||
Java_sun_java2d_xr_XIDGenerator_bufferXIDs;
|
||||
Java_sun_java2d_xr_XRBackendNative_freeGC;
|
||||
|
@ -374,6 +374,7 @@ SUNWprivate_1.1 {
|
||||
Java_sun_java2d_xr_XRSurfaceData_initXRPicture;
|
||||
Java_sun_java2d_xr_XRSurfaceData_initIDs;
|
||||
Java_sun_java2d_xr_XRSurfaceData_XRInitSurface;
|
||||
Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture;
|
||||
Java_sun_java2d_xr_XRBackendNative_initIDs;
|
||||
Java_sun_java2d_xr_XRBackendNative_freeGC;
|
||||
Java_sun_java2d_xr_XRBackendNative_createGC;
|
||||
@ -432,6 +433,7 @@ SUNWprivate_1.1 {
|
||||
Java_sun_awt_X11_GtkFileDialogPeer_run;
|
||||
Java_sun_awt_X11_GtkFileDialogPeer_quit;
|
||||
Java_sun_awt_X11_GtkFileDialogPeer_toFront;
|
||||
Java_sun_awt_X11_GtkFileDialogPeer_setBounds;
|
||||
|
||||
Java_sun_print_CUPSPrinter_initIDs;
|
||||
Java_sun_print_CUPSPrinter_getCupsServer;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2011, 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
|
||||
@ -26,9 +26,7 @@
|
||||
package com.sun.jarsigner;
|
||||
|
||||
import java.net.URI;
|
||||
import java.security.cert.X509CRL;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.util.Set;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
/**
|
||||
@ -82,13 +80,6 @@ public interface ContentSignerParameters {
|
||||
*/
|
||||
public X509Certificate[] getSignerCertificateChain();
|
||||
|
||||
/**
|
||||
* Retrieves the signer's X.509 CRLs.
|
||||
*
|
||||
* @return An unmodifiable set of X.509 CRLs (never <code>null</code>)
|
||||
*/
|
||||
public Set<X509CRL> getCRLs();
|
||||
|
||||
/**
|
||||
* Retrieves the content that was signed.
|
||||
* The content is the JAR file's signature file.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2011, 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
|
||||
@ -1011,7 +1011,7 @@ class PackageReader extends BandStructure {
|
||||
return -1;
|
||||
}
|
||||
|
||||
Comparator<Entry> entryOutputOrder = new Comparator<>() {
|
||||
Comparator<Entry> entryOutputOrder = new Comparator<Entry>() {
|
||||
public int compare(Entry e0, Entry e1) {
|
||||
int k0 = getOutputIndex(e0);
|
||||
int k1 = getOutputIndex(e1);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2001, 2011, 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
|
||||
@ -785,7 +785,7 @@ class PackageWriter extends BandStructure {
|
||||
defMap.entrySet().toArray(layoutsAndCounts);
|
||||
// Sort by count, most frequent first.
|
||||
// Predefs. participate in this sort, though it does not matter.
|
||||
Arrays.sort(layoutsAndCounts, new Comparator<>() {
|
||||
Arrays.sort(layoutsAndCounts, new Comparator<Object>() {
|
||||
public int compare(Object o0, Object o1) {
|
||||
Map.Entry e0 = (Map.Entry) o0;
|
||||
Map.Entry e1 = (Map.Entry) o1;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2011, 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
|
||||
@ -380,13 +380,19 @@ public final class Connection implements Runnable {
|
||||
}
|
||||
|
||||
LdapRequest writeRequest(BerEncoder ber, int msgId) throws IOException {
|
||||
return writeRequest(ber, msgId, false /* pauseAfterReceipt */);
|
||||
return writeRequest(ber, msgId, false /* pauseAfterReceipt */, -1);
|
||||
}
|
||||
|
||||
LdapRequest writeRequest(BerEncoder ber, int msgId, boolean pauseAfterReceipt)
|
||||
throws IOException {
|
||||
LdapRequest writeRequest(BerEncoder ber, int msgId,
|
||||
boolean pauseAfterReceipt) throws IOException {
|
||||
return writeRequest(ber, msgId, pauseAfterReceipt, -1);
|
||||
}
|
||||
|
||||
LdapRequest req = new LdapRequest(msgId, pauseAfterReceipt);
|
||||
LdapRequest writeRequest(BerEncoder ber, int msgId,
|
||||
boolean pauseAfterReceipt, int replyQueueCapacity) throws IOException {
|
||||
|
||||
LdapRequest req =
|
||||
new LdapRequest(msgId, pauseAfterReceipt, replyQueueCapacity);
|
||||
addRequest(req);
|
||||
|
||||
if (traceFile != null) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2011, 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
|
||||
@ -516,7 +516,8 @@ public final class LdapClient implements PooledConnection {
|
||||
LdapResult search(String dn, int scope, int deref, int sizeLimit,
|
||||
int timeLimit, boolean attrsOnly, String attrs[],
|
||||
String filter, int batchSize, Control[] reqCtls,
|
||||
Hashtable binaryAttrs, boolean waitFirstReply)
|
||||
Hashtable binaryAttrs, boolean waitFirstReply,
|
||||
int replyQueueCapacity)
|
||||
throws IOException, NamingException {
|
||||
|
||||
ensureOpen();
|
||||
@ -543,7 +544,8 @@ public final class LdapClient implements PooledConnection {
|
||||
if (isLdapv3) encodeControls(ber, reqCtls);
|
||||
ber.endSeq();
|
||||
|
||||
LdapRequest req = conn.writeRequest(ber, curMsgId);
|
||||
LdapRequest req =
|
||||
conn.writeRequest(ber, curMsgId, false, replyQueueCapacity);
|
||||
|
||||
res.msgId = curMsgId;
|
||||
res.status = LdapClient.LDAP_SUCCESS; //optimistic
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2011, 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
|
||||
@ -191,6 +191,14 @@ final public class LdapCtx extends ComponentDirContext
|
||||
// Environment property for the domain name (derived from this context's DN)
|
||||
private static final String DOMAIN_NAME = "com.sun.jndi.ldap.domainname";
|
||||
|
||||
// Block until the first search reply is received
|
||||
private static final String WAIT_FOR_REPLY =
|
||||
"com.sun.jndi.ldap.search.waitForReply";
|
||||
|
||||
// Size of the queue of unprocessed search replies
|
||||
private static final String REPLY_QUEUE_SIZE =
|
||||
"com.sun.jndi.ldap.search.replyQueueSize";
|
||||
|
||||
// ----------------- Fields that don't change -----------------------
|
||||
private static final NameParser parser = new LdapNameParser();
|
||||
|
||||
@ -246,6 +254,8 @@ final public class LdapCtx extends ComponentDirContext
|
||||
private Hashtable binaryAttrs = null; // attr values returned as byte[]
|
||||
private int connectTimeout = -1; // no timeout value
|
||||
private int readTimeout = -1; // no timeout value
|
||||
private boolean waitForReply = true; // wait for search response
|
||||
private int replyQueueSize = -1; // unlimited queue size
|
||||
private boolean useSsl = false; // true if SSL protocol is active
|
||||
private boolean useDefaultPortNumber = false; // no port number was supplied
|
||||
|
||||
@ -1759,8 +1769,8 @@ final public class LdapCtx extends ComponentDirContext
|
||||
SearchControls cons,
|
||||
Continuation cont)
|
||||
throws NamingException {
|
||||
return searchAux(name, filter, cloneSearchControls(cons), true, true,
|
||||
cont);
|
||||
return searchAux(name, filter, cloneSearchControls(cons), true,
|
||||
waitForReply, cont);
|
||||
}
|
||||
|
||||
protected NamingEnumeration c_search(Name name,
|
||||
@ -1928,7 +1938,7 @@ final public class LdapCtx extends ComponentDirContext
|
||||
}
|
||||
|
||||
private LdapResult doSearch(Name name, String filter, SearchControls cons,
|
||||
boolean relative, boolean waitFirstReply) throws NamingException {
|
||||
boolean relative, boolean waitForReply) throws NamingException {
|
||||
ensureOpen();
|
||||
try {
|
||||
int scope;
|
||||
@ -1984,7 +1994,8 @@ final public class LdapCtx extends ComponentDirContext
|
||||
batchSize,
|
||||
reqCtls,
|
||||
binaryAttrs,
|
||||
waitFirstReply);
|
||||
waitForReply,
|
||||
replyQueueSize);
|
||||
respCtls = answer.resControls; // retrieve response controls
|
||||
return answer;
|
||||
|
||||
@ -2170,6 +2181,10 @@ final public class LdapCtx extends ComponentDirContext
|
||||
connectTimeout = -1;
|
||||
} else if (propName.equals(READ_TIMEOUT)) {
|
||||
readTimeout = -1;
|
||||
} else if (propName.equals(WAIT_FOR_REPLY)) {
|
||||
waitForReply = true;
|
||||
} else if (propName.equals(REPLY_QUEUE_SIZE)) {
|
||||
replyQueueSize = -1;
|
||||
|
||||
// The following properties affect the connection
|
||||
|
||||
@ -2225,6 +2240,11 @@ final public class LdapCtx extends ComponentDirContext
|
||||
setConnectTimeout((String)propVal);
|
||||
} else if (propName.equals(READ_TIMEOUT)) {
|
||||
setReadTimeout((String)propVal);
|
||||
} else if (propName.equals(WAIT_FOR_REPLY)) {
|
||||
setWaitForReply((String)propVal);
|
||||
} else if (propName.equals(REPLY_QUEUE_SIZE)) {
|
||||
setReplyQueueSize((String)propVal);
|
||||
|
||||
// The following properties affect the connection
|
||||
|
||||
} else if (propName.equals(Context.SECURITY_PROTOCOL)) {
|
||||
@ -2312,6 +2332,13 @@ final public class LdapCtx extends ComponentDirContext
|
||||
// Set the read timeout
|
||||
setReadTimeout((String)envprops.get(READ_TIMEOUT));
|
||||
|
||||
// Set the flag that controls whether to block until the first reply
|
||||
// is received
|
||||
setWaitForReply((String)envprops.get(WAIT_FOR_REPLY));
|
||||
|
||||
// Set the size of the queue of unprocessed search replies
|
||||
setReplyQueueSize((String)envprops.get(REPLY_QUEUE_SIZE));
|
||||
|
||||
// When connection is created, it will use these and other
|
||||
// properties from the environment
|
||||
}
|
||||
@ -2441,6 +2468,34 @@ final public class LdapCtx extends ComponentDirContext
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the size of the queue of unprocessed search replies
|
||||
*/
|
||||
private void setReplyQueueSize(String replyQueueSizeProp) {
|
||||
if (replyQueueSizeProp != null) {
|
||||
replyQueueSize = Integer.parseInt(replyQueueSizeProp);
|
||||
// disallow an empty queue
|
||||
if (replyQueueSize <= 0) {
|
||||
replyQueueSize = -1; // unlimited
|
||||
}
|
||||
} else {
|
||||
replyQueueSize = -1; // unlimited
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the flag that controls whether to block until the first search
|
||||
* reply is received
|
||||
*/
|
||||
private void setWaitForReply(String waitForReplyProp) {
|
||||
if (waitForReplyProp != null &&
|
||||
(waitForReplyProp.equalsIgnoreCase("false"))) {
|
||||
waitForReply = false;
|
||||
} else {
|
||||
waitForReply = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the read timeout value
|
||||
*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2011, 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
|
||||
@ -26,7 +26,8 @@
|
||||
package com.sun.jndi.ldap;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Vector;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import javax.naming.CommunicationException;
|
||||
|
||||
final class LdapRequest {
|
||||
@ -35,14 +36,26 @@ final class LdapRequest {
|
||||
int msgId; // read-only
|
||||
|
||||
private int gotten = 0;
|
||||
private Vector replies = new Vector(3);
|
||||
private BlockingQueue<BerDecoder> replies;
|
||||
private int highWatermark = -1;
|
||||
private boolean cancelled = false;
|
||||
private boolean pauseAfterReceipt = false;
|
||||
private boolean completed = false;
|
||||
|
||||
LdapRequest(int msgId, boolean pause) {
|
||||
this(msgId, pause, -1);
|
||||
}
|
||||
|
||||
LdapRequest(int msgId, boolean pause, int replyQueueCapacity) {
|
||||
this.msgId = msgId;
|
||||
this.pauseAfterReceipt = pause;
|
||||
if (replyQueueCapacity == -1) {
|
||||
this.replies = new LinkedBlockingQueue<BerDecoder>();
|
||||
} else {
|
||||
this.replies =
|
||||
new LinkedBlockingQueue<BerDecoder>(replyQueueCapacity);
|
||||
highWatermark = (replyQueueCapacity * 80) / 100; // 80% capacity
|
||||
}
|
||||
}
|
||||
|
||||
synchronized void cancel() {
|
||||
@ -57,7 +70,13 @@ final class LdapRequest {
|
||||
if (cancelled) {
|
||||
return false;
|
||||
}
|
||||
replies.addElement(ber);
|
||||
|
||||
// Add a new reply to the queue of unprocessed replies.
|
||||
try {
|
||||
replies.put(ber);
|
||||
} catch (InterruptedException e) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
// peek at the BER buffer to check if it is a SearchResultDone PDU
|
||||
try {
|
||||
@ -70,6 +89,14 @@ final class LdapRequest {
|
||||
ber.reset();
|
||||
|
||||
notify(); // notify anyone waiting for reply
|
||||
/*
|
||||
* If a queue capacity has been set then trigger a pause when the
|
||||
* queue has filled to 80% capacity. Later, when the queue has drained
|
||||
* then the reader gets unpaused.
|
||||
*/
|
||||
if (highWatermark != -1 && replies.size() >= highWatermark) {
|
||||
return true; // trigger the pause
|
||||
}
|
||||
return pauseAfterReceipt;
|
||||
}
|
||||
|
||||
@ -79,14 +106,12 @@ final class LdapRequest {
|
||||
" cancelled");
|
||||
}
|
||||
|
||||
if (gotten < replies.size()) {
|
||||
BerDecoder answer = (BerDecoder)replies.elementAt(gotten);
|
||||
replies.setElementAt(null, gotten); // remove reference
|
||||
++gotten; // skip to next
|
||||
return answer;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
/*
|
||||
* Remove a reply if the queue is not empty.
|
||||
* poll returns null if queue is empty.
|
||||
*/
|
||||
BerDecoder reply = replies.poll();
|
||||
return reply;
|
||||
}
|
||||
|
||||
synchronized boolean hasSearchCompleted() {
|
||||
|
@ -25,12 +25,10 @@
|
||||
|
||||
package com.sun.media.sound;
|
||||
|
||||
import java.util.Vector;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.DataInputStream;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
@ -398,7 +396,8 @@ public class AiffFileWriter extends SunFileWriter {
|
||||
header = baos.toByteArray();
|
||||
headerStream = new ByteArrayInputStream( header );
|
||||
|
||||
aiffStream = new SequenceInputStream(headerStream,codedAudioStream);
|
||||
aiffStream = new SequenceInputStream(headerStream,
|
||||
new NoCloseInputStream(codedAudioStream));
|
||||
|
||||
return aiffStream;
|
||||
|
||||
|
@ -52,9 +52,6 @@ public class AlawCodec extends SunCodec {
|
||||
private static final short seg_end [] = {0xFF, 0x1FF, 0x3FF,
|
||||
0x7FF, 0xFFF, 0x1FFF, 0x3FFF, 0x7FFF};
|
||||
|
||||
private static final int tempBufferSize = 64;
|
||||
private byte tempBuffer [] = null;
|
||||
|
||||
/**
|
||||
* Initializes the decode tables
|
||||
*/
|
||||
@ -199,12 +196,9 @@ public class AlawCodec extends SunCodec {
|
||||
AudioFormat inputFormat = stream.getFormat();
|
||||
|
||||
if( inputFormat.matches(outputFormat) ) {
|
||||
|
||||
cs = stream;
|
||||
} else {
|
||||
|
||||
cs = (AudioInputStream) (new AlawCodecStream(stream, outputFormat));
|
||||
tempBuffer = new byte[tempBufferSize];
|
||||
}
|
||||
|
||||
return cs;
|
||||
@ -264,6 +258,10 @@ public class AlawCodec extends SunCodec {
|
||||
|
||||
class AlawCodecStream extends AudioInputStream {
|
||||
|
||||
// tempBuffer required only for encoding (when encode is true)
|
||||
private static final int tempBufferSize = 64;
|
||||
private byte tempBuffer [] = null;
|
||||
|
||||
/**
|
||||
* True to encode to a-law, false to decode to linear
|
||||
*/
|
||||
@ -303,6 +301,7 @@ public class AlawCodec extends SunCodec {
|
||||
encodeFormat = outputFormat;
|
||||
decodeFormat = inputFormat;
|
||||
PCMIsBigEndian = inputFormat.isBigEndian();
|
||||
tempBuffer = new byte[tempBufferSize];
|
||||
}
|
||||
|
||||
if (PCMIsBigEndian) {
|
||||
|
@ -25,12 +25,10 @@
|
||||
|
||||
package com.sun.media.sound;
|
||||
|
||||
import java.util.Vector;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.IllegalArgumentException;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
@ -131,10 +129,10 @@ public class AuFileWriter extends SunFileWriter {
|
||||
// $$fb: 2001-07-13: done. Fixes Bug 4479981
|
||||
RandomAccessFile raf=new RandomAccessFile(out, "rw");
|
||||
if (raf.length()<=0x7FFFFFFFl) {
|
||||
// skip AU magic and data offset field
|
||||
// skip AU magic and data offset field
|
||||
raf.skipBytes(8);
|
||||
raf.writeInt(bytesWritten-AuFileFormat.AU_HEADERSIZE);
|
||||
// that's all
|
||||
// that's all
|
||||
}
|
||||
raf.close();
|
||||
}
|
||||
@ -303,7 +301,8 @@ public class AuFileWriter extends SunFileWriter {
|
||||
dos.close();
|
||||
header = baos.toByteArray();
|
||||
headerStream = new ByteArrayInputStream( header );
|
||||
auStream = new SequenceInputStream(headerStream,codedAudioStream);
|
||||
auStream = new SequenceInputStream(headerStream,
|
||||
new NoCloseInputStream(codedAudioStream));
|
||||
|
||||
return auStream;
|
||||
}
|
||||
|
@ -395,11 +395,7 @@ class DirectAudioDevice extends AbstractMixer {
|
||||
protected volatile boolean noService = false; // do not run the nService method
|
||||
|
||||
// Guards all native calls.
|
||||
protected Object lockNative = new Object();
|
||||
// Guards the lastOpened static variable in implOpen and implClose.
|
||||
protected static Object lockLast = new Object();
|
||||
// Keeps track of last opened line, see implOpen "trick".
|
||||
protected static DirectDL lastOpened;
|
||||
protected final Object lockNative = new Object();
|
||||
|
||||
// CONSTRUCTOR
|
||||
protected DirectDL(DataLine.Info info,
|
||||
@ -501,48 +497,21 @@ class DirectAudioDevice extends AbstractMixer {
|
||||
// align buffer to full frames
|
||||
bufferSize = ((int) bufferSize / format.getFrameSize()) * format.getFrameSize();
|
||||
|
||||
synchronized(lockLast) {
|
||||
id = nOpen(mixerIndex, deviceID, isSource,
|
||||
encoding,
|
||||
hardwareFormat.getSampleRate(),
|
||||
hardwareFormat.getSampleSizeInBits(),
|
||||
hardwareFormat.getFrameSize(),
|
||||
hardwareFormat.getChannels(),
|
||||
hardwareFormat.getEncoding().equals(
|
||||
AudioFormat.Encoding.PCM_SIGNED),
|
||||
hardwareFormat.isBigEndian(),
|
||||
bufferSize);
|
||||
id = nOpen(mixerIndex, deviceID, isSource,
|
||||
encoding,
|
||||
hardwareFormat.getSampleRate(),
|
||||
hardwareFormat.getSampleSizeInBits(),
|
||||
hardwareFormat.getFrameSize(),
|
||||
hardwareFormat.getChannels(),
|
||||
hardwareFormat.getEncoding().equals(
|
||||
AudioFormat.Encoding.PCM_SIGNED),
|
||||
hardwareFormat.isBigEndian(),
|
||||
bufferSize);
|
||||
|
||||
if (id == 0) {
|
||||
// Bah... Dirty trick. The most likely cause is an application
|
||||
// already having a line open for this particular hardware
|
||||
// format and forgetting about it. If so, silently close that
|
||||
// implementation and try again. Unfortuantely we can only
|
||||
// open one line per hardware format currently.
|
||||
if (lastOpened != null
|
||||
&& hardwareFormat.matches(lastOpened.hardwareFormat)) {
|
||||
lastOpened.implClose();
|
||||
lastOpened = null;
|
||||
|
||||
id = nOpen(mixerIndex, deviceID, isSource,
|
||||
encoding,
|
||||
hardwareFormat.getSampleRate(),
|
||||
hardwareFormat.getSampleSizeInBits(),
|
||||
hardwareFormat.getFrameSize(),
|
||||
hardwareFormat.getChannels(),
|
||||
hardwareFormat.getEncoding().equals(
|
||||
AudioFormat.Encoding.PCM_SIGNED),
|
||||
hardwareFormat.isBigEndian(),
|
||||
bufferSize);
|
||||
}
|
||||
|
||||
if (id == 0) {
|
||||
// TODO: nicer error messages...
|
||||
throw new LineUnavailableException(
|
||||
"line with format "+format+" not supported.");
|
||||
}
|
||||
}
|
||||
lastOpened = this;
|
||||
if (id == 0) {
|
||||
// TODO: nicer error messages...
|
||||
throw new LineUnavailableException(
|
||||
"line with format "+format+" not supported.");
|
||||
}
|
||||
|
||||
this.bufferSize = nGetBufferSize(id, isSource);
|
||||
@ -615,14 +584,13 @@ class DirectAudioDevice extends AbstractMixer {
|
||||
}
|
||||
synchronized (lockNative) {
|
||||
nStop(id, isSource);
|
||||
|
||||
}
|
||||
// wake up any waiting threads
|
||||
synchronized(lock) {
|
||||
// need to set doIO to false before notifying the
|
||||
// read/write thread, that's why isStartedRunning()
|
||||
// cannot be used
|
||||
doIO = false;
|
||||
}
|
||||
// wake up any waiting threads
|
||||
synchronized(lock) {
|
||||
lock.notifyAll();
|
||||
}
|
||||
setActive(false);
|
||||
@ -649,12 +617,8 @@ class DirectAudioDevice extends AbstractMixer {
|
||||
doIO = false;
|
||||
long oldID = id;
|
||||
id = 0;
|
||||
synchronized (lockLast) {
|
||||
synchronized (lockNative) {
|
||||
nClose(oldID, isSource);
|
||||
if (lastOpened == this)
|
||||
lastOpened = null;
|
||||
}
|
||||
synchronized (lockNative) {
|
||||
nClose(oldID, isSource);
|
||||
}
|
||||
bytePosition = 0;
|
||||
softwareConversionSize = 0;
|
||||
@ -667,10 +631,9 @@ class DirectAudioDevice extends AbstractMixer {
|
||||
if (id == 0) {
|
||||
return 0;
|
||||
}
|
||||
int a = 0;
|
||||
int a;
|
||||
synchronized (lockNative) {
|
||||
if (doIO)
|
||||
a = nAvailable(id, isSource);
|
||||
a = nAvailable(id, isSource);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
@ -726,7 +689,7 @@ class DirectAudioDevice extends AbstractMixer {
|
||||
lock.notifyAll();
|
||||
}
|
||||
synchronized (lockNative) {
|
||||
if (id != 0 && doIO) {
|
||||
if (id != 0) {
|
||||
// then flush native buffers
|
||||
nFlush(id, isSource);
|
||||
}
|
||||
@ -737,10 +700,9 @@ class DirectAudioDevice extends AbstractMixer {
|
||||
|
||||
// replacement for getFramePosition (see AbstractDataLine)
|
||||
public long getLongFramePosition() {
|
||||
long pos = 0;
|
||||
long pos;
|
||||
synchronized (lockNative) {
|
||||
if (doIO)
|
||||
pos = nGetBytePosition(id, isSource, bytePosition);
|
||||
pos = nGetBytePosition(id, isSource, bytePosition);
|
||||
}
|
||||
// hack because ALSA sometimes reports wrong framepos
|
||||
if (pos < 0) {
|
||||
@ -786,12 +748,11 @@ class DirectAudioDevice extends AbstractMixer {
|
||||
}
|
||||
int written = 0;
|
||||
while (!flushing) {
|
||||
int thisWritten = 0;
|
||||
int thisWritten;
|
||||
synchronized (lockNative) {
|
||||
if (doIO)
|
||||
thisWritten = nWrite(id, b, off, len,
|
||||
softwareConversionSize,
|
||||
leftGain, rightGain);
|
||||
thisWritten = nWrite(id, b, off, len,
|
||||
softwareConversionSize,
|
||||
leftGain, rightGain);
|
||||
if (thisWritten < 0) {
|
||||
// error in native layer
|
||||
break;
|
||||
@ -1014,10 +975,9 @@ class DirectAudioDevice extends AbstractMixer {
|
||||
}
|
||||
int read = 0;
|
||||
while (doIO && !flushing) {
|
||||
int thisRead = 0;
|
||||
int thisRead;
|
||||
synchronized (lockNative) {
|
||||
if (doIO)
|
||||
thisRead = nRead(id, b, off, len, softwareConversionSize);
|
||||
thisRead = nRead(id, b, off, len, softwareConversionSize);
|
||||
if (thisRead < 0) {
|
||||
// error in native layer
|
||||
break;
|
||||
@ -1252,8 +1212,7 @@ class DirectAudioDevice extends AbstractMixer {
|
||||
// set new native position (if necessary)
|
||||
// this must come after the flush!
|
||||
synchronized (lockNative) {
|
||||
if (doIO)
|
||||
nSetBytePosition(id, isSource, frames * frameSize);
|
||||
nSetBytePosition(id, isSource, frames * frameSize);
|
||||
}
|
||||
|
||||
if (Printer.debug) Printer.debug(" DirectClip.setFramePosition: "
|
||||
|
@ -775,15 +775,22 @@ class RealTimeSequencer extends AbstractMidiDevice implements Sequencer, AutoCon
|
||||
Receiver rec = null;
|
||||
// first try to connect to the default synthesizer
|
||||
// IMPORTANT: this code needs to be synch'ed with
|
||||
// MidiSystem.getReceiver(boolean), because the same
|
||||
// MidiSystem.getSequencer(boolean), because the same
|
||||
// algorithm needs to be used!
|
||||
try {
|
||||
Synthesizer synth = MidiSystem.getSynthesizer();
|
||||
synth.open();
|
||||
if (synth instanceof ReferenceCountingDevice) {
|
||||
rec = ((ReferenceCountingDevice) synth).getReceiverReferenceCounting();
|
||||
} else {
|
||||
rec = synth.getReceiver();
|
||||
synth.open();
|
||||
try {
|
||||
rec = synth.getReceiver();
|
||||
} finally {
|
||||
// make sure that the synth is properly closed
|
||||
if (rec == null) {
|
||||
synth.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// something went wrong with synth
|
||||
|
@ -127,7 +127,7 @@ public class StandardMidiFileReader extends MidiFileReader {
|
||||
resolution = timing;
|
||||
} else {
|
||||
// SMPTE based timing. first decipher the frame code.
|
||||
int frameCode = (-1 * timing) >> 8;
|
||||
int frameCode = -1 * (timing >> 8);
|
||||
switch(frameCode) {
|
||||
case 24:
|
||||
divisionType = Sequence.SMPTE_24;
|
||||
|
@ -30,14 +30,9 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.net.URL;
|
||||
|
||||
import javax.sound.sampled.AudioFormat;
|
||||
import javax.sound.sampled.AudioFileFormat;
|
||||
import javax.sound.sampled.AudioInputStream;
|
||||
import javax.sound.sampled.AudioSystem;
|
||||
import javax.sound.sampled.UnsupportedAudioFileException;
|
||||
import javax.sound.sampled.spi.AudioFileWriter;
|
||||
|
||||
|
||||
@ -177,4 +172,62 @@ abstract class SunFileWriter extends AudioFileWriter {
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* InputStream wrapper class which prevent source stream from being closed.
|
||||
* The class is usefull for use with SequenceInputStream to prevent
|
||||
* closing of the source input streams.
|
||||
*/
|
||||
protected class NoCloseInputStream extends InputStream {
|
||||
private final InputStream in;
|
||||
|
||||
public NoCloseInputStream(InputStream in) {
|
||||
this.in = in;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
return in.read();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte b[]) throws IOException {
|
||||
return in.read(b);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte b[], int off, int len) throws IOException {
|
||||
return in.read(b, off, len);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long skip(long n) throws IOException {
|
||||
return in.skip(n);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int available() throws IOException {
|
||||
return in.available();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
// don't propagate the call
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mark(int readlimit) {
|
||||
in.mark(readlimit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reset() throws IOException {
|
||||
in.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean markSupported() {
|
||||
return in.markSupported();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -25,12 +25,10 @@
|
||||
|
||||
package com.sun.media.sound;
|
||||
|
||||
import java.util.Vector;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.io.IOException;
|
||||
import java.lang.IllegalArgumentException;
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
@ -371,7 +369,8 @@ public class WaveFileWriter extends SunFileWriter {
|
||||
dos.close();
|
||||
header = baos.toByteArray();
|
||||
headerStream = new ByteArrayInputStream( header );
|
||||
waveStream = new SequenceInputStream(headerStream,codedAudioStream);
|
||||
waveStream = new SequenceInputStream(headerStream,
|
||||
new NoCloseInputStream(codedAudioStream));
|
||||
|
||||
return (InputStream)waveStream;
|
||||
}
|
||||
|
@ -1985,8 +1985,22 @@ public class Font implements java.io.Serializable
|
||||
* @since 1.2
|
||||
*/
|
||||
public int canDisplayUpTo(String str) {
|
||||
return canDisplayUpTo(new StringCharacterIterator(str), 0,
|
||||
str.length());
|
||||
Font2D font2d = getFont2D();
|
||||
int len = str.length();
|
||||
for (int i = 0; i < len; i++) {
|
||||
char c = str.charAt(i);
|
||||
if (font2d.canDisplay(c)) {
|
||||
continue;
|
||||
}
|
||||
if (!Character.isHighSurrogate(c)) {
|
||||
return i;
|
||||
}
|
||||
if (!font2d.canDisplay(str.codePointAt(i))) {
|
||||
return i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2009,11 +2023,21 @@ public class Font implements java.io.Serializable
|
||||
* @since 1.2
|
||||
*/
|
||||
public int canDisplayUpTo(char[] text, int start, int limit) {
|
||||
while (start < limit && canDisplay(text[start])) {
|
||||
++start;
|
||||
Font2D font2d = getFont2D();
|
||||
for (int i = start; i < limit; i++) {
|
||||
char c = text[i];
|
||||
if (font2d.canDisplay(c)) {
|
||||
continue;
|
||||
}
|
||||
if (!Character.isHighSurrogate(c)) {
|
||||
return i;
|
||||
}
|
||||
if (!font2d.canDisplay(Character.codePointAt(text, i, limit))) {
|
||||
return i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return start == limit ? -1 : start;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2034,13 +2058,26 @@ public class Font implements java.io.Serializable
|
||||
* @since 1.2
|
||||
*/
|
||||
public int canDisplayUpTo(CharacterIterator iter, int start, int limit) {
|
||||
for (char c = iter.setIndex(start);
|
||||
iter.getIndex() < limit && canDisplay(c);
|
||||
c = iter.next()) {
|
||||
Font2D font2d = getFont2D();
|
||||
char c = iter.setIndex(start);
|
||||
for (int i = start; i < limit; i++, c = iter.next()) {
|
||||
if (font2d.canDisplay(c)) {
|
||||
continue;
|
||||
}
|
||||
if (!Character.isHighSurrogate(c)) {
|
||||
return i;
|
||||
}
|
||||
char c2 = iter.next();
|
||||
// c2 could be CharacterIterator.DONE which is not a low surrogate.
|
||||
if (!Character.isLowSurrogate(c2)) {
|
||||
return i;
|
||||
}
|
||||
if (!font2d.canDisplay(Character.toCodePoint(c, c2))) {
|
||||
return i;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
int result = iter.getIndex();
|
||||
return result == limit ? -1 : result;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,7 +58,6 @@ import java.util.StringTokenizer;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
|
||||
import sun.misc.BootClassLoaderHook;
|
||||
|
||||
/**
|
||||
* A representation of color profile data for device independent and
|
||||
@ -865,8 +864,7 @@ public class ICC_Profile implements Serializable {
|
||||
case ColorSpace.CS_PYCC:
|
||||
synchronized(ICC_Profile.class) {
|
||||
if (PYCCprofile == null) {
|
||||
if (BootClassLoaderHook.getHook() != null ||
|
||||
standardProfileExists("PYCC.pf"))
|
||||
if (standardProfileExists("PYCC.pf"))
|
||||
{
|
||||
ProfileDeferralInfo pInfo =
|
||||
new ProfileDeferralInfo("PYCC.pf",
|
||||
|
@ -2055,7 +2055,7 @@ public class File
|
||||
*
|
||||
* @return a {@code Path} constructed from this abstract path
|
||||
*
|
||||
* @throws InvalidPathException
|
||||
* @throws java.nio.file.InvalidPathException
|
||||
* if a {@code Path} object cannot be constructed from the abstract
|
||||
* path (see {@link java.nio.file.FileSystem#getPath FileSystem.getPath})
|
||||
*
|
||||
|
@ -51,7 +51,6 @@ import java.util.Vector;
|
||||
import java.util.Hashtable;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import sun.misc.BootClassLoaderHook;
|
||||
import sun.misc.ClassFileTransformer;
|
||||
import sun.misc.CompoundEnumeration;
|
||||
import sun.misc.Resource;
|
||||
@ -1300,7 +1299,6 @@ public abstract class ClassLoader {
|
||||
* Find resources from the VM's built-in classloader.
|
||||
*/
|
||||
private static URL getBootstrapResource(String name) {
|
||||
BootClassLoaderHook.preLoadResource(name);
|
||||
URLClassPath ucp = getBootstrapClassPath();
|
||||
Resource res = ucp.getResource(name);
|
||||
return res != null ? res.getURL() : null;
|
||||
@ -1814,7 +1812,6 @@ public abstract class ClassLoader {
|
||||
// Invoked in the java.lang.Runtime class to implement load and loadLibrary.
|
||||
static void loadLibrary(Class fromClass, String name,
|
||||
boolean isAbsolute) {
|
||||
BootClassLoaderHook.preLoadLibrary(name);
|
||||
ClassLoader loader =
|
||||
(fromClass == null) ? null : fromClass.getClassLoader();
|
||||
if (sys_paths == null) {
|
||||
|
@ -576,12 +576,10 @@ public class Package implements java.lang.reflect.AnnotatedElement {
|
||||
* Returns the Manifest for the specified JAR file name.
|
||||
*/
|
||||
private static Manifest loadManifest(String fn) {
|
||||
try {
|
||||
FileInputStream fis = new FileInputStream(fn);
|
||||
JarInputStream jis = new JarInputStream(fis, false);
|
||||
Manifest man = jis.getManifest();
|
||||
jis.close();
|
||||
return man;
|
||||
try (FileInputStream fis = new FileInputStream(fn);
|
||||
JarInputStream jis = new JarInputStream(fis, false))
|
||||
{
|
||||
return jis.getManifest();
|
||||
} catch (IOException e) {
|
||||
return null;
|
||||
}
|
||||
|
@ -400,7 +400,8 @@ abstract public class HttpURLConnection extends URLConnection {
|
||||
* @exception ProtocolException if the method cannot be reset or if
|
||||
* the requested method isn't valid for HTTP.
|
||||
* @exception SecurityException if a security manager is set and the
|
||||
* "allowHttpTrace" NetPermission is not granted.
|
||||
* method is "TRACE", but the "allowHttpTrace"
|
||||
* NetPermission is not granted.
|
||||
* @see #getRequestMethod()
|
||||
*/
|
||||
public void setRequestMethod(String method) throws ProtocolException {
|
||||
|
@ -73,6 +73,13 @@ import java.util.StringTokenizer;
|
||||
* </tr>
|
||||
*
|
||||
* <tr>
|
||||
* <td>getNetworkInformation</td>
|
||||
* <td>The ability to retrieve all information about local network interfaces.</td>
|
||||
* <td>Malicious code can read information about network hardware such as
|
||||
* MAC addresses, which could be used to construct local IPv6 addresses.</td>
|
||||
* </tr>
|
||||
*
|
||||
* <tr>
|
||||
* <td>getProxySelector</td>
|
||||
* <td>The ability to get the proxy selector used to make decisions
|
||||
* on which proxies to use when making network connections.</td>
|
||||
|
@ -991,7 +991,7 @@ public final class URI
|
||||
* authority and path are taken from the given URI. </p></li>
|
||||
*
|
||||
* <li><p> Otherwise the new URI's authority component is copied from
|
||||
* this URI, and its path is computed as follows: </p></li>
|
||||
* this URI, and its path is computed as follows: </p>
|
||||
*
|
||||
* <ol type=a>
|
||||
*
|
||||
@ -1005,7 +1005,7 @@ public final class URI
|
||||
* path and then normalizing the result as if by invoking the {@link
|
||||
* #normalize() normalize} method. </p></li>
|
||||
*
|
||||
* </ol>
|
||||
* </ol></li>
|
||||
*
|
||||
* </ol>
|
||||
*
|
||||
@ -1511,7 +1511,7 @@ public final class URI
|
||||
* fragments. </p></li>
|
||||
*
|
||||
* <li><p> Two hierarchical URIs with identical schemes are ordered
|
||||
* according to the ordering of their authority components: </p></li>
|
||||
* according to the ordering of their authority components: </p>
|
||||
*
|
||||
* <ul type=disc>
|
||||
*
|
||||
@ -1526,7 +1526,7 @@ public final class URI
|
||||
* the URIs are ordered according to the ordering of their authority
|
||||
* components. </p></li>
|
||||
*
|
||||
* </ul>
|
||||
* </ul></li>
|
||||
*
|
||||
* <li><p> Finally, two hierarchical URIs with identical schemes and
|
||||
* authority components are ordered according to the ordering of their
|
||||
|
@ -31,18 +31,18 @@ Provides the classes for implementing networking applications.
|
||||
|
||||
<p> The java.net package can be roughly divided in two sections:</p>
|
||||
<ul>
|
||||
<li> <p><i>A Low Level API</i>, which deals with the following abstractions:</p></li>
|
||||
<li> <p><i>A Low Level API</i>, which deals with the following abstractions:</p>
|
||||
<ul>
|
||||
<li><p><i>Addresses</i>, which are networking identifiers, like IP addresses.</p></li>
|
||||
<li><p><i>Sockets</i>, which are basic bidirectional data communication mechanisms.</p></li>
|
||||
<li><p><i>Interfaces</i>, which describe network interfaces. </p></li>
|
||||
</ul>
|
||||
<li> <p><i>A High Level API</i>, which deals with the following abstractions:</p></li>
|
||||
</ul></li>
|
||||
<li> <p><i>A High Level API</i>, which deals with the following abstractions:</p>
|
||||
<ul>
|
||||
<li><p><i>URIs</i>, which represent Universal Resource Identifiers.</p></li>
|
||||
<li><p><i>URLs</i>, which represent Universal Resource Locators.</p></li>
|
||||
<li><p><i>Connections</i>, which represents connections to the resource pointed to by <i>URLs</i>.</p></li>
|
||||
</ul>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<h2>Addresses</h2>
|
||||
<p>Addresses are used throughout the java.net APIs as either host identifiers, or socket endpoint identifiers.</p>
|
||||
|
@ -48,12 +48,12 @@ import java.util.Collections;
|
||||
*
|
||||
* <p> An asynchronous file channel does not have a <i>current position</i>
|
||||
* within the file. Instead, the file position is specified to each read and
|
||||
* write methd that initiate asynchronous operations. A {@link CompletionHandler}
|
||||
* write method that initiates asynchronous operations. A {@link CompletionHandler}
|
||||
* is specified as a parameter and is invoked to consume the result of the I/O
|
||||
* operation. This class also defines read and write methods that initiate
|
||||
* asynchronous operations, returning a {@link Future} to represent the pending
|
||||
* result of the operation. The {@code Future} may be used to check if the
|
||||
* operation has completed, to wait for its completion.
|
||||
* operation has completed, wait for its completion, and retrieve the result.
|
||||
*
|
||||
* <p> In addition to read and write operations, this class defines the
|
||||
* following operations: </p>
|
||||
@ -73,13 +73,13 @@ import java.util.Collections;
|
||||
* which tasks are submitted to handle I/O events and dispatch to completion
|
||||
* handlers that consume the results of I/O operations on the channel. The
|
||||
* completion handler for an I/O operation initiated on a channel is guaranteed
|
||||
* to be invoked by one threads in the thread pool (This ensures that the
|
||||
* to be invoked by one of the threads in the thread pool (This ensures that the
|
||||
* completion handler is run by a thread with the expected <em>identity</em>).
|
||||
* Where an I/O operation completes immediately, and the initiating thread is
|
||||
* itself a thread in the thread pool, then the completion handler may be invoked
|
||||
* directly by the initiating thread. When an {@code AsynchronousFileChannel} is
|
||||
* created without specifying a thread pool then the channel is associated with
|
||||
* a system-dependent and default thread pool that may be shared with other
|
||||
* a system-dependent default thread pool that may be shared with other
|
||||
* channels. The default thread pool is configured by the system properties
|
||||
* defined by the {@link AsynchronousChannelGroup} class.
|
||||
*
|
||||
|
@ -182,10 +182,13 @@ public abstract class SocketChannel
|
||||
SocketChannel sc = open();
|
||||
try {
|
||||
sc.connect(remote);
|
||||
} finally {
|
||||
if (!sc.isConnected()) {
|
||||
try { sc.close(); } catch (IOException x) { }
|
||||
} catch (Throwable x) {
|
||||
try {
|
||||
sc.close();
|
||||
} catch (Throwable suppressed) {
|
||||
x.addSuppressed(suppressed);
|
||||
}
|
||||
throw x;
|
||||
}
|
||||
assert sc.isConnected();
|
||||
return sc;
|
||||
|
@ -135,11 +135,13 @@ class CopyMoveHelper {
|
||||
view.setTimes(attrs.lastModifiedTime(),
|
||||
attrs.lastAccessTime(),
|
||||
attrs.creationTime());
|
||||
} catch (IOException x) {
|
||||
} catch (Throwable x) {
|
||||
// rollback
|
||||
try {
|
||||
Files.delete(target);
|
||||
} catch (IOException ignore) { }
|
||||
} catch (Throwable suppressed) {
|
||||
x.addSuppressed(suppressed);
|
||||
}
|
||||
throw x;
|
||||
}
|
||||
}
|
||||
|
@ -129,17 +129,18 @@ public final class Files {
|
||||
* <pre>
|
||||
* Path path = ...
|
||||
*
|
||||
* // replace an existing file or create the file if it doesn't initially exist
|
||||
* // truncate and overwrite an existing file, or create the file if
|
||||
* // it doesn't initially exist
|
||||
* OutputStream out = Files.newOutputStream(path);
|
||||
*
|
||||
* // append to an existing file, fail if the file does not exist
|
||||
* out = Files.newOutputStream(path, APPEND);
|
||||
*
|
||||
* // append to an existing file, create file if it doesn't initially exist
|
||||
* out = Files.newOutputStream(CREATE, APPEND);
|
||||
* out = Files.newOutputStream(path, CREATE, APPEND);
|
||||
*
|
||||
* // always create new file, failing if it already exists
|
||||
* out = Files.newOutputStream(CREATE_NEW);
|
||||
* out = Files.newOutputStream(path, CREATE_NEW);
|
||||
* </pre>
|
||||
*
|
||||
* @param path
|
||||
@ -793,7 +794,8 @@ public final class Files {
|
||||
FileAttribute<?>... attrs)
|
||||
throws IOException
|
||||
{
|
||||
return TempFileHelper.createTempFile(dir, prefix, suffix, attrs);
|
||||
return TempFileHelper.createTempFile(Objects.requireNonNull(dir),
|
||||
prefix, suffix, attrs);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -890,13 +892,14 @@ public final class Files {
|
||||
FileAttribute<?>... attrs)
|
||||
throws IOException
|
||||
{
|
||||
return TempFileHelper.createTempDirectory(dir, prefix, attrs);
|
||||
return TempFileHelper.createTempDirectory(Objects.requireNonNull(dir),
|
||||
prefix, attrs);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new directory in the default temporary-file directory, using
|
||||
* the given prefix and suffix to generate its name. The resulting {@code
|
||||
* Path} is associated with the default {@code FileSystem}.
|
||||
* the given prefix to generate its name. The resulting {@code Path} is
|
||||
* associated with the default {@code FileSystem}.
|
||||
*
|
||||
* <p> This method works in exactly the manner specified by {@link
|
||||
* #createTempDirectory(Path,String,FileAttribute[])} method for the case
|
||||
@ -2583,7 +2586,7 @@ public final class Files {
|
||||
* walkFileTree(start, EnumSet.noneOf(FileVisitOption.class), Integer.MAX_VALUE, visitor)
|
||||
* </pre></blockquote>
|
||||
* In other words, it does not follow symbolic links, and visits all levels
|
||||
* of the file level.
|
||||
* of the file tree.
|
||||
*
|
||||
* @param start
|
||||
* the starting file
|
||||
@ -3005,7 +3008,7 @@ public final class Files {
|
||||
* or after some bytes have been written to the file.
|
||||
*
|
||||
* <p> <b>Usage example</b>: By default the method creates a new file or
|
||||
* overrides an existing file. Suppose you instead want to append bytes
|
||||
* overwrites an existing file. Suppose you instead want to append bytes
|
||||
* to an existing file:
|
||||
* <pre>
|
||||
* Path path = ...
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2011, 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
|
||||
@ -26,10 +26,7 @@
|
||||
package java.security;
|
||||
|
||||
import java.io.*;
|
||||
import java.security.cert.CRL;
|
||||
import java.security.cert.CertPath;
|
||||
import sun.misc.JavaSecurityCodeSignerAccess;
|
||||
import sun.misc.SharedSecrets;
|
||||
|
||||
/**
|
||||
* This class encapsulates information about a code signer.
|
||||
@ -167,44 +164,6 @@ public final class CodeSigner implements Serializable {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
// A private attribute attached to this CodeSigner object. Can be accessed
|
||||
// through SharedSecrets.getJavaSecurityCodeSignerAccess().[g|s]etCRLs
|
||||
//
|
||||
// Currently called in SignatureFileVerifier.getSigners
|
||||
private transient CRL[] crls;
|
||||
|
||||
/**
|
||||
* Sets the CRLs attached
|
||||
* @param crls, null to clear
|
||||
*/
|
||||
void setCRLs(CRL[] crls) {
|
||||
this.crls = crls;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the CRLs attached
|
||||
* @return the crls, initially null
|
||||
*/
|
||||
CRL[] getCRLs() {
|
||||
return crls;
|
||||
}
|
||||
|
||||
// Set up JavaSecurityCodeSignerAccess in SharedSecrets
|
||||
static {
|
||||
SharedSecrets.setJavaSecurityCodeSignerAccess(
|
||||
new JavaSecurityCodeSignerAccess() {
|
||||
@Override
|
||||
public void setCRLs(CodeSigner signer, CRL[] crls) {
|
||||
signer.setCRLs(crls);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CRL[] getCRLs(CodeSigner signer) {
|
||||
return signer.getCRLs();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Explicitly reset hash code value to -1
|
||||
private void readObject(ObjectInputStream ois)
|
||||
throws IOException, ClassNotFoundException {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2011, 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
|
||||
@ -554,7 +554,7 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
|
||||
|
||||
/**
|
||||
* Field number for <code>get</code> and <code>set</code> indicating the
|
||||
* daylight savings offset in milliseconds.
|
||||
* daylight saving offset in milliseconds.
|
||||
* <p>
|
||||
* This field reflects the correct daylight saving offset value of
|
||||
* the time zone of this <code>Calendar</code> if the
|
||||
|
@ -233,7 +233,9 @@ public final class Currency implements Serializable {
|
||||
"currency.properties");
|
||||
if (propFile.exists()) {
|
||||
Properties props = new Properties();
|
||||
props.load(new FileReader(propFile));
|
||||
try (FileReader fr = new FileReader(propFile)) {
|
||||
props.load(fr);
|
||||
}
|
||||
Set<String> keys = props.stringPropertyNames();
|
||||
Pattern propertiesPattern =
|
||||
Pattern.compile("([A-Z]{3})\\s*,\\s*(\\d{3})\\s*,\\s*([0-3])");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2011, 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
|
||||
@ -260,7 +260,7 @@ import sun.util.calendar.ZoneInfo;
|
||||
* // create a Pacific Standard Time time zone
|
||||
* SimpleTimeZone pdt = new SimpleTimeZone(-8 * 60 * 60 * 1000, ids[0]);
|
||||
*
|
||||
* // set up rules for daylight savings time
|
||||
* // set up rules for Daylight Saving Time
|
||||
* pdt.setStartRule(Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
|
||||
* pdt.setEndRule(Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
|
||||
*
|
||||
|
@ -339,8 +339,9 @@ abstract public class TimeZone implements Serializable, Cloneable {
|
||||
/**
|
||||
* Returns a name in the specified {@code style} of this {@code TimeZone}
|
||||
* suitable for presentation to the user in the default locale. If the
|
||||
* specified {@code daylight} is {@code true}, a daylight saving time name
|
||||
* is returned. Otherwise, a standard time name is returned.
|
||||
* specified {@code daylight} is {@code true}, a Daylight Saving Time name
|
||||
* is returned (even if this {@code TimeZone} doesn't observe Daylight Saving
|
||||
* Time). Otherwise, a Standard Time name is returned.
|
||||
*
|
||||
* <p>This method is equivalent to:
|
||||
* <pre><blockquote>
|
||||
@ -348,7 +349,8 @@ abstract public class TimeZone implements Serializable, Cloneable {
|
||||
* Locale.getDefault({@link Locale.Category#DISPLAY}))
|
||||
* </blockquote></pre>
|
||||
*
|
||||
* @param daylight if {@code true}, return the daylight saving time name.
|
||||
* @param daylight {@code true} specifying a Daylight Saving Time name, or
|
||||
* {@code false} specifying a Standard Time name
|
||||
* @param style either {@link #LONG} or {@link #SHORT}
|
||||
* @return the human-readable name of this time zone in the default locale.
|
||||
* @exception IllegalArgumentException if {@code style} is invalid.
|
||||
@ -356,6 +358,7 @@ abstract public class TimeZone implements Serializable, Cloneable {
|
||||
* @see #getDisplayName(boolean, int, Locale)
|
||||
* @see Locale#getDefault(Locale.Category)
|
||||
* @see Locale.Category
|
||||
* @see java.text.DateFormatSymbols#getZoneStrings()
|
||||
*/
|
||||
public final String getDisplayName(boolean daylight, int style) {
|
||||
return getDisplayName(daylight, style,
|
||||
@ -365,8 +368,9 @@ abstract public class TimeZone implements Serializable, Cloneable {
|
||||
/**
|
||||
* Returns a name in the specified {@code style} of this {@code TimeZone}
|
||||
* suitable for presentation to the user in the specified {@code
|
||||
* locale}. If the specified {@code daylight} is {@code true}, a daylight
|
||||
* saving time name is returned. Otherwise, a standard time name is
|
||||
* locale}. If the specified {@code daylight} is {@code true}, a Daylight
|
||||
* Saving Time name is returned (even if this {@code TimeZone} doesn't
|
||||
* observe Daylight Saving Time). Otherwise, a Standard Time name is
|
||||
* returned.
|
||||
*
|
||||
* <p>When looking up a time zone name, the {@linkplain
|
||||
@ -379,13 +383,15 @@ abstract public class TimeZone implements Serializable, Cloneable {
|
||||
* found, the name is returned. Otherwise, a string in the
|
||||
* <a href="#NormalizedCustomID">normalized custom ID format</a> is returned.
|
||||
*
|
||||
* @param daylight if {@code true}, return the daylight saving time name.
|
||||
* @param daylight {@code true} specifying a Daylight Saving Time name, or
|
||||
* {@code false} specifying a Standard Time name
|
||||
* @param style either {@link #LONG} or {@link #SHORT}
|
||||
* @param locale the locale in which to supply the display name.
|
||||
* @param locale the locale in which to supply the display name.
|
||||
* @return the human-readable name of this time zone in the given locale.
|
||||
* @exception IllegalArgumentException if {@code style} is invalid.
|
||||
* @exception NullPointerException if {@code locale} is {@code null}.
|
||||
* @since 1.2
|
||||
* @see java.text.DateFormatSymbols#getZoneStrings()
|
||||
*/
|
||||
public String getDisplayName(boolean daylight, int style, Locale locale) {
|
||||
if (style != SHORT && style != LONG) {
|
||||
@ -526,10 +532,10 @@ abstract public class TimeZone implements Serializable, Cloneable {
|
||||
|
||||
/**
|
||||
* Queries if the given {@code date} is in Daylight Saving Time in
|
||||
* this {@code TimeZone}.
|
||||
* this time zone.
|
||||
*
|
||||
* @param date the given {@code Date}.
|
||||
* @return {@code true} if the given {@code date} is in Daylight Saving Time,
|
||||
* @param date the given Date.
|
||||
* @return {@code true} if the given date is in Daylight Saving Time,
|
||||
* {@code false}, otherwise.
|
||||
*/
|
||||
abstract public boolean inDaylightTime(Date date);
|
||||
@ -566,7 +572,7 @@ abstract public class TimeZone implements Serializable, Cloneable {
|
||||
* @param rawOffset the given time zone GMT offset in milliseconds.
|
||||
* @return an array of IDs, where the time zone for that ID has
|
||||
* the specified GMT offset. For example, "America/Phoenix" and "America/Denver"
|
||||
* both have GMT-07:00, but differ in daylight savings behavior.
|
||||
* both have GMT-07:00, but differ in daylight saving behavior.
|
||||
* @see #getRawOffset()
|
||||
*/
|
||||
public static synchronized String[] getAvailableIDs(int rawOffset) {
|
||||
|
@ -272,13 +272,6 @@ public class ConcurrentLinkedDeque<E>
|
||||
|
||||
private static final Node<Object> PREV_TERMINATOR, NEXT_TERMINATOR;
|
||||
|
||||
static {
|
||||
PREV_TERMINATOR = new Node<Object>(null);
|
||||
PREV_TERMINATOR.next = PREV_TERMINATOR;
|
||||
NEXT_TERMINATOR = new Node<Object>(null);
|
||||
NEXT_TERMINATOR.prev = NEXT_TERMINATOR;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Node<E> prevTerminator() {
|
||||
return (Node<E>) PREV_TERMINATOR;
|
||||
@ -294,6 +287,9 @@ public class ConcurrentLinkedDeque<E>
|
||||
volatile E item;
|
||||
volatile Node<E> next;
|
||||
|
||||
Node() { // default constructor for NEXT_TERMINATOR, PREV_TERMINATOR
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new node. Uses relaxed write because item can
|
||||
* only be seen after publication via casNext or casPrev.
|
||||
@ -324,14 +320,25 @@ public class ConcurrentLinkedDeque<E>
|
||||
|
||||
// Unsafe mechanics
|
||||
|
||||
private static final sun.misc.Unsafe UNSAFE =
|
||||
sun.misc.Unsafe.getUnsafe();
|
||||
private static final long prevOffset =
|
||||
objectFieldOffset(UNSAFE, "prev", Node.class);
|
||||
private static final long itemOffset =
|
||||
objectFieldOffset(UNSAFE, "item", Node.class);
|
||||
private static final long nextOffset =
|
||||
objectFieldOffset(UNSAFE, "next", Node.class);
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
private static final long prevOffset;
|
||||
private static final long itemOffset;
|
||||
private static final long nextOffset;
|
||||
|
||||
static {
|
||||
try {
|
||||
UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
Class k = Node.class;
|
||||
prevOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("prev"));
|
||||
itemOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("item"));
|
||||
nextOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("next"));
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1422,14 +1429,6 @@ public class ConcurrentLinkedDeque<E>
|
||||
initHeadTail(h, t);
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
|
||||
private static final sun.misc.Unsafe UNSAFE =
|
||||
sun.misc.Unsafe.getUnsafe();
|
||||
private static final long headOffset =
|
||||
objectFieldOffset(UNSAFE, "head", ConcurrentLinkedDeque.class);
|
||||
private static final long tailOffset =
|
||||
objectFieldOffset(UNSAFE, "tail", ConcurrentLinkedDeque.class);
|
||||
|
||||
private boolean casHead(Node<E> cmp, Node<E> val) {
|
||||
return UNSAFE.compareAndSwapObject(this, headOffset, cmp, val);
|
||||
@ -1439,15 +1438,25 @@ public class ConcurrentLinkedDeque<E>
|
||||
return UNSAFE.compareAndSwapObject(this, tailOffset, cmp, val);
|
||||
}
|
||||
|
||||
static long objectFieldOffset(sun.misc.Unsafe UNSAFE,
|
||||
String field, Class<?> klazz) {
|
||||
// Unsafe mechanics
|
||||
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
private static final long headOffset;
|
||||
private static final long tailOffset;
|
||||
static {
|
||||
PREV_TERMINATOR = new Node<Object>();
|
||||
PREV_TERMINATOR.next = PREV_TERMINATOR;
|
||||
NEXT_TERMINATOR = new Node<Object>();
|
||||
NEXT_TERMINATOR.prev = NEXT_TERMINATOR;
|
||||
try {
|
||||
return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field));
|
||||
} catch (NoSuchFieldException e) {
|
||||
// Convert Exception to corresponding Error
|
||||
NoSuchFieldError error = new NoSuchFieldError(field);
|
||||
error.initCause(e);
|
||||
throw error;
|
||||
UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
Class k = ConcurrentLinkedDeque.class;
|
||||
headOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("head"));
|
||||
tailOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("tail"));
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -194,12 +194,22 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
|
||||
|
||||
// Unsafe mechanics
|
||||
|
||||
private static final sun.misc.Unsafe UNSAFE =
|
||||
sun.misc.Unsafe.getUnsafe();
|
||||
private static final long nextOffset =
|
||||
objectFieldOffset(UNSAFE, "next", Node.class);
|
||||
private static final long itemOffset =
|
||||
objectFieldOffset(UNSAFE, "item", Node.class);
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
private static final long itemOffset;
|
||||
private static final long nextOffset;
|
||||
|
||||
static {
|
||||
try {
|
||||
UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
Class k = Node.class;
|
||||
itemOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("item"));
|
||||
nextOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("next"));
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -790,14 +800,6 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
|
||||
private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
private static final long headOffset =
|
||||
objectFieldOffset(UNSAFE, "head", ConcurrentLinkedQueue.class);
|
||||
private static final long tailOffset =
|
||||
objectFieldOffset(UNSAFE, "tail", ConcurrentLinkedQueue.class);
|
||||
|
||||
private boolean casTail(Node<E> cmp, Node<E> val) {
|
||||
return UNSAFE.compareAndSwapObject(this, tailOffset, cmp, val);
|
||||
}
|
||||
@ -806,15 +808,21 @@ public class ConcurrentLinkedQueue<E> extends AbstractQueue<E>
|
||||
return UNSAFE.compareAndSwapObject(this, headOffset, cmp, val);
|
||||
}
|
||||
|
||||
static long objectFieldOffset(sun.misc.Unsafe UNSAFE,
|
||||
String field, Class<?> klazz) {
|
||||
// Unsafe mechanics
|
||||
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
private static final long headOffset;
|
||||
private static final long tailOffset;
|
||||
static {
|
||||
try {
|
||||
return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field));
|
||||
} catch (NoSuchFieldException e) {
|
||||
// Convert Exception to corresponding Error
|
||||
NoSuchFieldError error = new NoSuchFieldError(field);
|
||||
error.initCause(e);
|
||||
throw error;
|
||||
UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
Class k = ConcurrentLinkedQueue.class;
|
||||
headOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("head"));
|
||||
tailOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("tail"));
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -507,13 +507,24 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
|
||||
return new AbstractMap.SimpleImmutableEntry<K,V>(key, v);
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
private static final long valueOffset =
|
||||
objectFieldOffset(UNSAFE, "value", Node.class);
|
||||
private static final long nextOffset =
|
||||
objectFieldOffset(UNSAFE, "next", Node.class);
|
||||
// UNSAFE mechanics
|
||||
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
private static final long valueOffset;
|
||||
private static final long nextOffset;
|
||||
|
||||
static {
|
||||
try {
|
||||
UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
Class k = Node.class;
|
||||
valueOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("value"));
|
||||
nextOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("next"));
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------- Indexing -------------- */
|
||||
@ -580,10 +591,18 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
private static final long rightOffset =
|
||||
objectFieldOffset(UNSAFE, "right", Index.class);
|
||||
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
private static final long rightOffset;
|
||||
static {
|
||||
try {
|
||||
UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
Class k = Index.class;
|
||||
rightOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("right"));
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------- Head nodes -------------- */
|
||||
@ -3082,20 +3101,16 @@ public class ConcurrentSkipListMap<K,V> extends AbstractMap<K,V>
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
private static final long headOffset =
|
||||
objectFieldOffset(UNSAFE, "head", ConcurrentSkipListMap.class);
|
||||
|
||||
static long objectFieldOffset(sun.misc.Unsafe UNSAFE,
|
||||
String field, Class<?> klazz) {
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
private static final long headOffset;
|
||||
static {
|
||||
try {
|
||||
return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field));
|
||||
} catch (NoSuchFieldException e) {
|
||||
// Convert Exception to corresponding Error
|
||||
NoSuchFieldError error = new NoSuchFieldError(field);
|
||||
error.initCause(e);
|
||||
throw error;
|
||||
UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
Class k = ConcurrentSkipListMap.class;
|
||||
headOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("head"));
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -470,16 +470,20 @@ public class ConcurrentSkipListSet<E>
|
||||
}
|
||||
|
||||
// Support for resetting map in clone
|
||||
private static final Unsafe unsafe = Unsafe.getUnsafe();
|
||||
private void setMap(ConcurrentNavigableMap<E,Object> map) {
|
||||
UNSAFE.putObjectVolatile(this, mapOffset, map);
|
||||
}
|
||||
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
private static final long mapOffset;
|
||||
static {
|
||||
try {
|
||||
mapOffset = unsafe.objectFieldOffset
|
||||
(ConcurrentSkipListSet.class.getDeclaredField("m"));
|
||||
} catch (Exception ex) { throw new Error(ex); }
|
||||
UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
Class k = ConcurrentSkipListSet.class;
|
||||
mapOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("m"));
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
private void setMap(ConcurrentNavigableMap<E,Object> map) {
|
||||
unsafe.putObjectVolatile(this, mapOffset, map);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1318,16 +1318,19 @@ public class CopyOnWriteArrayList<E>
|
||||
}
|
||||
|
||||
// Support for resetting lock while deserializing
|
||||
private static final Unsafe unsafe = Unsafe.getUnsafe();
|
||||
private void resetLock() {
|
||||
UNSAFE.putObjectVolatile(this, lockOffset, new ReentrantLock());
|
||||
}
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
private static final long lockOffset;
|
||||
static {
|
||||
try {
|
||||
lockOffset = unsafe.objectFieldOffset
|
||||
(CopyOnWriteArrayList.class.getDeclaredField("lock"));
|
||||
} catch (Exception ex) { throw new Error(ex); }
|
||||
UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
Class k = CopyOnWriteArrayList.class;
|
||||
lockOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("lock"));
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
private void resetLock() {
|
||||
unsafe.putObjectVolatile(this, lockOffset, new ReentrantLock());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -525,16 +525,27 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
|
||||
return false;
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
private static final long nextOffset =
|
||||
objectFieldOffset(UNSAFE, "next", Node.class);
|
||||
private static final long itemOffset =
|
||||
objectFieldOffset(UNSAFE, "item", Node.class);
|
||||
private static final long waiterOffset =
|
||||
objectFieldOffset(UNSAFE, "waiter", Node.class);
|
||||
|
||||
private static final long serialVersionUID = -3375979862319811754L;
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
private static final long itemOffset;
|
||||
private static final long nextOffset;
|
||||
private static final long waiterOffset;
|
||||
static {
|
||||
try {
|
||||
UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
Class k = Node.class;
|
||||
itemOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("item"));
|
||||
nextOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("next"));
|
||||
waiterOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("waiter"));
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** head of the queue; null until first enqueue */
|
||||
@ -1312,23 +1323,22 @@ public class LinkedTransferQueue<E> extends AbstractQueue<E>
|
||||
|
||||
// Unsafe mechanics
|
||||
|
||||
private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
private static final long headOffset =
|
||||
objectFieldOffset(UNSAFE, "head", LinkedTransferQueue.class);
|
||||
private static final long tailOffset =
|
||||
objectFieldOffset(UNSAFE, "tail", LinkedTransferQueue.class);
|
||||
private static final long sweepVotesOffset =
|
||||
objectFieldOffset(UNSAFE, "sweepVotes", LinkedTransferQueue.class);
|
||||
|
||||
static long objectFieldOffset(sun.misc.Unsafe UNSAFE,
|
||||
String field, Class<?> klazz) {
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
private static final long headOffset;
|
||||
private static final long tailOffset;
|
||||
private static final long sweepVotesOffset;
|
||||
static {
|
||||
try {
|
||||
return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field));
|
||||
} catch (NoSuchFieldException e) {
|
||||
// Convert Exception to corresponding Error
|
||||
NoSuchFieldError error = new NoSuchFieldError(field);
|
||||
error.initCause(e);
|
||||
throw error;
|
||||
UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
Class k = LinkedTransferQueue.class;
|
||||
headOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("head"));
|
||||
tailOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("tail"));
|
||||
sweepVotesOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("sweepVotes"));
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1137,18 +1137,16 @@ public class Phaser {
|
||||
|
||||
// Unsafe mechanics
|
||||
|
||||
private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
private static final long stateOffset =
|
||||
objectFieldOffset("state", Phaser.class);
|
||||
|
||||
private static long objectFieldOffset(String field, Class<?> klazz) {
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
private static final long stateOffset;
|
||||
static {
|
||||
try {
|
||||
return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field));
|
||||
} catch (NoSuchFieldException e) {
|
||||
// Convert Exception to corresponding Error
|
||||
NoSuchFieldError error = new NoSuchFieldError(field);
|
||||
error.initCause(e);
|
||||
throw error;
|
||||
UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
Class k = Phaser.class;
|
||||
stateOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("state"));
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -963,21 +963,16 @@ public class PriorityBlockingQueue<E> extends AbstractQueue<E>
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
private static final long allocationSpinLockOffset =
|
||||
objectFieldOffset(UNSAFE, "allocationSpinLock",
|
||||
PriorityBlockingQueue.class);
|
||||
|
||||
static long objectFieldOffset(sun.misc.Unsafe UNSAFE,
|
||||
String field, Class<?> klazz) {
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
private static final long allocationSpinLockOffset;
|
||||
static {
|
||||
try {
|
||||
return UNSAFE.objectFieldOffset(klazz.getDeclaredField(field));
|
||||
} catch (NoSuchFieldException e) {
|
||||
// Convert Exception to corresponding Error
|
||||
NoSuchFieldError error = new NoSuchFieldError(field);
|
||||
error.initCause(e);
|
||||
throw error;
|
||||
UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
Class k = PriorityBlockingQueue.class;
|
||||
allocationSpinLockOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("allocationSpinLock"));
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -279,12 +279,22 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
private static final long nextOffset =
|
||||
objectFieldOffset(UNSAFE, "next", SNode.class);
|
||||
private static final long matchOffset =
|
||||
objectFieldOffset(UNSAFE, "match", SNode.class);
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
private static final long matchOffset;
|
||||
private static final long nextOffset;
|
||||
|
||||
static {
|
||||
try {
|
||||
UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
Class k = SNode.class;
|
||||
matchOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("match"));
|
||||
nextOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("next"));
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** The head (top) of the stack */
|
||||
@ -498,10 +508,18 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
private static final long headOffset =
|
||||
objectFieldOffset(UNSAFE, "head", TransferStack.class);
|
||||
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
private static final long headOffset;
|
||||
static {
|
||||
try {
|
||||
UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
Class k = TransferStack.class;
|
||||
headOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("head"));
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Dual Queue */
|
||||
@ -558,11 +576,22 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
|
||||
}
|
||||
|
||||
// Unsafe mechanics
|
||||
private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
private static final long nextOffset =
|
||||
objectFieldOffset(UNSAFE, "next", QNode.class);
|
||||
private static final long itemOffset =
|
||||
objectFieldOffset(UNSAFE, "item", QNode.class);
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
private static final long itemOffset;
|
||||
private static final long nextOffset;
|
||||
|
||||
static {
|
||||
try {
|
||||
UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
Class k = QNode.class;
|
||||
itemOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("item"));
|
||||
nextOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("next"));
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Head of queue */
|
||||
@ -791,15 +820,24 @@ public class SynchronousQueue<E> extends AbstractQueue<E>
|
||||
}
|
||||
}
|
||||
|
||||
// unsafe mechanics
|
||||
private static final sun.misc.Unsafe UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
private static final long headOffset =
|
||||
objectFieldOffset(UNSAFE, "head", TransferQueue.class);
|
||||
private static final long tailOffset =
|
||||
objectFieldOffset(UNSAFE, "tail", TransferQueue.class);
|
||||
private static final long cleanMeOffset =
|
||||
objectFieldOffset(UNSAFE, "cleanMe", TransferQueue.class);
|
||||
|
||||
private static final sun.misc.Unsafe UNSAFE;
|
||||
private static final long headOffset;
|
||||
private static final long tailOffset;
|
||||
private static final long cleanMeOffset;
|
||||
static {
|
||||
try {
|
||||
UNSAFE = sun.misc.Unsafe.getUnsafe();
|
||||
Class k = TransferQueue.class;
|
||||
headOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("head"));
|
||||
tailOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("tail"));
|
||||
cleanMeOffset = UNSAFE.objectFieldOffset
|
||||
(k.getDeclaredField("cleanMe"));
|
||||
} catch (Exception e) {
|
||||
throw new Error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -376,9 +376,9 @@ class JarFile extends ZipFile {
|
||||
*/
|
||||
private byte[] getBytes(ZipEntry ze) throws IOException {
|
||||
byte[] b = new byte[(int)ze.getSize()];
|
||||
DataInputStream is = new DataInputStream(super.getInputStream(ze));
|
||||
is.readFully(b, 0, b.length);
|
||||
is.close();
|
||||
try (DataInputStream is = new DataInputStream(super.getInputStream(ze))) {
|
||||
is.readFully(b, 0, b.length);
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
@ -480,10 +480,10 @@ class JarFile extends ZipFile {
|
||||
JarEntry manEntry = getManEntry();
|
||||
if (manEntry != null) {
|
||||
byte[] b = new byte[(int)manEntry.getSize()];
|
||||
DataInputStream dis = new DataInputStream(
|
||||
super.getInputStream(manEntry));
|
||||
dis.readFully(b, 0, b.length);
|
||||
dis.close();
|
||||
try (DataInputStream dis = new DataInputStream(
|
||||
super.getInputStream(manEntry))) {
|
||||
dis.readFully(b, 0, b.length);
|
||||
}
|
||||
|
||||
int last = b.length - src.length;
|
||||
int i = 0;
|
||||
|
@ -26,7 +26,6 @@
|
||||
package java.util.zip;
|
||||
|
||||
import java.util.Date;
|
||||
import sun.misc.BootClassLoaderHook;
|
||||
|
||||
/**
|
||||
* This class is used to represent a ZIP file entry.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, 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
|
||||
@ -61,7 +61,6 @@ import sun.security.jca.GetInstance.Instance;
|
||||
* <p> Every implementation of the Java platform is required to support the
|
||||
* following standard <code>SecretKeyFactory</code> algorithms:
|
||||
* <ul>
|
||||
* <li><tt>AES</tt></li>
|
||||
* <li><tt>DES</tt></li>
|
||||
* <li><tt>DESede</tt></li>
|
||||
* </ul>
|
||||
|
@ -441,13 +441,6 @@ public class MidiSystem {
|
||||
Synthesizer synth = getSynthesizer();
|
||||
if (synth instanceof ReferenceCountingDevice) {
|
||||
rec = ((ReferenceCountingDevice) synth).getReceiverReferenceCounting();
|
||||
// only use MixerSynth if it could successfully load a soundbank
|
||||
if (synth.getClass().toString().contains("com.sun.media.sound.MixerSynth")
|
||||
&& (synth.getDefaultSoundbank() == null)) {
|
||||
// don't use this receiver if no soundbank available
|
||||
rec = null;
|
||||
synth.close();
|
||||
}
|
||||
} else {
|
||||
synth.open();
|
||||
try {
|
||||
|
@ -174,6 +174,8 @@ public class DefaultDesktopManager implements DesktopManager, java.io.Serializab
|
||||
if(!wasIcon(f)) {
|
||||
Rectangle r = getBoundsForIconOf(f);
|
||||
desktopIcon.setBounds(r.x, r.y, r.width, r.height);
|
||||
// we must validate the hierarchy to not break the hw/lw mixing
|
||||
desktopIcon.revalidate();
|
||||
setWasIcon(f, Boolean.TRUE);
|
||||
}
|
||||
|
||||
@ -453,11 +455,9 @@ public class DefaultDesktopManager implements DesktopManager, java.io.Serializab
|
||||
|
||||
/** This moves the <code>JComponent</code> and repaints the damaged areas. */
|
||||
public void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight) {
|
||||
boolean didResize = (f.getWidth() != newWidth || f.getHeight() != newHeight);
|
||||
f.setBounds(newX, newY, newWidth, newHeight);
|
||||
if(didResize) {
|
||||
f.validate();
|
||||
}
|
||||
// we must validate the hierarchy to not break the hw/lw mixing
|
||||
f.revalidate();
|
||||
}
|
||||
|
||||
/** Convenience method to remove the desktopIcon of <b>f</b> is necessary. */
|
||||
|
@ -5158,31 +5158,30 @@ public abstract class JComponent extends Container implements Serializable,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
g = safelyGetGraphics(paintingComponent, c);
|
||||
try {
|
||||
if (hasBuffer) {
|
||||
RepaintManager rm = RepaintManager.currentManager(
|
||||
bufferedComponent);
|
||||
rm.beginPaint();
|
||||
try {
|
||||
rm.paint(paintingComponent, bufferedComponent, g,
|
||||
paintImmediatelyClip.x,
|
||||
paintImmediatelyClip.y,
|
||||
paintImmediatelyClip.width,
|
||||
paintImmediatelyClip.height);
|
||||
} finally {
|
||||
rm.endPaint();
|
||||
if ((g = safelyGetGraphics(paintingComponent, c)) != null) {
|
||||
try {
|
||||
if (hasBuffer) {
|
||||
RepaintManager rm = RepaintManager.currentManager(
|
||||
bufferedComponent);
|
||||
rm.beginPaint();
|
||||
try {
|
||||
rm.paint(paintingComponent, bufferedComponent, g,
|
||||
paintImmediatelyClip.x,
|
||||
paintImmediatelyClip.y,
|
||||
paintImmediatelyClip.width,
|
||||
paintImmediatelyClip.height);
|
||||
} finally {
|
||||
rm.endPaint();
|
||||
}
|
||||
} else {
|
||||
g.setClip(paintImmediatelyClip.x, paintImmediatelyClip.y,
|
||||
paintImmediatelyClip.width, paintImmediatelyClip.height);
|
||||
paintingComponent.paint(g);
|
||||
}
|
||||
} finally {
|
||||
g.dispose();
|
||||
}
|
||||
else {
|
||||
g.setClip(paintImmediatelyClip.x,paintImmediatelyClip.y,
|
||||
paintImmediatelyClip.width,paintImmediatelyClip.height);
|
||||
paintingComponent.paint(g);
|
||||
}
|
||||
} finally {
|
||||
g.dispose();
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
@ -1111,6 +1111,8 @@ public class JViewport extends JComponent implements Accessible
|
||||
view.setLocation(newX, newY);
|
||||
repaintAll = false;
|
||||
}
|
||||
// we must validate the hierarchy to not break the hw/lw mixing
|
||||
revalidate();
|
||||
fireStateChanged();
|
||||
}
|
||||
}
|
||||
|
@ -390,11 +390,15 @@ public class Utilities {
|
||||
}
|
||||
if ((x >= currX) && (x < nextX)) {
|
||||
// found the hit position... return the appropriate side
|
||||
if ((round == false) || ((x - currX) < (nextX - x))) {
|
||||
return i - txtOffset;
|
||||
} else {
|
||||
return i + 1 - txtOffset;
|
||||
int offset = ((round == false) || ((x - currX) < (nextX - x))) ?
|
||||
(i - txtOffset) : (i + 1 - txtOffset);
|
||||
// the length of the string measured as a whole may differ from
|
||||
// the sum of individual character lengths, for example if
|
||||
// fractional metrics are enabled; and we must guard from this.
|
||||
while (metrics.charsWidth(txt, txtOffset, offset + 1) > (x - x0)) {
|
||||
offset--;
|
||||
}
|
||||
return (offset < 0 ? 0 : offset);
|
||||
}
|
||||
currX = nextX;
|
||||
}
|
||||
@ -403,24 +407,6 @@ public class Utilities {
|
||||
return txtCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust text offset so that the length of a resulting string as a whole
|
||||
* fits into the specified width.
|
||||
*/
|
||||
static int adjustOffsetForFractionalMetrics(
|
||||
Segment s, FontMetrics fm, int offset, int width) {
|
||||
// Sometimes the offset returned by getTabbedTextOffset is beyond the
|
||||
// available area, when fractional metrics are enabled. We should
|
||||
// guard against this.
|
||||
if (offset < s.count) {
|
||||
while (offset > 0 &&
|
||||
fm.charsWidth(s.array, s.offset, offset + 1) > width) {
|
||||
offset--;
|
||||
}
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine where to break the given text to fit
|
||||
* within the given span. This tries to find a word boundary.
|
||||
@ -443,7 +429,6 @@ public class Utilities {
|
||||
int txtCount = s.count;
|
||||
int index = Utilities.getTabbedTextOffset(s, metrics, x0, x,
|
||||
e, startOffset, false);
|
||||
index = adjustOffsetForFractionalMetrics(s, metrics, index, x - x0);
|
||||
|
||||
if (index >= txtCount - 1) {
|
||||
return txtCount;
|
||||
|
@ -239,11 +239,9 @@ public class WrappedPlainView extends BoxView implements TabExpander {
|
||||
tabBase, tabBase + currentWidth,
|
||||
this, p0);
|
||||
} else {
|
||||
int offset = Utilities.getTabbedTextOffset(segment, metrics,
|
||||
tabBase, tabBase + currentWidth, this, p0, false);
|
||||
offset = Utilities.adjustOffsetForFractionalMetrics(
|
||||
segment, metrics, offset, currentWidth);
|
||||
p = p0 + offset;
|
||||
p = p0 + Utilities.getTabbedTextOffset(segment, metrics,
|
||||
tabBase, tabBase + currentWidth,
|
||||
this, p0, false);
|
||||
}
|
||||
SegmentCache.releaseSharedSegment(segment);
|
||||
return p;
|
||||
|
@ -203,10 +203,11 @@ class CSSBorder extends AbstractBorder {
|
||||
|
||||
public void paintBorder(Component c, Graphics g,
|
||||
int x, int y, int width, int height) {
|
||||
assert (g instanceof Graphics2D) : "need Graphics2D instanse";
|
||||
Graphics2D g2 = (Graphics2D) g;
|
||||
Color savedColor = g2.getColor();
|
||||
Shape savedClip = g2.getClip();
|
||||
if (!(g instanceof Graphics2D)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Graphics2D g2 = (Graphics2D) g.create();
|
||||
|
||||
int[] widths = getWidths();
|
||||
|
||||
@ -238,16 +239,16 @@ class CSSBorder extends AbstractBorder {
|
||||
BorderPainter painter = getBorderPainter(i);
|
||||
|
||||
double angle = i * Math.PI / 2;
|
||||
g2.setClip(g.getClip()); // Restore initial clip
|
||||
g2.translate(intCorners[i][0], intCorners[i][1]);
|
||||
g2.rotate(angle);
|
||||
g2.setClip(shape);
|
||||
painter.paint(shape, g, color, i);
|
||||
g2.clip(shape);
|
||||
painter.paint(shape, g2, color, i);
|
||||
g2.rotate(-angle);
|
||||
g2.translate(-intCorners[i][0], -intCorners[i][1]);
|
||||
}
|
||||
}
|
||||
g2.setColor(savedColor);
|
||||
g2.setClip(savedClip);
|
||||
g2.dispose();
|
||||
}
|
||||
|
||||
|
||||
|
@ -319,8 +319,7 @@ public final class StrikeCache {
|
||||
ArrayList<Long> gids = null;
|
||||
|
||||
for (int i = 0; i < glyphPtrs.length; i++) {
|
||||
if (glyphPtrs[i] != 0 && unsafe.getByte(glyphPtrs[i] + managedOffset) == 0
|
||||
&& unsafe.getInt(glyphPtrs[i] + cacheCellOffset) != 0) {
|
||||
if (glyphPtrs[i] != 0 && unsafe.getByte(glyphPtrs[i] + managedOffset) == 0) {
|
||||
|
||||
if (gids == null) {
|
||||
gids = new ArrayList<Long>();
|
||||
@ -330,6 +329,8 @@ public final class StrikeCache {
|
||||
}
|
||||
|
||||
if (gids != null) {
|
||||
// Any reference by the disposers to the native glyph ptrs
|
||||
// must be done before this returns.
|
||||
notifyDisposeListeners(gids);
|
||||
}
|
||||
}
|
||||
@ -345,8 +346,7 @@ public final class StrikeCache {
|
||||
|
||||
for (int i=0; i < glyphPtrs.length; i++) {
|
||||
if (glyphPtrs[i] != 0
|
||||
&& unsafe.getByte(glyphPtrs[i] + managedOffset) == 0
|
||||
&& unsafe.getInt(glyphPtrs[i] + cacheCellOffset) != 0) {
|
||||
&& unsafe.getByte(glyphPtrs[i] + managedOffset) == 0) {
|
||||
|
||||
if (gids == null) {
|
||||
gids = new ArrayList<Long>();
|
||||
@ -356,6 +356,8 @@ public final class StrikeCache {
|
||||
}
|
||||
|
||||
if (gids != null) {
|
||||
// Any reference by the disposers to the native glyph ptrs
|
||||
// must be done before this returns.
|
||||
notifyDisposeListeners(gids);
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ public class AAShapePipe
|
||||
Region clip = sg.getCompClip();
|
||||
int abox[] = new int[4];
|
||||
AATileGenerator aatg =
|
||||
renderengine.getAATileGenerator(x, y, dx1, dy1, dx2, dy2, 0, 0,
|
||||
renderengine.getAATileGenerator(x, y, dx1, dy1, dx2, dy2, lw1, lw2,
|
||||
clip, abox);
|
||||
if (aatg == null) {
|
||||
// Nothing to render
|
||||
|
@ -1,141 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, 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.
|
||||
*/
|
||||
|
||||
package sun.misc;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URLStreamHandlerFactory;
|
||||
import sun.misc.URLClassPath;
|
||||
|
||||
/**
|
||||
* BootClassLoaderHook defines an interface for a hook to inject
|
||||
* into the bootstrap class loader.
|
||||
*
|
||||
* With jkernel now removed, no hook is set
|
||||
*/
|
||||
public abstract class BootClassLoaderHook {
|
||||
private static BootClassLoaderHook bootLoaderHook = null;
|
||||
public static synchronized BootClassLoaderHook getHook() {
|
||||
return bootLoaderHook;
|
||||
}
|
||||
|
||||
public static synchronized void setHook(BootClassLoaderHook hook) {
|
||||
if (!VM.isBooted()) {
|
||||
throw new InternalError("hook can only be set after VM is booted");
|
||||
}
|
||||
if (bootLoaderHook != null) {
|
||||
throw new InternalError("hook should not be reinitialized");
|
||||
}
|
||||
bootLoaderHook = hook;
|
||||
}
|
||||
|
||||
protected BootClassLoaderHook() {
|
||||
}
|
||||
|
||||
/**
|
||||
* A method to be invoked before a class loader loads
|
||||
* a bootstrap class.
|
||||
*
|
||||
* @param classname the binary name of the class
|
||||
*/
|
||||
public static void preLoadClass(String classname) {
|
||||
BootClassLoaderHook hook = getHook();
|
||||
if (hook != null) {
|
||||
hook.loadBootstrapClass(classname);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A method to be invoked before a class loader loads
|
||||
* a resource.
|
||||
*
|
||||
* @param resourcename the resource name
|
||||
*/
|
||||
public static void preLoadResource(String resourcename) {
|
||||
BootClassLoaderHook hook = getHook();
|
||||
if (hook != null) {
|
||||
hook.getBootstrapResource(resourcename);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A method to be invoked before a library is loaded.
|
||||
*
|
||||
* @param libname the name of the library
|
||||
*/
|
||||
public static void preLoadLibrary(String libname) {
|
||||
BootClassLoaderHook hook = getHook();
|
||||
if (hook != null) {
|
||||
hook.loadLibrary(libname);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a pathname of a JAR or class that the hook loads
|
||||
* per this loadClass request; or null.
|
||||
*
|
||||
* @param classname the binary name of the class
|
||||
*/
|
||||
public abstract String loadBootstrapClass(String className);
|
||||
|
||||
/**
|
||||
* Returns a pathname of a resource file that the hook loads
|
||||
* per this getResource request; or null.
|
||||
*
|
||||
* @param resourceName the resource name
|
||||
*/
|
||||
public abstract String getBootstrapResource(String resourceName);
|
||||
|
||||
/**
|
||||
* Returns true if the hook successfully performs an operation per
|
||||
* this loadLibrary request; or false if it fails.
|
||||
*
|
||||
* @param libname the name of the library
|
||||
*/
|
||||
public abstract boolean loadLibrary(String libname);
|
||||
|
||||
/**
|
||||
* Returns a bootstrap class path constructed by the hook.
|
||||
*
|
||||
* @param bcp VM's bootstrap class path
|
||||
* @param factory Launcher's URL stream handler
|
||||
*/
|
||||
public abstract URLClassPath getBootstrapClassPath(URLClassPath bcp,
|
||||
URLStreamHandlerFactory factory);
|
||||
|
||||
/**
|
||||
* Returns true if the current thread is in the process of doing
|
||||
* a prefetching operation.
|
||||
*/
|
||||
public abstract boolean isCurrentThreadPrefetching();
|
||||
|
||||
/**
|
||||
* Returns true if the hook successfully prefetches the specified file.
|
||||
*
|
||||
* @param name a platform independent pathname
|
||||
*/
|
||||
public abstract boolean prefetchFile(String name);
|
||||
}
|
@ -38,7 +38,6 @@ import java.util.StringTokenizer;
|
||||
import java.util.Set;
|
||||
import java.util.Vector;
|
||||
import java.security.AccessController;
|
||||
import java.security.AllPermission;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.security.AccessControlContext;
|
||||
@ -117,18 +116,6 @@ public class Launcher {
|
||||
return loader;
|
||||
}
|
||||
|
||||
public static void addURLToAppClassLoader(URL u) {
|
||||
AccessController.checkPermission(new AllPermission());
|
||||
ClassLoader loader = Launcher.getLauncher().getClassLoader();
|
||||
((Launcher.AppClassLoader) loader).addAppURL(u);
|
||||
}
|
||||
|
||||
public static void addURLToExtClassLoader(URL u) {
|
||||
AccessController.checkPermission(new AllPermission());
|
||||
ClassLoader loader = Launcher.getLauncher().getClassLoader();
|
||||
((Launcher.ExtClassLoader) loader.getParent()).addExtURL(u);
|
||||
}
|
||||
|
||||
/*
|
||||
* The class loader used for loading installed extensions.
|
||||
*/
|
||||
@ -247,11 +234,6 @@ public class Launcher {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected Class findClass(String name) throws ClassNotFoundException {
|
||||
BootClassLoaderHook.preLoadClass(name);
|
||||
return super.findClass(name);
|
||||
}
|
||||
|
||||
private static AccessControlContext getContext(File[] dirs)
|
||||
throws IOException
|
||||
{
|
||||
@ -316,7 +298,6 @@ public class Launcher {
|
||||
public Class loadClass(String name, boolean resolve)
|
||||
throws ClassNotFoundException
|
||||
{
|
||||
BootClassLoaderHook.preLoadClass(name);
|
||||
int i = name.lastIndexOf('.');
|
||||
if (i != -1) {
|
||||
SecurityManager sm = System.getSecurityManager();
|
||||
@ -373,10 +354,6 @@ public class Launcher {
|
||||
|
||||
return acc;
|
||||
}
|
||||
|
||||
void addAppURL(URL url) {
|
||||
super.addURL(url);
|
||||
}
|
||||
}
|
||||
|
||||
private static class BootClassPathHolder {
|
||||
@ -413,11 +390,7 @@ public class Launcher {
|
||||
}
|
||||
|
||||
public static URLClassPath getBootstrapClassPath() {
|
||||
URLClassPath bcp = BootClassPathHolder.bcp;
|
||||
// if DownloadManager is installed, return the bootstrap class path
|
||||
// maintained by the Java kernel
|
||||
BootClassLoaderHook hook = BootClassLoaderHook.getHook();
|
||||
return hook == null ? bcp : hook.getBootstrapClassPath(bcp, factory);
|
||||
return BootClassPathHolder.bcp;
|
||||
}
|
||||
|
||||
private static URL[] pathToURLs(File[] path) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2002, 2011, 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
|
||||
@ -28,7 +28,6 @@ package sun.misc;
|
||||
import java.util.jar.JarFile;
|
||||
import java.io.Console;
|
||||
import java.io.FileDescriptor;
|
||||
import java.security.CodeSigner;
|
||||
import java.security.ProtectionDomain;
|
||||
|
||||
/** A repository of "shared secrets", which are a mechanism for
|
||||
@ -49,7 +48,6 @@ public class SharedSecrets {
|
||||
private static JavaNioAccess javaNioAccess;
|
||||
private static JavaIOFileDescriptorAccess javaIOFileDescriptorAccess;
|
||||
private static JavaSecurityProtectionDomainAccess javaSecurityProtectionDomainAccess;
|
||||
private static JavaSecurityCodeSignerAccess javaSecurityCodeSignerAccess;
|
||||
|
||||
public static JavaUtilJarAccess javaUtilJarAccess() {
|
||||
if (javaUtilJarAccess == null) {
|
||||
@ -127,16 +125,4 @@ public class SharedSecrets {
|
||||
unsafe.ensureClassInitialized(ProtectionDomain.class);
|
||||
return javaSecurityProtectionDomainAccess;
|
||||
}
|
||||
|
||||
public static void setJavaSecurityCodeSignerAccess
|
||||
(JavaSecurityCodeSignerAccess jscsa) {
|
||||
javaSecurityCodeSignerAccess = jscsa;
|
||||
}
|
||||
|
||||
public static JavaSecurityCodeSignerAccess
|
||||
getJavaSecurityCodeSignerAccess() {
|
||||
if (javaSecurityCodeSignerAccess == null)
|
||||
unsafe.ensureClassInitialized(CodeSigner.class);
|
||||
return javaSecurityCodeSignerAccess;
|
||||
}
|
||||
}
|
||||
|
@ -69,32 +69,33 @@ class ChunkedInputStream extends LeftOverInputStream {
|
||||
*/
|
||||
private int readChunkHeader () throws IOException {
|
||||
boolean gotCR = false;
|
||||
char c;
|
||||
int c;
|
||||
char[] len_arr = new char [16];
|
||||
int len_size = 0;
|
||||
boolean end_of_len = false;
|
||||
|
||||
while ((c=(char)in.read())!= -1) {
|
||||
while ((c=in.read())!= -1) {
|
||||
char ch = (char) c;
|
||||
if (len_size == len_arr.length -1) {
|
||||
throw new IOException ("invalid chunk header");
|
||||
}
|
||||
if (gotCR) {
|
||||
if (c == LF) {
|
||||
if (ch == LF) {
|
||||
int l = numeric (len_arr, len_size);
|
||||
return l;
|
||||
} else {
|
||||
gotCR = false;
|
||||
}
|
||||
if (!end_of_len) {
|
||||
len_arr[len_size++] = c;
|
||||
len_arr[len_size++] = ch;
|
||||
}
|
||||
} else {
|
||||
if (c == CR) {
|
||||
if (ch == CR) {
|
||||
gotCR = true;
|
||||
} else if (c == ';') {
|
||||
} else if (ch == ';') {
|
||||
end_of_len = true;
|
||||
} else if (!end_of_len) {
|
||||
len_arr[len_size++] = c;
|
||||
len_arr[len_size++] = ch;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -475,8 +475,8 @@ public class FileChannelImpl
|
||||
assert !target.isOpen();
|
||||
try {
|
||||
close();
|
||||
} catch (IOException ignore) {
|
||||
// nothing we can do
|
||||
} catch (Throwable suppressed) {
|
||||
e.addSuppressed(suppressed);
|
||||
}
|
||||
throw e;
|
||||
} catch (IOException ioe) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2011, 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
|
||||
@ -42,14 +42,12 @@ import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
|
||||
* Cipher implementation class. This class currently supports
|
||||
* DES, DESede, AES, ARCFOUR, and Blowfish.
|
||||
*
|
||||
* This class is designed to support ECB and CBC with NoPadding and
|
||||
* PKCS5Padding for both. It will use its own padding impl if the
|
||||
* native mechanism does not support padding.
|
||||
* This class is designed to support ECB, CBC, CTR with NoPadding
|
||||
* and ECB, CBC with PKCS5Padding. It will use its own padding impl
|
||||
* if the native mechanism does not support padding.
|
||||
*
|
||||
* Note that PKCS#11 current only supports ECB and CBC. There are no
|
||||
* provisions for other modes such as CFB, OFB, PCBC, or CTR mode.
|
||||
* However, CTR could be implemented relatively easily (and efficiently)
|
||||
* on top of ECB mode in this class, if need be.
|
||||
* Note that PKCS#11 currently only supports ECB, CBC, and CTR.
|
||||
* There are no provisions for other modes such as CFB, OFB, and PCBC.
|
||||
*
|
||||
* @author Andreas Sterbenz
|
||||
* @since 1.5
|
||||
@ -60,6 +58,8 @@ final class P11Cipher extends CipherSpi {
|
||||
private final static int MODE_ECB = 3;
|
||||
// mode constant for CBC mode
|
||||
private final static int MODE_CBC = 4;
|
||||
// mode constant for CTR mode
|
||||
private final static int MODE_CTR = 5;
|
||||
|
||||
// padding constant for NoPadding
|
||||
private final static int PAD_NONE = 5;
|
||||
@ -157,7 +157,7 @@ final class P11Cipher extends CipherSpi {
|
||||
private byte[] padBuffer;
|
||||
private int padBufferLen;
|
||||
|
||||
// original IV, if in MODE_CBC
|
||||
// original IV, if in MODE_CBC or MODE_CTR
|
||||
private byte[] iv;
|
||||
|
||||
// number of bytes buffered internally by the native mechanism and padBuffer
|
||||
@ -213,6 +213,8 @@ final class P11Cipher extends CipherSpi {
|
||||
("CBC mode not supported with stream ciphers");
|
||||
}
|
||||
result = MODE_CBC;
|
||||
} else if (mode.equals("CTR")) {
|
||||
result = MODE_CTR;
|
||||
} else {
|
||||
throw new NoSuchAlgorithmException("Unsupported mode " + mode);
|
||||
}
|
||||
@ -228,6 +230,10 @@ final class P11Cipher extends CipherSpi {
|
||||
if (padding.equals("NOPADDING")) {
|
||||
paddingType = PAD_NONE;
|
||||
} else if (padding.equals("PKCS5PADDING")) {
|
||||
if (this.blockMode == MODE_CTR) {
|
||||
throw new NoSuchPaddingException
|
||||
("PKCS#5 padding not supported with CTR mode");
|
||||
}
|
||||
paddingType = PAD_PKCS5;
|
||||
if (mechanism != CKM_DES_CBC_PAD && mechanism != CKM_DES3_CBC_PAD &&
|
||||
mechanism != CKM_AES_CBC_PAD) {
|
||||
@ -348,11 +354,14 @@ final class P11Cipher extends CipherSpi {
|
||||
("IV not used in ECB mode");
|
||||
}
|
||||
}
|
||||
} else { // MODE_CBC
|
||||
} else { // MODE_CBC or MODE_CTR
|
||||
if (iv == null) {
|
||||
if (encrypt == false) {
|
||||
throw new InvalidAlgorithmParameterException
|
||||
("IV must be specified for decryption in CBC mode");
|
||||
String exMsg =
|
||||
(blockMode == MODE_CBC ?
|
||||
"IV must be specified for decryption in CBC mode" :
|
||||
"IV must be specified for decryption in CTR mode");
|
||||
throw new InvalidAlgorithmParameterException(exMsg);
|
||||
}
|
||||
// generate random IV
|
||||
if (random == null) {
|
||||
@ -410,13 +419,15 @@ final class P11Cipher extends CipherSpi {
|
||||
if (session == null) {
|
||||
session = token.getOpSession();
|
||||
}
|
||||
CK_MECHANISM mechParams = (blockMode == MODE_CTR?
|
||||
new CK_MECHANISM(mechanism, new CK_AES_CTR_PARAMS(iv)) :
|
||||
new CK_MECHANISM(mechanism, iv));
|
||||
|
||||
try {
|
||||
if (encrypt) {
|
||||
token.p11.C_EncryptInit(session.id(),
|
||||
new CK_MECHANISM(mechanism, iv), p11Key.keyID);
|
||||
token.p11.C_EncryptInit(session.id(), mechParams, p11Key.keyID);
|
||||
} else {
|
||||
token.p11.C_DecryptInit(session.id(),
|
||||
new CK_MECHANISM(mechanism, iv), p11Key.keyID);
|
||||
token.p11.C_DecryptInit(session.id(), mechParams, p11Key.keyID);
|
||||
}
|
||||
} catch (PKCS11Exception ex) {
|
||||
// release session when initialization failed
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2011, 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
|
||||
@ -62,6 +62,11 @@ final class P11RSACipher extends CipherSpi {
|
||||
// mode constant for public key decryption (verifying)
|
||||
private final static int MODE_VERIFY = 4;
|
||||
|
||||
// padding type constant for NoPadding
|
||||
private final static int PAD_NONE = 1;
|
||||
// padding type constant for PKCS1Padding
|
||||
private final static int PAD_PKCS1 = 2;
|
||||
|
||||
// token instance
|
||||
private final Token token;
|
||||
|
||||
@ -77,6 +82,9 @@ final class P11RSACipher extends CipherSpi {
|
||||
// mode, one of MODE_* above
|
||||
private int mode;
|
||||
|
||||
// padding, one of PAD_* above
|
||||
private int padType;
|
||||
|
||||
private byte[] buffer;
|
||||
private int bufOfs;
|
||||
|
||||
@ -113,8 +121,10 @@ final class P11RSACipher extends CipherSpi {
|
||||
protected void engineSetPadding(String padding)
|
||||
throws NoSuchPaddingException {
|
||||
String lowerPadding = padding.toLowerCase(Locale.ENGLISH);
|
||||
if (lowerPadding.equals("pkcs1Padding")) {
|
||||
// empty
|
||||
if (lowerPadding.equals("pkcs1padding")) {
|
||||
padType = PAD_PKCS1;
|
||||
} else if (lowerPadding.equals("nopadding")) {
|
||||
padType = PAD_NONE;
|
||||
} else {
|
||||
throw new NoSuchPaddingException("Unsupported padding " + padding);
|
||||
}
|
||||
@ -209,7 +219,8 @@ final class P11RSACipher extends CipherSpi {
|
||||
int n = (p11Key.keyLength() + 7) >> 3;
|
||||
outputSize = n;
|
||||
buffer = new byte[n];
|
||||
maxInputSize = encrypt ? (n - PKCS1_MIN_PADDING_LENGTH) : n;
|
||||
maxInputSize = ((padType == PAD_PKCS1 && encrypt) ?
|
||||
(n - PKCS1_MIN_PADDING_LENGTH) : n);
|
||||
try {
|
||||
initialize();
|
||||
} catch (PKCS11Exception e) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2011, 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
|
||||
@ -621,12 +621,16 @@ public final class SunPKCS11 extends AuthProvider {
|
||||
m(CKM_AES_CBC_PAD, CKM_AES_CBC));
|
||||
d(CIP, "AES/ECB", P11Cipher, s("AES"),
|
||||
m(CKM_AES_ECB));
|
||||
d(CIP, "AES/CTR/NoPadding", P11Cipher,
|
||||
m(CKM_AES_CTR));
|
||||
d(CIP, "Blowfish/CBC", P11Cipher,
|
||||
m(CKM_BLOWFISH_CBC));
|
||||
|
||||
// XXX RSA_X_509, RSA_OAEP not yet supported
|
||||
d(CIP, "RSA/ECB/PKCS1Padding", P11RSACipher,
|
||||
d(CIP, "RSA/ECB/PKCS1Padding", P11RSACipher, s("RSA"),
|
||||
m(CKM_RSA_PKCS));
|
||||
d(CIP, "RSA/ECB/NoPadding", P11RSACipher,
|
||||
m(CKM_RSA_X_509));
|
||||
|
||||
d(SIG, "RawDSA", P11Signature, s("NONEwithDSA"),
|
||||
m(CKM_DSA));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 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,12 +22,45 @@
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*/
|
||||
package sun.misc;
|
||||
|
||||
import java.security.CodeSigner;
|
||||
import java.security.cert.CRL;
|
||||
package sun.security.pkcs11.wrapper;
|
||||
|
||||
public interface JavaSecurityCodeSignerAccess {
|
||||
void setCRLs(CodeSigner signer, CRL[] crls);
|
||||
CRL[] getCRLs(CodeSigner signer);
|
||||
/**
|
||||
* This class represents the necessary parameters required by
|
||||
* the CKM_AES_CTR mechanism as defined in CK_AES_CTR_PARAMS structure.<p>
|
||||
* <B>PKCS#11 structure:</B>
|
||||
* <PRE>
|
||||
* typedef struct CK_AES_CTR_PARAMS {
|
||||
* CK_ULONG ulCounterBits;
|
||||
* CK_BYTE cb[16];
|
||||
* } CK_AES_CTR_PARAMS;
|
||||
* </PRE>
|
||||
*
|
||||
* @author Yu-Ching Valerie Peng
|
||||
* @since 1.7
|
||||
*/
|
||||
public class CK_AES_CTR_PARAMS {
|
||||
|
||||
private final long ulCounterBits;
|
||||
private final byte cb[];
|
||||
|
||||
public CK_AES_CTR_PARAMS(byte[] cb) {
|
||||
ulCounterBits = 128;
|
||||
this.cb = cb.clone();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
|
||||
buffer.append(Constants.INDENT);
|
||||
buffer.append("ulCounterBits: ");
|
||||
buffer.append(ulCounterBits);
|
||||
buffer.append(Constants.NEWLINE);
|
||||
|
||||
buffer.append(Constants.INDENT);
|
||||
buffer.append("cb: ");
|
||||
buffer.append(Functions.toHexString(cb));
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
/* Copyright (c) 2002 Graz University of Technology. All rights reserved.
|
||||
@ -48,6 +48,7 @@
|
||||
package sun.security.pkcs11.wrapper;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import static sun.security.pkcs11.wrapper.PKCS11Constants.*;
|
||||
|
||||
/**
|
||||
* class CK_MECHANISM specifies a particular mechanism and any parameters it
|
||||
@ -127,6 +128,10 @@ public class CK_MECHANISM {
|
||||
init(mechanism, params);
|
||||
}
|
||||
|
||||
public CK_MECHANISM(long mechanism, CK_AES_CTR_PARAMS params) {
|
||||
init(mechanism, params);
|
||||
}
|
||||
|
||||
private void init(long mechanism, Object pParameter) {
|
||||
this.mechanism = mechanism;
|
||||
this.pParameter = pParameter;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
/* Copyright (c) 2002 Graz University of Technology. All rights reserved.
|
||||
@ -47,8 +47,6 @@
|
||||
|
||||
package sun.security.pkcs11.wrapper;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This interface holds constants of the PKCS#11 v2.11 standard.
|
||||
* This is mainly the content of the 'pkcs11t.h' header file.
|
||||
@ -306,6 +304,10 @@ public interface PKCS11Constants {
|
||||
|
||||
public static final long CKK_VENDOR_DEFINED = 0x80000000L;
|
||||
|
||||
// new for v2.20 amendment 3
|
||||
//public static final long CKK_CAMELLIA = 0x00000025L;
|
||||
//public static final long CKK_ARIA = 0x00000026L;
|
||||
|
||||
// pseudo key type ANY (for template manager)
|
||||
public static final long PCKK_ANY = 0x7FFFFF22L;
|
||||
|
||||
@ -690,6 +692,34 @@ public interface PKCS11Constants {
|
||||
|
||||
public static final long CKM_VENDOR_DEFINED = 0x80000000L;
|
||||
|
||||
// new for v2.20 amendment 3
|
||||
public static final long CKM_SHA224 = 0x00000255L;
|
||||
public static final long CKM_SHA224_HMAC = 0x00000256L;
|
||||
public static final long CKM_SHA224_HMAC_GENERAL = 0x00000257L;
|
||||
public static final long CKM_SHA224_KEY_DERIVATION = 0x00000396L;
|
||||
public static final long CKM_SHA224_RSA_PKCS = 0x00000046L;
|
||||
public static final long CKM_SHA224_RSA_PKCS_PSS = 0x00000047L;
|
||||
public static final long CKM_AES_CTR = 0x00001086L;
|
||||
/*
|
||||
public static final long CKM_CAMELLIA_KEY_GEN = 0x00000550L;
|
||||
public static final long CKM_CAMELLIA_ECB = 0x00000551L;
|
||||
public static final long CKM_CAMELLIA_CBC = 0x00000552L;
|
||||
public static final long CKM_CAMELLIA_MAC = 0x00000553L;
|
||||
public static final long CKM_CAMELLIA_MAC_GENERAL = 0x00000554L;
|
||||
public static final long CKM_CAMELLIA_CBC_PAD = 0x00000555L;
|
||||
public static final long CKM_CAMELLIA_ECB_ENCRYPT_DATA = 0x00000556L;
|
||||
public static final long CKM_CAMELLIA_CBC_ENCRYPT_DATA = 0x00000557L;
|
||||
public static final long CKM_CAMELLIA_CTR = 0x00000558L;
|
||||
public static final long CKM_ARIA_KEY_GEN = 0x00000560L;
|
||||
public static final long CKM_ARIA_ECB = 0x00000561L;
|
||||
public static final long CKM_ARIA_CBC = 0x00000562L;
|
||||
public static final long CKM_ARIA_MAC = 0x00000563L;
|
||||
public static final long CKM_ARIA_MAC_GENERAL = 0x00000564L;
|
||||
public static final long CKM_ARIA_CBC_PAD = 0x00000565L;
|
||||
public static final long CKM_ARIA_ECB_ENCRYPT_DATA = 0x00000566L;
|
||||
public static final long CKM_ARIA_CBC_ENCRYPT_DATA = 0x00000567L;
|
||||
*/
|
||||
|
||||
// NSS private
|
||||
public static final long CKM_NSS_TLS_PRF_GENERAL = 0x80000373L;
|
||||
|
||||
@ -881,7 +911,8 @@ public interface PKCS11Constants {
|
||||
|
||||
/* The following MGFs are defined */
|
||||
public static final long CKG_MGF1_SHA1 = 0x00000001L;
|
||||
|
||||
// new for v2.20 amendment 3
|
||||
public static final long CKG_MGF1_SHA224 = 0x00000005L;
|
||||
|
||||
/* The following encoding parameter sources are defined */
|
||||
public static final long CKZ_DATA_SPECIFIED = 0x00000001L;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, 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
|
||||
@ -26,7 +26,6 @@
|
||||
package sun.security.tools;
|
||||
|
||||
import java.io.*;
|
||||
import java.security.cert.X509CRL;
|
||||
import java.util.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.jar.*;
|
||||
@ -36,7 +35,6 @@ import java.net.URISyntaxException;
|
||||
import java.text.Collator;
|
||||
import java.text.MessageFormat;
|
||||
import java.security.cert.Certificate;
|
||||
import java.security.cert.CRL;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.*;
|
||||
@ -58,7 +56,6 @@ import java.util.Map.Entry;
|
||||
import sun.security.x509.*;
|
||||
import sun.security.util.*;
|
||||
import sun.misc.BASE64Encoder;
|
||||
import sun.misc.SharedSecrets;
|
||||
|
||||
|
||||
/**
|
||||
@ -117,13 +114,11 @@ public class JarSigner {
|
||||
static final int SIGNED_BY_ALIAS = 0x08; // signer is in alias list
|
||||
|
||||
X509Certificate[] certChain; // signer's cert chain (when composing)
|
||||
Set<X509CRL> crls; // signer provided CRLs
|
||||
PrivateKey privateKey; // private key
|
||||
KeyStore store; // the keystore specified by -keystore
|
||||
// or the default keystore, never null
|
||||
|
||||
String keystore; // key store file
|
||||
List<String> crlfiles = new ArrayList<>(); // CRL files to add
|
||||
boolean nullStream = false; // null keystore input stream (NONE)
|
||||
boolean token = false; // token-based keystore
|
||||
String jarfile; // jar files to sign or verify
|
||||
@ -151,7 +146,6 @@ public class JarSigner {
|
||||
boolean signManifest = true; // "sign" the whole manifest
|
||||
boolean externalSF = true; // leave the .SF out of the PKCS7 block
|
||||
boolean strict = false; // treat warnings as error
|
||||
boolean autoCRL = false; // Automatcially add CRL defined in cert
|
||||
|
||||
// read zip entry raw bytes
|
||||
private ByteArrayOutputStream baos = new ByteArrayOutputStream(2048);
|
||||
@ -232,29 +226,6 @@ public class JarSigner {
|
||||
} else {
|
||||
loadKeyStore(keystore, true);
|
||||
getAliasInfo(alias);
|
||||
crls = new HashSet<X509CRL>();
|
||||
if (crlfiles.size() > 0 || autoCRL) {
|
||||
CertificateFactory fac =
|
||||
CertificateFactory.getInstance("X509");
|
||||
List<CRL> list = new ArrayList<>();
|
||||
for (String file: crlfiles) {
|
||||
Collection<? extends CRL> tmp = KeyTool.loadCRLs(file);
|
||||
for (CRL crl: tmp) {
|
||||
if (crl instanceof X509CRL) {
|
||||
crls.add((X509CRL)crl);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (autoCRL) {
|
||||
List<CRL> crlsFromCert =
|
||||
KeyTool.readCRLsFromCert(certChain[0]);
|
||||
for (CRL crl: crlsFromCert) {
|
||||
if (crl instanceof X509CRL) {
|
||||
crls.add((X509CRL)crl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// load the alternative signing mechanism
|
||||
if (altSignerClass != null) {
|
||||
@ -396,13 +367,6 @@ public class JarSigner {
|
||||
} else if (collator.compare(flags, "-digestalg") ==0) {
|
||||
if (++n == args.length) usageNoArg();
|
||||
digestalg = args[n];
|
||||
} else if (collator.compare(flags, "-crl") ==0) {
|
||||
if ("auto".equals(modifier)) {
|
||||
autoCRL = true;
|
||||
} else {
|
||||
if (++n == args.length) usageNoArg();
|
||||
crlfiles.add(args[n]);
|
||||
}
|
||||
} else if (collator.compare(flags, "-certs") ==0) {
|
||||
showcerts = true;
|
||||
} else if (collator.compare(flags, "-strict") ==0) {
|
||||
@ -548,9 +512,6 @@ public class JarSigner {
|
||||
System.out.println(rb.getString
|
||||
(".sigalg.algorithm.name.of.signature.algorithm"));
|
||||
System.out.println();
|
||||
System.out.println(rb.getString
|
||||
(".crl.auto.file.include.CRL.in.signed.jar"));
|
||||
System.out.println();
|
||||
System.out.println(rb.getString
|
||||
(".verify.verify.a.signed.JAR.file"));
|
||||
System.out.println();
|
||||
@ -691,20 +652,6 @@ public class JarSigner {
|
||||
if (showcerts) {
|
||||
sb.append(si);
|
||||
sb.append('\n');
|
||||
CRL[] crls = SharedSecrets
|
||||
.getJavaSecurityCodeSignerAccess()
|
||||
.getCRLs(signer);
|
||||
if (crls != null) {
|
||||
for (CRL crl: crls) {
|
||||
if (crl instanceof X509CRLImpl) {
|
||||
sb.append(tab).append("[");
|
||||
sb.append(String.format(
|
||||
rb.getString("with.a.CRL.including.d.entries"),
|
||||
((X509CRLImpl)crl).getRevokedCertificates().size()))
|
||||
.append("]\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (showcerts && !verbose.equals("all")) {
|
||||
@ -1284,7 +1231,7 @@ public class JarSigner {
|
||||
|
||||
try {
|
||||
block =
|
||||
sf.generateBlock(privateKey, sigalg, certChain, crls,
|
||||
sf.generateBlock(privateKey, sigalg, certChain,
|
||||
externalSF, tsaUrl, tsaCert, signingMechanism, args,
|
||||
zipFile);
|
||||
} catch (SocketTimeoutException e) {
|
||||
@ -2249,7 +2196,6 @@ class SignatureFile {
|
||||
public Block generateBlock(PrivateKey privateKey,
|
||||
String sigalg,
|
||||
X509Certificate[] certChain,
|
||||
Set<X509CRL> crls,
|
||||
boolean externalSF, String tsaUrl,
|
||||
X509Certificate tsaCert,
|
||||
ContentSigner signingMechanism,
|
||||
@ -2257,7 +2203,7 @@ class SignatureFile {
|
||||
throws NoSuchAlgorithmException, InvalidKeyException, IOException,
|
||||
SignatureException, CertificateException
|
||||
{
|
||||
return new Block(this, privateKey, sigalg, certChain, crls, externalSF,
|
||||
return new Block(this, privateKey, sigalg, certChain, externalSF,
|
||||
tsaUrl, tsaCert, signingMechanism, args, zipFile);
|
||||
}
|
||||
|
||||
@ -2271,8 +2217,7 @@ class SignatureFile {
|
||||
* Construct a new signature block.
|
||||
*/
|
||||
Block(SignatureFile sfg, PrivateKey privateKey, String sigalg,
|
||||
X509Certificate[] certChain, Set<X509CRL> crls,
|
||||
boolean externalSF, String tsaUrl,
|
||||
X509Certificate[] certChain, boolean externalSF, String tsaUrl,
|
||||
X509Certificate tsaCert, ContentSigner signingMechanism,
|
||||
String[] args, ZipFile zipFile)
|
||||
throws NoSuchAlgorithmException, InvalidKeyException, IOException,
|
||||
@ -2359,7 +2304,7 @@ class SignatureFile {
|
||||
// Assemble parameters for the signing mechanism
|
||||
ContentSignerParameters params =
|
||||
new JarSignerParameters(args, tsaUri, tsaCert, signature,
|
||||
signatureAlgorithm, certChain, crls, content, zipFile);
|
||||
signatureAlgorithm, certChain, content, zipFile);
|
||||
|
||||
// Generate the signature block
|
||||
block = signingMechanism.generateSignedData(
|
||||
@ -2400,7 +2345,6 @@ class JarSignerParameters implements ContentSignerParameters {
|
||||
private byte[] signature;
|
||||
private String signatureAlgorithm;
|
||||
private X509Certificate[] signerCertificateChain;
|
||||
private Set<X509CRL> crls;
|
||||
private byte[] content;
|
||||
private ZipFile source;
|
||||
|
||||
@ -2409,8 +2353,7 @@ class JarSignerParameters implements ContentSignerParameters {
|
||||
*/
|
||||
JarSignerParameters(String[] args, URI tsa, X509Certificate tsaCertificate,
|
||||
byte[] signature, String signatureAlgorithm,
|
||||
X509Certificate[] signerCertificateChain, Set<X509CRL> crls,
|
||||
byte[] content,
|
||||
X509Certificate[] signerCertificateChain, byte[] content,
|
||||
ZipFile source) {
|
||||
|
||||
if (signature == null || signatureAlgorithm == null ||
|
||||
@ -2423,7 +2366,6 @@ class JarSignerParameters implements ContentSignerParameters {
|
||||
this.signature = signature;
|
||||
this.signatureAlgorithm = signatureAlgorithm;
|
||||
this.signerCertificateChain = signerCertificateChain;
|
||||
this.crls = crls;
|
||||
this.content = content;
|
||||
this.source = source;
|
||||
}
|
||||
@ -2499,13 +2441,4 @@ class JarSignerParameters implements ContentSignerParameters {
|
||||
public ZipFile getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<X509CRL> getCRLs() {
|
||||
if (crls == null) {
|
||||
return Collections.emptySet();
|
||||
} else {
|
||||
return Collections.unmodifiableSet(crls);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2011, 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
|
||||
@ -74,8 +74,6 @@ public class JarSignerResources extends java.util.ListResourceBundle {
|
||||
"[-digestalg <algorithm>] name of digest algorithm"},
|
||||
{".sigalg.algorithm.name.of.signature.algorithm",
|
||||
"[-sigalg <algorithm>] name of signature algorithm"},
|
||||
{".crl.auto.file.include.CRL.in.signed.jar",
|
||||
"[-crl[:auto| <file>] include CRL in signed jar"},
|
||||
{".verify.verify.a.signed.JAR.file",
|
||||
"[-verify] verify a signed JAR file"},
|
||||
{".verbose.suboptions.verbose.output.when.signing.verifying.",
|
||||
@ -193,7 +191,6 @@ public class JarSignerResources extends java.util.ListResourceBundle {
|
||||
{"using.an.alternative.signing.mechanism",
|
||||
"using an alternative signing mechanism"},
|
||||
{"entry.was.signed.on", "entry was signed on {0}"},
|
||||
{"with.a.CRL.including.d.entries", "with a CRL including %d entries"},
|
||||
{"Warning.", "Warning: "},
|
||||
{"This.jar.contains.unsigned.entries.which.have.not.been.integrity.checked.",
|
||||
"This jar contains unsigned entries which have not been integrity-checked. "},
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2011, 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,7 +25,6 @@
|
||||
|
||||
package sun.security.tools;
|
||||
|
||||
import sun.misc.SharedSecrets;
|
||||
import java.io.*;
|
||||
import java.security.CodeSigner;
|
||||
import java.security.KeyStore;
|
||||
@ -2311,16 +2310,6 @@ public final class KeyTool {
|
||||
out.println();
|
||||
}
|
||||
}
|
||||
CRL[] crls = SharedSecrets
|
||||
.getJavaSecurityCodeSignerAccess()
|
||||
.getCRLs(signer);
|
||||
if (crls != null) {
|
||||
out.println(rb.getString("CRLs."));
|
||||
out.println();
|
||||
for (CRL crl: crls) {
|
||||
printCRL(crl, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2007, 2011, 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
|
||||
@ -38,7 +38,6 @@ import java.security.cert.X509Certificate;
|
||||
import java.util.List;
|
||||
|
||||
import com.sun.jarsigner.*;
|
||||
import java.security.cert.X509CRL;
|
||||
import java.util.Arrays;
|
||||
import sun.security.pkcs.*;
|
||||
import sun.security.timestamp.*;
|
||||
@ -238,9 +237,8 @@ public final class TimestampedSigner extends ContentSigner {
|
||||
AlgorithmId[] algorithms = {digestAlgorithmId};
|
||||
|
||||
// Create the PKCS #7 signed data message
|
||||
PKCS7 p7 =
|
||||
new PKCS7(algorithms, contentInfo, signerCertificateChain,
|
||||
parameters.getCRLs().toArray(new X509CRL[parameters.getCRLs().size()]), signerInfos);
|
||||
PKCS7 p7 = new PKCS7(algorithms, contentInfo, signerCertificateChain,
|
||||
null, signerInfos);
|
||||
ByteArrayOutputStream p7out = new ByteArrayOutputStream();
|
||||
p7.encodeSignedData(p7out);
|
||||
|
||||
|
@ -37,7 +37,6 @@ import java.util.jar.*;
|
||||
import sun.security.pkcs.*;
|
||||
import sun.security.timestamp.TimestampToken;
|
||||
import sun.misc.BASE64Decoder;
|
||||
import sun.misc.SharedSecrets;
|
||||
|
||||
import sun.security.jca.Providers;
|
||||
|
||||
@ -486,12 +485,7 @@ public class SignatureFileVerifier {
|
||||
signers = new ArrayList<CodeSigner>();
|
||||
}
|
||||
// Append the new code signer
|
||||
CodeSigner signer = new CodeSigner(certChain, getTimestamp(info));
|
||||
if (block.getCRLs() != null) {
|
||||
SharedSecrets.getJavaSecurityCodeSignerAccess().setCRLs(
|
||||
signer, block.getCRLs());
|
||||
}
|
||||
signers.add(signer);
|
||||
signers.add(new CodeSigner(certChain, getTimestamp(info)));
|
||||
|
||||
if (debug != null) {
|
||||
debug.println("Signature Block Certificate: " +
|
||||
|
@ -94,7 +94,7 @@ public class Main {
|
||||
* Run the converter
|
||||
*/
|
||||
public synchronized boolean convert(String argv[]){
|
||||
Vector v = new Vector(2);
|
||||
List<String> v = new ArrayList<>(2);
|
||||
File outputFile = null;
|
||||
boolean createOutputFile = false;
|
||||
|
||||
@ -115,7 +115,7 @@ public class Main {
|
||||
usage();
|
||||
return false;
|
||||
}
|
||||
v.addElement(argv[i]);
|
||||
v.add(argv[i]);
|
||||
}
|
||||
}
|
||||
if (encodingString == null)
|
||||
@ -126,11 +126,11 @@ public class Main {
|
||||
initializeConverter();
|
||||
|
||||
if (v.size() == 1)
|
||||
inputFileName = (String)v.elementAt(0);
|
||||
inputFileName = v.get(0);
|
||||
|
||||
if (v.size() == 2) {
|
||||
inputFileName = (String)v.elementAt(0);
|
||||
outputFileName = (String)v.elementAt(1);
|
||||
inputFileName = v.get(0);
|
||||
outputFileName = v.get(1);
|
||||
createOutputFile = true;
|
||||
}
|
||||
|
||||
@ -363,9 +363,7 @@ public class Main {
|
||||
|
||||
private String formatMsg(String key, String arg) {
|
||||
String msg = getMsg(key);
|
||||
String[] args = new String[1];
|
||||
args[0] = arg;
|
||||
return MessageFormat.format(msg, (Object)args);
|
||||
return MessageFormat.format(msg, arg);
|
||||
}
|
||||
|
||||
|
||||
|
@ -127,7 +127,9 @@ public class LocalGregorianCalendar extends BaseCalendar {
|
||||
calendarProps = (Properties) AccessController.doPrivileged(new PrivilegedExceptionAction() {
|
||||
public Object run() throws IOException {
|
||||
Properties props = new Properties();
|
||||
props.load(new FileInputStream(fname));
|
||||
try (FileInputStream fis = new FileInputStream(fname)) {
|
||||
props.load(fis);
|
||||
}
|
||||
return props;
|
||||
}
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2011, 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
|
||||
@ -266,7 +266,7 @@ public class ZoneInfo extends TimeZone {
|
||||
int index = getTransitionIndex(date, type);
|
||||
|
||||
// prior to the transition table, returns the raw offset.
|
||||
// should support LMT.
|
||||
// FIXME: should support LMT.
|
||||
if (index < 0) {
|
||||
int offset = getLastRawOffset();
|
||||
if (offsets != null) {
|
||||
@ -297,7 +297,13 @@ public class ZoneInfo extends TimeZone {
|
||||
if (type != UTC_TIME) {
|
||||
msec -= rawOffset;
|
||||
}
|
||||
int dstoffset = tz.inDaylightTime(new Date(msec)) ? tz.getDSTSavings() : 0;
|
||||
int dstoffset = tz.getOffset(msec) - rawOffset;
|
||||
|
||||
// Check if it's in a standard-to-daylight transition.
|
||||
if (dstoffset > 0 && tz.getOffset(msec - dstoffset) == rawoffset) {
|
||||
dstoffset = 0;
|
||||
}
|
||||
|
||||
if (offsets != null) {
|
||||
offsets[0] = rawoffset;
|
||||
offsets[1] = dstoffset;
|
||||
@ -452,6 +458,36 @@ public class ZoneInfo extends TimeZone {
|
||||
return (simpleTimeZoneParams != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean observesDaylightTime() {
|
||||
if (simpleTimeZoneParams != null) {
|
||||
return true;
|
||||
}
|
||||
if (transitions == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Look up the transition table to see if it's in DST right
|
||||
// now or if there's any standard-to-daylight transition at
|
||||
// any future.
|
||||
long utc = System.currentTimeMillis() - rawOffsetDiff;
|
||||
int index = getTransitionIndex(utc, UTC_TIME);
|
||||
|
||||
// before transitions in the transition table
|
||||
if (index < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// the time is in the table range.
|
||||
for (int i = index; i < transitions.length; i++) {
|
||||
if ((transitions[i] & DST_MASK) != 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// No further DST is observed.
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries if the specified date is in Daylight Saving Time.
|
||||
*/
|
||||
|
@ -535,7 +535,14 @@ public class PlatformLogger {
|
||||
}
|
||||
|
||||
void doLog(int level, String msg, Object... params) {
|
||||
LoggingSupport.log(javaLogger, levelObjects.get(level), msg, params);
|
||||
// only pass String objects to the j.u.l.Logger which may
|
||||
// be created by untrusted code
|
||||
int len = (params != null) ? params.length : 0;
|
||||
Object[] sparams = new String[len];
|
||||
for (int i = 0; i < len; i++) {
|
||||
sparams [i] = String.valueOf(params[i]);
|
||||
}
|
||||
LoggingSupport.log(javaLogger, levelObjects.get(level), msg, sparams);
|
||||
}
|
||||
|
||||
boolean isEnabled() {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -76,7 +76,7 @@ public class ZipDirectoryStream implements DirectoryStream<Path> {
|
||||
} catch (IOException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
return new Iterator<>() {
|
||||
return new Iterator<Path>() {
|
||||
private Path next;
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
|
@ -112,11 +112,8 @@ public class ZipFileSystem extends FileSystem {
|
||||
}
|
||||
// sm and existence check
|
||||
zfpath.getFileSystem().provider().checkAccess(zfpath, AccessMode.READ);
|
||||
try {
|
||||
zfpath.getFileSystem().provider().checkAccess(zfpath, AccessMode.WRITE);
|
||||
} catch (AccessDeniedException x) {
|
||||
if (!Files.isWritable(zfpath))
|
||||
this.readOnly = true;
|
||||
}
|
||||
this.zc = ZipCoder.get(nameEncoding);
|
||||
this.defaultdir = new ZipPath(this, getBytes(defaultDir));
|
||||
this.ch = Files.newByteChannel(zfpath, READ);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@ -590,7 +590,7 @@ public class ZipPath implements Path {
|
||||
|
||||
@Override
|
||||
public Iterator<Path> iterator() {
|
||||
return new Iterator<>() {
|
||||
return new Iterator<Path>() {
|
||||
private int i = 0;
|
||||
|
||||
@Override
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
/* Copyright (c) 2002 Graz University of Technology. All rights reserved.
|
||||
@ -694,6 +694,46 @@ CK_SSL3_KEY_MAT_PARAMS jSsl3KeyMatParamToCKSsl3KeyMatParam(JNIEnv *env, jobject
|
||||
return ckParam ;
|
||||
}
|
||||
|
||||
/*
|
||||
* converts the Java CK_AES_CTR_PARAMS object to a CK_AES_CTR_PARAMS structure
|
||||
*
|
||||
* @param env - used to call JNI funktions to get the Java classes and objects
|
||||
* @param jParam - the Java CK_AES_CTR_PARAMS object to convert
|
||||
* @param ckpParam - pointer to the new CK_AES_CTR_PARAMS structure
|
||||
*/
|
||||
void jAesCtrParamsToCKAesCtrParam(JNIEnv *env, jobject jParam,
|
||||
CK_AES_CTR_PARAMS_PTR ckpParam) {
|
||||
jclass jAesCtrParamsClass;
|
||||
jfieldID fieldID;
|
||||
jlong jCounterBits;
|
||||
jobject jCb;
|
||||
CK_BYTE_PTR ckBytes;
|
||||
CK_ULONG ckTemp;
|
||||
|
||||
/* get ulCounterBits */
|
||||
jAesCtrParamsClass = (*env)->FindClass(env, CLASS_AES_CTR_PARAMS);
|
||||
if (jAesCtrParamsClass == NULL) { return; }
|
||||
fieldID = (*env)->GetFieldID(env, jAesCtrParamsClass, "ulCounterBits", "J");
|
||||
if (fieldID == NULL) { return; }
|
||||
jCounterBits = (*env)->GetLongField(env, jParam, fieldID);
|
||||
|
||||
/* get cb */
|
||||
fieldID = (*env)->GetFieldID(env, jAesCtrParamsClass, "cb", "[B");
|
||||
if (fieldID == NULL) { return; }
|
||||
jCb = (*env)->GetObjectField(env, jParam, fieldID);
|
||||
|
||||
/* populate java values */
|
||||
ckpParam->ulCounterBits = jLongToCKULong(jCounterBits);
|
||||
jByteArrayToCKByteArray(env, jCb, &ckBytes, &ckTemp);
|
||||
if ((*env)->ExceptionCheck(env)) { return; }
|
||||
if (ckTemp != 16) {
|
||||
TRACE1("ERROR: WRONG CTR IV LENGTH %d", ckTemp);
|
||||
} else {
|
||||
memcpy(ckpParam->cb, ckBytes, ckTemp);
|
||||
free(ckBytes);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* converts a Java CK_MECHANISM object into a CK_MECHANISM structure
|
||||
*
|
||||
@ -937,12 +977,10 @@ void jMechanismParameterToCKMechanismParameterSlow(JNIEnv *env, jobject jParam,
|
||||
{
|
||||
/* get all Java mechanism parameter classes */
|
||||
jclass jVersionClass, jSsl3MasterKeyDeriveParamsClass, jSsl3KeyMatParamsClass;
|
||||
jclass jTlsPrfParamsClass, jRsaPkcsOaepParamsClass, jPbeParamsClass;
|
||||
jclass jPkcs5Pbkd2ParamsClass, jRsaPkcsPssParamsClass;
|
||||
jclass jTlsPrfParamsClass, jAesCtrParamsClass, jRsaPkcsOaepParamsClass;
|
||||
jclass jPbeParamsClass, jPkcs5Pbkd2ParamsClass, jRsaPkcsPssParamsClass;
|
||||
jclass jEcdh1DeriveParamsClass, jEcdh2DeriveParamsClass;
|
||||
jclass jX942Dh1DeriveParamsClass, jX942Dh2DeriveParamsClass;
|
||||
|
||||
/* get all Java mechanism parameter classes */
|
||||
TRACE0("\nDEBUG: jMechanismParameterToCKMechanismParameter");
|
||||
|
||||
/* most common cases, i.e. NULL/byte[]/long, are already handled by
|
||||
@ -1046,6 +1084,33 @@ void jMechanismParameterToCKMechanismParameterSlow(JNIEnv *env, jobject jParam,
|
||||
return;
|
||||
}
|
||||
|
||||
jAesCtrParamsClass = (*env)->FindClass(env, CLASS_AES_CTR_PARAMS);
|
||||
if (jAesCtrParamsClass == NULL) { return; }
|
||||
if ((*env)->IsInstanceOf(env, jParam, jAesCtrParamsClass)) {
|
||||
/*
|
||||
* CK_AES_CTR_PARAMS
|
||||
*/
|
||||
CK_AES_CTR_PARAMS_PTR ckpParam;
|
||||
|
||||
ckpParam = (CK_AES_CTR_PARAMS_PTR) malloc(sizeof(CK_AES_CTR_PARAMS));
|
||||
if (ckpParam == NULL) {
|
||||
JNU_ThrowOutOfMemoryError(env, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
/* convert jParameter to CKParameter */
|
||||
jAesCtrParamsToCKAesCtrParam(env, jParam, ckpParam);
|
||||
if ((*env)->ExceptionCheck(env)) {
|
||||
free(ckpParam);
|
||||
return;
|
||||
}
|
||||
|
||||
/* get length and pointer of parameter */
|
||||
*ckpLength = sizeof(CK_AES_CTR_PARAMS);
|
||||
*ckpParamPtr = ckpParam;
|
||||
return;
|
||||
}
|
||||
|
||||
jRsaPkcsOaepParamsClass = (*env)->FindClass(env, CLASS_RSA_PKCS_OAEP_PARAMS);
|
||||
if (jRsaPkcsOaepParamsClass == NULL) { return; }
|
||||
if ((*env)->IsInstanceOf(env, jParam, jRsaPkcsOaepParamsClass)) {
|
||||
|
@ -0,0 +1,124 @@
|
||||
/* pkcs-11v2-20a3.h include file for the PKCS #11 Version 2.20 Amendment 3
|
||||
document. */
|
||||
|
||||
/* $Revision: 1.4 $ */
|
||||
|
||||
/* License to copy and use this software is granted provided that it is
|
||||
* identified as "RSA Security Inc. PKCS #11 Cryptographic Token Interface
|
||||
* (Cryptoki) Version 2.20 Amendment 3" in all material mentioning or
|
||||
* referencing this software.
|
||||
|
||||
* RSA Security Inc. makes no representations concerning either the
|
||||
* merchantability of this software or the suitability of this software for
|
||||
* any particular purpose. It is provided "as is" without express or implied
|
||||
* warranty of any kind.
|
||||
*/
|
||||
|
||||
/* This file is preferably included after inclusion of pkcs11.h */
|
||||
|
||||
#ifndef _PKCS_11V2_20A3_H_
|
||||
#define _PKCS_11V2_20A3_H_ 1
|
||||
|
||||
/* Are the definitions of this file already included in pkcs11t.h ? */
|
||||
#ifndef CKK_CAMELLIA
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Key types */
|
||||
|
||||
/* Camellia is new for PKCS #11 v2.20 amendment 3 */
|
||||
#define CKK_CAMELLIA 0x00000025
|
||||
/* ARIA is new for PKCS #11 v2.20 amendment 3 */
|
||||
#define CKK_ARIA 0x00000026
|
||||
|
||||
|
||||
/* Mask-generating functions */
|
||||
|
||||
/* SHA-224 is new for PKCS #11 v2.20 amendment 3 */
|
||||
#define CKG_MGF1_SHA224 0x00000005
|
||||
|
||||
|
||||
/* Mechanism Identifiers */
|
||||
|
||||
/* SHA-224 is new for PKCS #11 v2.20 amendment 3 */
|
||||
#define CKM_SHA224 0x00000255
|
||||
#define CKM_SHA224_HMAC 0x00000256
|
||||
#define CKM_SHA224_HMAC_GENERAL 0x00000257
|
||||
|
||||
/* SHA-224 key derivation is new for PKCS #11 v2.20 amendment 3 */
|
||||
#define CKM_SHA224_KEY_DERIVATION 0x00000396
|
||||
|
||||
/* SHA-224 RSA mechanisms are new for PKCS #11 v2.20 amendment 3 */
|
||||
#define CKM_SHA224_RSA_PKCS 0x00000046
|
||||
#define CKM_SHA224_RSA_PKCS_PSS 0x00000047
|
||||
|
||||
/* AES counter mode is new for PKCS #11 v2.20 amendment 3 */
|
||||
#define CKM_AES_CTR 0x00001086
|
||||
|
||||
/* Camellia is new for PKCS #11 v2.20 amendment 3 */
|
||||
#define CKM_CAMELLIA_KEY_GEN 0x00000550
|
||||
#define CKM_CAMELLIA_ECB 0x00000551
|
||||
#define CKM_CAMELLIA_CBC 0x00000552
|
||||
#define CKM_CAMELLIA_MAC 0x00000553
|
||||
#define CKM_CAMELLIA_MAC_GENERAL 0x00000554
|
||||
#define CKM_CAMELLIA_CBC_PAD 0x00000555
|
||||
#define CKM_CAMELLIA_ECB_ENCRYPT_DATA 0x00000556
|
||||
#define CKM_CAMELLIA_CBC_ENCRYPT_DATA 0x00000557
|
||||
#define CKM_CAMELLIA_CTR 0x00000558
|
||||
|
||||
/* ARIA is new for PKCS #11 v2.20 amendment 3 */
|
||||
#define CKM_ARIA_KEY_GEN 0x00000560
|
||||
#define CKM_ARIA_ECB 0x00000561
|
||||
#define CKM_ARIA_CBC 0x00000562
|
||||
#define CKM_ARIA_MAC 0x00000563
|
||||
#define CKM_ARIA_MAC_GENERAL 0x00000564
|
||||
#define CKM_ARIA_CBC_PAD 0x00000565
|
||||
#define CKM_ARIA_ECB_ENCRYPT_DATA 0x00000566
|
||||
#define CKM_ARIA_CBC_ENCRYPT_DATA 0x00000567
|
||||
|
||||
|
||||
/* Mechanism parameters */
|
||||
|
||||
/* CK_AES_CTR_PARAMS is new for PKCS #11 v2.20 amendment 3 */
|
||||
typedef struct CK_AES_CTR_PARAMS {
|
||||
CK_ULONG ulCounterBits;
|
||||
CK_BYTE cb[16];
|
||||
} CK_AES_CTR_PARAMS;
|
||||
|
||||
typedef CK_AES_CTR_PARAMS CK_PTR CK_AES_CTR_PARAMS_PTR;
|
||||
|
||||
/* CK_CAMELLIA_CTR_PARAMS is new for PKCS #11 v2.20 amendment 3 */
|
||||
typedef struct CK_CAMELLIA_CTR_PARAMS {
|
||||
CK_ULONG ulCounterBits;
|
||||
CK_BYTE cb[16];
|
||||
} CK_CAMELLIA_CTR_PARAMS;
|
||||
|
||||
typedef CK_CAMELLIA_CTR_PARAMS CK_PTR CK_CAMELLIA_CTR_PARAMS_PTR;
|
||||
|
||||
/* CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS is new for PKCS #11 v2.20 amendment 3 */
|
||||
typedef struct CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS {
|
||||
CK_BYTE iv[16];
|
||||
CK_BYTE_PTR pData;
|
||||
CK_ULONG length;
|
||||
} CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS;
|
||||
|
||||
typedef CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_CAMELLIA_CBC_ENCRYPT_DATA_PARAMS_PTR;
|
||||
|
||||
/* CK_ARIA_CBC_ENCRYPT_DATA_PARAMS is new for PKCS #11 v2.20 amendment 3 */
|
||||
typedef struct CK_ARIA_CBC_ENCRYPT_DATA_PARAMS {
|
||||
CK_BYTE iv[16];
|
||||
CK_BYTE_PTR pData;
|
||||
CK_ULONG length;
|
||||
} CK_ARIA_CBC_ENCRYPT_DATA_PARAMS;
|
||||
|
||||
typedef CK_ARIA_CBC_ENCRYPT_DATA_PARAMS CK_PTR CK_ARIA_CBC_ENCRYPT_DATA_PARAMS_PTR;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
*/
|
||||
|
||||
/* Copyright (c) 2002 Graz University of Technology. All rights reserved.
|
||||
@ -153,6 +153,7 @@
|
||||
#include "p11_md.h"
|
||||
|
||||
#include "pkcs11.h"
|
||||
#include "pkcs-11v2-20a3.h"
|
||||
#include <jni.h>
|
||||
#include <jni_util.h>
|
||||
|
||||
@ -272,6 +273,7 @@
|
||||
#define CLASS_SSL3_MASTER_KEY_DERIVE_PARAMS "sun/security/pkcs11/wrapper/CK_SSL3_MASTER_KEY_DERIVE_PARAMS"
|
||||
#define CLASS_SSL3_KEY_MAT_PARAMS "sun/security/pkcs11/wrapper/CK_SSL3_KEY_MAT_PARAMS"
|
||||
#define CLASS_TLS_PRF_PARAMS "sun/security/pkcs11/wrapper/CK_TLS_PRF_PARAMS"
|
||||
#define CLASS_AES_CTR_PARAMS "sun/security/pkcs11/wrapper/CK_AES_CTR_PARAMS"
|
||||
|
||||
/* function to convert a PKCS#11 return value other than CK_OK into a Java Exception
|
||||
* or to throw a PKCS11RuntimeException
|
||||
|
@ -571,9 +571,9 @@ class FileSystemPreferences extends AbstractPreferences {
|
||||
long newLastSyncTime = 0;
|
||||
try {
|
||||
newLastSyncTime = prefsFile.lastModified();
|
||||
FileInputStream fis = new FileInputStream(prefsFile);
|
||||
XmlSupport.importMap(fis, m);
|
||||
fis.close();
|
||||
try (FileInputStream fis = new FileInputStream(prefsFile)) {
|
||||
XmlSupport.importMap(fis, m);
|
||||
}
|
||||
} catch(Exception e) {
|
||||
if (e instanceof InvalidPreferencesFormatException) {
|
||||
getLogger().warning("Invalid preferences format in "
|
||||
@ -618,9 +618,9 @@ class FileSystemPreferences extends AbstractPreferences {
|
||||
if (!dir.exists() && !dir.mkdirs())
|
||||
throw new BackingStoreException(dir +
|
||||
" create failed.");
|
||||
FileOutputStream fos = new FileOutputStream(tmpFile);
|
||||
XmlSupport.exportMap(fos, prefsCache);
|
||||
fos.close();
|
||||
try (FileOutputStream fos = new FileOutputStream(tmpFile)) {
|
||||
XmlSupport.exportMap(fos, prefsCache);
|
||||
}
|
||||
if (!tmpFile.renameTo(prefsFile))
|
||||
throw new BackingStoreException("Can't rename " +
|
||||
tmpFile + " to " + prefsFile);
|
||||
|
@ -56,12 +56,14 @@ class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer {
|
||||
}
|
||||
|
||||
private native void run(String title, int mode, String dir, String file,
|
||||
FilenameFilter filter, boolean isMultipleMode);
|
||||
FilenameFilter filter, boolean isMultipleMode, int x, int y);
|
||||
private native void quit();
|
||||
|
||||
@Override
|
||||
public native void toFront();
|
||||
|
||||
@Override
|
||||
public native void setBounds(int x, int y, int width, int height, int op);
|
||||
|
||||
/**
|
||||
* Called exclusively by the native C code.
|
||||
@ -106,9 +108,8 @@ class GtkFileDialogPeer extends XDialogPeer implements FileDialogPeer {
|
||||
Thread t = new Thread() {
|
||||
public void run() {
|
||||
GtkFileDialogPeer.this.run(fd.getTitle(), fd.getMode(),
|
||||
fd.getDirectory(), fd.getFile(), fd
|
||||
.getFilenameFilter(), fd
|
||||
.isMultipleMode());
|
||||
fd.getDirectory(), fd.getFile(), fd.getFilenameFilter(), fd.isMultipleMode(),
|
||||
fd.getX(), fd.getY());
|
||||
fd.setVisible(false);
|
||||
}
|
||||
};
|
||||
|
@ -70,9 +70,14 @@ public class XRGlyphCache implements GlyphDisposedListener {
|
||||
try {
|
||||
SunToolkit.awtLock();
|
||||
|
||||
ArrayList<Integer> glyphIDList = new ArrayList<Integer>(glyphPtrList.size());
|
||||
GrowableIntArray glyphIDList = new GrowableIntArray(1, glyphPtrList.size());
|
||||
for (long glyphPtr : glyphPtrList) {
|
||||
glyphIDList.add(XRGlyphCacheEntry.getGlyphID(glyphPtr));
|
||||
int glyphID = XRGlyphCacheEntry.getGlyphID(glyphPtr);
|
||||
|
||||
//Check if glyph hasn't been freed already
|
||||
if (glyphID != 0) {
|
||||
glyphIDList.addInt(glyphID);
|
||||
}
|
||||
}
|
||||
freeGlyphs(glyphIDList);
|
||||
} finally {
|
||||
@ -83,7 +88,6 @@ public class XRGlyphCache implements GlyphDisposedListener {
|
||||
protected int getFreeGlyphID() {
|
||||
if (freeGlyphIDs.size() > 0) {
|
||||
int newID = freeGlyphIDs.remove(freeGlyphIDs.size() - 1);
|
||||
;
|
||||
return newID;
|
||||
}
|
||||
return nextID++;
|
||||
@ -246,7 +250,7 @@ public class XRGlyphCache implements GlyphDisposedListener {
|
||||
glyph.setPinned();
|
||||
}
|
||||
|
||||
ArrayList<Integer> deleteGlyphList = new ArrayList<Integer>();
|
||||
GrowableIntArray deleteGlyphList = new GrowableIntArray(1, 10);
|
||||
int pixelsToRelease = cachedPixels - MAX_CACHED_PIXELS;
|
||||
|
||||
for (int i = cacheList.size() - 1; i >= 0 && pixelsToRelease > 0; i--) {
|
||||
@ -254,7 +258,7 @@ public class XRGlyphCache implements GlyphDisposedListener {
|
||||
|
||||
if (!entry.isPinned()) {
|
||||
pixelsToRelease -= entry.getPixelCnt();
|
||||
deleteGlyphList.add(new Integer(entry.getGlyphID()));
|
||||
deleteGlyphList.addInt(entry.getGlyphID());
|
||||
}
|
||||
}
|
||||
|
||||
@ -265,26 +269,23 @@ public class XRGlyphCache implements GlyphDisposedListener {
|
||||
freeGlyphs(deleteGlyphList);
|
||||
}
|
||||
|
||||
private void freeGlyphs(List<Integer> glyphIdList) {
|
||||
private void freeGlyphs(GrowableIntArray glyphIdList) {
|
||||
GrowableIntArray removedLCDGlyphs = new GrowableIntArray(1, 10);
|
||||
GrowableIntArray removedGrayscaleGlyphs = new GrowableIntArray(1, 10);
|
||||
|
||||
freeGlyphIDs.addAll(glyphIdList);
|
||||
for (int i=0; i < glyphIdList.getSize(); i++) {
|
||||
int glyphId = glyphIdList.getInt(i);
|
||||
freeGlyphIDs.add(glyphId);
|
||||
|
||||
GrowableIntArray removedLCDGlyphs = new GrowableIntArray(1, 1);
|
||||
GrowableIntArray removedGrayscaleGlyphs = new GrowableIntArray(1, 1);
|
||||
|
||||
for (Integer glyphId : glyphIdList) {
|
||||
tmp.setValue(glyphId.intValue());
|
||||
tmp.setValue(glyphId);
|
||||
XRGlyphCacheEntry entry = cacheMap.get(tmp);
|
||||
cachedPixels -= entry.getPixelCnt();
|
||||
|
||||
int removedGlyphID = entry.getGlyphID();
|
||||
tmp.setValue(removedGlyphID);
|
||||
cacheMap.remove(tmp);
|
||||
|
||||
if (entry.getGlyphSet() == grayGlyphSet) {
|
||||
removedGrayscaleGlyphs.addInt(removedGlyphID);
|
||||
removedGrayscaleGlyphs.addInt(glyphId);
|
||||
} else {
|
||||
removedLCDGlyphs.addInt(removedGlyphID);
|
||||
removedLCDGlyphs.addInt(glyphId);
|
||||
}
|
||||
|
||||
entry.setGlyphID(0);
|
||||
|
@ -55,6 +55,8 @@ public abstract class XRSurfaceData extends XSurfaceData {
|
||||
|
||||
native void initXRPicture(long xsdo, int pictForm);
|
||||
|
||||
native void freeXSDOPicture(long xsdo);
|
||||
|
||||
public static final String DESC_BYTE_A8_X11 = "Byte A8 Pixmap";
|
||||
public static final String DESC_INT_RGB_X11 = "Integer RGB Pixmap";
|
||||
public static final String DESC_INT_ARGB_X11 = "Integer ARGB-Pre Pixmap";
|
||||
@ -531,6 +533,17 @@ public abstract class XRSurfaceData extends XSurfaceData {
|
||||
public Object getDestination() {
|
||||
return peer.getTarget();
|
||||
}
|
||||
|
||||
public void invalidate() {
|
||||
try {
|
||||
SunToolkit.awtLock();
|
||||
freeXSDOPicture(getNativeOps());
|
||||
}finally {
|
||||
SunToolkit.awtUnlock();
|
||||
}
|
||||
|
||||
super.invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
public static class XRInternalSurfaceData extends XRSurfaceData {
|
||||
|
@ -236,7 +236,9 @@ class UnixAsynchronousServerSocketChannelImpl
|
||||
} catch (SecurityException x) {
|
||||
try {
|
||||
ch.close();
|
||||
} catch (IOException ignore) { }
|
||||
} catch (Throwable suppressed) {
|
||||
x.addSuppressed(suppressed);
|
||||
}
|
||||
throw x;
|
||||
}
|
||||
return ch;
|
||||
|
@ -137,7 +137,7 @@ class UnixAsynchronousSocketChannelImpl
|
||||
return port;
|
||||
}
|
||||
|
||||
// register for events if there are outstanding I/O operations
|
||||
// register events for outstanding I/O operations, caller already owns updateLock
|
||||
private void updateEvents() {
|
||||
assert Thread.holdsLock(updateLock);
|
||||
int events = 0;
|
||||
@ -149,6 +149,13 @@ class UnixAsynchronousSocketChannelImpl
|
||||
port.startPoll(fdVal, events);
|
||||
}
|
||||
|
||||
// register events for outstanding I/O operations
|
||||
private void lockAndUpdateEvents() {
|
||||
synchronized (updateLock) {
|
||||
updateEvents();
|
||||
}
|
||||
}
|
||||
|
||||
// invoke to finish read and/or write operations
|
||||
private void finish(boolean mayInvokeDirect,
|
||||
boolean readable,
|
||||
@ -255,10 +262,11 @@ class UnixAsynchronousSocketChannelImpl
|
||||
// close channel if connection cannot be established
|
||||
try {
|
||||
close();
|
||||
} catch (IOException ignore) { }
|
||||
} catch (Throwable suppressed) {
|
||||
e.addSuppressed(suppressed);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// invoke handler and set result
|
||||
CompletionHandler<Void,Object> handler = connectHandler;
|
||||
Object att = connectAttachment;
|
||||
@ -345,7 +353,9 @@ class UnixAsynchronousSocketChannelImpl
|
||||
if (e != null) {
|
||||
try {
|
||||
close();
|
||||
} catch (IOException ignore) { }
|
||||
} catch (Throwable suppressed) {
|
||||
e.addSuppressed(suppressed);
|
||||
}
|
||||
}
|
||||
if (handler == null) {
|
||||
return CompletedFuture.withResult(null, e);
|
||||
@ -399,9 +409,8 @@ class UnixAsynchronousSocketChannelImpl
|
||||
exc = x;
|
||||
} finally {
|
||||
// restart poll in case of concurrent write
|
||||
synchronized (updateLock) {
|
||||
updateEvents();
|
||||
}
|
||||
if (!(exc instanceof AsynchronousCloseException))
|
||||
lockAndUpdateEvents();
|
||||
end();
|
||||
}
|
||||
|
||||
@ -595,9 +604,8 @@ class UnixAsynchronousSocketChannelImpl
|
||||
exc = x;
|
||||
} finally {
|
||||
// restart poll in case of concurrent write
|
||||
synchronized (updateLock) {
|
||||
updateEvents();
|
||||
}
|
||||
if (!(exc instanceof AsynchronousCloseException))
|
||||
lockAndUpdateEvents();
|
||||
end();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2011, 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,22 +77,24 @@ Java_java_net_Inet4AddressImpl_getLocalHostName(JNIEnv *env, jobject this) {
|
||||
*/
|
||||
#endif /* __linux__ */
|
||||
struct hostent res, res2, *hp;
|
||||
char buf[HENT_BUF_SIZE];
|
||||
char buf2[HENT_BUF_SIZE];
|
||||
// these buffers must be pointer-aligned so they are declared
|
||||
// with pointer type
|
||||
char *buf[HENT_BUF_SIZE/(sizeof (char *))];
|
||||
char *buf2[HENT_BUF_SIZE/(sizeof (char *))];
|
||||
int h_error=0;
|
||||
|
||||
#ifdef __GLIBC__
|
||||
gethostbyname_r(hostname, &res, buf, sizeof(buf), &hp, &h_error);
|
||||
gethostbyname_r(hostname, &res, (char*)buf, sizeof(buf), &hp, &h_error);
|
||||
#else
|
||||
hp = gethostbyname_r(hostname, &res, buf, sizeof(buf), &h_error);
|
||||
hp = gethostbyname_r(hostname, &res, (char*)buf, sizeof(buf), &h_error);
|
||||
#endif
|
||||
if (hp) {
|
||||
#ifdef __GLIBC__
|
||||
gethostbyaddr_r(hp->h_addr, hp->h_length, AF_INET,
|
||||
&res2, buf2, sizeof(buf2), &hp, &h_error);
|
||||
&res2, (char*)buf2, sizeof(buf2), &hp, &h_error);
|
||||
#else
|
||||
hp = gethostbyaddr_r(hp->h_addr, hp->h_length, AF_INET,
|
||||
&res2, buf2, sizeof(buf2), &h_error);
|
||||
&res2, (char*)buf2, sizeof(buf2), &h_error);
|
||||
#endif
|
||||
if (hp) {
|
||||
/*
|
||||
@ -136,7 +138,9 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
|
||||
const char *hostname;
|
||||
jobjectArray ret = 0;
|
||||
struct hostent res, *hp = 0;
|
||||
char buf[HENT_BUF_SIZE];
|
||||
// this buffer must be pointer-aligned so is declared
|
||||
// with pointer type
|
||||
char *buf[HENT_BUF_SIZE/(sizeof (char *))];
|
||||
|
||||
/* temporary buffer, on the off chance we need to expand */
|
||||
char *tmp = NULL;
|
||||
@ -176,9 +180,9 @@ Java_java_net_Inet4AddressImpl_lookupAllHostAddr(JNIEnv *env, jobject this,
|
||||
|
||||
/* Try once, with our static buffer. */
|
||||
#ifdef __GLIBC__
|
||||
gethostbyname_r(hostname, &res, buf, sizeof(buf), &hp, &h_error);
|
||||
gethostbyname_r(hostname, &res, (char*)buf, sizeof(buf), &hp, &h_error);
|
||||
#else
|
||||
hp = gethostbyname_r(hostname, &res, buf, sizeof(buf), &h_error);
|
||||
hp = gethostbyname_r(hostname, &res, (char*)buf, sizeof(buf), &h_error);
|
||||
#endif
|
||||
|
||||
/* With the re-entrant system calls, it's possible that the buffer
|
||||
@ -251,7 +255,9 @@ Java_java_net_Inet4AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
|
||||
jstring ret = NULL;
|
||||
jint addr;
|
||||
struct hostent hent, *hp = 0;
|
||||
char buf[HENT_BUF_SIZE];
|
||||
// this buffer must be pointer-aligned so is declared
|
||||
// with pointer type
|
||||
char *buf[HENT_BUF_SIZE/(sizeof (char *))];
|
||||
int h_error = 0;
|
||||
char *tmp = NULL;
|
||||
|
||||
@ -273,10 +279,10 @@ Java_java_net_Inet4AddressImpl_getHostByAddr(JNIEnv *env, jobject this,
|
||||
addr = htonl(addr);
|
||||
#ifdef __GLIBC__
|
||||
gethostbyaddr_r((char *)&addr, sizeof(addr), AF_INET, &hent,
|
||||
buf, sizeof(buf), &hp, &h_error);
|
||||
(char*)buf, sizeof(buf), &hp, &h_error);
|
||||
#else
|
||||
hp = gethostbyaddr_r((char *)&addr, sizeof(addr), AF_INET, &hent,
|
||||
buf, sizeof(buf), &h_error);
|
||||
(char*)buf, sizeof(buf), &h_error);
|
||||
#endif
|
||||
/* With the re-entrant system calls, it's possible that the buffer
|
||||
* we pass to it is not large enough to hold an exceptionally
|
||||
|
@ -45,7 +45,6 @@
|
||||
#ifdef __linux__
|
||||
#include <sys/ioctl.h>
|
||||
#include <bits/ioctls.h>
|
||||
#include <linux/sockios.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
@ -1100,7 +1099,7 @@ static netif *enumIPv4Interfaces(JNIEnv *env, int sock, netif *ifs) {
|
||||
#ifdef AF_INET6
|
||||
static netif *enumIPv6Interfaces(JNIEnv *env, int sock, netif *ifs) {
|
||||
FILE *f;
|
||||
char addr6[40], devname[20];
|
||||
char addr6[40], devname[21];
|
||||
char addr6p[8][5];
|
||||
int plen, scope, dad_status, if_idx;
|
||||
uint8_t ipv6addr[16];
|
||||
|
@ -34,8 +34,8 @@
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
#include <linux/unistd.h>
|
||||
#include <linux/sysctl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/utsname.h>
|
||||
#include <netinet/ip.h>
|
||||
|
||||
|
@ -42,8 +42,8 @@
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#ifdef __linux__
|
||||
#include <linux/unistd.h>
|
||||
#include <linux/sysctl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/sysctl.h>
|
||||
#endif
|
||||
|
||||
#include "jvm.h"
|
||||
|
@ -112,7 +112,7 @@ static void __attribute((constructor)) init() {
|
||||
*/
|
||||
static inline fdEntry_t *getFdEntry(int fd)
|
||||
{
|
||||
if (fd < 0 || fd > fdCount) {
|
||||
if (fd < 0 || fd >= fdCount) {
|
||||
return NULL;
|
||||
}
|
||||
return &fdTable[fd];
|
||||
|
@ -608,7 +608,7 @@ static void initLoopbackRoutes() {
|
||||
{
|
||||
/* now find the scope_id for "lo" */
|
||||
|
||||
char devname[20];
|
||||
char devname[21];
|
||||
char addr6p[8][5];
|
||||
int plen, scope, dad_status, if_idx;
|
||||
|
||||
@ -651,7 +651,7 @@ static int nifs = 0; /* number of entries used in array */
|
||||
static void initLocalIfs () {
|
||||
FILE *f;
|
||||
unsigned char staddr [16];
|
||||
char ifname [32];
|
||||
char ifname [33];
|
||||
struct localinterface *lif=0;
|
||||
int index, x1, x2, x3;
|
||||
unsigned int u0,u1,u2,u3,u4,u5,u6,u7,u8,u9,ua,ub,uc,ud,ue,uf;
|
||||
@ -660,7 +660,7 @@ static void initLocalIfs () {
|
||||
return ;
|
||||
}
|
||||
while (fscanf (f, "%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x%2x "
|
||||
"%d %x %x %x %s",&u0,&u1,&u2,&u3,&u4,&u5,&u6,&u7,
|
||||
"%d %x %x %x %32s",&u0,&u1,&u2,&u3,&u4,&u5,&u6,&u7,
|
||||
&u8,&u9,&ua,&ub,&uc,&ud,&ue,&uf,
|
||||
&index, &x1, &x2, &x3, ifname) == 21) {
|
||||
staddr[0] = (unsigned char)u0;
|
||||
@ -1102,7 +1102,7 @@ int getDefaultIPv6Interface(struct in6_addr *target_addr) {
|
||||
* index.
|
||||
*/
|
||||
if (match) {
|
||||
char devname[20];
|
||||
char devname[21];
|
||||
char addr6p[8][5];
|
||||
int plen, scope, dad_status, if_idx;
|
||||
|
||||
|
@ -608,7 +608,10 @@ gboolean gtk2_load()
|
||||
fp_gtk_viewport_new = dl_symbol("gtk_viewport_new");
|
||||
fp_gtk_window_new = dl_symbol("gtk_window_new");
|
||||
fp_gtk_window_present = dl_symbol("gtk_window_present");
|
||||
fp_gtk_dialog_new = dl_symbol("gtk_dialog_new");
|
||||
fp_gtk_window_move = dl_symbol("gtk_window_move");
|
||||
fp_gtk_window_resize = dl_symbol("gtk_window_resize");
|
||||
|
||||
fp_gtk_dialog_new = dl_symbol("gtk_dialog_new");
|
||||
fp_gtk_frame_new = dl_symbol("gtk_frame_new");
|
||||
|
||||
fp_gtk_adjustment_new = dl_symbol("gtk_adjustment_new");
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user