Merge
This commit is contained in:
commit
7be853ba86
@ -1,40 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
* 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.awt;
|
||||
|
||||
// This class exists only so we can flush the PostEventQueue for the right AppContext
|
||||
// The default flushPendingEvents only flushes the thread-local context, which is wrong.
|
||||
// c.f. 3746956
|
||||
public abstract class SunToolkitSubclass extends SunToolkit {
|
||||
public static void flushPendingEvents(AppContext appContext) {
|
||||
flushLock.lock();
|
||||
PostEventQueue postEventQueue = (PostEventQueue)appContext.get("PostEventQueue");
|
||||
if (postEventQueue != null) {
|
||||
postEventQueue.flush();
|
||||
}
|
||||
flushLock.unlock();
|
||||
}
|
||||
}
|
@ -37,6 +37,7 @@ import java.util.Vector;
|
||||
import javax.swing.plaf.FontUIResource;
|
||||
|
||||
import sun.awt.FontConfiguration;
|
||||
import sun.awt.HeadlessToolkit;
|
||||
import sun.lwawt.macosx.*;
|
||||
|
||||
public class CFontManager extends SunFontManager {
|
||||
@ -342,9 +343,14 @@ public class CFontManager extends SunFontManager {
|
||||
@Override
|
||||
public String getFontPath(boolean noType1Fonts) {
|
||||
// In the case of the Cocoa toolkit, since we go through NSFont, we dont need to register /Library/Fonts
|
||||
if (Toolkit.getDefaultToolkit() instanceof LWCToolkit) {
|
||||
Toolkit tk = Toolkit.getDefaultToolkit();
|
||||
if (tk instanceof HeadlessToolkit) {
|
||||
tk = ((HeadlessToolkit)tk).getUnderlyingToolkit();
|
||||
}
|
||||
if (tk instanceof LWCToolkit) {
|
||||
return "";
|
||||
}
|
||||
|
||||
// X11 case
|
||||
return "/Library/Fonts";
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ final class CPlatformResponder {
|
||||
boolean postsTyped = false;
|
||||
|
||||
char testChar = KeyEvent.CHAR_UNDEFINED;
|
||||
char testDeadChar = 0;
|
||||
boolean isDeadChar = (chars!= null && chars.length() == 0);
|
||||
|
||||
if (isFlagsChangedEvent) {
|
||||
int[] in = new int[] {modifierFlags, keyCode};
|
||||
@ -150,14 +150,18 @@ final class CPlatformResponder {
|
||||
testChar = chars.charAt(0);
|
||||
}
|
||||
|
||||
int[] in = new int[] {testChar, testDeadChar, modifierFlags, keyCode};
|
||||
int[] out = new int[2]; // [jkeyCode, jkeyLocation]
|
||||
int[] in = new int[] {testChar, isDeadChar ? 1 : 0, modifierFlags, keyCode};
|
||||
int[] out = new int[3]; // [jkeyCode, jkeyLocation, deadChar]
|
||||
|
||||
postsTyped = NSEvent.nsToJavaKeyInfo(in, out);
|
||||
if (!postsTyped) {
|
||||
testChar = KeyEvent.CHAR_UNDEFINED;
|
||||
}
|
||||
|
||||
if(isDeadChar){
|
||||
testChar = (char) out[2];
|
||||
}
|
||||
|
||||
jkeyCode = out[0];
|
||||
jkeyLocation = out[1];
|
||||
jeventType = isNpapiCallback ? NSEvent.npToJavaEventType(eventType) :
|
||||
|
@ -536,7 +536,7 @@ public class LWCToolkit extends LWToolkit {
|
||||
SunToolkit.postEvent(appContext, invocationEvent);
|
||||
|
||||
// 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock
|
||||
sun.awt.SunToolkitSubclass.flushPendingEvents(appContext);
|
||||
SunToolkit.flushPendingEvents(appContext);
|
||||
} else {
|
||||
// This should be the equivalent to EventQueue.invokeAndWait
|
||||
((LWCToolkit)Toolkit.getDefaultToolkit()).getSystemEventQueueForInvokeAndWait().postEvent(invocationEvent);
|
||||
@ -561,7 +561,7 @@ public class LWCToolkit extends LWToolkit {
|
||||
SunToolkit.postEvent(appContext, invocationEvent);
|
||||
|
||||
// 3746956 - flush events from PostEventQueue to prevent them from getting stuck and causing a deadlock
|
||||
sun.awt.SunToolkitSubclass.flushPendingEvents(appContext);
|
||||
SunToolkit.flushPendingEvents(appContext);
|
||||
} else {
|
||||
// This should be the equivalent to EventQueue.invokeAndWait
|
||||
((LWCToolkit)Toolkit.getDefaultToolkit()).getSystemEventQueueForInvokeAndWait().postEvent(invocationEvent);
|
||||
|
@ -33,5 +33,7 @@ void DeliverJavaKeyEvent(JNIEnv *env, NSEvent *event, jobject peer);
|
||||
void DeliverJavaMouseEvent(JNIEnv *env, NSEvent *event, jobject peer);
|
||||
void SendAdditionalJavaEvents(JNIEnv *env, NSEvent *nsEvent, jobject peer);
|
||||
jint GetJavaMouseModifiers(NSInteger button, NSUInteger modifierFlags);
|
||||
jint NsKeyModifiersToJavaModifiers(NSUInteger nsFlags, BOOL isExtMods);
|
||||
NSUInteger JavaModifiersToNsKeyModifiers(jint javaModifiers, BOOL isExtMods);
|
||||
|
||||
#endif /* __AWTEVENT_H */
|
||||
|
@ -26,6 +26,7 @@
|
||||
#import <JavaNativeFoundation/JavaNativeFoundation.h>
|
||||
#import <JavaRuntimeSupport/JavaRuntimeSupport.h>
|
||||
#import <sys/time.h>
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
#import "LWCToolkit.h"
|
||||
#import "ThreadUtilities.h"
|
||||
@ -244,6 +245,7 @@ static struct _nsKeyToJavaModifier
|
||||
//NSUInteger cgsRightMask;
|
||||
unsigned short leftKeyCode;
|
||||
unsigned short rightKeyCode;
|
||||
jint javaExtMask;
|
||||
jint javaMask;
|
||||
jint javaKey;
|
||||
}
|
||||
@ -254,6 +256,7 @@ const nsKeyToJavaModifierTable[] =
|
||||
0,
|
||||
0,
|
||||
0, // no Java equivalent
|
||||
0, // no Java equivalent
|
||||
java_awt_event_KeyEvent_VK_CAPS_LOCK
|
||||
},
|
||||
{
|
||||
@ -263,6 +266,7 @@ const nsKeyToJavaModifierTable[] =
|
||||
56,
|
||||
60,
|
||||
java_awt_event_InputEvent_SHIFT_DOWN_MASK,
|
||||
java_awt_event_InputEvent_SHIFT_MASK,
|
||||
java_awt_event_KeyEvent_VK_SHIFT
|
||||
},
|
||||
{
|
||||
@ -272,6 +276,7 @@ const nsKeyToJavaModifierTable[] =
|
||||
59,
|
||||
62,
|
||||
java_awt_event_InputEvent_CTRL_DOWN_MASK,
|
||||
java_awt_event_InputEvent_CTRL_MASK,
|
||||
java_awt_event_KeyEvent_VK_CONTROL
|
||||
},
|
||||
{
|
||||
@ -281,6 +286,7 @@ const nsKeyToJavaModifierTable[] =
|
||||
58,
|
||||
61,
|
||||
java_awt_event_InputEvent_ALT_DOWN_MASK,
|
||||
java_awt_event_InputEvent_ALT_MASK,
|
||||
java_awt_event_KeyEvent_VK_ALT
|
||||
},
|
||||
{
|
||||
@ -290,6 +296,7 @@ const nsKeyToJavaModifierTable[] =
|
||||
55,
|
||||
54,
|
||||
java_awt_event_InputEvent_META_DOWN_MASK,
|
||||
java_awt_event_InputEvent_META_MASK,
|
||||
java_awt_event_KeyEvent_VK_META
|
||||
},
|
||||
// NSNumericPadKeyMask
|
||||
@ -298,10 +305,11 @@ const nsKeyToJavaModifierTable[] =
|
||||
0,
|
||||
0,
|
||||
0, // no Java equivalent
|
||||
0, // no Java equivalent
|
||||
java_awt_event_KeyEvent_VK_HELP
|
||||
},
|
||||
// NSFunctionKeyMask
|
||||
{0, 0, 0, 0, 0}
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
/*
|
||||
@ -371,26 +379,67 @@ NsCharToJavaChar(unichar nsChar, NSUInteger modifiers)
|
||||
return nsChar;
|
||||
}
|
||||
|
||||
static unichar NsGetDeadKeyChar(unsigned short keyCode)
|
||||
{
|
||||
TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource();
|
||||
CFDataRef uchr = (CFDataRef)TISGetInputSourceProperty(currentKeyboard, kTISPropertyUnicodeKeyLayoutData);
|
||||
const UCKeyboardLayout *keyboardLayout = (const UCKeyboardLayout*)CFDataGetBytePtr(uchr);
|
||||
// Carbon modifiers should be used instead of NSEvent modifiers
|
||||
UInt32 modifierKeyState = (GetCurrentEventKeyModifiers() >> 8) & 0xFF;
|
||||
|
||||
if (keyboardLayout) {
|
||||
UInt32 deadKeyState = 0;
|
||||
UniCharCount maxStringLength = 255;
|
||||
UniCharCount actualStringLength = 0;
|
||||
UniChar unicodeString[maxStringLength];
|
||||
|
||||
// get the deadKeyState
|
||||
OSStatus status = UCKeyTranslate(keyboardLayout,
|
||||
keyCode, kUCKeyActionDown, modifierKeyState,
|
||||
LMGetKbdType(), kUCKeyTranslateNoDeadKeysBit,
|
||||
&deadKeyState,
|
||||
maxStringLength,
|
||||
&actualStringLength, unicodeString);
|
||||
|
||||
if (status == noErr && deadKeyState != 0) {
|
||||
// Press SPACE to get the dead key char
|
||||
status = UCKeyTranslate(keyboardLayout,
|
||||
kVK_Space, kUCKeyActionDown, 0,
|
||||
LMGetKbdType(), 0,
|
||||
&deadKeyState,
|
||||
maxStringLength,
|
||||
&actualStringLength, unicodeString);
|
||||
|
||||
if (status == noErr && actualStringLength > 0) {
|
||||
return unicodeString[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the function that uses the table above to take incoming
|
||||
* NSEvent keyCodes and translate to the Java virtual key code.
|
||||
*/
|
||||
static void
|
||||
NsCharToJavaVirtualKeyCode(unichar ch, unichar deadChar,
|
||||
NsCharToJavaVirtualKeyCode(unichar ch, BOOL isDeadChar,
|
||||
NSUInteger flags, unsigned short key,
|
||||
jint *keyCode, jint *keyLocation, BOOL *postsTyped)
|
||||
jint *keyCode, jint *keyLocation, BOOL *postsTyped, unichar *deadChar)
|
||||
{
|
||||
static size_t size = sizeof(keyTable) / sizeof(struct _key);
|
||||
NSInteger offset;
|
||||
|
||||
if (deadChar) {
|
||||
if (isDeadChar) {
|
||||
unichar testDeadChar = NsGetDeadKeyChar(key);
|
||||
const struct CharToVKEntry *map;
|
||||
for (map = charToDeadVKTable; map->c != 0; ++map) {
|
||||
if (deadChar == map->c) {
|
||||
if (testDeadChar == map->c) {
|
||||
*keyCode = map->javaKey;
|
||||
*postsTyped = NO;
|
||||
// TODO: use UNKNOWN here?
|
||||
*keyLocation = java_awt_event_KeyEvent_KEY_LOCATION_UNKNOWN;
|
||||
*deadChar = testDeadChar;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -491,25 +540,51 @@ NsKeyModifiersToJavaKeyInfo(NSUInteger nsFlags, unsigned short eventKeyCode,
|
||||
/*
|
||||
* This returns the java modifiers for a key NSEvent.
|
||||
*/
|
||||
static jint
|
||||
NsKeyModifiersToJavaModifiers(NSUInteger nsFlags)
|
||||
jint NsKeyModifiersToJavaModifiers(NSUInteger nsFlags, BOOL isExtMods)
|
||||
{
|
||||
jint javaModifiers = 0;
|
||||
const struct _nsKeyToJavaModifier* cur;
|
||||
|
||||
for (cur = nsKeyToJavaModifierTable; cur->nsMask != 0; ++cur) {
|
||||
if ((cur->nsMask & nsFlags) != 0) {
|
||||
javaModifiers |= cur->javaMask;
|
||||
javaModifiers |= isExtMods? cur->javaExtMask : cur->javaMask;
|
||||
}
|
||||
}
|
||||
|
||||
return javaModifiers;
|
||||
}
|
||||
|
||||
/*
|
||||
* This returns the NSEvent flags for java key modifiers.
|
||||
*/
|
||||
NSUInteger JavaModifiersToNsKeyModifiers(jint javaModifiers, BOOL isExtMods)
|
||||
{
|
||||
NSUInteger nsFlags = 0;
|
||||
const struct _nsKeyToJavaModifier* cur;
|
||||
|
||||
for (cur = nsKeyToJavaModifierTable; cur->nsMask != 0; ++cur) {
|
||||
jint mask = isExtMods? cur->javaExtMask : cur->javaMask;
|
||||
if ((mask & javaModifiers) != 0) {
|
||||
nsFlags |= cur->nsMask;
|
||||
}
|
||||
}
|
||||
|
||||
// special case
|
||||
jint mask = isExtMods? java_awt_event_InputEvent_ALT_GRAPH_DOWN_MASK :
|
||||
java_awt_event_InputEvent_ALT_GRAPH_MASK;
|
||||
|
||||
if ((mask & javaModifiers) != 0) {
|
||||
nsFlags |= NSAlternateKeyMask;
|
||||
}
|
||||
|
||||
return nsFlags;
|
||||
}
|
||||
|
||||
|
||||
jint GetJavaMouseModifiers(NSInteger button, NSUInteger modifierFlags)
|
||||
{
|
||||
// Mousing needs the key modifiers
|
||||
jint modifiers = NsKeyModifiersToJavaModifiers(modifierFlags);
|
||||
jint modifiers = NsKeyModifiersToJavaModifiers(modifierFlags, YES);
|
||||
|
||||
|
||||
/*
|
||||
@ -590,7 +665,7 @@ Java_sun_lwawt_macosx_event_NSEvent_nsToJavaKeyModifiers
|
||||
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
jmodifiers = NsKeyModifiersToJavaModifiers(modifierFlags);
|
||||
jmodifiers = NsKeyModifiersToJavaModifiers(modifierFlags, YES);
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
|
||||
@ -615,20 +690,22 @@ JNF_COCOA_ENTER(env);
|
||||
|
||||
// in = [testChar, testDeadChar, modifierFlags, keyCode]
|
||||
jchar testChar = (jchar)data[0];
|
||||
jchar testDeadChar = (jchar)data[1];
|
||||
BOOL isDeadChar = (data[1] != 0);
|
||||
jint modifierFlags = data[2];
|
||||
jshort keyCode = (jshort)data[3];
|
||||
|
||||
jint jkeyCode = java_awt_event_KeyEvent_VK_UNDEFINED;
|
||||
jint jkeyLocation = java_awt_event_KeyEvent_KEY_LOCATION_UNKNOWN;
|
||||
jchar testDeadChar = 0;
|
||||
|
||||
NsCharToJavaVirtualKeyCode((unichar)testChar, (unichar)testDeadChar,
|
||||
NsCharToJavaVirtualKeyCode((unichar)testChar, isDeadChar,
|
||||
(NSUInteger)modifierFlags, (unsigned short)keyCode,
|
||||
&jkeyCode, &jkeyLocation, &postsTyped);
|
||||
&jkeyCode, &jkeyLocation, &postsTyped, &testDeadChar);
|
||||
|
||||
// out = [jkeyCode, jkeyLocation];
|
||||
(*env)->SetIntArrayRegion(env, outData, 0, 1, &jkeyCode);
|
||||
(*env)->SetIntArrayRegion(env, outData, 1, 1, &jkeyLocation);
|
||||
(*env)->SetIntArrayRegion(env, outData, 2, 1, (jint *)&testDeadChar);
|
||||
|
||||
(*env)->ReleaseIntArrayElements(env, inData, data, 0);
|
||||
|
||||
@ -685,12 +762,12 @@ Java_sun_lwawt_macosx_event_NSEvent_nsToJavaChar
|
||||
(JNIEnv *env, jclass cls, char nsChar, jint modifierFlags)
|
||||
{
|
||||
jchar javaChar = 0;
|
||||
|
||||
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
|
||||
javaChar = NsCharToJavaChar(nsChar, modifierFlags);
|
||||
|
||||
JNF_COCOA_EXIT(env);
|
||||
|
||||
|
||||
return javaChar;
|
||||
}
|
||||
|
@ -178,8 +178,8 @@ AWT_NS_WINDOW_IMPLEMENTATION
|
||||
[self.nsWindow setDocumentEdited:IS(bits, DOCUMENT_MODIFIED)];
|
||||
}
|
||||
|
||||
if ([self.nsWindow respondsToSelector:@selector(toggleFullScreen:)]) {
|
||||
if (IS(mask, FULLSCREENABLE)) {
|
||||
if (IS(mask, FULLSCREENABLE) && [self.nsWindow respondsToSelector:@selector(toggleFullScreen:)]) {
|
||||
if (IS(bits, FULLSCREENABLE)) {
|
||||
[self.nsWindow setCollectionBehavior:(1 << 7) /*NSWindowCollectionBehaviorFullScreenPrimary*/];
|
||||
} else {
|
||||
[self.nsWindow setCollectionBehavior:NSWindowCollectionBehaviorDefault];
|
||||
|
@ -460,7 +460,7 @@ static BOOL sNeedsEnter;
|
||||
}
|
||||
|
||||
// Convert fModifiers (extModifiers) to NS:
|
||||
NSUInteger modifiers = [DnDUtilities mapJavaExtModifiersToNSKeyModifiers:fModifiers];
|
||||
NSUInteger modifiers = JavaModifiersToNsKeyModifiers(fModifiers, TRUE);
|
||||
|
||||
// Just a dummy value ...
|
||||
NSInteger eventNumber = 0;
|
||||
@ -658,7 +658,7 @@ JNF_COCOA_ENTER(env);
|
||||
}
|
||||
|
||||
// b) drag actions (key modifiers) have changed:
|
||||
jint modifiers = [DnDUtilities currentJavaExtKeyModifiers];
|
||||
jint modifiers = NsKeyModifiersToJavaModifiers([NSEvent modifierFlags], YES);
|
||||
if (fDragKeyModifiers != modifiers) {
|
||||
NSDragOperation currentOp = [DnDUtilities nsDragOperationForModifiers:[NSEvent modifierFlags]];
|
||||
NSDragOperation allowedOp = [DnDUtilities mapJavaDragOperationToNS:fSourceActions] & currentOp;
|
||||
|
@ -70,6 +70,18 @@ AWT_ASSERT_APPKIT_THREAD;
|
||||
JNIEnv *env = [ThreadUtilities getJNIEnv];
|
||||
JNF_COCOA_ENTER(env);
|
||||
|
||||
// If we are called as a result of user pressing a shorcut, do nothing,
|
||||
// because AVTView has already sent corresponding key event to the Java
|
||||
// layer from performKeyEquivalent
|
||||
NSEvent *currEvent = [[NSApplication sharedApplication] currentEvent];
|
||||
if ([currEvent type] == NSKeyDown) {
|
||||
NSString *menuKey = [sender keyEquivalent];
|
||||
NSString *eventKey = [currEvent characters];
|
||||
if ([menuKey isEqualToString:eventKey]) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (fIsCheckbox) {
|
||||
static JNF_CLASS_CACHE(jc_CCheckboxMenuItem, "sun/lwawt/macosx/CCheckboxMenuItem");
|
||||
static JNF_MEMBER_CACHE(jm_ckHandleAction, jc_CCheckboxMenuItem, "handleAction", "(Z)V");
|
||||
@ -83,14 +95,8 @@ JNF_COCOA_ENTER(env);
|
||||
static JNF_CLASS_CACHE(jc_CMenuItem, "sun/lwawt/macosx/CMenuItem");
|
||||
static JNF_MEMBER_CACHE(jm_handleAction, jc_CMenuItem, "handleAction", "(JI)V"); // AWT_THREADING Safe (event)
|
||||
|
||||
NSEvent *currEvent = [[NSApplication sharedApplication] currentEvent];
|
||||
NSUInteger modifiers = [currEvent modifierFlags];
|
||||
jint javaModifiers = 0;
|
||||
|
||||
if ((modifiers & NSCommandKeyMask) != 0) javaModifiers |= java_awt_Event_META_MASK;
|
||||
if ((modifiers & NSShiftKeyMask) != 0) javaModifiers |= java_awt_Event_SHIFT_MASK;
|
||||
if ((modifiers & NSControlKeyMask) != 0) javaModifiers |= java_awt_Event_CTRL_MASK;
|
||||
if ((modifiers & NSAlternateKeyMask) != 0) javaModifiers |= java_awt_Event_ALT_MASK;
|
||||
jint javaModifiers = NsKeyModifiersToJavaModifiers(modifiers, NO);
|
||||
|
||||
JNFCallVoidMethod(env, fPeer, jm_handleAction, UTC(currEvent), javaModifiers); // AWT_THREADING Safe (event)
|
||||
}
|
||||
@ -117,10 +123,7 @@ AWT_ASSERT_NOT_APPKIT_THREAD;
|
||||
modifiers &= ~java_awt_event_KeyEvent_SHIFT_MASK;
|
||||
}
|
||||
|
||||
if ((modifiers & java_awt_event_KeyEvent_SHIFT_MASK) != 0) modifierMask |= NSShiftKeyMask;
|
||||
if ((modifiers & java_awt_event_KeyEvent_CTRL_MASK) != 0) modifierMask |= NSControlKeyMask;
|
||||
if ((modifiers & java_awt_event_KeyEvent_ALT_MASK) != 0) modifierMask |= NSAlternateKeyMask;
|
||||
if ((modifiers & java_awt_event_KeyEvent_META_MASK) != 0) modifierMask |= NSCommandKeyMask;
|
||||
modifierMask = JavaModifiersToNsKeyModifiers(modifiers, NO);
|
||||
}
|
||||
|
||||
[JNFRunLoop performOnMainThreadWaiting:YES withBlock:^(){
|
||||
|
@ -239,9 +239,22 @@ void JavaCT_DrawTextUsingQSD(JNIEnv *env, const QuartzSDOps *qsdo, const AWTStri
|
||||
CGContextSetTextMatrix(cgRef, CGAffineTransformIdentity); // resets the damage from CoreText
|
||||
|
||||
NSString *string = [NSString stringWithCharacters:chars length:length];
|
||||
/*
|
||||
The calls below were used previously but for unknown reason did not
|
||||
render using the right font (see bug 7183516) when attribString is not
|
||||
initialized with font dictionary attributes. It seems that "options"
|
||||
in CTTypesetterCreateWithAttributedStringAndOptions which contains the
|
||||
font dictionary is ignored.
|
||||
|
||||
NSAttributedString *attribString = [[NSAttributedString alloc] initWithString:string];
|
||||
|
||||
CTTypesetterRef typeSetterRef = CTTypesetterCreateWithAttributedStringAndOptions((CFAttributedStringRef) attribString, (CFDictionaryRef) ctsDictionaryFor(nsFont, JRSFontStyleUsesFractionalMetrics(strike->fStyle)));
|
||||
*/
|
||||
NSAttributedString *attribString = [[NSAttributedString alloc]
|
||||
initWithString:string
|
||||
attributes:ctsDictionaryFor(nsFont, JRSFontStyleUsesFractionalMetrics(strike->fStyle))];
|
||||
|
||||
CTTypesetterRef typeSetterRef = CTTypesetterCreateWithAttributedString((CFAttributedStringRef) attribString);
|
||||
|
||||
CFRange range = {0, length};
|
||||
CTLineRef lineRef = CTTypesetterCreateLine(typeSetterRef, range);
|
||||
|
@ -42,7 +42,6 @@
|
||||
+ (jint)narrowJavaDropActions:(jint)actions;
|
||||
|
||||
// Mouse and key modifiers mapping:
|
||||
+ (NSUInteger)mapJavaExtModifiersToNSKeyModifiers:(jint)modifiers;
|
||||
+ (NSUInteger)mapJavaExtModifiersToNSMouseDownButtons:(jint)modifiers;
|
||||
+ (NSUInteger)mapJavaExtModifiersToNSMouseUpButtons:(jint)modifiers;
|
||||
|
||||
@ -50,9 +49,6 @@
|
||||
+ (jint)extractJavaExtKeyModifiersFromJavaExtModifiers:(jint)modifiers;
|
||||
+ (jint)extractJavaExtMouseModifiersFromJavaExtModifiers:(jint)modifiers;
|
||||
|
||||
// Get the current keyboard modifier keys as java modifiers (for operationChanged)
|
||||
+ (jint)currentJavaExtKeyModifiers;
|
||||
|
||||
// Getting the state of the current Drag
|
||||
+ (NSDragOperation)nsDragOperationForModifiers:(NSUInteger)modifiers;
|
||||
+ (jint) javaKeyModifiersForNSDragOperation:(NSDragOperation)dragOp;
|
||||
|
@ -161,28 +161,6 @@ There are several problems with Drag and Drop - notably, the mismatch between Ja
|
||||
}
|
||||
|
||||
// Mouse and key modifiers mapping:
|
||||
+ (NSUInteger)mapJavaExtModifiersToNSKeyModifiers:(jint)modifiers
|
||||
{
|
||||
NSUInteger result = 0;
|
||||
|
||||
if ((modifiers & java_awt_event_InputEvent_SHIFT_DOWN_MASK) != 0)
|
||||
result |= NSShiftKeyMask;
|
||||
|
||||
if ((modifiers & java_awt_event_InputEvent_CTRL_DOWN_MASK) != 0)
|
||||
result |= NSControlKeyMask;
|
||||
|
||||
if ((modifiers & java_awt_event_InputEvent_META_DOWN_MASK) != 0)
|
||||
result |= NSCommandKeyMask;
|
||||
|
||||
if ((modifiers & java_awt_event_InputEvent_ALT_DOWN_MASK) != 0)
|
||||
result |= NSAlternateKeyMask;
|
||||
|
||||
if ((modifiers & java_awt_event_InputEvent_ALT_GRAPH_DOWN_MASK) != 0)
|
||||
result |= NSAlternateKeyMask;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
+ (NSUInteger)mapJavaExtModifiersToNSMouseDownButtons:(jint)modifiers
|
||||
{
|
||||
NSUInteger result = NSLeftMouseDown;
|
||||
@ -245,32 +223,6 @@ There are several problems with Drag and Drop - notably, the mismatch between Ja
|
||||
return modifiers & mask;
|
||||
}
|
||||
|
||||
|
||||
+ (jint)currentJavaExtKeyModifiers
|
||||
{
|
||||
NSUInteger modifiers = [NSEvent modifierFlags];
|
||||
jint jmodifiers = 0;
|
||||
|
||||
if(modifiers & NSShiftKeyMask) {
|
||||
jmodifiers |= java_awt_event_InputEvent_SHIFT_DOWN_MASK;
|
||||
}
|
||||
|
||||
if(modifiers & NSControlKeyMask) {
|
||||
jmodifiers |= java_awt_event_InputEvent_CTRL_DOWN_MASK;
|
||||
}
|
||||
|
||||
if(modifiers & NSAlternateKeyMask) {
|
||||
jmodifiers |= java_awt_event_InputEvent_ALT_DOWN_MASK;
|
||||
}
|
||||
|
||||
if(modifiers & NSCommandKeyMask) {
|
||||
jmodifiers |= java_awt_event_InputEvent_META_DOWN_MASK;
|
||||
}
|
||||
|
||||
return jmodifiers;
|
||||
}
|
||||
|
||||
|
||||
+ (NSDragOperation) nsDragOperationForModifiers:(NSUInteger)modifiers {
|
||||
|
||||
// Java first
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2012, 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
|
||||
@ -644,6 +644,9 @@ public class WindowsLookAndFeel extends BasicLookAndFeel
|
||||
"released SPACE", "released"
|
||||
}),
|
||||
|
||||
"Caret.width",
|
||||
new DesktopProperty("win.caret.width", null),
|
||||
|
||||
"CheckBox.font", ControlFont,
|
||||
"CheckBox.interiorBackground", WindowBackgroundColor,
|
||||
"CheckBox.background", ControlBackgroundColor,
|
||||
|
@ -883,7 +883,7 @@ class PackageWriter extends BandStructure {
|
||||
avHiBits &= (1L<<attrIndexLimit[i])-1;
|
||||
int nextLoBit = 0;
|
||||
Map<Attribute.Layout, int[]> defMap = allLayouts.get(i);
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
Map.Entry<Attribute.Layout, int[]>[] layoutsAndCounts =
|
||||
new Map.Entry[defMap.size()];
|
||||
defMap.entrySet().toArray(layoutsAndCounts);
|
||||
|
@ -32,14 +32,15 @@ import static javax.management.openmbean.SimpleType.*;
|
||||
|
||||
import com.sun.jmx.remote.util.EnvHelp;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.io.InvalidObjectException;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.GenericArrayType;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.lang.reflect.ParameterizedType;
|
||||
@ -1129,14 +1130,56 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
|
||||
to getters. */
|
||||
private static final class CompositeBuilderViaConstructor
|
||||
extends CompositeBuilder {
|
||||
static class AnnotationHelper {
|
||||
private static Class<? extends Annotation> constructorPropertiesClass;
|
||||
private static Method valueMethod;
|
||||
static {
|
||||
findConstructorPropertiesClass();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static void findConstructorPropertiesClass() {
|
||||
try {
|
||||
constructorPropertiesClass = (Class<? extends Annotation>)
|
||||
Class.forName("java.beans.ConstructorProperties", false,
|
||||
DefaultMXBeanMappingFactory.class.getClassLoader());
|
||||
valueMethod = constructorPropertiesClass.getMethod("value");
|
||||
} catch (ClassNotFoundException cnf) {
|
||||
// java.beans not present
|
||||
} catch (NoSuchMethodException e) {
|
||||
// should not reach here
|
||||
throw new InternalError(e);
|
||||
}
|
||||
}
|
||||
|
||||
static boolean isAvailable() {
|
||||
return constructorPropertiesClass != null;
|
||||
}
|
||||
|
||||
static String[] getPropertyNames(Constructor<?> constr) {
|
||||
if (!isAvailable())
|
||||
return null;
|
||||
|
||||
Annotation a = constr.getAnnotation(constructorPropertiesClass);
|
||||
if (a == null) return null;
|
||||
|
||||
try {
|
||||
return (String[]) valueMethod.invoke(a);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw new InternalError(e);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new InternalError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CompositeBuilderViaConstructor(Class<?> targetClass, String[] itemNames) {
|
||||
super(targetClass, itemNames);
|
||||
}
|
||||
|
||||
String applicable(Method[] getters) throws InvalidObjectException {
|
||||
|
||||
final Class<ConstructorProperties> propertyNamesClass = ConstructorProperties.class;
|
||||
if (!AnnotationHelper.isAvailable())
|
||||
return "@ConstructorProperties annotation not available";
|
||||
|
||||
Class<?> targetClass = getTargetClass();
|
||||
Constructor<?>[] constrs = targetClass.getConstructors();
|
||||
@ -1145,7 +1188,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
|
||||
List<Constructor<?>> annotatedConstrList = newList();
|
||||
for (Constructor<?> constr : constrs) {
|
||||
if (Modifier.isPublic(constr.getModifiers())
|
||||
&& constr.getAnnotation(propertyNamesClass) != null)
|
||||
&& AnnotationHelper.getPropertyNames(constr) != null)
|
||||
annotatedConstrList.add(constr);
|
||||
}
|
||||
|
||||
@ -1174,8 +1217,7 @@ public class DefaultMXBeanMappingFactory extends MXBeanMappingFactory {
|
||||
// so we can test unambiguity.
|
||||
Set<BitSet> getterIndexSets = newSet();
|
||||
for (Constructor<?> constr : annotatedConstrList) {
|
||||
String[] propertyNames =
|
||||
constr.getAnnotation(propertyNamesClass).value();
|
||||
String[] propertyNames = AnnotationHelper.getPropertyNames(constr);
|
||||
|
||||
Type[] paramTypes = constr.getGenericParameterTypes();
|
||||
if (paramTypes.length != propertyNames.length) {
|
||||
|
@ -178,7 +178,7 @@ public class VMOption {
|
||||
return "VM option: " + getName() +
|
||||
" value: " + value + " " +
|
||||
" origin: " + origin + " " +
|
||||
(writeable ? "(read-only)" : "(read-write)");
|
||||
(writeable ? "(read-write)" : "(read-only)");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -153,8 +153,8 @@ public final class Init {
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (Node el=config.getFirstChild();el!=null;el=el.getNextSibling()) {
|
||||
if (!(el instanceof Element)) {
|
||||
for (Node el=config.getFirstChild();el!=null;el=el.getNextSibling()) {
|
||||
if (el.getNodeType() != Node.ELEMENT_NODE) {
|
||||
continue;
|
||||
}
|
||||
String tag=el.getLocalName();
|
||||
|
@ -205,7 +205,7 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi {
|
||||
try {
|
||||
NameSpaceSymbTable ns=new NameSpaceSymbTable();
|
||||
int nodeLevel=NODE_BEFORE_DOCUMENT_ELEMENT;
|
||||
if (rootNode instanceof Element) {
|
||||
if (rootNode != null && rootNode.getNodeType() == Node.ELEMENT_NODE) {
|
||||
//Fills the nssymbtable with the definitions of the parent of the root subnode
|
||||
getParentNameSpaces((Element)rootNode,ns);
|
||||
nodeLevel=NODE_NOT_BEFORE_OR_AFTER_DOCUMENT_ELEMENT;
|
||||
@ -335,7 +335,7 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi {
|
||||
return;
|
||||
sibling=parentNode.getNextSibling();
|
||||
parentNode=parentNode.getParentNode();
|
||||
if (!(parentNode instanceof Element)) {
|
||||
if (parentNode !=null && parentNode.getNodeType() != Node.ELEMENT_NODE) {
|
||||
documentLevel=NODE_AFTER_DOCUMENT_ELEMENT;
|
||||
parentNode=null;
|
||||
}
|
||||
@ -391,7 +391,7 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi {
|
||||
return;
|
||||
boolean currentNodeIsVisible = false;
|
||||
NameSpaceSymbTable ns=new NameSpaceSymbTable();
|
||||
if (currentNode instanceof Element)
|
||||
if (currentNode != null && currentNode.getNodeType() == Node.ELEMENT_NODE)
|
||||
getParentNameSpaces((Element)currentNode,ns);
|
||||
Node sibling=null;
|
||||
Node parentNode=null;
|
||||
@ -512,7 +512,7 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi {
|
||||
return;
|
||||
sibling=parentNode.getNextSibling();
|
||||
parentNode=parentNode.getParentNode();
|
||||
if (!(parentNode instanceof Element)) {
|
||||
if (parentNode != null && parentNode.getNodeType() != Node.ELEMENT_NODE) {
|
||||
parentNode=null;
|
||||
documentLevel=NODE_AFTER_DOCUMENT_ELEMENT;
|
||||
}
|
||||
@ -594,18 +594,14 @@ public abstract class CanonicalizerBase extends CanonicalizerSpi {
|
||||
final void getParentNameSpaces(Element el,NameSpaceSymbTable ns) {
|
||||
List<Element> parents=new ArrayList<Element>(10);
|
||||
Node n1=el.getParentNode();
|
||||
if (!(n1 instanceof Element)) {
|
||||
if (n1 == null || n1.getNodeType() != Node.ELEMENT_NODE) {
|
||||
return;
|
||||
}
|
||||
//Obtain all the parents of the elemnt
|
||||
Element parent=(Element) n1;
|
||||
while (parent!=null) {
|
||||
parents.add(parent);
|
||||
Node n=parent.getParentNode();
|
||||
if (!(n instanceof Element )) {
|
||||
break;
|
||||
}
|
||||
parent=(Element)n;
|
||||
Node parent = n1;
|
||||
while (parent!=null && parent.getNodeType() == Node.ELEMENT_NODE) {
|
||||
parents.add((Element)parent);
|
||||
parent = parent.getParentNode();
|
||||
}
|
||||
//Visit them in reverse order.
|
||||
ListIterator<Element> it=parents.listIterator(parents.size());
|
||||
|
@ -1445,7 +1445,7 @@ public class XMLCipher {
|
||||
// The de-serialiser returns a fragment whose children we need to
|
||||
// take on.
|
||||
|
||||
if (sourceParent instanceof Document) {
|
||||
if (sourceParent != null && sourceParent.getNodeType() == Node.DOCUMENT_NODE) {
|
||||
|
||||
// If this is a content decryption, this may have problems
|
||||
|
||||
|
@ -283,7 +283,7 @@ public class RetrievalMethodResolver extends KeyResolverSpi {
|
||||
Element e=null;
|
||||
while (it.hasNext()) {
|
||||
Node currentNode=it.next();
|
||||
if (currentNode instanceof Element) {
|
||||
if (currentNode != null && currentNode.getNodeType() == Node.ELEMENT_NODE) {
|
||||
e=(Element)currentNode;
|
||||
break;
|
||||
}
|
||||
@ -292,14 +292,14 @@ public class RetrievalMethodResolver extends KeyResolverSpi {
|
||||
List<Element> parents=new ArrayList<Element>(10);
|
||||
|
||||
//Obtain all the parents of the elemnt
|
||||
do {
|
||||
while (e != null) {
|
||||
parents.add(e);
|
||||
Node n=e.getParentNode();
|
||||
if (!(n instanceof Element )) {
|
||||
if (n == null || n.getNodeType() != Node.ELEMENT_NODE) {
|
||||
break;
|
||||
}
|
||||
e=(Element)n;
|
||||
} while (e!=null);
|
||||
}
|
||||
//Visit them in reverse order.
|
||||
ListIterator<Element> it2=parents.listIterator(parents.size()-1);
|
||||
Element ele=null;
|
||||
|
@ -225,7 +225,7 @@ public class IdResolver {
|
||||
} while (sibling==null && parentNode!=null) {
|
||||
sibling=parentNode.getNextSibling();
|
||||
parentNode=parentNode.getParentNode();
|
||||
if (!(parentNode instanceof Element)) {
|
||||
if (parentNode != null && parentNode.getNodeType() != Node.ELEMENT_NODE) {
|
||||
parentNode=null;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2012, 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
|
||||
@ -31,7 +31,6 @@ import javax.naming.*;
|
||||
import java.io.*;
|
||||
import java.math.*;
|
||||
import java.util.*;
|
||||
import java.beans.*;
|
||||
|
||||
import javax.sql.rowset.*;
|
||||
|
||||
@ -83,12 +82,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
|
||||
*/
|
||||
private ResultSetMetaData resMD;
|
||||
|
||||
/**
|
||||
* The property that helps to fire the property changed event when certain
|
||||
* properties are changed in the <code>JdbcRowSet</code> object. This property
|
||||
* is being added to satisfy Rave requirements.
|
||||
*/
|
||||
private PropertyChangeSupport propertyChangeSupport;
|
||||
|
||||
/**
|
||||
* The Vector holding the Match Columns
|
||||
@ -145,7 +138,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
|
||||
throw new RuntimeException(ioe);
|
||||
}
|
||||
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
|
||||
initParams();
|
||||
|
||||
@ -268,7 +260,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
|
||||
throw new RuntimeException(ioe);
|
||||
}
|
||||
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
|
||||
initParams();
|
||||
// set the defaults
|
||||
@ -343,7 +334,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
|
||||
throw new RuntimeException(ioe);
|
||||
}
|
||||
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
|
||||
initParams();
|
||||
|
||||
@ -360,10 +350,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
|
||||
setMaxRows(0);
|
||||
setMaxFieldSize(0);
|
||||
|
||||
// to ensure connection to a db call connect now
|
||||
// and associate a conn with "this" object
|
||||
// in this case.
|
||||
conn = connect();
|
||||
setParams();
|
||||
|
||||
setReadOnly(true);
|
||||
@ -435,7 +421,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
|
||||
throw new RuntimeException(ioe);
|
||||
}
|
||||
|
||||
propertyChangeSupport = new PropertyChangeSupport(this);
|
||||
|
||||
initParams();
|
||||
|
||||
@ -620,12 +605,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
|
||||
|
||||
}
|
||||
|
||||
// An alternate solution is required instead of having the
|
||||
// connect method as protected.
|
||||
// This is a work around to assist Rave Team
|
||||
// :ah
|
||||
|
||||
protected Connection connect() throws SQLException {
|
||||
private Connection connect() throws SQLException {
|
||||
|
||||
// Get a JDBC connection.
|
||||
|
||||
@ -4056,9 +4036,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
|
||||
// Added as per Rave requirements
|
||||
|
||||
if( conn.getHoldability() != HOLD_CURSORS_OVER_COMMIT) {
|
||||
ResultSet oldVal = rs;
|
||||
rs = null;
|
||||
// propertyChangeSupport.firePropertyChange("ResultSet",oldVal,rs);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4119,9 +4097,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
|
||||
// Makes the result ste handle null after rollback
|
||||
// Added as per Rave requirements
|
||||
|
||||
ResultSet oldVal = rs;
|
||||
rs = null;
|
||||
// propertyChangeSupport.firePropertyChange("ResultSet", oldVal,rs);
|
||||
}
|
||||
|
||||
|
||||
@ -4247,12 +4223,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
|
||||
rs = resultSet;
|
||||
}
|
||||
|
||||
|
||||
// Over riding the setCommand from BaseRowSet for
|
||||
// firing the propertyChangeSupport Event for
|
||||
// Rave requirements when this property's value
|
||||
// changes.
|
||||
|
||||
/**
|
||||
* Sets this <code>JdbcRowSet</code> object's <code>command</code> property to
|
||||
* the given <code>String</code> object and clears the parameters, if any,
|
||||
@ -4277,28 +4247,19 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
|
||||
* @see #getCommand
|
||||
*/
|
||||
public void setCommand(String command) throws SQLException {
|
||||
String oldVal;
|
||||
|
||||
if (getCommand() != null) {
|
||||
if(!getCommand().equals(command)) {
|
||||
oldVal = getCommand();
|
||||
super.setCommand(command);
|
||||
ps = null;
|
||||
rs = null;
|
||||
propertyChangeSupport.firePropertyChange("command", oldVal,command);
|
||||
}
|
||||
}
|
||||
else {
|
||||
super.setCommand(command);
|
||||
propertyChangeSupport.firePropertyChange("command", null,command);
|
||||
}
|
||||
}
|
||||
|
||||
// Over riding the setDataSourceName from BaseRowSet for
|
||||
// firing the propertyChangeSupport Event for
|
||||
// Rave requirements when this property's values
|
||||
// changes.
|
||||
|
||||
/**
|
||||
* Sets the <code>dataSourceName</code> property for this <code>JdbcRowSet</code>
|
||||
* object to the given logical name and sets this <code>JdbcRowSet</code> object's
|
||||
@ -4329,28 +4290,20 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
|
||||
* @see #getDataSourceName
|
||||
*/
|
||||
public void setDataSourceName(String dsName) throws SQLException{
|
||||
String oldVal;
|
||||
|
||||
if(getDataSourceName() != null) {
|
||||
if(!getDataSourceName().equals(dsName)) {
|
||||
oldVal = getDataSourceName();
|
||||
super.setDataSourceName(dsName);
|
||||
conn = null;
|
||||
ps = null;
|
||||
rs = null;
|
||||
propertyChangeSupport.firePropertyChange("dataSourceName",oldVal,dsName);
|
||||
}
|
||||
}
|
||||
else {
|
||||
super.setDataSourceName(dsName);
|
||||
propertyChangeSupport.firePropertyChange("dataSourceName",null,dsName);
|
||||
}
|
||||
}
|
||||
|
||||
// Over riding the setUrl from BaseRowSet for
|
||||
// firing the propertyChangeSupport Event for
|
||||
// Rave requirements when this property's values
|
||||
// changes.
|
||||
|
||||
/**
|
||||
* Sets the Url property for this <code>JdbcRowSet</code> object
|
||||
@ -4394,29 +4347,20 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
|
||||
*/
|
||||
|
||||
public void setUrl(String url) throws SQLException {
|
||||
String oldVal;
|
||||
|
||||
if(getUrl() != null) {
|
||||
if(!getUrl().equals(url)) {
|
||||
oldVal = getUrl();
|
||||
super.setUrl(url);
|
||||
conn = null;
|
||||
ps = null;
|
||||
rs = null;
|
||||
propertyChangeSupport.firePropertyChange("url", oldVal, url);
|
||||
}
|
||||
}
|
||||
else {
|
||||
super.setUrl(url);
|
||||
propertyChangeSupport.firePropertyChange("url", null, url);
|
||||
}
|
||||
}
|
||||
|
||||
// Over riding the setUsername from BaseRowSet for
|
||||
// firing the propertyChangeSupport Event for
|
||||
// Rave requirements when this property's values
|
||||
// changes.
|
||||
|
||||
/**
|
||||
* Sets the username property for this <code>JdbcRowSet</code> object
|
||||
* to the given user name. Because it
|
||||
@ -4438,29 +4382,20 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
|
||||
* @see #getUsername
|
||||
*/
|
||||
public void setUsername(String uname) {
|
||||
String oldVal;
|
||||
|
||||
if( getUsername() != null) {
|
||||
if(!getUsername().equals(uname)) {
|
||||
oldVal = getUsername();
|
||||
super.setUsername(uname);
|
||||
conn = null;
|
||||
ps = null;
|
||||
rs = null;
|
||||
propertyChangeSupport.firePropertyChange("username",oldVal,uname);
|
||||
}
|
||||
}
|
||||
else{
|
||||
super.setUsername(uname);
|
||||
propertyChangeSupport.firePropertyChange("username",null,uname);
|
||||
}
|
||||
}
|
||||
|
||||
// Over riding the setPassword from BaseRowSet for
|
||||
// firing the propertyChangeSupport Event for
|
||||
// Rave requirements when this property's values
|
||||
// changes.
|
||||
|
||||
/**
|
||||
* Sets the password property for this <code>JdbcRowSet</code> object
|
||||
* to the given <code>String</code> object. Because it
|
||||
@ -4481,21 +4416,17 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
|
||||
* that must be supplied to the database to create a connection
|
||||
*/
|
||||
public void setPassword(String password) {
|
||||
String oldVal;
|
||||
|
||||
if ( getPassword() != null) {
|
||||
if(!getPassword().equals(password)) {
|
||||
oldVal = getPassword();
|
||||
super.setPassword(password);
|
||||
conn = null;
|
||||
ps = null;
|
||||
rs = null;
|
||||
propertyChangeSupport.firePropertyChange("password",oldVal,password);
|
||||
}
|
||||
}
|
||||
else{
|
||||
super.setPassword(password);
|
||||
propertyChangeSupport.firePropertyChange("password",null,password);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4528,7 +4459,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
|
||||
|
||||
if(oldVal != type) {
|
||||
super.setType(type);
|
||||
propertyChangeSupport.firePropertyChange("type",oldVal,type);
|
||||
}
|
||||
|
||||
}
|
||||
@ -4561,78 +4491,6 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
|
||||
|
||||
if(oldVal != concur) {
|
||||
super.setConcurrency(concur);
|
||||
propertyChangeSupport.firePropertyChange("concurrency",oldVal,concur);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the transaction isolation property for this JDBC <code>RowSet</code> object to the given
|
||||
* constant. The DBMS will use this transaction isolation level for
|
||||
* transactions if it can.
|
||||
* <p>
|
||||
* For <code>RowSet</code> implementations such as
|
||||
* the <code>CachedRowSet</code> that operate in a disconnected environment,
|
||||
* the <code>SyncProvider</code> object being used
|
||||
* offers complementary locking and data integrity options. The
|
||||
* options described below are pertinent only to connected <code>RowSet</code>
|
||||
* objects (<code>JdbcRowSet</code> objects).
|
||||
*
|
||||
* @param transIso one of the following constants, listed in ascending order:
|
||||
* <code>Connection.TRANSACTION_NONE</code>,
|
||||
* <code>Connection.TRANSACTION_READ_UNCOMMITTED</code>,
|
||||
* <code>Connection.TRANSACTION_READ_COMMITTED</code>,
|
||||
* <code>Connection.TRANSACTION_REPEATABLE_READ</code>, or
|
||||
* <code>Connection.TRANSACTION_SERIALIZABLE</code>
|
||||
* @throws SQLException if the given parameter is not one of the Connection
|
||||
* constants
|
||||
* @see javax.sql.rowset.spi.SyncFactory
|
||||
* @see javax.sql.rowset.spi.SyncProvider
|
||||
* @see #getTransactionIsolation
|
||||
*/
|
||||
public void setTransactionIsolation(int transIso) throws SQLException {
|
||||
|
||||
int oldVal;
|
||||
|
||||
try {
|
||||
oldVal = getTransactionIsolation();
|
||||
}catch(NullPointerException ex) {
|
||||
oldVal = 0;
|
||||
}
|
||||
|
||||
if(oldVal != transIso) {
|
||||
super.setTransactionIsolation(transIso);
|
||||
propertyChangeSupport.firePropertyChange("transactionIsolation",oldVal,transIso);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the maximum number of rows that this <code>RowSet</code> object may contain to
|
||||
* the given number. If this limit is exceeded, the excess rows are
|
||||
* silently dropped.
|
||||
*
|
||||
* @param mRows an <code>int</code> indicating the current maximum number
|
||||
* of rows; zero means that there is no limit
|
||||
* @throws SQLException if an error occurs internally setting the
|
||||
* maximum limit on the number of rows that a JDBC <code>RowSet</code> object
|
||||
* can contain; or if <i>max</i> is less than <code>0</code>; or
|
||||
* if <i>max</i> is less than the <code>fetchSize</code> of the
|
||||
* <code>RowSet</code>
|
||||
*/
|
||||
public void setMaxRows(int mRows) throws SQLException {
|
||||
|
||||
int oldVal;
|
||||
|
||||
try {
|
||||
oldVal = getMaxRows();
|
||||
}catch(NullPointerException ex) {
|
||||
oldVal = 0;
|
||||
}
|
||||
|
||||
if(oldVal != mRows) {
|
||||
super.setMaxRows(mRows);
|
||||
propertyChangeSupport.firePropertyChange("maxRows",oldVal,mRows);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -52,7 +52,9 @@ import javax.swing.JTextField;
|
||||
* This can be used by a JAAS application to instantiate a
|
||||
* CallbackHandler
|
||||
* @see javax.security.auth.callback
|
||||
* @deprecated This class will be removed in a future release.
|
||||
*/
|
||||
@Deprecated
|
||||
public class DialogCallbackHandler implements CallbackHandler {
|
||||
|
||||
/* -- Fields -- */
|
||||
|
@ -1046,6 +1046,10 @@ public class EventQueue {
|
||||
}
|
||||
|
||||
final boolean detachDispatchThread(EventDispatchThread edt, boolean forceDetach) {
|
||||
/*
|
||||
* Minimize discard possibility for non-posted events
|
||||
*/
|
||||
SunToolkit.flushPendingEvents();
|
||||
/*
|
||||
* This synchronized block is to secure that the event dispatch
|
||||
* thread won't die in the middle of posting a new event to the
|
||||
@ -1060,11 +1064,8 @@ public class EventQueue {
|
||||
/*
|
||||
* Don't detach the thread if any events are pending. Not
|
||||
* sure if it's a possible scenario, though.
|
||||
*
|
||||
* Fix for 4648733. Check both the associated java event
|
||||
* queue and the PostEventQueue.
|
||||
*/
|
||||
if (!forceDetach && (peekEvent() != null) || !SunToolkit.isPostEventQueueEmpty()) {
|
||||
if (!forceDetach && (peekEvent() != null)) {
|
||||
return false;
|
||||
}
|
||||
dispatchThread = null;
|
||||
|
@ -495,6 +495,16 @@ public class IndexedPropertyDescriptor extends PropertyDescriptor {
|
||||
indexedReadMethodName = old.indexedReadMethodName;
|
||||
}
|
||||
|
||||
void updateGenericsFor(Class<?> type) {
|
||||
super.updateGenericsFor(type);
|
||||
try {
|
||||
setIndexedPropertyType(findIndexedPropertyType(getIndexedReadMethod0(), getIndexedWriteMethod0()));
|
||||
}
|
||||
catch (IntrospectionException exception) {
|
||||
setIndexedPropertyType(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a hash code value for the object.
|
||||
* See {@link java.lang.Object#hashCode} for a complete description.
|
||||
|
@ -574,26 +574,25 @@ public class Introspector {
|
||||
// replace existing property descriptor
|
||||
// only if we have types to resolve
|
||||
// in the context of this.beanClass
|
||||
try {
|
||||
String name = pd.getName();
|
||||
Method read = pd.getReadMethod();
|
||||
Method write = pd.getWriteMethod();
|
||||
boolean cls = true;
|
||||
if (read != null) cls = cls && read.getGenericReturnType() instanceof Class;
|
||||
if (write != null) cls = cls && write.getGenericParameterTypes()[0] instanceof Class;
|
||||
if (pd instanceof IndexedPropertyDescriptor) {
|
||||
IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor)pd;
|
||||
Method readI = ipd.getIndexedReadMethod();
|
||||
Method writeI = ipd.getIndexedWriteMethod();
|
||||
if (readI != null) cls = cls && readI.getGenericReturnType() instanceof Class;
|
||||
if (writeI != null) cls = cls && writeI.getGenericParameterTypes()[1] instanceof Class;
|
||||
if (!cls) {
|
||||
pd = new IndexedPropertyDescriptor(this.beanClass, name, read, write, readI, writeI);
|
||||
}
|
||||
} else if (!cls) {
|
||||
pd = new PropertyDescriptor(this.beanClass, name, read, write);
|
||||
Method read = pd.getReadMethod();
|
||||
Method write = pd.getWriteMethod();
|
||||
boolean cls = true;
|
||||
if (read != null) cls = cls && read.getGenericReturnType() instanceof Class;
|
||||
if (write != null) cls = cls && write.getGenericParameterTypes()[0] instanceof Class;
|
||||
if (pd instanceof IndexedPropertyDescriptor) {
|
||||
IndexedPropertyDescriptor ipd = (IndexedPropertyDescriptor) pd;
|
||||
Method readI = ipd.getIndexedReadMethod();
|
||||
Method writeI = ipd.getIndexedWriteMethod();
|
||||
if (readI != null) cls = cls && readI.getGenericReturnType() instanceof Class;
|
||||
if (writeI != null) cls = cls && writeI.getGenericParameterTypes()[1] instanceof Class;
|
||||
if (!cls) {
|
||||
pd = new IndexedPropertyDescriptor(ipd);
|
||||
pd.updateGenericsFor(this.beanClass);
|
||||
}
|
||||
} catch ( IntrospectionException e ) {
|
||||
}
|
||||
else if (!cls) {
|
||||
pd = new PropertyDescriptor(pd);
|
||||
pd.updateGenericsFor(this.beanClass);
|
||||
}
|
||||
}
|
||||
list.add(pd);
|
||||
|
@ -632,6 +632,16 @@ public class PropertyDescriptor extends FeatureDescriptor {
|
||||
constrained = old.constrained;
|
||||
}
|
||||
|
||||
void updateGenericsFor(Class<?> type) {
|
||||
setClass0(type);
|
||||
try {
|
||||
setPropertyType(findPropertyType(getReadMethod0(), getWriteMethod0()));
|
||||
}
|
||||
catch (IntrospectionException exception) {
|
||||
setPropertyType(null);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the property type that corresponds to the read and write method.
|
||||
* The type precedence is given to the readMethod.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2012, 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
|
||||
@ -31,10 +31,6 @@ import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Vector;
|
||||
import java.util.Collections;
|
||||
import java.io.ObjectStreamField;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.IOException;
|
||||
import sun.security.util.SecurityConstants;
|
||||
|
||||
/**
|
||||
@ -424,7 +420,7 @@ public final class FilePermission extends Permission implements Serializable {
|
||||
/**
|
||||
* Converts an actions String to an actions mask.
|
||||
*
|
||||
* @param action the action string.
|
||||
* @param actions the action string.
|
||||
* @return the actions mask.
|
||||
*/
|
||||
private static int getMask(String actions) {
|
||||
@ -435,7 +431,9 @@ public final class FilePermission extends Permission implements Serializable {
|
||||
if (actions == null) {
|
||||
return mask;
|
||||
}
|
||||
// Check against use of constants (used heavily within the JDK)
|
||||
|
||||
// Use object identity comparison against known-interned strings for
|
||||
// performance benefit (these values are used heavily within the JDK).
|
||||
if (actions == SecurityConstants.FILE_READ_ACTION) {
|
||||
return READ;
|
||||
} else if (actions == SecurityConstants.FILE_WRITE_ACTION) {
|
||||
@ -531,7 +529,7 @@ public final class FilePermission extends Permission implements Serializable {
|
||||
switch(a[i-matchlen]) {
|
||||
case ',':
|
||||
seencomma = true;
|
||||
/*FALLTHROUGH*/
|
||||
break;
|
||||
case ' ': case '\r': case '\n':
|
||||
case '\f': case '\t':
|
||||
break;
|
||||
@ -798,7 +796,7 @@ implements Serializable {
|
||||
* @return an enumeration of all the FilePermission objects.
|
||||
*/
|
||||
|
||||
public Enumeration elements() {
|
||||
public Enumeration<Permission> elements() {
|
||||
// Convert Iterator into Enumeration
|
||||
synchronized (this) {
|
||||
return Collections.enumeration(perms);
|
||||
@ -843,7 +841,6 @@ implements Serializable {
|
||||
/*
|
||||
* Reads in a Vector of FilePermissions and saves them in the perms field.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private void readObject(ObjectInputStream in) throws IOException,
|
||||
ClassNotFoundException {
|
||||
// Don't call defaultReadObject()
|
||||
@ -852,6 +849,7 @@ implements Serializable {
|
||||
ObjectInputStream.GetField gfields = in.readFields();
|
||||
|
||||
// Get the one we want
|
||||
@SuppressWarnings("unchecked")
|
||||
Vector<Permission> permissions = (Vector<Permission>)gfields.get("permissions", null);
|
||||
perms = new ArrayList<>(permissions.size());
|
||||
perms.addAll(permissions);
|
||||
|
@ -96,6 +96,8 @@ abstract class AbstractStringBuilder implements Appendable, CharSequence {
|
||||
* </ul>
|
||||
* If the {@code minimumCapacity} argument is nonpositive, this
|
||||
* method takes no action and simply returns.
|
||||
* Note that subsequent operations on this object can reduce the
|
||||
* actual capacity below that requested here.
|
||||
*
|
||||
* @param minimumCapacity the minimum desired capacity.
|
||||
*/
|
||||
|
@ -27,7 +27,7 @@ package java.lang.management;
|
||||
|
||||
import javax.management.openmbean.CompositeData;
|
||||
import java.util.concurrent.locks.*;
|
||||
import java.beans.ConstructorProperties;
|
||||
import sun.management.LockInfoCompositeData;
|
||||
|
||||
/**
|
||||
* Information about a <em>lock</em>. A lock can be a built-in object monitor,
|
||||
@ -44,8 +44,7 @@ import java.beans.ConstructorProperties;
|
||||
*
|
||||
* <h4><a name="MappedType">MXBean Mapping</a></h4>
|
||||
* <tt>LockInfo</tt> is mapped to a {@link CompositeData CompositeData}
|
||||
* as specified in the <a href="../../../javax/management/MXBean.html#mapping-rules">
|
||||
* type mapping rules</a> of {@linkplain javax.management.MXBean MXBeans}.
|
||||
* as specified in the {@link #from from} method.
|
||||
*
|
||||
* @see java.util.concurrent.locks.AbstractOwnableSynchronizer
|
||||
* @see java.util.concurrent.locks.Condition
|
||||
@ -66,7 +65,6 @@ public class LockInfo {
|
||||
* @param identityHashCode the {@link System#identityHashCode
|
||||
* identity hash code} of the lock object.
|
||||
*/
|
||||
@ConstructorProperties({"className", "identityHashCode"})
|
||||
public LockInfo(String className, int identityHashCode) {
|
||||
if (className == null) {
|
||||
throw new NullPointerException("Parameter className cannot be null");
|
||||
@ -102,6 +100,50 @@ public class LockInfo {
|
||||
return identityHashCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a {@code LockInfo} object represented by the
|
||||
* given {@code CompositeData}.
|
||||
* The given {@code CompositeData} must contain the following attributes:
|
||||
* <blockquote>
|
||||
* <table border>
|
||||
* <tr>
|
||||
* <th align=left>Attribute Name</th>
|
||||
* <th align=left>Type</th>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>className</td>
|
||||
* <td><tt>java.lang.String</tt></td>
|
||||
* </tr>
|
||||
* <tr>
|
||||
* <td>identityHashCode</td>
|
||||
* <td><tt>java.lang.Integer</tt></td>
|
||||
* </tr>
|
||||
* </table>
|
||||
* </blockquote>
|
||||
*
|
||||
* @param cd {@code CompositeData} representing a {@code LockInfo}
|
||||
*
|
||||
* @throws IllegalArgumentException if {@code cd} does not
|
||||
* represent a {@code LockInfo} with the attributes described
|
||||
* above.
|
||||
* @return a {@code LockInfo} object represented
|
||||
* by {@code cd} if {@code cd} is not {@code null};
|
||||
* {@code null} otherwise.
|
||||
*
|
||||
* @since 1.8
|
||||
*/
|
||||
public static LockInfo from(CompositeData cd) {
|
||||
if (cd == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (cd instanceof LockInfoCompositeData) {
|
||||
return ((LockInfoCompositeData) cd).getLockInfo();
|
||||
} else {
|
||||
return LockInfoCompositeData.toLockInfo(cd);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of a lock. The returned
|
||||
* string representation consists of the name of the class of the
|
||||
|
@ -696,9 +696,7 @@ public class ThreadInfo {
|
||||
* <td>lockInfo</td>
|
||||
* <td><tt>javax.management.openmbean.CompositeData</tt>
|
||||
* - the mapped type for {@link LockInfo} as specified in the
|
||||
* <a href="../../../javax/management/MXBean.html#mapping-rules">
|
||||
* type mapping rules</a> of
|
||||
* {@linkplain javax.management.MXBean MXBeans}.
|
||||
* {@link LockInfo#from} method.
|
||||
* <p>
|
||||
* If <tt>cd</tt> does not contain this attribute,
|
||||
* the <tt>LockInfo</tt> object will be constructed from
|
||||
@ -766,10 +764,7 @@ public class ThreadInfo {
|
||||
* <td>lockedSynchronizers</td>
|
||||
* <td><tt>javax.management.openmbean.CompositeData[]</tt>
|
||||
* whose element type is the mapped type for
|
||||
* {@link LockInfo} as specified in the
|
||||
* <a href="../../../javax/management/MXBean.html#mapping-rules">
|
||||
* type mapping rules</a> of
|
||||
* {@linkplain javax.management.MXBean MXBeans}.
|
||||
* {@link LockInfo} as specified in the {@link LockInfo#from} method.
|
||||
* <p>
|
||||
* If <tt>cd</tt> does not contain this attribute,
|
||||
* this attribute will be set to an empty array. </td>
|
||||
@ -830,7 +825,6 @@ public class ThreadInfo {
|
||||
* @since 1.6
|
||||
*/
|
||||
public LockInfo[] getLockedSynchronizers() {
|
||||
// represents an <a href="LockInfo.html#OwnableSynchronizer">
|
||||
return lockedSynchronizers;
|
||||
}
|
||||
|
||||
|
@ -182,7 +182,7 @@ public final class Constructor<T> extends Executable {
|
||||
* @since 1.5
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public TypeVariable<Constructor<T>>[] getTypeParameters() {
|
||||
if (getSignature() != null) {
|
||||
return (TypeVariable<Constructor<T>>[])getGenericInfo().getTypeParameters();
|
||||
|
@ -194,7 +194,7 @@ public final class Method extends Executable {
|
||||
* @since 1.5
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public TypeVariable<Method>[] getTypeParameters() {
|
||||
if (getGenericSignature() != null)
|
||||
return (TypeVariable<Method>[])getGenericInfo().getTypeParameters();
|
||||
|
@ -467,7 +467,6 @@ implements java.io.Serializable
|
||||
* @param action the action string
|
||||
* @return the action mask
|
||||
*/
|
||||
@SuppressWarnings("fallthrough")
|
||||
private static int getMask(String action) {
|
||||
|
||||
if (action == null) {
|
||||
@ -480,7 +479,8 @@ implements java.io.Serializable
|
||||
|
||||
int mask = NONE;
|
||||
|
||||
// Check against use of constants (used heavily within the JDK)
|
||||
// Use object identity comparison against known-interned strings for
|
||||
// performance benefit (these values are used heavily within the JDK).
|
||||
if (action == SecurityConstants.SOCKET_RESOLVE_ACTION) {
|
||||
return RESOLVE;
|
||||
} else if (action == SecurityConstants.SOCKET_CONNECT_ACTION) {
|
||||
@ -568,7 +568,7 @@ implements java.io.Serializable
|
||||
switch(a[i-matchlen]) {
|
||||
case ',':
|
||||
seencomma = true;
|
||||
/*FALLTHROUGH*/
|
||||
break;
|
||||
case ' ': case '\r': case '\n':
|
||||
case '\f': case '\t':
|
||||
break;
|
||||
|
@ -248,7 +248,7 @@ public abstract class AsynchronousFileChannel
|
||||
return provider.newAsynchronousFileChannel(file, options, executor, attrs);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" }) // generic array construction
|
||||
@SuppressWarnings({"unchecked", "rawtypes"}) // generic array construction
|
||||
private static final FileAttribute<?>[] NO_ATTRIBUTES = new FileAttribute[0];
|
||||
|
||||
/**
|
||||
|
@ -287,7 +287,7 @@ public abstract class FileChannel
|
||||
return provider.newFileChannel(path, options, attrs);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" }) // generic array construction
|
||||
@SuppressWarnings({"unchecked", "rawtypes"}) // generic array construction
|
||||
private static final FileAttribute<?>[] NO_ATTRIBUTES = new FileAttribute[0];
|
||||
|
||||
/**
|
||||
|
@ -121,6 +121,7 @@ public class ArrayDeque<E> extends AbstractCollection<E>
|
||||
*
|
||||
* @param numElements the number of elements to hold
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
private void allocateElements(int numElements) {
|
||||
int initialCapacity = MIN_INITIAL_CAPACITY;
|
||||
// Find the best power of two to hold elements.
|
||||
@ -152,10 +153,11 @@ public class ArrayDeque<E> extends AbstractCollection<E>
|
||||
int newCapacity = n << 1;
|
||||
if (newCapacity < 0)
|
||||
throw new IllegalStateException("Sorry, deque too big");
|
||||
Object[] a = new Object[newCapacity];
|
||||
@SuppressWarnings("unchecked")
|
||||
E[] a = (E[]) new Object[newCapacity];
|
||||
System.arraycopy(elements, p, a, 0, r);
|
||||
System.arraycopy(elements, 0, a, r, p);
|
||||
elements = (E[])a;
|
||||
elements = a;
|
||||
head = 0;
|
||||
tail = n;
|
||||
}
|
||||
@ -182,6 +184,7 @@ public class ArrayDeque<E> extends AbstractCollection<E>
|
||||
* Constructs an empty array deque with an initial capacity
|
||||
* sufficient to hold 16 elements.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public ArrayDeque() {
|
||||
elements = (E[]) new Object[16];
|
||||
}
|
||||
@ -793,6 +796,7 @@ public class ArrayDeque<E> extends AbstractCollection<E>
|
||||
* this deque
|
||||
* @throws NullPointerException if the specified array is null
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T[] toArray(T[] a) {
|
||||
int size = size();
|
||||
if (a.length < size)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2012, 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
|
||||
@ -560,7 +560,7 @@ public class Arrays {
|
||||
* off is the offset to generate corresponding low, high in src
|
||||
* To be removed in a future release.
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private static void mergeSort(Object[] src,
|
||||
Object[] dest,
|
||||
int low,
|
||||
@ -747,7 +747,7 @@ public class Arrays {
|
||||
* off is the offset into src corresponding to low in dest
|
||||
* To be removed in a future release.
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
private static void mergeSort(Object[] src,
|
||||
Object[] dest,
|
||||
int low, int high, int off,
|
||||
@ -2832,6 +2832,7 @@ public class Arrays {
|
||||
* @return a list view of the specified array
|
||||
*/
|
||||
@SafeVarargs
|
||||
@SuppressWarnings("varargs")
|
||||
public static <T> List<T> asList(T... a) {
|
||||
return new ArrayList<>(a);
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ public class Collections {
|
||||
* @throws IllegalArgumentException (optional) if the comparator is
|
||||
* found to violate the {@link Comparator} contract
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public static <T> void sort(List<T> list, Comparator<? super T> c) {
|
||||
Object[] a = list.toArray();
|
||||
Arrays.sort(a, (Comparator)c);
|
||||
@ -418,7 +418,7 @@ public class Collections {
|
||||
* @throws UnsupportedOperationException if the specified list or
|
||||
* its list-iterator does not support the <tt>set</tt> operation.
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public static void reverse(List<?> list) {
|
||||
int size = list.size();
|
||||
if (size < REVERSE_THRESHOLD || list instanceof RandomAccess) {
|
||||
@ -497,7 +497,7 @@ public class Collections {
|
||||
* @throws UnsupportedOperationException if the specified list or its
|
||||
* list-iterator does not support the <tt>set</tt> operation.
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public static void shuffle(List<?> list, Random rnd) {
|
||||
int size = list.size();
|
||||
if (size < SHUFFLE_THRESHOLD || list instanceof RandomAccess) {
|
||||
@ -535,7 +535,7 @@ public class Collections {
|
||||
* || j < 0 || j >= list.size()).
|
||||
* @since 1.4
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
public static void swap(List<?> list, int i, int j) {
|
||||
// instead of using a raw type here, it's possible to capture
|
||||
// the wildcard but it will require a call to a supplementary
|
||||
@ -669,7 +669,7 @@ public class Collections {
|
||||
* @throws NoSuchElementException if the collection is empty.
|
||||
* @see Comparable
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public static <T> T min(Collection<? extends T> coll, Comparator<? super T> comp) {
|
||||
if (comp==null)
|
||||
return (T)min((Collection) coll);
|
||||
@ -740,7 +740,7 @@ public class Collections {
|
||||
* @throws NoSuchElementException if the collection is empty.
|
||||
* @see Comparable
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public static <T> T max(Collection<? extends T> coll, Comparator<? super T> comp) {
|
||||
if (comp==null)
|
||||
return (T)max((Collection) coll);
|
||||
@ -1403,7 +1403,7 @@ public class Collections {
|
||||
extends UnmodifiableSet<Map.Entry<K,V>> {
|
||||
private static final long serialVersionUID = 7854390611657943733L;
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
UnmodifiableEntrySet(Set<? extends Map.Entry<? extends K, ? extends V>> s) {
|
||||
// Need to cast to raw in order to work around a limitation in the type system
|
||||
super((Set)s);
|
||||
@ -3172,7 +3172,7 @@ public class Collections {
|
||||
*
|
||||
* @see #emptySet()
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static final Set EMPTY_SET = new EmptySet<>();
|
||||
|
||||
/**
|
||||
@ -3271,10 +3271,13 @@ public class Collections {
|
||||
return new EmptySortedSet<>();
|
||||
}
|
||||
|
||||
public Comparator comparator() {
|
||||
@Override
|
||||
public Comparator<? super E> comparator() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public SortedSet<E> subSet(Object fromElement, Object toElement) {
|
||||
Objects.requireNonNull(fromElement);
|
||||
Objects.requireNonNull(toElement);
|
||||
@ -3294,6 +3297,7 @@ public class Collections {
|
||||
return emptySortedSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedSet<E> headSet(Object toElement) {
|
||||
Objects.requireNonNull(toElement);
|
||||
|
||||
@ -3304,6 +3308,7 @@ public class Collections {
|
||||
return emptySortedSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SortedSet<E> tailSet(Object fromElement) {
|
||||
Objects.requireNonNull(fromElement);
|
||||
|
||||
@ -3314,10 +3319,12 @@ public class Collections {
|
||||
return emptySortedSet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public E first() {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public E last() {
|
||||
throw new NoSuchElementException();
|
||||
}
|
||||
@ -3328,7 +3335,7 @@ public class Collections {
|
||||
*
|
||||
* @see #emptyList()
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static final List EMPTY_LIST = new EmptyList<>();
|
||||
|
||||
/**
|
||||
@ -3402,7 +3409,7 @@ public class Collections {
|
||||
* @see #emptyMap()
|
||||
* @since 1.3
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static final Map EMPTY_MAP = new EmptyMap<>();
|
||||
|
||||
/**
|
||||
@ -3685,6 +3692,7 @@ public class Collections {
|
||||
return a;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T[] toArray(T[] a) {
|
||||
final int n = this.n;
|
||||
if (a.length < n) {
|
||||
@ -3731,6 +3739,7 @@ public class Collections {
|
||||
* the <tt>Comparable</tt> interface.
|
||||
* @see Comparable
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> Comparator<T> reverseOrder() {
|
||||
return (Comparator<T>) ReverseComparator.REVERSE_ORDER;
|
||||
}
|
||||
|
@ -208,7 +208,7 @@ class ComparableTimSort {
|
||||
* @param start the index of the first element in the range that is
|
||||
* not already known to be sorted ({@code lo <= start <= hi})
|
||||
*/
|
||||
@SuppressWarnings({ "fallthrough", "rawtypes", "unchecked" })
|
||||
@SuppressWarnings({"fallthrough", "rawtypes", "unchecked"})
|
||||
private static void binarySort(Object[] a, int lo, int hi, int start) {
|
||||
assert lo <= start && start <= hi;
|
||||
if (start == lo)
|
||||
@ -277,7 +277,7 @@ class ComparableTimSort {
|
||||
* @return the length of the run beginning at the specified position in
|
||||
* the specified array
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private static int countRunAndMakeAscending(Object[] a, int lo, int hi) {
|
||||
assert lo < hi;
|
||||
int runHi = lo + 1;
|
||||
@ -612,7 +612,7 @@ class ComparableTimSort {
|
||||
* (must be aBase + aLen)
|
||||
* @param len2 length of second run to be merged (must be > 0)
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private void mergeLo(int base1, int len1, int base2, int len2) {
|
||||
assert len1 > 0 && len2 > 0 && base1 + len1 == base2;
|
||||
|
||||
@ -729,7 +729,7 @@ class ComparableTimSort {
|
||||
* (must be aBase + aLen)
|
||||
* @param len2 length of second run to be merged (must be > 0)
|
||||
*/
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
private void mergeHi(int base1, int len1, int base2, int len2) {
|
||||
assert len1 > 0 && len2 > 0 && base1 + len1 == base2;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2000, 2012, 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
|
||||
@ -34,6 +34,8 @@ import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.regex.Pattern;
|
||||
@ -60,7 +62,14 @@ import sun.util.logging.PlatformLogger;
|
||||
* and the ISO 4217 currency data respectively. The value part consists of
|
||||
* three ISO 4217 values of a currency, i.e., an alphabetic code, a numeric
|
||||
* code, and a minor unit. Those three ISO 4217 values are separated by commas.
|
||||
* The lines which start with '#'s are considered comment lines. For example,
|
||||
* The lines which start with '#'s are considered comment lines. An optional UTC
|
||||
* timestamp may be specified per currency entry if users need to specify a
|
||||
* cutover date indicating when the new data comes into effect. The timestamp is
|
||||
* appended to the end of the currency properties and uses a comma as a separator.
|
||||
* If a UTC datestamp is present and valid, the JRE will only use the new currency
|
||||
* properties if the current UTC date is later than the date specified at class
|
||||
* loading time. The format of the timestamp must be of ISO 8601 format :
|
||||
* {@code 'yyyy-MM-dd'T'HH:mm:ss'}. For example,
|
||||
* <p>
|
||||
* <code>
|
||||
* #Sample currency properties<br>
|
||||
@ -69,6 +78,20 @@ import sun.util.logging.PlatformLogger;
|
||||
* <p>
|
||||
* will supersede the currency data for Japan.
|
||||
*
|
||||
* <p>
|
||||
* <code>
|
||||
* #Sample currency properties with cutover date<br>
|
||||
* JP=JPZ,999,0,2014-01-01T00:00:00
|
||||
* </code>
|
||||
* <p>
|
||||
* will supersede the currency data for Japan if {@code Currency} class is loaded after
|
||||
* 1st January 2014 00:00:00 GMT.
|
||||
* <p>
|
||||
* Where syntactically malformed entries are encountered, the entry is ignored
|
||||
* and the remainder of entries in file are processed. For instances where duplicate
|
||||
* country code entries exist, the behavior of the Currency information for that
|
||||
* {@code Currency} is undefined and the remainder of entries in file are processed.
|
||||
*
|
||||
* @since 1.4
|
||||
*/
|
||||
public final class Currency implements Serializable {
|
||||
@ -100,7 +123,6 @@ public final class Currency implements Serializable {
|
||||
private static ConcurrentMap<String, Currency> instances = new ConcurrentHashMap<>(7);
|
||||
private static HashSet<Currency> available;
|
||||
|
||||
|
||||
// Class data: currency data obtained from currency.data file.
|
||||
// Purpose:
|
||||
// - determine valid country codes
|
||||
@ -235,7 +257,9 @@ public final class Currency implements Serializable {
|
||||
}
|
||||
Set<String> keys = props.stringPropertyNames();
|
||||
Pattern propertiesPattern =
|
||||
Pattern.compile("([A-Z]{3})\\s*,\\s*(\\d{3})\\s*,\\s*([0-3])");
|
||||
Pattern.compile("([A-Z]{3})\\s*,\\s*(\\d{3})\\s*,\\s*" +
|
||||
"([0-3])\\s*,?\\s*(\\d{4}-\\d{2}-\\d{2}T\\d{2}:" +
|
||||
"\\d{2}:\\d{2})?");
|
||||
for (String key : keys) {
|
||||
replaceCurrencyData(propertiesPattern,
|
||||
key.toUpperCase(Locale.ROOT),
|
||||
@ -645,29 +669,38 @@ public final class Currency implements Serializable {
|
||||
* consists of "three-letter alphabet code", "three-digit numeric code",
|
||||
* and "one-digit (0,1,2, or 3) default fraction digit".
|
||||
* For example, "JPZ,392,0".
|
||||
* @throws
|
||||
* An optional UTC date can be appended to the string (comma separated)
|
||||
* to allow a currency change take effect after date specified.
|
||||
* For example, "JP=JPZ,999,0,2014-01-01T00:00:00" has no effect unless
|
||||
* UTC time is past 1st January 2014 00:00:00 GMT.
|
||||
*/
|
||||
private static void replaceCurrencyData(Pattern pattern, String ctry, String curdata) {
|
||||
|
||||
if (ctry.length() != 2) {
|
||||
// ignore invalid country code
|
||||
String message = new StringBuilder()
|
||||
.append("The entry in currency.properties for ")
|
||||
.append(ctry).append(" is ignored because of the invalid country code.")
|
||||
.toString();
|
||||
info(message, null);
|
||||
info("currency.properties entry for " + ctry +
|
||||
" is ignored because of the invalid country code.", null);
|
||||
return;
|
||||
}
|
||||
|
||||
Matcher m = pattern.matcher(curdata);
|
||||
if (!m.find()) {
|
||||
if (!m.find() || (m.group(4) == null && countOccurrences(curdata, ',') >= 3)) {
|
||||
// format is not recognized. ignore the data
|
||||
String message = new StringBuilder()
|
||||
.append("The entry in currency.properties for ")
|
||||
.append(ctry)
|
||||
.append(" is ignored because the value format is not recognized.")
|
||||
.toString();
|
||||
info(message, null);
|
||||
// if group(4) date string is null and we've 4 values, bad date value
|
||||
info("currency.properties entry for " + ctry +
|
||||
" ignored because the value format is not recognized.", null);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (m.group(4) != null && !isPastCutoverDate(m.group(4))) {
|
||||
info("currency.properties entry for " + ctry +
|
||||
" ignored since cutover date has not passed :" + curdata, null);
|
||||
return;
|
||||
}
|
||||
} catch (IndexOutOfBoundsException | NullPointerException | ParseException ex) {
|
||||
info("currency.properties entry for " + ctry +
|
||||
" ignored since exception encountered :" + ex.getMessage(), null);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -695,6 +728,26 @@ public final class Currency implements Serializable {
|
||||
setMainTableEntry(ctry.charAt(0), ctry.charAt(1), entry);
|
||||
}
|
||||
|
||||
private static boolean isPastCutoverDate(String s)
|
||||
throws IndexOutOfBoundsException, NullPointerException, ParseException {
|
||||
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ROOT);
|
||||
format.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
format.setLenient(false);
|
||||
long time = format.parse(s.trim()).getTime();
|
||||
return System.currentTimeMillis() > time;
|
||||
|
||||
}
|
||||
|
||||
private static int countOccurrences(String value, char match) {
|
||||
int count = 0;
|
||||
for (char c : value.toCharArray()) {
|
||||
if (c == match) {
|
||||
++count;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
private static void info(String message, Throwable t) {
|
||||
PlatformLogger logger = PlatformLogger.getLogger("java.util.Currency");
|
||||
if (logger.isLoggable(PlatformLogger.INFO)) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2012, 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
|
||||
@ -230,7 +230,7 @@ public class HashMap<K,V>
|
||||
|
||||
this.loadFactor = loadFactor;
|
||||
threshold = (int)Math.min(capacity * loadFactor, MAXIMUM_CAPACITY + 1);
|
||||
table = new Entry[capacity];
|
||||
table = new Entry<?,?>[capacity];
|
||||
init();
|
||||
}
|
||||
|
||||
@ -1078,7 +1078,7 @@ public class HashMap<K,V>
|
||||
capacity <<= 1;
|
||||
}
|
||||
|
||||
table = new Entry[capacity];
|
||||
table = new Entry<?,?>[capacity];
|
||||
threshold = (int) Math.min(capacity * loadFactor, MAXIMUM_CAPACITY + 1);
|
||||
init(); // Give subclass a chance to do its thing.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -121,6 +121,7 @@ class JumboEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
||||
unseen = elements[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
while (unseen == 0 && unseenIndex < elements.length - 1)
|
||||
unseen = elements[++unseenIndex];
|
||||
@ -128,6 +129,7 @@ class JumboEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public E next() {
|
||||
if (!hasNext())
|
||||
throw new NoSuchElementException();
|
||||
@ -138,6 +140,7 @@ class JumboEnumSet<E extends Enum<E>> extends EnumSet<E> {
|
||||
+ Long.numberOfTrailingZeros(lastReturned)];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
if (lastReturned == 0)
|
||||
throw new IllegalStateException();
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2012, 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
|
||||
@ -330,6 +330,7 @@ public class PriorityQueue<E> extends AbstractQueue<E>
|
||||
return true;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public E peek() {
|
||||
if (size == 0)
|
||||
return null;
|
||||
|
@ -246,7 +246,8 @@ public final class PropertyPermission extends BasicPermission {
|
||||
return mask;
|
||||
}
|
||||
|
||||
// Check against use of constants (used heavily within the JDK)
|
||||
// Use object identity comparison against known-interned strings for
|
||||
// performance benefit (these values are used heavily within the JDK).
|
||||
if (actions == SecurityConstants.PROPERTY_READ_ACTION) {
|
||||
return READ;
|
||||
} if (actions == SecurityConstants.PROPERTY_WRITE_ACTION) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2012, 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
|
||||
@ -125,6 +125,7 @@ public class PropertyResourceBundle extends ResourceBundle {
|
||||
* @throws IOException if an I/O error occurs
|
||||
* @throws NullPointerException if <code>stream</code> is null
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public PropertyResourceBundle (InputStream stream) throws IOException {
|
||||
Properties properties = new Properties();
|
||||
properties.load(stream);
|
||||
@ -143,6 +144,7 @@ public class PropertyResourceBundle extends ResourceBundle {
|
||||
* @throws NullPointerException if <code>reader</code> is null
|
||||
* @since 1.6
|
||||
*/
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
public PropertyResourceBundle (Reader reader) throws IOException {
|
||||
Properties properties = new Properties();
|
||||
properties.load(reader);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2012, 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
|
||||
@ -325,6 +325,7 @@ class JarVerifier {
|
||||
* the given file in the jar.
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public java.security.cert.Certificate[] getCerts(String name)
|
||||
{
|
||||
return mapSignersToCertArray(getCodeSigners(name));
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2003,2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003,2012, 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
|
||||
@ -726,13 +726,13 @@ public abstract class Pack200 {
|
||||
private static final String PACK_PROVIDER = "java.util.jar.Pack200.Packer";
|
||||
private static final String UNPACK_PROVIDER = "java.util.jar.Pack200.Unpacker";
|
||||
|
||||
private static Class packerImpl;
|
||||
private static Class unpackerImpl;
|
||||
private static Class<?> packerImpl;
|
||||
private static Class<?> unpackerImpl;
|
||||
|
||||
private synchronized static Object newInstance(String prop) {
|
||||
String implName = "(unknown)";
|
||||
try {
|
||||
Class impl = (PACK_PROVIDER.equals(prop))? packerImpl: unpackerImpl;
|
||||
Class<?> impl = (PACK_PROVIDER.equals(prop))? packerImpl: unpackerImpl;
|
||||
if (impl == null) {
|
||||
// The first time, we must decide which class to use.
|
||||
implName = java.security.AccessController.doPrivileged(
|
||||
|
@ -2,7 +2,7 @@
|
||||
<html>
|
||||
<head>
|
||||
<!--
|
||||
Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 1998, 2012, 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
|
||||
@ -41,7 +41,7 @@ input streams.
|
||||
|
||||
</a>
|
||||
<ul>
|
||||
<li><a href="ftp://ftp.uu.net/pub/archiving/zip/doc/appnote-970311-iz.zip">
|
||||
<li><a href="http://www.info-zip.org/doc/appnote-19970311-iz.zip">
|
||||
Info-ZIP Application Note 970311
|
||||
</a> - a detailed description of the Info-ZIP format upon which
|
||||
the <code>java.util.zip</code> classes are based.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2012, 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
|
||||
@ -1503,9 +1503,14 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
|
||||
|
||||
if (caretWidth > -1) {
|
||||
return caretWidth;
|
||||
} else {
|
||||
Object property = UIManager.get("Caret.width");
|
||||
if (property instanceof Integer) {
|
||||
return ((Integer) property).intValue();
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// --- serialization ---------------------------------------------
|
||||
|
@ -506,40 +506,25 @@ public abstract class SunToolkit extends Toolkit
|
||||
postEvent(targetToAppContext(e.getSource()), pe);
|
||||
}
|
||||
|
||||
protected static final Lock flushLock = new ReentrantLock();
|
||||
private static boolean isFlushingPendingEvents = false;
|
||||
|
||||
/*
|
||||
* Flush any pending events which haven't been posted to the AWT
|
||||
* EventQueue yet.
|
||||
*/
|
||||
public static void flushPendingEvents() {
|
||||
flushLock.lock();
|
||||
try {
|
||||
// Don't call flushPendingEvents() recursively
|
||||
if (!isFlushingPendingEvents) {
|
||||
isFlushingPendingEvents = true;
|
||||
AppContext appContext = AppContext.getAppContext();
|
||||
PostEventQueue postEventQueue =
|
||||
(PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY);
|
||||
if (postEventQueue != null) {
|
||||
postEventQueue.flush();
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
isFlushingPendingEvents = false;
|
||||
flushLock.unlock();
|
||||
}
|
||||
AppContext appContext = AppContext.getAppContext();
|
||||
flushPendingEvents(appContext);
|
||||
}
|
||||
|
||||
public static boolean isPostEventQueueEmpty() {
|
||||
AppContext appContext = AppContext.getAppContext();
|
||||
/*
|
||||
* Flush the PostEventQueue for the right AppContext.
|
||||
* The default flushPendingEvents only flushes the thread-local context,
|
||||
* which is not always correct, c.f. 3746956
|
||||
*/
|
||||
public static void flushPendingEvents(AppContext appContext) {
|
||||
PostEventQueue postEventQueue =
|
||||
(PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY);
|
||||
(PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY);
|
||||
if (postEventQueue != null) {
|
||||
return postEventQueue.noEvents();
|
||||
} else {
|
||||
return true;
|
||||
postEventQueue.flush();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2045,17 +2030,12 @@ class PostEventQueue {
|
||||
private EventQueueItem queueTail = null;
|
||||
private final EventQueue eventQueue;
|
||||
|
||||
// For the case when queue is cleared but events are not posted
|
||||
private volatile boolean isFlushing = false;
|
||||
private Thread flushThread = null;
|
||||
|
||||
PostEventQueue(EventQueue eq) {
|
||||
eventQueue = eq;
|
||||
}
|
||||
|
||||
public synchronized boolean noEvents() {
|
||||
return queueHead == null && !isFlushing;
|
||||
}
|
||||
|
||||
/*
|
||||
* Continually post pending AWTEvents to the Java EventQueue. The method
|
||||
* is synchronized to ensure the flush is completed before a new event
|
||||
@ -2066,20 +2046,48 @@ class PostEventQueue {
|
||||
* potentially lead to deadlock
|
||||
*/
|
||||
public void flush() {
|
||||
EventQueueItem tempQueue;
|
||||
synchronized (this) {
|
||||
tempQueue = queueHead;
|
||||
queueHead = queueTail = null;
|
||||
isFlushing = true;
|
||||
}
|
||||
|
||||
Thread newThread = Thread.currentThread();
|
||||
|
||||
try {
|
||||
while (tempQueue != null) {
|
||||
eventQueue.postEvent(tempQueue.event);
|
||||
tempQueue = tempQueue.next;
|
||||
EventQueueItem tempQueue;
|
||||
synchronized (this) {
|
||||
// Avoid method recursion
|
||||
if (newThread == flushThread) {
|
||||
return;
|
||||
}
|
||||
// Wait for other threads' flushing
|
||||
while (flushThread != null) {
|
||||
wait();
|
||||
}
|
||||
// Skip everything if queue is empty
|
||||
if (queueHead == null) {
|
||||
return;
|
||||
}
|
||||
// Remember flushing thread
|
||||
flushThread = newThread;
|
||||
|
||||
tempQueue = queueHead;
|
||||
queueHead = queueTail = null;
|
||||
}
|
||||
try {
|
||||
while (tempQueue != null) {
|
||||
eventQueue.postEvent(tempQueue.event);
|
||||
tempQueue = tempQueue.next;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
// Only the flushing thread can get here
|
||||
synchronized (this) {
|
||||
// Forget flushing thread, inform other pending threads
|
||||
flushThread = null;
|
||||
notifyAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
isFlushing = false;
|
||||
catch (InterruptedException e) {
|
||||
// Couldn't allow exception go up, so at least recover the flag
|
||||
newThread.interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -333,11 +333,12 @@ public abstract class VolatileSurfaceManager
|
||||
// using a SurfaceData that was created in a different
|
||||
// display mode.
|
||||
sdBackup = null;
|
||||
sdCurrent = getBackupSurface();
|
||||
// Now, invalidate the old hardware-based SurfaceData
|
||||
// Note that getBackupSurface may set sdAccel to null so we have to invalidate it before
|
||||
SurfaceData oldData = sdAccel;
|
||||
sdAccel = null;
|
||||
oldData.invalidate();
|
||||
sdCurrent = getBackupSurface();
|
||||
}
|
||||
// Update graphicsConfig for the vImg in case it changed due to
|
||||
// this display change event
|
||||
|
@ -1,111 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2008, 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.management;
|
||||
|
||||
import java.lang.management.LockInfo;
|
||||
import java.lang.management.ThreadInfo;
|
||||
import javax.management.Attribute;
|
||||
import javax.management.StandardMBean;
|
||||
import javax.management.openmbean.CompositeData;
|
||||
|
||||
/**
|
||||
* This MXBean is used for data conversion from LockInfo
|
||||
* to CompositeData (its mapped type) or vice versa.
|
||||
*/
|
||||
class LockDataConverter extends StandardMBean
|
||||
implements LockDataConverterMXBean {
|
||||
private LockInfo lockInfo;
|
||||
private LockInfo[] lockedSyncs;
|
||||
|
||||
LockDataConverter() {
|
||||
super(LockDataConverterMXBean.class, true);
|
||||
this.lockInfo = null;
|
||||
this.lockedSyncs = null;
|
||||
}
|
||||
|
||||
LockDataConverter(ThreadInfo ti) {
|
||||
super(LockDataConverterMXBean.class, true);
|
||||
this.lockInfo = ti.getLockInfo();
|
||||
this.lockedSyncs = ti.getLockedSynchronizers();
|
||||
}
|
||||
|
||||
public void setLockInfo(LockInfo l) {
|
||||
this.lockInfo = l;
|
||||
}
|
||||
|
||||
public LockInfo getLockInfo() {
|
||||
return this.lockInfo;
|
||||
}
|
||||
|
||||
public void setLockedSynchronizers(LockInfo[] l) {
|
||||
this.lockedSyncs = l;
|
||||
}
|
||||
|
||||
public LockInfo[] getLockedSynchronizers() {
|
||||
return this.lockedSyncs;
|
||||
}
|
||||
|
||||
// helper methods
|
||||
CompositeData toLockInfoCompositeData() {
|
||||
try {
|
||||
return (CompositeData) getAttribute("LockInfo");
|
||||
} catch (Exception e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
|
||||
CompositeData[] toLockedSynchronizersCompositeData() {
|
||||
try {
|
||||
return (CompositeData[]) getAttribute("LockedSynchronizers");
|
||||
} catch (Exception e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
|
||||
LockInfo toLockInfo(CompositeData cd) {
|
||||
try {
|
||||
setAttribute(new Attribute("LockInfo", cd));
|
||||
} catch (Exception e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
return getLockInfo();
|
||||
}
|
||||
|
||||
LockInfo[] toLockedSynchronizers(CompositeData[] cd) {
|
||||
try {
|
||||
setAttribute(new Attribute("LockedSynchronizers", cd));
|
||||
} catch (Exception e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
return getLockedSynchronizers();
|
||||
}
|
||||
|
||||
static CompositeData toLockInfoCompositeData(LockInfo l) {
|
||||
LockDataConverter ldc = new LockDataConverter();
|
||||
ldc.setLockInfo(l);
|
||||
return ldc.toLockInfoCompositeData();
|
||||
}
|
||||
}
|
118
jdk/src/share/classes/sun/management/LockInfoCompositeData.java
Normal file
118
jdk/src/share/classes/sun/management/LockInfoCompositeData.java
Normal file
@ -0,0 +1,118 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 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.management;
|
||||
|
||||
import java.lang.management.LockInfo;
|
||||
import javax.management.openmbean.CompositeType;
|
||||
import javax.management.openmbean.CompositeData;
|
||||
import javax.management.openmbean.CompositeDataSupport;
|
||||
import javax.management.openmbean.OpenDataException;
|
||||
|
||||
/**
|
||||
* A CompositeData for LockInfo for the local management support.
|
||||
* This class avoids the performance penalty paid to the
|
||||
* construction of a CompositeData use in the local case.
|
||||
*/
|
||||
public class LockInfoCompositeData extends LazyCompositeData {
|
||||
private final LockInfo lock;
|
||||
|
||||
private LockInfoCompositeData(LockInfo li) {
|
||||
this.lock = li;
|
||||
}
|
||||
|
||||
public LockInfo getLockInfo() {
|
||||
return lock;
|
||||
}
|
||||
|
||||
public static CompositeData toCompositeData(LockInfo li) {
|
||||
if (li == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
LockInfoCompositeData licd = new LockInfoCompositeData(li);
|
||||
return licd.getCompositeData();
|
||||
}
|
||||
|
||||
protected CompositeData getCompositeData() {
|
||||
// CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
|
||||
// lockInfoItemNames!
|
||||
final Object[] lockInfoItemValues = {
|
||||
new String(lock.getClassName()),
|
||||
new Integer(lock.getIdentityHashCode()),
|
||||
};
|
||||
|
||||
try {
|
||||
return new CompositeDataSupport(lockInfoCompositeType,
|
||||
lockInfoItemNames,
|
||||
lockInfoItemValues);
|
||||
} catch (OpenDataException e) {
|
||||
// Should never reach here
|
||||
throw Util.newException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static final CompositeType lockInfoCompositeType;
|
||||
static {
|
||||
try {
|
||||
lockInfoCompositeType = (CompositeType)
|
||||
MappedMXBeanType.toOpenType(LockInfo.class);
|
||||
} catch (OpenDataException e) {
|
||||
// Should never reach here
|
||||
throw Util.newException(e);
|
||||
}
|
||||
}
|
||||
|
||||
static CompositeType getLockInfoCompositeType() {
|
||||
return lockInfoCompositeType;
|
||||
}
|
||||
|
||||
private static final String CLASS_NAME = "className";
|
||||
private static final String IDENTITY_HASH_CODE = "identityHashCode";
|
||||
private static final String[] lockInfoItemNames = {
|
||||
CLASS_NAME,
|
||||
IDENTITY_HASH_CODE,
|
||||
};
|
||||
|
||||
/*
|
||||
* Returns a LockInfo object mapped from the given CompositeData.
|
||||
*/
|
||||
public static LockInfo toLockInfo(CompositeData cd) {
|
||||
if (cd == null) {
|
||||
throw new NullPointerException("Null CompositeData");
|
||||
}
|
||||
|
||||
if (!isTypeMatched(lockInfoCompositeType, cd.getCompositeType())) {
|
||||
throw new IllegalArgumentException(
|
||||
"Unexpected composite type for LockInfo");
|
||||
}
|
||||
|
||||
String className = getString(cd, CLASS_NAME);
|
||||
int identityHashCode = getInt(cd, IDENTITY_HASH_CODE);
|
||||
return new LockInfo(className, identityHashCode);
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -6374759159749014052L;
|
||||
}
|
@ -703,7 +703,7 @@ public abstract class MappedMXBeanType {
|
||||
if (data instanceof java.lang.management.MonitorInfo) {
|
||||
return MonitorInfoCompositeData.toCompositeData((MonitorInfo) data);
|
||||
}
|
||||
return LockDataConverter.toLockInfoCompositeData((LockInfo) data);
|
||||
return LockInfoCompositeData.toCompositeData((LockInfo) data);
|
||||
}
|
||||
|
||||
if (data instanceof MemoryNotificationInfo) {
|
||||
|
@ -59,7 +59,7 @@ public class MonitorInfoCompositeData extends LazyCompositeData {
|
||||
|
||||
int len = monitorInfoItemNames.length;
|
||||
Object[] values = new Object[len];
|
||||
CompositeData li = LockDataConverter.toLockInfoCompositeData(lock);
|
||||
CompositeData li = LockInfoCompositeData.toCompositeData(lock);
|
||||
|
||||
for (int i = 0; i < len; i++) {
|
||||
String item = monitorInfoItemNames[i];
|
||||
|
@ -85,11 +85,18 @@ public class ThreadInfoCompositeData extends LazyCompositeData {
|
||||
}
|
||||
|
||||
// Convert MonitorInfo[] and LockInfo[] to CompositeData[]
|
||||
LockDataConverter converter = new LockDataConverter(threadInfo);
|
||||
CompositeData lockInfoData = converter.toLockInfoCompositeData();
|
||||
CompositeData[] lockedSyncsData = converter.toLockedSynchronizersCompositeData();
|
||||
CompositeData lockInfoData =
|
||||
LockInfoCompositeData.toCompositeData(threadInfo.getLockInfo());
|
||||
|
||||
// Convert LockInfo[] and MonitorInfo[] to CompositeData[]
|
||||
LockInfo[] lockedSyncs = threadInfo.getLockedSynchronizers();
|
||||
CompositeData[] lockedSyncsData =
|
||||
new CompositeData[lockedSyncs.length];
|
||||
for (int i = 0; i < lockedSyncs.length; i++) {
|
||||
LockInfo li = lockedSyncs[i];
|
||||
lockedSyncsData[i] = LockInfoCompositeData.toCompositeData(li);
|
||||
}
|
||||
|
||||
// Convert MonitorInfo[] to CompositeData[]
|
||||
MonitorInfo[] lockedMonitors = threadInfo.getLockedMonitors();
|
||||
CompositeData[] lockedMonitorsData =
|
||||
new CompositeData[lockedMonitors.length];
|
||||
@ -98,7 +105,6 @@ public class ThreadInfoCompositeData extends LazyCompositeData {
|
||||
lockedMonitorsData[i] = MonitorInfoCompositeData.toCompositeData(mi);
|
||||
}
|
||||
|
||||
|
||||
// CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
|
||||
// threadInfoItemNames!
|
||||
final Object[] threadInfoItemValues = {
|
||||
@ -216,11 +222,11 @@ public class ThreadInfoCompositeData extends LazyCompositeData {
|
||||
// with it. So we can get the CompositeType representing LockInfo
|
||||
// from a mapped CompositeData for any LockInfo object.
|
||||
// Thus we construct a random LockInfo object and pass it
|
||||
// to LockDataConverter to do the conversion.
|
||||
// to LockInfoCompositeData to do the conversion.
|
||||
Object o = new Object();
|
||||
LockInfo li = new LockInfo(o.getClass().getName(),
|
||||
System.identityHashCode(o));
|
||||
CompositeData cd = LockDataConverter.toLockInfoCompositeData(li);
|
||||
CompositeData cd = LockInfoCompositeData.toCompositeData(li);
|
||||
lockInfoCompositeType = cd.getCompositeType();
|
||||
}
|
||||
|
||||
@ -315,9 +321,8 @@ public class ThreadInfoCompositeData extends LazyCompositeData {
|
||||
|
||||
// 6.0 new attributes
|
||||
public LockInfo lockInfo() {
|
||||
LockDataConverter converter = new LockDataConverter();
|
||||
CompositeData lockInfoData = (CompositeData) cdata.get(LOCK_INFO);
|
||||
return converter.toLockInfo(lockInfoData);
|
||||
return LockInfo.from(lockInfoData);
|
||||
}
|
||||
|
||||
public MonitorInfo[] lockedMonitors() {
|
||||
@ -336,13 +341,17 @@ public class ThreadInfoCompositeData extends LazyCompositeData {
|
||||
}
|
||||
|
||||
public LockInfo[] lockedSynchronizers() {
|
||||
LockDataConverter converter = new LockDataConverter();
|
||||
CompositeData[] lockedSyncsData =
|
||||
(CompositeData[]) cdata.get(LOCKED_SYNCS);
|
||||
|
||||
// The LockedSynchronizers item cannot be null, but if it is we will
|
||||
// get a NullPointerException when we ask for its length.
|
||||
return converter.toLockedSynchronizers(lockedSyncsData);
|
||||
LockInfo[] locks = new LockInfo[lockedSyncsData.length];
|
||||
for (int i = 0; i < lockedSyncsData.length; i++) {
|
||||
CompositeData cdi = lockedSyncsData[i];
|
||||
locks[i] = LockInfo.from(cdi);
|
||||
}
|
||||
return locks;
|
||||
}
|
||||
|
||||
/** Validate if the input CompositeData has the expected
|
||||
|
@ -87,8 +87,10 @@ public final class ECParameters extends AlgorithmParametersSpi {
|
||||
if ((data.length == 0) || (data[0] != 4)) {
|
||||
throw new IOException("Only uncompressed point format supported");
|
||||
}
|
||||
int n = data.length / 2;
|
||||
if (n > ((curve.getField().getFieldSize() + 7 ) >> 3)) {
|
||||
// Per ANSI X9.62, an encoded point is a 1 byte type followed by
|
||||
// ceiling(log base 2 field-size / 8) bytes of x and the same of y.
|
||||
int n = (data.length - 1) / 2;
|
||||
if (n != ((curve.getField().getFieldSize() + 7 ) >> 3)) {
|
||||
throw new IOException("Point does not match field size");
|
||||
}
|
||||
byte[] xb = new byte[n];
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2012, 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
|
||||
@ -259,8 +259,7 @@ final public class AlgorithmChecker extends PKIXCertPathChecker {
|
||||
}
|
||||
|
||||
// Inherit key parameters from previous key
|
||||
if (currPubKey instanceof DSAPublicKey &&
|
||||
((DSAPublicKey)currPubKey).getParams() == null) {
|
||||
if (PKIX.isDSAPublicKeyWithoutParams(currPubKey)) {
|
||||
// Inherit DSA parameters from previous key
|
||||
if (!(prevPubKey instanceof DSAPublicKey)) {
|
||||
throw new CertPathValidatorException("Input key is not " +
|
||||
|
@ -101,9 +101,7 @@ class BasicChecker extends PKIXCertPathChecker {
|
||||
public void init(boolean forward) throws CertPathValidatorException {
|
||||
if (!forward) {
|
||||
prevPubKey = trustedPubKey;
|
||||
if (prevPubKey instanceof DSAPublicKey &&
|
||||
((DSAPublicKey)prevPubKey).getParams() == null)
|
||||
{
|
||||
if (PKIX.isDSAPublicKeyWithoutParams(prevPubKey)) {
|
||||
// If TrustAnchor is a DSA public key and it has no params, it
|
||||
// cannot be used to verify the signature of the first cert,
|
||||
// so throw exception
|
||||
@ -248,8 +246,7 @@ class BasicChecker extends PKIXCertPathChecker {
|
||||
currCert.getSubjectX500Principal() + "; serial#: " +
|
||||
currCert.getSerialNumber().toString());
|
||||
}
|
||||
if (cKey instanceof DSAPublicKey &&
|
||||
((DSAPublicKey)cKey).getParams() == null) {
|
||||
if (PKIX.isDSAPublicKeyWithoutParams(cKey)) {
|
||||
// cKey needs to inherit DSA parameters from prev key
|
||||
cKey = makeInheritedParamsKey(cKey, prevPubKey);
|
||||
if (debug != null) debug.println("BasicChecker.updateState Made " +
|
||||
|
@ -35,6 +35,7 @@ import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.PrivilegedActionException;
|
||||
import java.security.PrivilegedExceptionAction;
|
||||
import java.security.cert.CertStore;
|
||||
import java.security.cert.CertStoreException;
|
||||
import java.security.cert.X509CertSelector;
|
||||
import java.security.cert.X509CRLSelector;
|
||||
import javax.security.auth.x500.X500Principal;
|
||||
@ -96,6 +97,25 @@ public abstract class CertStoreHelper {
|
||||
}
|
||||
}
|
||||
|
||||
static boolean isCausedByNetworkIssue(String type, CertStoreException cse) {
|
||||
switch (type) {
|
||||
case "LDAP":
|
||||
case "SSLServer":
|
||||
try {
|
||||
CertStoreHelper csh = CertStoreHelper.getInstance(type);
|
||||
return csh.isCausedByNetworkIssue(cse);
|
||||
} catch (NoSuchAlgorithmException nsae) {
|
||||
return false;
|
||||
}
|
||||
case "URI":
|
||||
Throwable t = cse.getCause();
|
||||
return (t != null && t instanceof IOException);
|
||||
default:
|
||||
// we don't know about any other remote CertStore types
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a CertStore using the given URI as parameters.
|
||||
*/
|
||||
@ -119,4 +139,10 @@ public abstract class CertStoreHelper {
|
||||
Collection<X500Principal> certIssuers,
|
||||
String dn)
|
||||
throws IOException;
|
||||
|
||||
/**
|
||||
* Returns true if the cause of the CertStoreException is a network
|
||||
* related issue.
|
||||
*/
|
||||
public abstract boolean isCausedByNetworkIssue(CertStoreException e);
|
||||
}
|
||||
|
@ -116,12 +116,17 @@ class DistributionPointFetcher {
|
||||
/**
|
||||
* Download CRLs from the given distribution point, verify and return them.
|
||||
* See the top of the class for current limitations.
|
||||
*
|
||||
* @throws CertStoreException if there is an error retrieving the CRLs
|
||||
* from one of the GeneralNames and no other CRLs are retrieved from
|
||||
* the other GeneralNames. If more than one GeneralName throws an
|
||||
* exception then the one from the last GeneralName is thrown.
|
||||
*/
|
||||
private static Collection<X509CRL> getCRLs(X509CRLSelector selector,
|
||||
X509CertImpl certImpl, DistributionPoint point, boolean[] reasonsMask,
|
||||
boolean signFlag, PublicKey prevKey, String provider,
|
||||
List<CertStore> certStores, Set<TrustAnchor> trustAnchors,
|
||||
Date validity) {
|
||||
Date validity) throws CertStoreException {
|
||||
|
||||
// check for full name
|
||||
GeneralNames fullName = point.getFullName();
|
||||
@ -149,24 +154,33 @@ class DistributionPointFetcher {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
}
|
||||
Collection<X509CRL> possibleCRLs = new ArrayList<X509CRL>();
|
||||
Collection<X509CRL> crls = new ArrayList<X509CRL>(2);
|
||||
Collection<X509CRL> possibleCRLs = new ArrayList<>();
|
||||
CertStoreException savedCSE = null;
|
||||
for (Iterator<GeneralName> t = fullName.iterator(); t.hasNext(); ) {
|
||||
GeneralName name = t.next();
|
||||
if (name.getType() == GeneralNameInterface.NAME_DIRECTORY) {
|
||||
X500Name x500Name = (X500Name) name.getName();
|
||||
possibleCRLs.addAll(
|
||||
getCRLs(x500Name, certImpl.getIssuerX500Principal(),
|
||||
certStores));
|
||||
} else if (name.getType() == GeneralNameInterface.NAME_URI) {
|
||||
URIName uriName = (URIName)name.getName();
|
||||
X509CRL crl = getCRL(uriName);
|
||||
if (crl != null) {
|
||||
possibleCRLs.add(crl);
|
||||
try {
|
||||
GeneralName name = t.next();
|
||||
if (name.getType() == GeneralNameInterface.NAME_DIRECTORY) {
|
||||
X500Name x500Name = (X500Name) name.getName();
|
||||
possibleCRLs.addAll(
|
||||
getCRLs(x500Name, certImpl.getIssuerX500Principal(),
|
||||
certStores));
|
||||
} else if (name.getType() == GeneralNameInterface.NAME_URI) {
|
||||
URIName uriName = (URIName)name.getName();
|
||||
X509CRL crl = getCRL(uriName);
|
||||
if (crl != null) {
|
||||
possibleCRLs.add(crl);
|
||||
}
|
||||
}
|
||||
} catch (CertStoreException cse) {
|
||||
savedCSE = cse;
|
||||
}
|
||||
}
|
||||
// only throw CertStoreException if no CRLs are retrieved
|
||||
if (possibleCRLs.isEmpty() && savedCSE != null) {
|
||||
throw savedCSE;
|
||||
}
|
||||
|
||||
Collection<X509CRL> crls = new ArrayList<>(2);
|
||||
for (X509CRL crl : possibleCRLs) {
|
||||
try {
|
||||
// make sure issuer is not set
|
||||
@ -191,34 +205,43 @@ class DistributionPointFetcher {
|
||||
/**
|
||||
* Download CRL from given URI.
|
||||
*/
|
||||
private static X509CRL getCRL(URIName name) {
|
||||
private static X509CRL getCRL(URIName name) throws CertStoreException {
|
||||
URI uri = name.getURI();
|
||||
if (debug != null) {
|
||||
debug.println("Trying to fetch CRL from DP " + uri);
|
||||
}
|
||||
CertStore ucs = null;
|
||||
try {
|
||||
CertStore ucs = URICertStore.getInstance
|
||||
ucs = URICertStore.getInstance
|
||||
(new URICertStore.URICertStoreParameters(uri));
|
||||
Collection<? extends CRL> crls = ucs.getCRLs(null);
|
||||
if (crls.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
return (X509CRL) crls.iterator().next();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InvalidAlgorithmParameterException |
|
||||
NoSuchAlgorithmException e) {
|
||||
if (debug != null) {
|
||||
debug.println("Exception getting CRL from CertStore: " + e);
|
||||
e.printStackTrace();
|
||||
debug.println("Can't create URICertStore: " + e.getMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Collection<? extends CRL> crls = ucs.getCRLs(null);
|
||||
if (crls.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
return (X509CRL) crls.iterator().next();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch CRLs from certStores.
|
||||
*
|
||||
* @throws CertStoreException if there is an error retrieving the CRLs from
|
||||
* one of the CertStores and no other CRLs are retrieved from
|
||||
* the other CertStores. If more than one CertStore throws an
|
||||
* exception then the one from the last CertStore is thrown.
|
||||
*/
|
||||
private static Collection<X509CRL> getCRLs(X500Name name,
|
||||
X500Principal certIssuer, List<CertStore> certStores)
|
||||
X500Principal certIssuer,
|
||||
List<CertStore> certStores)
|
||||
throws CertStoreException
|
||||
{
|
||||
if (debug != null) {
|
||||
debug.println("Trying to fetch CRL from DP " + name);
|
||||
@ -227,21 +250,27 @@ class DistributionPointFetcher {
|
||||
xcs.addIssuer(name.asX500Principal());
|
||||
xcs.addIssuer(certIssuer);
|
||||
Collection<X509CRL> crls = new ArrayList<>();
|
||||
CertStoreException savedCSE = null;
|
||||
for (CertStore store : certStores) {
|
||||
try {
|
||||
for (CRL crl : store.getCRLs(xcs)) {
|
||||
crls.add((X509CRL)crl);
|
||||
}
|
||||
} catch (CertStoreException cse) {
|
||||
// don't add the CRL
|
||||
if (debug != null) {
|
||||
debug.println("Non-fatal exception while retrieving " +
|
||||
debug.println("Exception while retrieving " +
|
||||
"CRLs: " + cse);
|
||||
cse.printStackTrace();
|
||||
}
|
||||
savedCSE = new PKIX.CertStoreTypeException(store.getType(),cse);
|
||||
}
|
||||
}
|
||||
return crls;
|
||||
// only throw CertStoreException if no CRLs are retrieved
|
||||
if (crls.isEmpty() && savedCSE != null) {
|
||||
throw savedCSE;
|
||||
} else {
|
||||
return crls;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -369,20 +369,21 @@ class ForwardBuilder extends Builder {
|
||||
boolean add = false;
|
||||
for (AccessDescription ad : adList) {
|
||||
CertStore cs = URICertStore.getInstance(ad);
|
||||
try {
|
||||
if (certs.addAll((Collection<X509Certificate>)
|
||||
cs.getCertificates(caSelector))) {
|
||||
add = true;
|
||||
if (!searchAllCertStores) {
|
||||
return true;
|
||||
if (cs != null) {
|
||||
try {
|
||||
if (certs.addAll((Collection<X509Certificate>)
|
||||
cs.getCertificates(caSelector))) {
|
||||
add = true;
|
||||
if (!searchAllCertStores) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
} catch (CertStoreException cse) {
|
||||
if (debug != null) {
|
||||
debug.println("exception getting certs from CertStore:");
|
||||
cse.printStackTrace();
|
||||
}
|
||||
}
|
||||
} catch (CertStoreException cse) {
|
||||
if (debug != null) {
|
||||
debug.println("exception getting certs from CertStore:");
|
||||
cse.printStackTrace();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return add;
|
||||
@ -816,36 +817,36 @@ class ForwardBuilder extends Builder {
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
X500Principal principal = anchor.getCA();
|
||||
PublicKey publicKey = anchor.getCAPublicKey();
|
||||
}
|
||||
X500Principal principal = anchor.getCA();
|
||||
PublicKey publicKey = anchor.getCAPublicKey();
|
||||
|
||||
if (principal != null && publicKey != null &&
|
||||
principal.equals(cert.getSubjectX500Principal())) {
|
||||
if (publicKey.equals(cert.getPublicKey())) {
|
||||
// the cert itself is a trust anchor
|
||||
this.trustAnchor = anchor;
|
||||
return true;
|
||||
}
|
||||
// else, it is a self-issued certificate of the anchor
|
||||
if (principal != null && publicKey != null &&
|
||||
principal.equals(cert.getSubjectX500Principal())) {
|
||||
if (publicKey.equals(cert.getPublicKey())) {
|
||||
// the cert itself is a trust anchor
|
||||
this.trustAnchor = anchor;
|
||||
return true;
|
||||
}
|
||||
// else, it is a self-issued certificate of the anchor
|
||||
}
|
||||
|
||||
// Check subject/issuer name chaining
|
||||
if (principal == null ||
|
||||
!principal.equals(cert.getIssuerX500Principal())) {
|
||||
continue;
|
||||
}
|
||||
// Check subject/issuer name chaining
|
||||
if (principal == null ||
|
||||
!principal.equals(cert.getIssuerX500Principal())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// skip anchor if it contains a DSA key with no DSA params
|
||||
if (PKIX.isDSAPublicKeyWithoutParams(publicKey)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check signature
|
||||
*/
|
||||
try {
|
||||
// NOTE: the DSA public key in the buildParams may lack
|
||||
// parameters, yet there is no key to inherit the parameters
|
||||
// from. This is probably such a rare case that it is not worth
|
||||
// trying to detect the situation earlier.
|
||||
cert.verify(anchor.getCAPublicKey(), buildParams.sigProvider());
|
||||
cert.verify(publicKey, buildParams.sigProvider());
|
||||
} catch (InvalidKeyException ike) {
|
||||
if (debug != null) {
|
||||
debug.println("ForwardBuilder.isPathCompleted() invalid "
|
||||
|
@ -26,12 +26,10 @@
|
||||
package sun.security.provider.certpath;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.PublicKey;
|
||||
import java.security.cert.CertificateException;
|
||||
import java.security.cert.CertPathValidatorException;
|
||||
import java.security.cert.PKIXCertPathChecker;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.security.interfaces.DSAPublicKey;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@ -169,9 +167,7 @@ class ForwardState implements State {
|
||||
X509CertImpl icert = X509CertImpl.toImpl(cert);
|
||||
|
||||
/* see if certificate key has null parameters */
|
||||
PublicKey newKey = icert.getPublicKey();
|
||||
if (newKey instanceof DSAPublicKey &&
|
||||
((DSAPublicKey)newKey).getParams() == null) {
|
||||
if (PKIX.isDSAPublicKeyWithoutParams(icert.getPublicKey())) {
|
||||
keyParamsNeededFlag = true;
|
||||
}
|
||||
|
||||
|
@ -335,8 +335,8 @@ public final class OCSP {
|
||||
static class NetworkFailureException extends CertPathValidatorException {
|
||||
private static final long serialVersionUID = 0l;
|
||||
|
||||
private NetworkFailureException(IOException ioe) {
|
||||
super(ioe);
|
||||
NetworkFailureException(Throwable t) {
|
||||
super(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -26,7 +26,9 @@ package sun.security.provider.certpath;
|
||||
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.KeyStore;
|
||||
import java.security.PublicKey;
|
||||
import java.security.cert.*;
|
||||
import java.security.interfaces.DSAPublicKey;
|
||||
import java.util.*;
|
||||
import javax.security.auth.x500.X500Principal;
|
||||
|
||||
@ -42,6 +44,11 @@ class PKIX {
|
||||
|
||||
private PKIX() { }
|
||||
|
||||
static boolean isDSAPublicKeyWithoutParams(PublicKey publicKey) {
|
||||
return (publicKey instanceof DSAPublicKey &&
|
||||
((DSAPublicKey)publicKey).getParams() == null);
|
||||
}
|
||||
|
||||
static ValidatorParams checkParams(CertPath cp, CertPathParameters params)
|
||||
throws InvalidAlgorithmParameterException
|
||||
{
|
||||
@ -270,6 +277,24 @@ class PKIX {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A CertStoreException with additional information about the type of
|
||||
* CertStore that generated the exception.
|
||||
*/
|
||||
static class CertStoreTypeException extends CertStoreException {
|
||||
private static final long serialVersionUID = 7463352639238322556L;
|
||||
|
||||
private final String type;
|
||||
|
||||
CertStoreTypeException(String type, CertStoreException cse) {
|
||||
super(cse.getMessage(), cse.getCause());
|
||||
this.type = type;
|
||||
}
|
||||
String getType() {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Comparator that orders CertStores so that local CertStores come before
|
||||
* remote CertStores.
|
||||
|
@ -32,7 +32,6 @@ import java.security.cert.CertPathValidatorException;
|
||||
import java.security.cert.PKIXCertPathChecker;
|
||||
import java.security.cert.TrustAnchor;
|
||||
import java.security.cert.X509Certificate;
|
||||
import java.security.interfaces.DSAPublicKey;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@ -287,8 +286,7 @@ class ReverseState implements State {
|
||||
/* check for key needing to inherit alg parameters */
|
||||
X509CertImpl icert = X509CertImpl.toImpl(cert);
|
||||
PublicKey newKey = cert.getPublicKey();
|
||||
if (newKey instanceof DSAPublicKey &&
|
||||
(((DSAPublicKey)newKey).getParams() == null)) {
|
||||
if (PKIX.isDSAPublicKeyWithoutParams(newKey)) {
|
||||
newKey = BasicChecker.makeInheritedParamsKey(newKey, pubKey);
|
||||
}
|
||||
|
||||
|
@ -38,7 +38,6 @@ import java.security.Security;
|
||||
import java.security.cert.CertPathValidatorException.BasicReason;
|
||||
import java.security.cert.Extension;
|
||||
import java.security.cert.*;
|
||||
import java.security.interfaces.DSAPublicKey;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -50,7 +49,7 @@ import java.util.Set;
|
||||
import javax.security.auth.x500.X500Principal;
|
||||
|
||||
import static sun.security.provider.certpath.OCSP.*;
|
||||
import sun.security.provider.certpath.PKIX.ValidatorParams;
|
||||
import static sun.security.provider.certpath.PKIX.*;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
import sun.security.x509.*;
|
||||
import static sun.security.x509.PKIXExtensions.*;
|
||||
@ -406,8 +405,7 @@ class RevocationChecker extends PKIXRevocationChecker {
|
||||
|
||||
// Make new public key if parameters are missing
|
||||
PublicKey pubKey = cert.getPublicKey();
|
||||
if (pubKey instanceof DSAPublicKey &&
|
||||
((DSAPublicKey)pubKey).getParams() == null) {
|
||||
if (PKIX.isDSAPublicKeyWithoutParams(pubKey)) {
|
||||
// pubKey needs to inherit DSA parameters from prev key
|
||||
pubKey = BasicChecker.makeInheritedParamsKey(pubKey, prevPubKey);
|
||||
}
|
||||
@ -458,14 +456,23 @@ class RevocationChecker extends PKIXRevocationChecker {
|
||||
sel.setCertificateChecking(cert);
|
||||
CertPathHelper.setDateAndTime(sel, params.date(), MAX_CLOCK_SKEW);
|
||||
|
||||
// First, check cached CRLs
|
||||
// First, check user-specified CertStores
|
||||
NetworkFailureException nfe = null;
|
||||
for (CertStore store : certStores) {
|
||||
try {
|
||||
for (CRL crl : store.getCRLs(sel)) {
|
||||
possibleCRLs.add((X509CRL)crl);
|
||||
}
|
||||
} catch (CertStoreException e) {
|
||||
// XXX ignore?
|
||||
if (debug != null) {
|
||||
debug.println("RevocationChecker.checkCRLs() " +
|
||||
"CertStoreException: " + e.getMessage());
|
||||
}
|
||||
if (softFail && nfe == null &&
|
||||
CertStoreHelper.isCausedByNetworkIssue(store.getType(),e)) {
|
||||
// save this exception, we may need to throw it later
|
||||
nfe = new NetworkFailureException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -504,9 +511,12 @@ class RevocationChecker extends PKIXRevocationChecker {
|
||||
reasonsMask, anchors, params.date()));
|
||||
}
|
||||
} catch (CertStoreException e) {
|
||||
if (debug != null) {
|
||||
debug.println("RevocationChecker.checkCRLs() " +
|
||||
"unexpected exception: " + e.getMessage());
|
||||
if (softFail && e instanceof CertStoreTypeException) {
|
||||
CertStoreTypeException cste = (CertStoreTypeException)e;
|
||||
if (CertStoreHelper.isCausedByNetworkIssue(cste.getType(),
|
||||
e)) {
|
||||
throw new NetworkFailureException(e);
|
||||
}
|
||||
}
|
||||
throw new CertPathValidatorException(e);
|
||||
}
|
||||
@ -516,10 +526,28 @@ class RevocationChecker extends PKIXRevocationChecker {
|
||||
checkApprovedCRLs(cert, approvedCRLs);
|
||||
} else {
|
||||
if (allowSeparateKey) {
|
||||
verifyWithSeparateSigningKey(cert, prevKey, signFlag,
|
||||
stackedCerts);
|
||||
return;
|
||||
try {
|
||||
verifyWithSeparateSigningKey(cert, prevKey, signFlag,
|
||||
stackedCerts);
|
||||
return;
|
||||
} catch (CertPathValidatorException cpve) {
|
||||
if (nfe != null) {
|
||||
// if a network issue previously prevented us from
|
||||
// retrieving a CRL from one of the user-specified
|
||||
// CertStores and SOFT_FAIL is enabled, throw it now
|
||||
// so it can be handled appropriately
|
||||
throw nfe;
|
||||
}
|
||||
throw cpve;
|
||||
}
|
||||
} else {
|
||||
if (nfe != null) {
|
||||
// if a network issue previously prevented us from
|
||||
// retrieving a CRL from one of the user-specified
|
||||
// CertStores and SOFT_FAIL is enabled, throw it now
|
||||
// so it can be handled appropriately
|
||||
throw nfe;
|
||||
}
|
||||
throw new CertPathValidatorException
|
||||
("Could not determine revocation status", null, null, -1,
|
||||
BasicReason.UNDETERMINED_REVOCATION_STATUS);
|
||||
|
@ -31,7 +31,6 @@ import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.PublicKey;
|
||||
import java.security.cert.*;
|
||||
import java.security.cert.PKIXReason;
|
||||
import java.security.interfaces.DSAPublicKey;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@ -242,6 +241,15 @@ public final class SunCertPathBuilder extends CertPathBuilderSpi {
|
||||
break;
|
||||
}
|
||||
|
||||
// skip anchor if it contains a DSA key with no DSA params
|
||||
X509Certificate trustedCert = anchor.getTrustedCert();
|
||||
PublicKey pubKey = trustedCert != null ? trustedCert.getPublicKey()
|
||||
: anchor.getCAPublicKey();
|
||||
|
||||
if (PKIX.isDSAPublicKeyWithoutParams(pubKey)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Initialize current state */
|
||||
currentState.initState(buildParams);
|
||||
currentState.updateState(anchor, buildParams);
|
||||
@ -705,9 +713,7 @@ public final class SunCertPathBuilder extends CertPathBuilderSpi {
|
||||
* Extract and save the final target public key
|
||||
*/
|
||||
finalPublicKey = cert.getPublicKey();
|
||||
if (finalPublicKey instanceof DSAPublicKey &&
|
||||
((DSAPublicKey)finalPublicKey).getParams() == null)
|
||||
{
|
||||
if (PKIX.isDSAPublicKeyWithoutParams(finalPublicKey)) {
|
||||
finalPublicKey =
|
||||
BasicChecker.makeInheritedParamsKey
|
||||
(finalPublicKey, currentState.pubKey);
|
||||
|
@ -340,7 +340,11 @@ class URICertStore extends CertStoreSpi {
|
||||
// Fetch the CRLs via LDAP. LDAPCertStore has its own
|
||||
// caching mechanism, see the class description for more info.
|
||||
// Safe cast since xsel is an X509 certificate selector.
|
||||
return (Collection<X509CRL>) ldapCertStore.getCRLs(xsel);
|
||||
try {
|
||||
return (Collection<X509CRL>) ldapCertStore.getCRLs(xsel);
|
||||
} catch (CertStoreException cse) {
|
||||
throw new PKIX.CertStoreTypeException("LDAP", cse);
|
||||
}
|
||||
}
|
||||
|
||||
// Return the CRLs for this entry. It returns the cached value
|
||||
@ -391,11 +395,12 @@ class URICertStore extends CertStoreSpi {
|
||||
debug.println("Exception fetching CRL:");
|
||||
e.printStackTrace();
|
||||
}
|
||||
// exception, forget previous values
|
||||
lastModified = 0;
|
||||
crl = null;
|
||||
throw new PKIX.CertStoreTypeException("URI",
|
||||
new CertStoreException(e));
|
||||
}
|
||||
// exception, forget previous values
|
||||
lastModified = 0;
|
||||
crl = null;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2009, 2012, 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,15 +25,18 @@
|
||||
|
||||
package sun.security.provider.certpath.ldap;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Collection;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.cert.CertStore;
|
||||
import java.security.cert.CertStoreException;
|
||||
import java.security.cert.X509CertSelector;
|
||||
import java.security.cert.X509CRLSelector;
|
||||
import javax.naming.CommunicationException;
|
||||
import javax.naming.ServiceUnavailableException;
|
||||
import javax.security.auth.x500.X500Principal;
|
||||
import java.io.IOException;
|
||||
|
||||
import sun.security.provider.certpath.CertStoreHelper;
|
||||
|
||||
@ -68,4 +71,11 @@ public final class LDAPCertStoreHelper
|
||||
{
|
||||
return new LDAPCertStore.LDAPCRLSelector(selector, certIssuers, ldapDN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCausedByNetworkIssue(CertStoreException e) {
|
||||
Throwable t = e.getCause();
|
||||
return (t != null && (t instanceof ServiceUnavailableException ||
|
||||
t instanceof CommunicationException));
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2011, 2012, 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,15 +25,16 @@
|
||||
|
||||
package sun.security.provider.certpath.ssl;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.Collection;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.cert.CertStore;
|
||||
import java.security.cert.CertStoreException;
|
||||
import java.security.cert.X509CertSelector;
|
||||
import java.security.cert.X509CRLSelector;
|
||||
import java.util.Collection;
|
||||
import javax.security.auth.x500.X500Principal;
|
||||
import java.io.IOException;
|
||||
|
||||
import sun.security.provider.certpath.CertStoreHelper;
|
||||
|
||||
@ -66,4 +67,10 @@ public final class SSLServerCertStoreHelper extends CertStoreHelper {
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCausedByNetworkIssue(CertStoreException e) {
|
||||
Throwable t = e.getCause();
|
||||
return (t != null && t instanceof IOException);
|
||||
}
|
||||
}
|
||||
|
@ -266,7 +266,7 @@ public abstract class SSLContextImpl extends SSLContextSpi {
|
||||
}
|
||||
|
||||
// Get suported CipherSuiteList.
|
||||
CipherSuiteList getSuportedCipherSuiteList() {
|
||||
CipherSuiteList getSupportedCipherSuiteList() {
|
||||
// The maintenance of cipher suites needs to be synchronized.
|
||||
synchronized (this) {
|
||||
// Clear cache of available ciphersuites.
|
||||
|
@ -1978,7 +1978,7 @@ final public class SSLEngineImpl extends SSLEngine {
|
||||
* @return an array of cipher suite names
|
||||
*/
|
||||
public String[] getSupportedCipherSuites() {
|
||||
return sslContext.getSuportedCipherSuiteList().toStringArray();
|
||||
return sslContext.getSupportedCipherSuiteList().toStringArray();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2012, 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
|
||||
@ -113,7 +113,7 @@ public class SSLServerSocketFactoryImpl extends SSLServerSocketFactory
|
||||
* @return an array of cipher suite names
|
||||
*/
|
||||
public String[] getSupportedCipherSuites() {
|
||||
return context.getSuportedCipherSuiteList().toStringArray();
|
||||
return context.getSupportedCipherSuiteList().toStringArray();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1996, 2012, 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
|
||||
@ -168,7 +168,7 @@ class SSLServerSocketImpl extends SSLServerSocket
|
||||
* @return an array of cipher suite names
|
||||
*/
|
||||
public String[] getSupportedCipherSuites() {
|
||||
return sslContext.getSuportedCipherSuiteList().toStringArray();
|
||||
return sslContext.getSupportedCipherSuiteList().toStringArray();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2012, 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
|
||||
@ -177,6 +177,6 @@ final public class SSLSocketFactoryImpl extends SSLSocketFactory {
|
||||
* certain kinds of certificates to use certain cipher suites.
|
||||
*/
|
||||
public String[] getSupportedCipherSuites() {
|
||||
return context.getSuportedCipherSuiteList().toStringArray();
|
||||
return context.getSupportedCipherSuiteList().toStringArray();
|
||||
}
|
||||
}
|
||||
|
@ -2353,7 +2353,7 @@ final public class SSLSocketImpl extends BaseSSLSocketImpl {
|
||||
* @return an array of cipher suite names
|
||||
*/
|
||||
public String[] getSupportedCipherSuites() {
|
||||
return sslContext.getSuportedCipherSuiteList().toStringArray();
|
||||
return sslContext.getSupportedCipherSuiteList().toStringArray();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,15 +70,22 @@ public class Debug {
|
||||
System.err.println();
|
||||
System.err.println("all turn on all debugging");
|
||||
System.err.println("access print all checkPermission results");
|
||||
System.err.println("certpath PKIX CertPathBuilder and");
|
||||
System.err.println(" CertPathValidator debugging");
|
||||
System.err.println("combiner SubjectDomainCombiner debugging");
|
||||
System.err.println("gssloginconfig");
|
||||
System.err.println(" GSS LoginConfigImpl debugging");
|
||||
System.err.println("configfile JAAS ConfigFile loading");
|
||||
System.err.println("configparser JAAS ConfigFile parsing");
|
||||
System.err.println(" GSS LoginConfigImpl debugging");
|
||||
System.err.println("jar jar verification");
|
||||
System.err.println("logincontext login context results");
|
||||
System.err.println("jca JCA engine class debugging");
|
||||
System.err.println("policy loading and granting");
|
||||
System.err.println("provider security provider debugging");
|
||||
System.err.println("pkcs11 PKCS11 session manager debugging");
|
||||
System.err.println("pkcs11keystore");
|
||||
System.err.println(" PKCS11 KeyStore debugging");
|
||||
System.err.println("sunpkcs11 SunPKCS11 provider debugging");
|
||||
System.err.println("scl permissions SecureClassLoader assigns");
|
||||
System.err.println("ts timestamping");
|
||||
System.err.println();
|
||||
|
@ -1,177 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
* 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.security.x509;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import sun.security.util.*;
|
||||
|
||||
/**
|
||||
* This class defines the subject/issuer unique identity attribute
|
||||
* for the Certificate.
|
||||
*
|
||||
* @author Amit Kapoor
|
||||
* @author Hemma Prafullchandra
|
||||
* @see CertAttrSet
|
||||
*/
|
||||
public class CertificateIssuerUniqueIdentity implements CertAttrSet<String> {
|
||||
private UniqueIdentity id;
|
||||
|
||||
/**
|
||||
* Identifier for this attribute, to be used with the
|
||||
* get, set, delete methods of Certificate, x509 type.
|
||||
*/
|
||||
public static final String IDENT = "x509.info.issuerID";
|
||||
/**
|
||||
* Sub attributes name for this CertAttrSet.
|
||||
*/
|
||||
public static final String NAME = "issuerID";
|
||||
public static final String ID = "id";
|
||||
|
||||
/**
|
||||
* Default constructor for the certificate attribute.
|
||||
*
|
||||
* @param key the UniqueIdentity
|
||||
*/
|
||||
public CertificateIssuerUniqueIdentity(UniqueIdentity id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the object, decoding the values from the passed DER stream.
|
||||
*
|
||||
* @param in the DerInputStream to read the UniqueIdentity from.
|
||||
* @exception IOException on decoding errors.
|
||||
*/
|
||||
public CertificateIssuerUniqueIdentity(DerInputStream in)
|
||||
throws IOException {
|
||||
id = new UniqueIdentity(in);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the object, decoding the values from the passed stream.
|
||||
*
|
||||
* @param in the InputStream to read the UniqueIdentity from.
|
||||
* @exception IOException on decoding errors.
|
||||
*/
|
||||
public CertificateIssuerUniqueIdentity(InputStream in)
|
||||
throws IOException {
|
||||
DerValue val = new DerValue(in);
|
||||
id = new UniqueIdentity(val);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the object, decoding the values from the passed DER value.
|
||||
*
|
||||
* @param in the DerValue to read the UniqueIdentity from.
|
||||
* @exception IOException on decoding errors.
|
||||
*/
|
||||
public CertificateIssuerUniqueIdentity(DerValue val)
|
||||
throws IOException {
|
||||
id = new UniqueIdentity(val);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the identity as user readable string.
|
||||
*/
|
||||
public String toString() {
|
||||
if (id == null) return "";
|
||||
return (id.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode the identity in DER form to the stream.
|
||||
*
|
||||
* @param out the DerOutputStream to marshal the contents to.
|
||||
* @exception IOException on errors.
|
||||
*/
|
||||
public void encode(OutputStream out) throws IOException {
|
||||
DerOutputStream tmp = new DerOutputStream();
|
||||
id.encode(tmp,DerValue.createTag(DerValue.TAG_CONTEXT,false,(byte)1));
|
||||
|
||||
out.write(tmp.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the attribute value.
|
||||
*/
|
||||
public void set(String name, Object obj) throws IOException {
|
||||
if (!(obj instanceof UniqueIdentity)) {
|
||||
throw new IOException("Attribute must be of type UniqueIdentity.");
|
||||
}
|
||||
if (name.equalsIgnoreCase(ID)) {
|
||||
id = (UniqueIdentity)obj;
|
||||
} else {
|
||||
throw new IOException("Attribute name not recognized by " +
|
||||
"CertAttrSet: CertificateIssuerUniqueIdentity.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attribute value.
|
||||
*/
|
||||
public UniqueIdentity get(String name) throws IOException {
|
||||
if (name.equalsIgnoreCase(ID)) {
|
||||
return (id);
|
||||
} else {
|
||||
throw new IOException("Attribute name not recognized by " +
|
||||
"CertAttrSet: CertificateIssuerUniqueIdentity.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the attribute value.
|
||||
*/
|
||||
public void delete(String name) throws IOException {
|
||||
if (name.equalsIgnoreCase(ID)) {
|
||||
id = null;
|
||||
} else {
|
||||
throw new IOException("Attribute name not recognized by " +
|
||||
"CertAttrSet: CertificateIssuerUniqueIdentity.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an enumeration of names of attributes existing within this
|
||||
* attribute.
|
||||
*/
|
||||
public Enumeration<String> getElements() {
|
||||
AttributeNameEnumeration elements = new AttributeNameEnumeration();
|
||||
elements.addElement(ID);
|
||||
|
||||
return (elements.elements());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of this attribute.
|
||||
*/
|
||||
public String getName() {
|
||||
return (NAME);
|
||||
}
|
||||
}
|
@ -1,176 +0,0 @@
|
||||
/*
|
||||
* 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
|
||||
* 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.security.x509;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Enumeration;
|
||||
|
||||
import sun.security.util.*;
|
||||
|
||||
/**
|
||||
* This class defines the subject/issuer unique identity attribute
|
||||
* for the Certificate.
|
||||
*
|
||||
* @author Amit Kapoor
|
||||
* @author Hemma Prafullchandra
|
||||
* @see CertAttrSet
|
||||
*/
|
||||
public class CertificateSubjectUniqueIdentity implements CertAttrSet<String> {
|
||||
/**
|
||||
* Identifier for this attribute, to be used with the
|
||||
* get, set, delete methods of Certificate, x509 type.
|
||||
*/
|
||||
public static final String IDENT = "x509.info.subjectID";
|
||||
/**
|
||||
* Sub attributes name for this CertAttrSet.
|
||||
*/
|
||||
public static final String NAME = "subjectID";
|
||||
public static final String ID = "id";
|
||||
|
||||
private UniqueIdentity id;
|
||||
|
||||
/**
|
||||
* Default constructor for the certificate attribute.
|
||||
*
|
||||
* @param key the UniqueIdentity
|
||||
*/
|
||||
public CertificateSubjectUniqueIdentity(UniqueIdentity id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the object, decoding the values from the passed DER stream.
|
||||
*
|
||||
* @param in the DerInputStream to read the UniqueIdentity from.
|
||||
* @exception IOException on decoding errors.
|
||||
*/
|
||||
public CertificateSubjectUniqueIdentity(DerInputStream in)
|
||||
throws IOException {
|
||||
id = new UniqueIdentity(in);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the object, decoding the values from the passed stream.
|
||||
*
|
||||
* @param in the InputStream to read the UniqueIdentity from.
|
||||
* @exception IOException on decoding errors.
|
||||
*/
|
||||
public CertificateSubjectUniqueIdentity(InputStream in)
|
||||
throws IOException {
|
||||
DerValue val = new DerValue(in);
|
||||
id = new UniqueIdentity(val);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the object, decoding the values from the passed DER value.
|
||||
*
|
||||
* @param in the DerValue to read the UniqueIdentity from.
|
||||
* @exception IOException on decoding errors.
|
||||
*/
|
||||
public CertificateSubjectUniqueIdentity(DerValue val)
|
||||
throws IOException {
|
||||
id = new UniqueIdentity(val);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the identity as user readable string.
|
||||
*/
|
||||
public String toString() {
|
||||
if (id == null) return "";
|
||||
return(id.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Encode the identity in DER form to the stream.
|
||||
*
|
||||
* @param out the DerOutputStream to marshal the contents to.
|
||||
* @exception IOException on errors.
|
||||
*/
|
||||
public void encode(OutputStream out) throws IOException {
|
||||
DerOutputStream tmp = new DerOutputStream();
|
||||
id.encode(tmp,DerValue.createTag(DerValue.TAG_CONTEXT,false,(byte)2));
|
||||
|
||||
out.write(tmp.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the attribute value.
|
||||
*/
|
||||
public void set(String name, Object obj) throws IOException {
|
||||
if (!(obj instanceof UniqueIdentity)) {
|
||||
throw new IOException("Attribute must be of type UniqueIdentity.");
|
||||
}
|
||||
if (name.equalsIgnoreCase(ID)) {
|
||||
id = (UniqueIdentity)obj;
|
||||
} else {
|
||||
throw new IOException("Attribute name not recognized by " +
|
||||
"CertAttrSet: CertificateSubjectUniqueIdentity.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the attribute value.
|
||||
*/
|
||||
public UniqueIdentity get(String name) throws IOException {
|
||||
if (name.equalsIgnoreCase(ID)) {
|
||||
return(id);
|
||||
} else {
|
||||
throw new IOException("Attribute name not recognized by " +
|
||||
"CertAttrSet: CertificateSubjectUniqueIdentity.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete the attribute value.
|
||||
*/
|
||||
public void delete(String name) throws IOException {
|
||||
if (name.equalsIgnoreCase(ID)) {
|
||||
id = null;
|
||||
} else {
|
||||
throw new IOException("Attribute name not recognized by " +
|
||||
"CertAttrSet: CertificateSubjectUniqueIdentity.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an enumeration of names of attributes existing within this
|
||||
* attribute.
|
||||
*/
|
||||
public Enumeration<String> getElements() {
|
||||
AttributeNameEnumeration elements = new AttributeNameEnumeration();
|
||||
elements.addElement(ID);
|
||||
|
||||
return (elements.elements());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the name of this attribute.
|
||||
*/
|
||||
public String getName() {
|
||||
return (NAME);
|
||||
}
|
||||
}
|
@ -1070,8 +1070,7 @@ public class X509CertImpl extends X509Certificate implements DerEncoder {
|
||||
return null;
|
||||
try {
|
||||
UniqueIdentity id = (UniqueIdentity)info.get(
|
||||
CertificateIssuerUniqueIdentity.NAME
|
||||
+ DOT + CertificateIssuerUniqueIdentity.ID);
|
||||
X509CertInfo.ISSUER_ID);
|
||||
if (id == null)
|
||||
return null;
|
||||
else
|
||||
@ -1091,8 +1090,7 @@ public class X509CertImpl extends X509Certificate implements DerEncoder {
|
||||
return null;
|
||||
try {
|
||||
UniqueIdentity id = (UniqueIdentity)info.get(
|
||||
CertificateSubjectUniqueIdentity.NAME
|
||||
+ DOT + CertificateSubjectUniqueIdentity.ID);
|
||||
X509CertInfo.SUBJECT_ID);
|
||||
if (id == null)
|
||||
return null;
|
||||
else
|
||||
|
@ -75,8 +75,8 @@ public class X509CertInfo implements CertAttrSet<String> {
|
||||
public static final String VALIDITY = CertificateValidity.NAME;
|
||||
public static final String SUBJECT = CertificateSubjectName.NAME;
|
||||
public static final String KEY = CertificateX509Key.NAME;
|
||||
public static final String ISSUER_ID = CertificateIssuerUniqueIdentity.NAME;
|
||||
public static final String SUBJECT_ID = CertificateSubjectUniqueIdentity.NAME;
|
||||
public static final String ISSUER_ID = "issuerID";
|
||||
public static final String SUBJECT_ID = "subjectID";
|
||||
public static final String EXTENSIONS = CertificateExtensions.NAME;
|
||||
|
||||
// X509.v1 data
|
||||
@ -89,8 +89,8 @@ public class X509CertInfo implements CertAttrSet<String> {
|
||||
protected CertificateX509Key pubKey = null;
|
||||
|
||||
// X509.v2 & v3 extensions
|
||||
protected CertificateIssuerUniqueIdentity issuerUniqueId = null;
|
||||
protected CertificateSubjectUniqueIdentity subjectUniqueId = null;
|
||||
protected UniqueIdentity issuerUniqueId = null;
|
||||
protected UniqueIdentity subjectUniqueId = null;
|
||||
|
||||
// X509.v3 extensions
|
||||
protected CertificateExtensions extensions = null;
|
||||
@ -431,19 +431,11 @@ public class X509CertInfo implements CertAttrSet<String> {
|
||||
break;
|
||||
|
||||
case ATTR_ISSUER_ID:
|
||||
if (suffix == null) {
|
||||
setIssuerUniqueId(val);
|
||||
} else {
|
||||
issuerUniqueId.set(suffix, val);
|
||||
}
|
||||
setIssuerUniqueId(val);
|
||||
break;
|
||||
|
||||
case ATTR_SUBJECT_ID:
|
||||
if (suffix == null) {
|
||||
setSubjectUniqueId(val);
|
||||
} else {
|
||||
subjectUniqueId.set(suffix, val);
|
||||
}
|
||||
setSubjectUniqueId(val);
|
||||
break;
|
||||
|
||||
case ATTR_EXTENSIONS:
|
||||
@ -529,18 +521,10 @@ public class X509CertInfo implements CertAttrSet<String> {
|
||||
}
|
||||
break;
|
||||
case (ATTR_ISSUER_ID):
|
||||
if (suffix == null) {
|
||||
issuerUniqueId = null;
|
||||
} else {
|
||||
issuerUniqueId.delete(suffix);
|
||||
}
|
||||
issuerUniqueId = null;
|
||||
break;
|
||||
case (ATTR_SUBJECT_ID):
|
||||
if (suffix == null) {
|
||||
subjectUniqueId = null;
|
||||
} else {
|
||||
subjectUniqueId.delete(suffix);
|
||||
}
|
||||
subjectUniqueId = null;
|
||||
break;
|
||||
case (ATTR_EXTENSIONS):
|
||||
if (suffix == null) {
|
||||
@ -626,23 +610,9 @@ public class X509CertInfo implements CertAttrSet<String> {
|
||||
return(serialNum.get(suffix));
|
||||
}
|
||||
case (ATTR_ISSUER_ID):
|
||||
if (suffix == null) {
|
||||
return(issuerUniqueId);
|
||||
} else {
|
||||
if (issuerUniqueId == null)
|
||||
return null;
|
||||
else
|
||||
return(issuerUniqueId.get(suffix));
|
||||
}
|
||||
return(issuerUniqueId);
|
||||
case (ATTR_SUBJECT_ID):
|
||||
if (suffix == null) {
|
||||
return(subjectUniqueId);
|
||||
} else {
|
||||
if (subjectUniqueId == null)
|
||||
return null;
|
||||
else
|
||||
return(subjectUniqueId.get(suffix));
|
||||
}
|
||||
return(subjectUniqueId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -711,7 +681,7 @@ public class X509CertInfo implements CertAttrSet<String> {
|
||||
// Get the issuerUniqueId if present
|
||||
tmp = in.getDerValue();
|
||||
if (tmp.isContextSpecific((byte)1)) {
|
||||
issuerUniqueId = new CertificateIssuerUniqueIdentity(tmp);
|
||||
issuerUniqueId = new UniqueIdentity(tmp);
|
||||
if (in.available() == 0)
|
||||
return;
|
||||
tmp = in.getDerValue();
|
||||
@ -719,7 +689,7 @@ public class X509CertInfo implements CertAttrSet<String> {
|
||||
|
||||
// Get the subjectUniqueId if present.
|
||||
if (tmp.isContextSpecific((byte)2)) {
|
||||
subjectUniqueId = new CertificateSubjectUniqueIdentity(tmp);
|
||||
subjectUniqueId = new UniqueIdentity(tmp);
|
||||
if (in.available() == 0)
|
||||
return;
|
||||
tmp = in.getDerValue();
|
||||
@ -814,10 +784,12 @@ public class X509CertInfo implements CertAttrSet<String> {
|
||||
|
||||
// Encode issuerUniqueId & subjectUniqueId.
|
||||
if (issuerUniqueId != null) {
|
||||
issuerUniqueId.encode(tmp);
|
||||
issuerUniqueId.encode(tmp, DerValue.createTag(DerValue.TAG_CONTEXT,
|
||||
false,(byte)1));
|
||||
}
|
||||
if (subjectUniqueId != null) {
|
||||
subjectUniqueId.encode(tmp);
|
||||
subjectUniqueId.encode(tmp, DerValue.createTag(DerValue.TAG_CONTEXT,
|
||||
false,(byte)2));
|
||||
}
|
||||
|
||||
// Write all the extensions.
|
||||
@ -946,11 +918,11 @@ public class X509CertInfo implements CertAttrSet<String> {
|
||||
if (version.compare(CertificateVersion.V2) < 0) {
|
||||
throw new CertificateException("Invalid version");
|
||||
}
|
||||
if (!(val instanceof CertificateIssuerUniqueIdentity)) {
|
||||
if (!(val instanceof UniqueIdentity)) {
|
||||
throw new CertificateException(
|
||||
"IssuerUniqueId class type invalid.");
|
||||
}
|
||||
issuerUniqueId = (CertificateIssuerUniqueIdentity)val;
|
||||
issuerUniqueId = (UniqueIdentity)val;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -963,11 +935,11 @@ public class X509CertInfo implements CertAttrSet<String> {
|
||||
if (version.compare(CertificateVersion.V2) < 0) {
|
||||
throw new CertificateException("Invalid version");
|
||||
}
|
||||
if (!(val instanceof CertificateSubjectUniqueIdentity)) {
|
||||
if (!(val instanceof UniqueIdentity)) {
|
||||
throw new CertificateException(
|
||||
"SubjectUniqueId class type invalid.");
|
||||
}
|
||||
subjectUniqueId = (CertificateSubjectUniqueIdentity)val;
|
||||
subjectUniqueId = (UniqueIdentity)val;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -126,7 +126,7 @@ public abstract class PreHashedMap<V>
|
||||
*/
|
||||
protected abstract void init(Object[] ht);
|
||||
|
||||
// @SuppressWarnings("unchecked")
|
||||
@SuppressWarnings("unchecked")
|
||||
private V toV(Object x) {
|
||||
return (V)x;
|
||||
}
|
||||
@ -259,8 +259,7 @@ public abstract class PreHashedMap<V>
|
||||
return true;
|
||||
if (!(ob instanceof Map.Entry))
|
||||
return false;
|
||||
Map.Entry<String,V> that
|
||||
= (Map.Entry<String,V>)ob;
|
||||
Map.Entry<?,?> that = (Map.Entry<?,?>)ob;
|
||||
return ((this.getKey() == null
|
||||
? that.getKey() == null
|
||||
: this.getKey()
|
||||
|
@ -40,6 +40,22 @@ public class DefaultAsynchronousChannelProvider {
|
||||
*/
|
||||
private DefaultAsynchronousChannelProvider() { }
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static AsynchronousChannelProvider createProvider(String cn) {
|
||||
Class<AsynchronousChannelProvider> c;
|
||||
try {
|
||||
c = (Class<AsynchronousChannelProvider>)Class.forName(cn);
|
||||
} catch (ClassNotFoundException x) {
|
||||
throw new AssertionError(x);
|
||||
}
|
||||
try {
|
||||
return c.newInstance();
|
||||
} catch (IllegalAccessException | InstantiationException x) {
|
||||
throw new AssertionError(x);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default AsynchronousChannelProvider.
|
||||
*/
|
||||
@ -47,12 +63,11 @@ public class DefaultAsynchronousChannelProvider {
|
||||
String osname = AccessController
|
||||
.doPrivileged(new GetPropertyAction("os.name"));
|
||||
if (osname.equals("SunOS"))
|
||||
return new SolarisAsynchronousChannelProvider();
|
||||
return createProvider("sun.nio.ch.SolarisAsynchronousChannelProvider");
|
||||
if (osname.equals("Linux"))
|
||||
return new LinuxAsynchronousChannelProvider();
|
||||
return createProvider("sun.nio.ch.LinuxAsynchronousChannelProvider");
|
||||
if (osname.contains("OS X"))
|
||||
return new BsdAsynchronousChannelProvider();
|
||||
return createProvider("sun.nio.ch.BsdAsynchronousChannelProvider");
|
||||
throw new InternalError("platform not recognized");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ package sun.nio.ch;
|
||||
|
||||
import java.nio.channels.spi.SelectorProvider;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
/**
|
||||
@ -41,34 +40,32 @@ public class DefaultSelectorProvider {
|
||||
*/
|
||||
private DefaultSelectorProvider() { }
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static SelectorProvider createProvider(String cn) {
|
||||
Class<SelectorProvider> c;
|
||||
try {
|
||||
c = (Class<SelectorProvider>)Class.forName(cn);
|
||||
} catch (ClassNotFoundException x) {
|
||||
throw new AssertionError(x);
|
||||
}
|
||||
try {
|
||||
return c.newInstance();
|
||||
} catch (IllegalAccessException | InstantiationException x) {
|
||||
throw new AssertionError(x);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default SelectorProvider.
|
||||
*/
|
||||
public static SelectorProvider create() {
|
||||
String osname = AccessController.doPrivileged(
|
||||
new GetPropertyAction("os.name"));
|
||||
if ("SunOS".equals(osname)) {
|
||||
return new sun.nio.ch.DevPollSelectorProvider();
|
||||
}
|
||||
|
||||
// use EPollSelectorProvider for Linux kernels >= 2.6
|
||||
if ("Linux".equals(osname)) {
|
||||
String osversion = AccessController.doPrivileged(
|
||||
new GetPropertyAction("os.version"));
|
||||
String[] vers = osversion.split("\\.", 0);
|
||||
if (vers.length >= 2) {
|
||||
try {
|
||||
int major = Integer.parseInt(vers[0]);
|
||||
int minor = Integer.parseInt(vers[1]);
|
||||
if (major > 2 || (major == 2 && minor >= 6)) {
|
||||
return new sun.nio.ch.EPollSelectorProvider();
|
||||
}
|
||||
} catch (NumberFormatException x) {
|
||||
// format not recognized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String osname = AccessController
|
||||
.doPrivileged(new GetPropertyAction("os.name"));
|
||||
if (osname.equals("SunOS"))
|
||||
return createProvider("sun.nio.ch.DevPollSelectorProvider");
|
||||
if (osname.equals("Linux"))
|
||||
return createProvider("sun.nio.ch.EPollSelectorProvider");
|
||||
return new sun.nio.ch.PollSelectorProvider();
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,6 @@ package sun.nio.fs;
|
||||
|
||||
import java.nio.file.spi.FileSystemProvider;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
/**
|
||||
@ -38,24 +37,18 @@ public class DefaultFileSystemProvider {
|
||||
private DefaultFileSystemProvider() { }
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private static FileSystemProvider createProvider(final String cn) {
|
||||
return AccessController
|
||||
.doPrivileged(new PrivilegedAction<FileSystemProvider>() {
|
||||
public FileSystemProvider run() {
|
||||
Class<FileSystemProvider> c;
|
||||
try {
|
||||
c = (Class<FileSystemProvider>)Class.forName(cn, true, null);
|
||||
} catch (ClassNotFoundException x) {
|
||||
throw new AssertionError(x);
|
||||
}
|
||||
try {
|
||||
return c.newInstance();
|
||||
} catch (IllegalAccessException x) {
|
||||
throw new AssertionError(x);
|
||||
} catch (InstantiationException x) {
|
||||
throw new AssertionError(x);
|
||||
}
|
||||
}});
|
||||
private static FileSystemProvider createProvider(String cn) {
|
||||
Class<FileSystemProvider> c;
|
||||
try {
|
||||
c = (Class<FileSystemProvider>)Class.forName(cn);
|
||||
} catch (ClassNotFoundException x) {
|
||||
throw new AssertionError(x);
|
||||
}
|
||||
try {
|
||||
return c.newInstance();
|
||||
} catch (IllegalAccessException | InstantiationException x) {
|
||||
throw new AssertionError(x);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -68,7 +61,7 @@ public class DefaultFileSystemProvider {
|
||||
return createProvider("sun.nio.fs.SolarisFileSystemProvider");
|
||||
if (osname.equals("Linux"))
|
||||
return createProvider("sun.nio.fs.LinuxFileSystemProvider");
|
||||
if (osname.equals("Darwin") || osname.contains("OS X"))
|
||||
if (osname.contains("OS X"))
|
||||
return createProvider("sun.nio.fs.MacOSXFileSystemProvider");
|
||||
throw new AssertionError("Platform not recognized");
|
||||
}
|
||||
|
@ -110,6 +110,11 @@ public class ScreenUpdateManager {
|
||||
public SurfaceData getReplacementScreenSurface(WComponentPeer peer,
|
||||
SurfaceData oldsd)
|
||||
{
|
||||
SurfaceData surfaceData = peer.getSurfaceData();
|
||||
if (surfaceData.isValid()) {
|
||||
return surfaceData;
|
||||
}
|
||||
peer.replaceSurfaceData();
|
||||
return peer.getSurfaceData();
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2012, 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
|
||||
@ -70,6 +70,7 @@ void AwtDesktopProperties::GetWindowsParameters() {
|
||||
GetNonClientParameters();
|
||||
GetIconParameters();
|
||||
GetColorParameters();
|
||||
GetCaretParameters();
|
||||
GetOtherParameters();
|
||||
GetSoundEvents();
|
||||
GetSystemProperties();
|
||||
@ -636,6 +637,10 @@ void AwtDesktopProperties::GetSoundEvents() {
|
||||
SetSoundProperty(TEXT("win.sound.start"), TEXT("SystemStart"));
|
||||
}
|
||||
|
||||
void AwtDesktopProperties::GetCaretParameters() {
|
||||
SetIntegerProperty(TEXT("win.caret.width"), GetIntegerParameter(SPI_GETCARETWIDTH));
|
||||
}
|
||||
|
||||
BOOL AwtDesktopProperties::GetBooleanParameter(UINT spi) {
|
||||
BOOL flag;
|
||||
SystemParametersInfo(spi, 0, &flag, 0);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2012, 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
|
||||
@ -64,6 +64,7 @@ class AwtDesktopProperties {
|
||||
void GetColorParameters();
|
||||
void GetOtherParameters();
|
||||
void GetSoundEvents();
|
||||
void GetCaretParameters();
|
||||
|
||||
static BOOL GetBooleanParameter(UINT spi);
|
||||
static UINT GetIntegerParameter(UINT spi);
|
||||
|
@ -75,6 +75,7 @@ MsgRouting
|
||||
AwtTextField::HandleEvent(MSG *msg, BOOL synthetic)
|
||||
{
|
||||
MsgRouting returnVal;
|
||||
BOOL systemBeeperEnabled = FALSE;
|
||||
/*
|
||||
* RichEdit 1.0 control starts internal message loop if the
|
||||
* left mouse button is pressed while the cursor is not over
|
||||
@ -217,7 +218,34 @@ AwtTextField::HandleEvent(MSG *msg, BOOL synthetic)
|
||||
}
|
||||
delete msg;
|
||||
return mrConsume;
|
||||
} else if (msg->message == WM_KEYDOWN) {
|
||||
UINT virtualKey = (UINT) msg->wParam;
|
||||
|
||||
switch(virtualKey){
|
||||
case VK_RETURN:
|
||||
case VK_UP:
|
||||
case VK_DOWN:
|
||||
case VK_LEFT:
|
||||
case VK_RIGHT:
|
||||
case VK_DELETE:
|
||||
case VK_BACK:
|
||||
SystemParametersInfo(SPI_GETBEEP, 0, &systemBeeperEnabled, 0);
|
||||
if(systemBeeperEnabled){
|
||||
// disable system beeper for the RICHEDIT control to be compatible
|
||||
// with the EDIT control behaviour
|
||||
SystemParametersInfo(SPI_SETBEEP, 0, NULL, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else if (msg->message == WM_SETTINGCHANGE) {
|
||||
if (msg->wParam == SPI_SETBEEP) {
|
||||
SystemParametersInfo(SPI_GETBEEP, 0, &systemBeeperEnabled, 0);
|
||||
if(systemBeeperEnabled){
|
||||
SystemParametersInfo(SPI_SETBEEP, 1, NULL, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Store the 'synthetic' parameter so that the WM_PASTE security check
|
||||
* happens only for synthetic events.
|
||||
@ -226,6 +254,10 @@ AwtTextField::HandleEvent(MSG *msg, BOOL synthetic)
|
||||
returnVal = AwtComponent::HandleEvent(msg, synthetic);
|
||||
m_synthetic = FALSE;
|
||||
|
||||
if(systemBeeperEnabled){
|
||||
SystemParametersInfo(SPI_SETBEEP, 1, NULL, 0);
|
||||
}
|
||||
|
||||
return returnVal;
|
||||
}
|
||||
|
||||
|
@ -156,6 +156,9 @@ javax/management/remote/mandatory/connection/ReconnectTest.java generic-all
|
||||
# 7158614, locks up Windows machines at least
|
||||
sun/management/jmxremote/startstop/JMXStartStopTest.sh windows-all
|
||||
|
||||
# 7120365
|
||||
javax/management/remote/mandatory/notif/DiffHBTest.java generic-all
|
||||
|
||||
############################################################################
|
||||
|
||||
# jdk_math
|
||||
@ -225,11 +228,6 @@ java/net/DatagramSocket/SendDatagramToBadAddress.java macosx-all
|
||||
sun/net/www/protocol/http/B6299712.java macosx-all
|
||||
java/net/CookieHandler/CookieManagerTest.java macosx-all
|
||||
|
||||
# 7164518
|
||||
sun/security/krb5/auto/Unreachable.java macosx-all
|
||||
|
||||
# JPRT needs to set 127.0.0.1 in proxy bypass list
|
||||
java/net/URLClassLoader/closetest/CloseTest.java macosx-all
|
||||
############################################################################
|
||||
|
||||
# jdk_io
|
||||
@ -260,9 +258,6 @@ java/nio/channels/DatagramChannel/ChangingAddress.java macosx-all
|
||||
# 7132677
|
||||
java/nio/channels/Selector/OutOfBand.java macosx-all
|
||||
|
||||
# 7142919
|
||||
java/nio/channels/AsyncCloseAndInterrupt.java solaris-all
|
||||
|
||||
############################################################################
|
||||
|
||||
# jdk_rmi
|
||||
@ -286,6 +281,9 @@ sun/rmi/transport/proxy/EagerHttpFallback.java linux-all
|
||||
|
||||
# jdk_security
|
||||
|
||||
# 7164518: no PortUnreachableException on Mac
|
||||
sun/security/krb5/auto/Unreachable.java macosx-all
|
||||
|
||||
# 7193792
|
||||
sun/security/pkcs11/ec/TestECDSA.java solaris-all
|
||||
sun/security/pkcs11/ec/TestECDSA.java linux-all
|
||||
@ -293,47 +291,17 @@ sun/security/pkcs11/ec/TestECDSA.java linux-all
|
||||
# 7193793
|
||||
sun/security/pkcs11/ec/TestECDH.java linux-all
|
||||
|
||||
# 7198198: the test also fails on SuSE Linux
|
||||
sun/security/pkcs11/ec/ReadCertificates.java linux-all
|
||||
|
||||
# 7147060
|
||||
com/sun/org/apache/xml/internal/security/transforms/ClassLoaderTest.java generic-all
|
||||
|
||||
# Failing on Solaris i586, 3/9/2010, not a -samevm issue (jdk_security3)
|
||||
sun/security/pkcs11/Secmod/AddPrivateKey.java solaris-i586
|
||||
sun/security/pkcs11/ec/ReadCertificates.java generic-all
|
||||
sun/security/pkcs11/ec/ReadPKCS12.java generic-all
|
||||
sun/security/pkcs11/ec/TestCurves.java solaris-i586
|
||||
#sun/security/pkcs11/ec/TestECGenSpec.java solaris-i586
|
||||
#sun/security/pkcs11/ec/TestKeyFactory.java solaris-i586
|
||||
sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java generic-all
|
||||
|
||||
# Fails on Fedora 9/Ubuntu 10.04 64bit, PKCS11Exception: CKR_DEVICE_ERROR
|
||||
sun/security/pkcs11/KeyAgreement/TestDH.java generic-all
|
||||
|
||||
# Run too slow on Solaris 10 sparc
|
||||
sun/security/ssl/com/sun/net/ssl/internal/ssl/InputRecord/SSLSocketTimeoutNulls.java solaris-sparc
|
||||
sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ClientTimeout.java solaris-sparc
|
||||
sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/ServerTimeout.java solaris-sparc
|
||||
sun/security/ssl/sun/net/www/protocol/https/HttpsURLConnection/ReadTimeout.java solaris-sparc
|
||||
sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/NotifyHandshakeTest.sh solaris-sparc
|
||||
|
||||
# Solaris 10 sparc, passed/failed confusion? java.security.ProviderException: update() failed
|
||||
sun/security/ssl/com/sun/net/ssl/internal/ssl/SSLSocketImpl/AsyncSSLSocketClose.java generic-all
|
||||
|
||||
# Othervm, sparc, NoRouteToHostException: Cannot assign requested address
|
||||
sun/security/ssl/javax/net/ssl/NewAPIs/SessionCacheSizeTests.java generic-all
|
||||
|
||||
# Times out on windows X64, othervm mode
|
||||
# Solaris sparc and sparcv9 -server, timeout
|
||||
sun/security/ssl/javax/net/ssl/NewAPIs/SessionTimeOutTests.java generic-all
|
||||
|
||||
# Various failures on Linux Fedora 9 X64, othervm mode
|
||||
sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/TestAllSuites.java generic-all
|
||||
sun/security/ssl/sanity/ciphersuites/CheckCipherSuites.java generic-all
|
||||
|
||||
# Various failures on Linux Fedora 9 X64, othervm mode
|
||||
sun/security/ssl/sanity/interop/ClientJSSEServerJSSE.java generic-all
|
||||
|
||||
# 7079203 sun/security/tools/keytool/printssl.sh fails on solaris with timeout
|
||||
sun/security/tools/keytool/printssl.sh solaris-all
|
||||
# 6988842: 4 tests failing on Solaris 5.10
|
||||
sun/security/pkcs11/Secmod/AddPrivateKey.java solaris-all
|
||||
sun/security/pkcs11/ec/ReadCertificates.java solaris-all
|
||||
sun/security/pkcs11/ec/ReadPKCS12.java solaris-all
|
||||
sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java solaris-all
|
||||
|
||||
# 7041639, Solaris DSA keypair generation bug (Note: jdk_util also affected)
|
||||
java/security/KeyPairGenerator/SolarisShortDSA.java solaris-all
|
||||
@ -357,6 +325,8 @@ sun/security/tools/keytool/standard.sh solaris-all
|
||||
|
||||
# jdk_text
|
||||
|
||||
# 7196199
|
||||
java/text/Bidi/Bug6665028.java generic-all
|
||||
############################################################################
|
||||
|
||||
# jdk_tools
|
||||
|
@ -195,7 +195,7 @@ public class PaddingTest {
|
||||
|
||||
private static void diff(String fname1, String fname2) throws Exception {
|
||||
if (!Arrays.equals(Files.readAllBytes(Paths.get(fname1)),
|
||||
Files.readAllBytes(Paths.get(fname1)))) {
|
||||
Files.readAllBytes(Paths.get(fname2)))) {
|
||||
throw new Exception(
|
||||
"files " + fname1 + " and " + fname2 + " differ");
|
||||
}
|
||||
|
@ -0,0 +1,91 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @test PostEventOrderingTest.java
|
||||
* @bug 4171596 6699589
|
||||
* @summary Checks that the posting of events between the PostEventQueue
|
||||
* @summary and the EventQueue maintains proper ordering.
|
||||
* @run main PostEventOrderingTest
|
||||
* @author fredx
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
import sun.awt.AppContext;
|
||||
import sun.awt.SunToolkit;
|
||||
|
||||
public class PostEventOrderingTest {
|
||||
static boolean testPassed = true;
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
EventQueue q = Toolkit.getDefaultToolkit().getSystemEventQueue();
|
||||
for (int i = 0; i < 100; i++) {
|
||||
for (int j = 0; j < 100; j++) {
|
||||
q.postEvent(new PostActionEvent());
|
||||
for (int k = 0; k < 10; k++) {
|
||||
SunToolkit.postEvent(AppContext.getAppContext(), new PostActionEvent());
|
||||
}
|
||||
}
|
||||
for (int k = 0; k < 100; k++) {
|
||||
SunToolkit.postEvent(AppContext.getAppContext(), new PostActionEvent());
|
||||
}
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
Thread.currentThread().sleep(100);
|
||||
if (q.peekEvent() == null) {
|
||||
Thread.currentThread().sleep(100);
|
||||
if (q.peekEvent() == null)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!testPassed) {
|
||||
throw new Exception("PostEventOrderingTest FAILED -- events dispatched out of order.");
|
||||
} else {
|
||||
System.out.println("PostEventOrderingTest passed!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class PostActionEvent extends ActionEvent implements ActiveEvent {
|
||||
static int counter = 0;
|
||||
static int mostRecent = -1;
|
||||
|
||||
int myval;
|
||||
|
||||
public PostActionEvent() {
|
||||
super("", ACTION_PERFORMED, "" + counter);
|
||||
myval = counter++;
|
||||
}
|
||||
|
||||
public void dispatch() {
|
||||
//System.out.println("myval = "+myval+", mostRecent = "+mostRecent+", diff = "+(myval-mostRecent)+".");
|
||||
if ((myval - mostRecent) != 1)
|
||||
PostEventOrderingTest.testPassed = false;
|
||||
mostRecent = myval;
|
||||
}
|
||||
}
|
173
jdk/test/java/awt/JAWT/JAWT.sh
Normal file
173
jdk/test/java/awt/JAWT/JAWT.sh
Normal file
@ -0,0 +1,173 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
# @test JAWT.sh
|
||||
# @bug 7190587
|
||||
# @summary Tests Java AWT native interface library
|
||||
# @author kshefov
|
||||
# @run shell JAWT.sh
|
||||
|
||||
# NB: To run on Windows with MKS and Visual Studio compiler
|
||||
# add the following options to jtreg: -e INCLUDE="%INCLUDE%;." -e LIB="%LIB%;."
|
||||
|
||||
if [ "${TESTSRC}" = "" ]
|
||||
then TESTSRC=.
|
||||
fi
|
||||
|
||||
if [ "${TESTJAVA}" = "" ]
|
||||
then
|
||||
PARENT=`dirname \`which java\``
|
||||
TESTJAVA=`dirname ${PARENT}`
|
||||
echo "TESTJAVA not set, selecting " ${TESTJAVA}
|
||||
echo "If this is incorrect, try setting the variable manually."
|
||||
fi
|
||||
|
||||
# set platform-dependent variables
|
||||
OS=`uname -s`
|
||||
case "$OS" in
|
||||
Linux )
|
||||
NULL=/dev/null
|
||||
PS=":"
|
||||
FS="/"
|
||||
${TESTJAVA}${FS}bin${FS}java -version 2>&1 | grep '64-Bit' > $NULL
|
||||
if [ $? -eq '0' ]
|
||||
then
|
||||
ARCH="amd64"
|
||||
else
|
||||
ARCH="i386"
|
||||
fi
|
||||
SYST="linux"
|
||||
MAKEFILE="Makefile.unix"
|
||||
CC="gcc"
|
||||
MAKE="make"
|
||||
LD_LIBRARY_PATH="."
|
||||
;;
|
||||
SunOS )
|
||||
NULL=/dev/null
|
||||
PS=":"
|
||||
FS="/"
|
||||
if [ `uname -p | grep -c 'sparc'` -gt '0' ]
|
||||
then
|
||||
ARCH="sparc"
|
||||
else
|
||||
ARCH="i386"
|
||||
fi
|
||||
SYST="solaris"
|
||||
MAKEFILE="Makefile.unix"
|
||||
CC="gcc"
|
||||
MAKE="make"
|
||||
LD_LIBRARY_PATH="."
|
||||
;;
|
||||
Windows* )
|
||||
NULL=null
|
||||
PS=";"
|
||||
FS="\\"
|
||||
MAKEFILE="Makefile.win"
|
||||
CC="cl"
|
||||
MAKE="nmake"
|
||||
${TESTJAVA}${FS}bin${FS}java -d64 -version 2>&1 | grep '64-Bit' > $NULL
|
||||
if [ "$?" -eq '0' ]
|
||||
then
|
||||
ARCH="amd64"
|
||||
else
|
||||
ARCH="i386"
|
||||
fi
|
||||
SYST="windows"
|
||||
;;
|
||||
CYGWIN* )
|
||||
NULL=/dev/null
|
||||
PS=":"
|
||||
FS="/"
|
||||
MAKEFILE="Makefile.cygwin"
|
||||
CC="gcc"
|
||||
${TESTJAVA}${FS}bin${FS}java -d64 -version 2>&1 | grep '64-Bit' > $NULL
|
||||
if [ "$?" -eq '0' ]
|
||||
then
|
||||
ARCH="amd64"
|
||||
else
|
||||
ARCH="i386"
|
||||
fi
|
||||
SYST="cygwin"
|
||||
MAKE="make"
|
||||
;;
|
||||
Darwin )
|
||||
echo "Test passed. This test is not for MacOS."
|
||||
exit 0;
|
||||
;;
|
||||
* )
|
||||
echo "Unrecognized system!"
|
||||
exit 1;
|
||||
;;
|
||||
esac
|
||||
|
||||
# Skip unsupported platforms
|
||||
case `uname -m` in
|
||||
arm* | ppc* )
|
||||
echo "Test passed. Not supported on current architecture."
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "OS-ARCH is" ${SYST}-${ARCH}
|
||||
${TESTJAVA}${FS}jre${FS}bin${FS}java -fullversion 2>&1
|
||||
|
||||
which ${MAKE} >${NULL} 2>&1
|
||||
if [ "$?" -ne '0' ]
|
||||
then
|
||||
echo "No make found. Test passed."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
which ${CC} >${NULL} 2>&1
|
||||
if [ "$?" -ne '0' ]
|
||||
then
|
||||
echo "No C compiler found. Test passed."
|
||||
exit 0
|
||||
fi
|
||||
case "$OS" in
|
||||
SunOS )
|
||||
${CC} -v >${NULL} 2>&1
|
||||
if [ "$?" -ne '0' ]
|
||||
then
|
||||
echo "No C compiler found. Test passed."
|
||||
exit 0
|
||||
fi
|
||||
esac
|
||||
|
||||
cp ${TESTSRC}${FS}${MAKEFILE} .
|
||||
|
||||
JAVA=${TESTJAVA}${FS}jre${FS}bin${FS}java
|
||||
JAVAC=${TESTJAVA}${FS}bin${FS}javac
|
||||
JAVAH=${TESTJAVA}${FS}bin${FS}javah
|
||||
|
||||
export CC SYST ARCH LD_LIBRARY_PATH
|
||||
|
||||
${JAVAC} -d . ${TESTSRC}${FS}MyCanvas.java
|
||||
${JAVAH} -jni -classpath . -d . MyCanvas
|
||||
${MAKE} -f ${MAKEFILE}
|
||||
${JAVA} -classpath . MyCanvas
|
||||
|
||||
exit $?
|
||||
|
49
jdk/test/java/awt/JAWT/Makefile.cygwin
Normal file
49
jdk/test/java/awt/JAWT/Makefile.cygwin
Normal file
@ -0,0 +1,49 @@
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
CFLAGS =
|
||||
OBJS = myfile.o
|
||||
HEADERS = MyCanvas.h
|
||||
CLASSES = MyCanvas.class
|
||||
|
||||
JAVA = $(TESTJAVA)/bin/java -classpath .
|
||||
JAVAC = $(TESTJAVA)/bin/javac
|
||||
JAVAH = $(TESTJAVA)/bin/javah
|
||||
DEL = rm -rf
|
||||
LINK = $(CC)
|
||||
|
||||
INCLUDES = -I $(TESTJAVA)/include/win32 -I $(TESTJAVA)/include -I .
|
||||
|
||||
LIBS = $(TESTJAVA)/lib/jawt.lib -lgdi32
|
||||
|
||||
all: $(CLASSES) mylib.dll
|
||||
|
||||
mylib.dll: $(HEADERS) $(OBJS)
|
||||
$(LINK) -shared -o mylib.dll $(OBJS) $(LIBS)
|
||||
|
||||
myfile.o:
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -c $(TESTSRC)/myfile.cpp
|
||||
|
||||
clean:
|
||||
$(DEL) mylib.* *.h *.class *.o
|
||||
|
48
jdk/test/java/awt/JAWT/Makefile.unix
Normal file
48
jdk/test/java/awt/JAWT/Makefile.unix
Normal file
@ -0,0 +1,48 @@
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
CFLAGS = -fPIC -O
|
||||
OBJS = myfile.o
|
||||
HEADERS = MyCanvas.h
|
||||
CLASSES = MyCanvas.class
|
||||
|
||||
ENV = /usr/bin/env
|
||||
JAVA = $(TESTJAVA)/bin/java -classpath .
|
||||
JAVAC = $(TESTJAVA)/bin/javac
|
||||
JAVAH = $(TESTJAVA)/bin/javah
|
||||
LINK = ld
|
||||
|
||||
J_INC = $(TESTJAVA)/include
|
||||
INCLUDES = -I$(J_INC) -I$(J_INC)/$(SYST) -I.
|
||||
LIBS = -L$(TESTJAVA)/jre/lib/$(ARCH) -ljawt -lX11
|
||||
|
||||
all: $(CLASSES) libmylib.so
|
||||
|
||||
libmylib.so: $(HEADERS) $(OBJS)
|
||||
$(LINK) -G -o libmylib.so $(OBJS) $(LIBS)
|
||||
|
||||
myfile.o: $(TESTSRC)/myfile.c
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -c $(TESTSRC)/myfile.c
|
||||
|
||||
clean:
|
||||
rm -rf libmylib.so $(HEADERS) $(CLASSES) $(OBJS)
|
47
jdk/test/java/awt/JAWT/Makefile.win
Normal file
47
jdk/test/java/awt/JAWT/Makefile.win
Normal file
@ -0,0 +1,47 @@
|
||||
# Copyright (c) 2012 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.
|
||||
|
||||
CFLAGS = -nologo
|
||||
OBJS = myfile.obj
|
||||
HEADERS = MyCanvas.h
|
||||
CLASSES = MyCanvas.class
|
||||
|
||||
DEL = del /Q
|
||||
LINK = link
|
||||
|
||||
INCLUDES = -I$(TESTJAVA)\include\win32 -I$(TESTJAVA)\include
|
||||
|
||||
LIBS = gdi32.lib user32.lib $(TESTJAVA)\lib\jawt.lib
|
||||
|
||||
all: $(CLASSES) mylib.dll
|
||||
|
||||
mylib.dll: $(HEADERS) $(OBJS)
|
||||
$(LINK) -nologo -dll -out:mylib.dll $(OBJS) $(LIBS)
|
||||
|
||||
myfile.obj: $(TESTSRC)\myfile.cpp
|
||||
$(CC) $(CFLAGS) $(INCLUDES) -c $(TESTSRC)\myfile.cpp
|
||||
|
||||
clean:
|
||||
$(DEL) mylib.*
|
||||
$(DEL) $(HEADERS) $(CLASSES)
|
||||
$(DEL) *.obj
|
72
jdk/test/java/awt/JAWT/MyCanvas.java
Normal file
72
jdk/test/java/awt/JAWT/MyCanvas.java
Normal file
@ -0,0 +1,72 @@
|
||||
/**
|
||||
* Copyright (c) 2012 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.
|
||||
*/
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.*;
|
||||
|
||||
public class MyCanvas extends Canvas {
|
||||
|
||||
static {
|
||||
try {
|
||||
System.loadLibrary("mylib");
|
||||
} catch (Throwable t) {
|
||||
System.out.println("Test failed!!");
|
||||
t.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
public native void paint(Graphics g);
|
||||
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
Robot robot = new Robot();
|
||||
Frame f = new Frame();
|
||||
f.setBounds(0, 0, 100, 100);
|
||||
f.add(new MyCanvas());
|
||||
f.addWindowListener(new WindowAdapter() {
|
||||
public void windowClosing(WindowEvent ev) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
f.setVisible(true);
|
||||
robot.delay(5000);
|
||||
Color col1 = new Color(0, 0, 0);
|
||||
Color col2 = robot.getPixelColor(f.getX()+50, f.getY()+50);
|
||||
if (col1.equals(col2)) {
|
||||
System.out.println("Test passed!");
|
||||
} else {
|
||||
throw new RuntimeException("Color of JAWT canvas is wrong or " +
|
||||
"it was not rendered. " + "Check that other windows " +
|
||||
"do not block the test frame.");
|
||||
}
|
||||
System.exit(0);
|
||||
} catch (Throwable t) {
|
||||
System.out.println("Test failed!");
|
||||
t.printStackTrace();
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
}
|
106
jdk/test/java/awt/JAWT/myfile.c
Normal file
106
jdk/test/java/awt/JAWT/myfile.c
Normal file
@ -0,0 +1,106 @@
|
||||
/*
|
||||
* Copyright (c) 2012 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.
|
||||
*/
|
||||
|
||||
#include "MyCanvas.h"
|
||||
#include "jawt_md.h"
|
||||
|
||||
/*
|
||||
* Class: MyCanvas
|
||||
* Method: paint
|
||||
* Signature: (Ljava/awt/Graphics;)V
|
||||
*/
|
||||
JNIEXPORT void JNICALL Java_MyCanvas_paint
|
||||
(JNIEnv* env, jobject canvas, jobject graphics)
|
||||
{
|
||||
JAWT awt;
|
||||
JAWT_DrawingSurface* ds;
|
||||
JAWT_DrawingSurfaceInfo* dsi;
|
||||
JAWT_X11DrawingSurfaceInfo* dsi_x11;
|
||||
jboolean result;
|
||||
jint lock;
|
||||
GC gc;
|
||||
jobject ref;
|
||||
|
||||
/* Get the AWT */
|
||||
awt.version = JAWT_VERSION_1_4;
|
||||
if (JAWT_GetAWT(env, &awt) == JNI_FALSE) {
|
||||
printf("AWT Not found\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Lock the AWT */
|
||||
awt.Lock(env);
|
||||
|
||||
/* Unlock the AWT */
|
||||
awt.Unlock(env);
|
||||
|
||||
/* Get the drawing surface */
|
||||
ds = awt.GetDrawingSurface(env, canvas);
|
||||
if (ds == NULL) {
|
||||
printf("NULL drawing surface\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Lock the drawing surface */
|
||||
lock = ds->Lock(ds);
|
||||
printf("Lock value %d\n", (int)lock);
|
||||
if((lock & JAWT_LOCK_ERROR) != 0) {
|
||||
printf("Error locking surface\n");
|
||||
awt.FreeDrawingSurface(ds);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get the drawing surface info */
|
||||
dsi = ds->GetDrawingSurfaceInfo(ds);
|
||||
if (dsi == NULL) {
|
||||
printf("Error getting surface info\n");
|
||||
ds->Unlock(ds);
|
||||
awt.FreeDrawingSurface(ds);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Get the platform-specific drawing info */
|
||||
dsi_x11 = (JAWT_X11DrawingSurfaceInfo*)dsi->platformInfo;
|
||||
|
||||
/* Now paint */
|
||||
gc = XCreateGC(dsi_x11->display, dsi_x11->drawable, 0, 0);
|
||||
XSetForeground(dsi_x11->display, gc, 0);
|
||||
XFillRectangle(dsi_x11->display, dsi_x11->drawable, gc,
|
||||
5, 5, 90, 90);
|
||||
XFreeGC(dsi_x11->display, gc);
|
||||
ref = awt.GetComponent(env, (void*)(dsi_x11->drawable));
|
||||
if (!(*env)->IsSameObject(env, ref, canvas)) {
|
||||
printf("Error! Different objects!\n");
|
||||
}
|
||||
|
||||
/* Free the drawing surface info */
|
||||
ds->FreeDrawingSurfaceInfo(dsi);
|
||||
|
||||
/* Unlock the drawing surface */
|
||||
ds->Unlock(ds);
|
||||
|
||||
/* Free the drawing surface */
|
||||
awt.FreeDrawingSurface(ds);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user