提交 035dddf2 编写于 作者: A asaha

Merge

...@@ -406,6 +406,10 @@ c669323bd55ac59ad26c7ee4f47a6daefc82af8e jdk8u45-b11 ...@@ -406,6 +406,10 @@ c669323bd55ac59ad26c7ee4f47a6daefc82af8e jdk8u45-b11
7087623dfa7033f8738d537864e4bac6b8528172 jdk8u45-b15 7087623dfa7033f8738d537864e4bac6b8528172 jdk8u45-b15
c7fbbf6133c339fb56f03241de28666774023d5d jdk8u45-b31 c7fbbf6133c339fb56f03241de28666774023d5d jdk8u45-b31
ea547c5a1217fe7916f366950d0e3156e4225aa5 jdk8u45-b32 ea547c5a1217fe7916f366950d0e3156e4225aa5 jdk8u45-b32
27836976c3157a90a9504eb2ec0de54b769b68b4 jdk8u45-b33
98c0901da96579e1819e591c95d19066e0dad9b6 jdk8u45-b34
c292ff6412c8d6a9fb258b72fcffada39aa556b1 jdk8u45-b35
8027bdc8f3d28a0d734fc45a3b7b329c3632ea70 jdk8u45-b36
ac97b69b88e37c18c1b077be8b1f100b6803fea5 jdk8u51-b00 ac97b69b88e37c18c1b077be8b1f100b6803fea5 jdk8u51-b00
2e0732282470f7a02d57af5fc8542efa9db7b3e4 jdk8u51-b01 2e0732282470f7a02d57af5fc8542efa9db7b3e4 jdk8u51-b01
cc75137936f9a8e97017e7e18b1064b76238116f jdk8u51-b02 cc75137936f9a8e97017e7e18b1064b76238116f jdk8u51-b02
......
...@@ -195,7 +195,7 @@ public class AquaIcon { ...@@ -195,7 +195,7 @@ public class AquaIcon {
AquaPainter.create(JRSUIState.getInstance()); AquaPainter.create(JRSUIState.getInstance());
initIconPainter(painter); initIconPainter(painter);
g.setClip(new Rectangle(x, y, width, height)); g.clipRect(x, y, width, height);
painter.paint(g, c, x, y, width, height); painter.paint(g, c, x, y, width, height);
g.dispose(); g.dispose();
} }
......
...@@ -310,7 +310,10 @@ AWT_ASSERT_APPKIT_THREAD; ...@@ -310,7 +310,10 @@ AWT_ASSERT_APPKIT_THREAD;
} }
- (BOOL) performKeyEquivalent: (NSEvent *) event { - (BOOL) performKeyEquivalent: (NSEvent *) event {
[self deliverJavaKeyEventHelper: event]; // if IM is active key events should be ignored
if (![self hasMarkedText] && !fInPressAndHold) {
[self deliverJavaKeyEventHelper: event];
}
// Workaround for 8020209: special case for "Cmd =" and "Cmd ." // Workaround for 8020209: special case for "Cmd =" and "Cmd ."
// because Cocoa calls performKeyEquivalent twice for these keystrokes // because Cocoa calls performKeyEquivalent twice for these keystrokes
......
...@@ -982,7 +982,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -982,7 +982,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
SocketPermission p = URLtoSocketPermission(this.url); SocketPermission p = URLtoSocketPermission(this.url);
if (p != null) { if (p != null) {
try { try {
AccessController.doPrivileged( AccessController.doPrivilegedWithCombiner(
new PrivilegedExceptionAction<Void>() { new PrivilegedExceptionAction<Void>() {
public Void run() throws IOException { public Void run() throws IOException {
plainConnect0(); plainConnect0();
...@@ -1243,7 +1243,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -1243,7 +1243,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
if (p != null) { if (p != null) {
try { try {
return AccessController.doPrivileged( return AccessController.doPrivilegedWithCombiner(
new PrivilegedExceptionAction<OutputStream>() { new PrivilegedExceptionAction<OutputStream>() {
public OutputStream run() throws IOException { public OutputStream run() throws IOException {
return getOutputStream0(); return getOutputStream0();
...@@ -1426,7 +1426,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -1426,7 +1426,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
if (p != null) { if (p != null) {
try { try {
return AccessController.doPrivileged( return AccessController.doPrivilegedWithCombiner(
new PrivilegedExceptionAction<InputStream>() { new PrivilegedExceptionAction<InputStream>() {
public InputStream run() throws IOException { public InputStream run() throws IOException {
return getInputStream0(); return getInputStream0();
...@@ -2568,7 +2568,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ...@@ -2568,7 +2568,7 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
if (p != null) { if (p != null) {
try { try {
return AccessController.doPrivileged( return AccessController.doPrivilegedWithCombiner(
new PrivilegedExceptionAction<Boolean>() { new PrivilegedExceptionAction<Boolean>() {
public Boolean run() throws IOException { public Boolean run() throws IOException {
return followRedirect0(loc, stat, locUrl0); return followRedirect0(loc, stat, locUrl0);
......
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* 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.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeModel;
/*
* @test
* @bug 8072676
* @summary Checks if the tree painter doesn't expand existing clip
* @author Anton Nashatyrev
*/
public class TreeClipTest {
static boolean passed = true;
static boolean checkImage(BufferedImage img, int clipY) {
for (int y = clipY; y < img.getHeight(); y++) {
for (int x = 0; x < img.getWidth(); x++) {
if ((img.getRGB(x,y) & 0xFFFFFF) != 0xFFFFFF) {
return false;
}
}
}
return true;
}
public static void main(String[] args) throws Exception {
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
DefaultMutableTreeNode root = new DefaultMutableTreeNode("JTree");
DefaultMutableTreeNode parent;
parent = new DefaultMutableTreeNode("colors");
root.add(parent);
parent.add(new DefaultMutableTreeNode("blue"));
DefaultTreeModel model = new DefaultTreeModel(root);
JTree tree = new JTree(model);
BufferedImage img = new BufferedImage(50, 50, BufferedImage.TYPE_INT_ARGB);
for (int clipY = 1; clipY < 50; clipY++) {
Graphics2D ig = img.createGraphics();
ig.setColor(Color.WHITE);
ig.fillRect(0,0,1000, 1000);
tree.setSize(200,200);
ig.setClip(0,0,1000,clipY);
tree.paint(ig);
ig.dispose();
if (!checkImage(img, clipY)) {
System.err.println("Failed with clipY=" + clipY);
passed = false;
try {
ImageIO.write(img, "PNG", new File("failedResult.png"));
} catch (IOException e) {
e.printStackTrace();
}
return;
}
}
}
});
if (!passed) {
throw new RuntimeException("Test failed.");
} else {
System.out.println("Passed.");
}
}
}
\ No newline at end of file
...@@ -40,16 +40,28 @@ import java.io.BufferedReader; ...@@ -40,16 +40,28 @@ import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.PasswordAuthentication; import java.net.PasswordAuthentication;
import java.net.Proxy; import java.net.Proxy;
import java.net.URL; import java.net.URL;
import java.security.PrivilegedExceptionAction; import java.net.URLConnection;
import java.security.*;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import javax.security.auth.Subject; import javax.security.auth.Subject;
import javax.security.auth.callback.Callback;
import javax.security.auth.callback.CallbackHandler;
import javax.security.auth.callback.NameCallback;
import javax.security.auth.callback.PasswordCallback;
import javax.security.auth.callback.UnsupportedCallbackException;
import javax.security.auth.login.AppConfigurationEntry;
import javax.security.auth.login.Configuration;
import javax.security.auth.login.LoginContext;
import javax.security.auth.login.LoginException;
import javax.security.auth.login.AppConfigurationEntry.LoginModuleControlFlag;
import org.ietf.jgss.GSSContext; import org.ietf.jgss.GSSContext;
import org.ietf.jgss.GSSCredential; import org.ietf.jgss.GSSCredential;
import org.ietf.jgss.GSSManager; import org.ietf.jgss.GSSManager;
...@@ -191,7 +203,7 @@ public class HttpNegotiateServer { ...@@ -191,7 +203,7 @@ public class HttpNegotiateServer {
proxyUrl = new URL("http://nosuchplace/a/b/c"); proxyUrl = new URL("http://nosuchplace/a/b/c");
try { try {
Exception e1 = null, e2 = null; Exception e1 = null, e2 = null, e3 = null;
try { try {
test6578647(); test6578647();
} catch (Exception e) { } catch (Exception e) {
...@@ -204,7 +216,14 @@ public class HttpNegotiateServer { ...@@ -204,7 +216,14 @@ public class HttpNegotiateServer {
e2 = e; e2 = e;
e.printStackTrace(); e.printStackTrace();
} }
if (e1 != null || e2 != null) { try {
test8077155();
} catch (Exception e) {
e3 = e;
e.printStackTrace();
}
if (e1 != null || e2 != null || e3 != null) {
throw new RuntimeException("Test error"); throw new RuntimeException("Test error");
} }
} finally { } finally {
...@@ -248,6 +267,121 @@ public class HttpNegotiateServer { ...@@ -248,6 +267,121 @@ public class HttpNegotiateServer {
} }
} }
static void testConnect() {
InputStream inputStream = null;
try {
URL url = webUrl;
URLConnection conn = url.openConnection();
conn.connect();
inputStream = conn.getInputStream();
byte[] b = new byte[inputStream.available()];
for (int j = 0; j < b.length; j++) {
b[j] = (byte) inputStream.read();
}
String s = new String(b);
System.out.println("Length: " + s.length());
System.out.println(s);
} catch (Exception ex) {
throw new RuntimeException(ex);
} finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
static void test8077155() throws Exception {
final String username = WEB_USER;
final char[] password = WEB_PASS;
SecurityManager security = new SecurityManager();
Policy.setPolicy(new SecurityPolicy());
System.setSecurityManager(security);
CallbackHandler callback = new CallbackHandler() {
@Override
public void handle(Callback[] pCallbacks) throws IOException, UnsupportedCallbackException {
for (Callback cb : pCallbacks) {
if (cb instanceof NameCallback) {
NameCallback ncb = (NameCallback)cb;
ncb.setName(username);
} else if (cb instanceof PasswordCallback) {
PasswordCallback pwdcb = (PasswordCallback) cb;
pwdcb.setPassword(password);
}
}
}
};
final String jaasConfigName = "oracle.test.kerberos.login";
final String krb5LoginModule = "com.sun.security.auth.module.Krb5LoginModule";
Configuration loginConfig = new Configuration() {
@Override
public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
if (! jaasConfigName.equals(name)) {
return new AppConfigurationEntry[0];
}
Map<String, String> options = new HashMap<String, String>();
options.put("useTicketCache", Boolean.FALSE.toString());
options.put("useKeyTab", Boolean.FALSE.toString());
return new AppConfigurationEntry[] {
new AppConfigurationEntry(krb5LoginModule,
LoginModuleControlFlag.REQUIRED,
options)
};
}
};
// oracle context/subject/login
LoginContext context = null;
try {
context = new LoginContext("oracle.test.kerberos.login", null, callback, loginConfig);
context.login();
} catch (LoginException ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
Subject subject = context.getSubject();
final PrivilegedExceptionAction<Object> test_action = new PrivilegedExceptionAction<Object>() {
public Object run() throws Exception {
testConnect();
return null;
}
};
System.err.println("\n\nExpecting to succeed when executing with the the logged in subject.");
try {
Subject.doAs(subject, test_action);
System.err.println("\n\nConnection succeed when executing with the the logged in subject.");
} catch (PrivilegedActionException e) {
System.err.println("\n\nFailure unexpected when executing with the the logged in subject.");
e.printStackTrace();
throw new RuntimeException("Failed to login as subject");
}
try {
System.err.println("\n\nExpecting to fail when running with the current user's login.");
testConnect();
} catch (Exception ex) {
System.err.println("\nConnect failed when running with the current user's login:\n" + ex.getMessage());
}
}
/** /**
* Creates and starts an HTTP or proxy server that requires * Creates and starts an HTTP or proxy server that requires
* Negotiate authentication. * Negotiate authentication.
...@@ -360,3 +494,22 @@ public class HttpNegotiateServer { ...@@ -360,3 +494,22 @@ public class HttpNegotiateServer {
} }
} }
} }
class SecurityPolicy extends Policy {
private static Permissions perms;
public SecurityPolicy() {
super();
if (perms == null) {
perms = new Permissions();
perms.add(new AllPermission());
}
}
@Override
public PermissionCollection getPermissions(CodeSource codesource) {
return perms;
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册