Merge
This commit is contained in:
commit
a4074cd2c5
@ -293,10 +293,8 @@ class JarVerifier {
|
|||||||
}
|
}
|
||||||
sfv.process(sigFileSigners);
|
sfv.process(sigFileSigners);
|
||||||
|
|
||||||
} catch (sun.security.pkcs.ParsingException pe) {
|
|
||||||
if (debug != null) debug.println("processEntry caught: "+pe);
|
|
||||||
// ignore and treat as unsigned
|
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
|
// e.g. sun.security.pkcs.ParsingException
|
||||||
if (debug != null) debug.println("processEntry caught: "+ioe);
|
if (debug != null) debug.println("processEntry caught: "+ioe);
|
||||||
// ignore and treat as unsigned
|
// ignore and treat as unsigned
|
||||||
} catch (SignatureException se) {
|
} catch (SignatureException se) {
|
||||||
|
@ -31,6 +31,7 @@ import java.nio.channels.*;
|
|||||||
import java.net.*;
|
import java.net.*;
|
||||||
import javax.net.ssl.*;
|
import javax.net.ssl.*;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.logging.Logger;
|
||||||
import java.text.*;
|
import java.text.*;
|
||||||
import sun.net.www.MessageHeader;
|
import sun.net.www.MessageHeader;
|
||||||
import com.sun.net.httpserver.*;
|
import com.sun.net.httpserver.*;
|
||||||
@ -204,6 +205,21 @@ class ExchangeImpl {
|
|||||||
tmpout.write (bytes(statusLine, 0), 0, statusLine.length());
|
tmpout.write (bytes(statusLine, 0), 0, statusLine.length());
|
||||||
boolean noContentToSend = false; // assume there is content
|
boolean noContentToSend = false; // assume there is content
|
||||||
rspHdrs.set ("Date", df.format (new Date()));
|
rspHdrs.set ("Date", df.format (new Date()));
|
||||||
|
|
||||||
|
/* check for response type that is not allowed to send a body */
|
||||||
|
|
||||||
|
if ((rCode>=100 && rCode <200) /* informational */
|
||||||
|
||(rCode == 204) /* no content */
|
||||||
|
||(rCode == 304)) /* not modified */
|
||||||
|
{
|
||||||
|
if (contentLen != -1) {
|
||||||
|
Logger logger = server.getLogger();
|
||||||
|
String msg = "sendResponseHeaders: rCode = "+ rCode
|
||||||
|
+ ": forcing contentLen = -1";
|
||||||
|
logger.warning (msg);
|
||||||
|
}
|
||||||
|
contentLen = -1;
|
||||||
|
}
|
||||||
if (contentLen == 0) {
|
if (contentLen == 0) {
|
||||||
if (http10) {
|
if (http10) {
|
||||||
o.setWrappedStream (new UndefLengthOutputStream (this, ros));
|
o.setWrappedStream (new UndefLengthOutputStream (this, ros));
|
||||||
|
@ -1180,6 +1180,10 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
|
|||||||
inputStream = http.getInputStream();
|
inputStream = http.getInputStream();
|
||||||
|
|
||||||
respCode = getResponseCode();
|
respCode = getResponseCode();
|
||||||
|
if (respCode == -1) {
|
||||||
|
disconnectInternal();
|
||||||
|
throw new IOException ("Invalid Http response");
|
||||||
|
}
|
||||||
if (respCode == HTTP_PROXY_AUTH) {
|
if (respCode == HTTP_PROXY_AUTH) {
|
||||||
if (streaming()) {
|
if (streaming()) {
|
||||||
disconnectInternal();
|
disconnectInternal();
|
||||||
|
@ -104,11 +104,11 @@ class SolarisAclFileAttributeView
|
|||||||
int uid;
|
int uid;
|
||||||
if (user.isSpecial()) {
|
if (user.isSpecial()) {
|
||||||
uid = -1;
|
uid = -1;
|
||||||
if (who.getName().equals(UnixUserPrincipals.SPECIAL_OWNER.getName()))
|
if (who == UnixUserPrincipals.SPECIAL_OWNER)
|
||||||
flags |= ACE_OWNER;
|
flags |= ACE_OWNER;
|
||||||
else if (who.getName().equals(UnixUserPrincipals.SPECIAL_GROUP.getName()))
|
else if (who == UnixUserPrincipals.SPECIAL_GROUP)
|
||||||
flags |= ACE_GROUP;
|
flags |= (ACE_GROUP | ACE_IDENTIFIER_GROUP);
|
||||||
else if (who.getName().equals(UnixUserPrincipals.SPECIAL_EVERYONE.getName()))
|
else if (who == UnixUserPrincipals.SPECIAL_EVERYONE)
|
||||||
flags |= ACE_EVERYONE;
|
flags |= ACE_EVERYONE;
|
||||||
else
|
else
|
||||||
throw new AssertionError("Unable to map special identifier");
|
throw new AssertionError("Unable to map special identifier");
|
||||||
@ -281,7 +281,7 @@ class SolarisAclFileAttributeView
|
|||||||
aceFlags.add(AclEntryFlag.DIRECTORY_INHERIT);
|
aceFlags.add(AclEntryFlag.DIRECTORY_INHERIT);
|
||||||
if ((flags & ACE_NO_PROPAGATE_INHERIT_ACE) > 0)
|
if ((flags & ACE_NO_PROPAGATE_INHERIT_ACE) > 0)
|
||||||
aceFlags.add(AclEntryFlag.NO_PROPAGATE_INHERIT);
|
aceFlags.add(AclEntryFlag.NO_PROPAGATE_INHERIT);
|
||||||
if ((flags & ACE_INHERIT_ONLY_ACE ) > 0)
|
if ((flags & ACE_INHERIT_ONLY_ACE) > 0)
|
||||||
aceFlags.add(AclEntryFlag.INHERIT_ONLY);
|
aceFlags.add(AclEntryFlag.INHERIT_ONLY);
|
||||||
|
|
||||||
// build the ACL entry and add it to the list
|
// build the ACL entry and add it to the list
|
||||||
|
93
jdk/test/com/sun/net/httpserver/bugs/B6886436.java
Normal file
93
jdk/test/com/sun/net/httpserver/bugs/B6886436.java
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
|
||||||
|
* CA 95054 USA or visit www.sun.com if you need additional information or
|
||||||
|
* have any questions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @test
|
||||||
|
* @bug 6886436
|
||||||
|
* @summary
|
||||||
|
*/
|
||||||
|
|
||||||
|
import com.sun.net.httpserver.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.*;
|
||||||
|
import java.util.logging.*;
|
||||||
|
import java.io.*;
|
||||||
|
import java.net.*;
|
||||||
|
|
||||||
|
public class B6886436 {
|
||||||
|
|
||||||
|
public static void main (String[] args) throws Exception {
|
||||||
|
Logger logger = Logger.getLogger ("com.sun.net.httpserver");
|
||||||
|
ConsoleHandler c = new ConsoleHandler();
|
||||||
|
c.setLevel (Level.WARNING);
|
||||||
|
logger.addHandler (c);
|
||||||
|
logger.setLevel (Level.WARNING);
|
||||||
|
Handler handler = new Handler();
|
||||||
|
InetSocketAddress addr = new InetSocketAddress (0);
|
||||||
|
HttpServer server = HttpServer.create (addr, 0);
|
||||||
|
HttpContext ctx = server.createContext ("/test", handler);
|
||||||
|
ExecutorService executor = Executors.newCachedThreadPool();
|
||||||
|
server.setExecutor (executor);
|
||||||
|
server.start ();
|
||||||
|
|
||||||
|
URL url = new URL ("http://localhost:"+server.getAddress().getPort()+"/test/foo.html");
|
||||||
|
HttpURLConnection urlc = (HttpURLConnection)url.openConnection ();
|
||||||
|
try {
|
||||||
|
InputStream is = urlc.getInputStream();
|
||||||
|
while (is.read()!= -1) ;
|
||||||
|
is.close ();
|
||||||
|
urlc = (HttpURLConnection)url.openConnection ();
|
||||||
|
urlc.setReadTimeout (3000);
|
||||||
|
is = urlc.getInputStream();
|
||||||
|
while (is.read()!= -1);
|
||||||
|
is.close ();
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
server.stop(2);
|
||||||
|
executor.shutdown();
|
||||||
|
throw new RuntimeException ("Test failed");
|
||||||
|
}
|
||||||
|
server.stop(2);
|
||||||
|
executor.shutdown();
|
||||||
|
System.out.println ("OK");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean error = false;
|
||||||
|
|
||||||
|
static class Handler implements HttpHandler {
|
||||||
|
int invocation = 1;
|
||||||
|
public void handle (HttpExchange t)
|
||||||
|
throws IOException
|
||||||
|
{
|
||||||
|
InputStream is = t.getRequestBody();
|
||||||
|
Headers map = t.getRequestHeaders();
|
||||||
|
Headers rmap = t.getResponseHeaders();
|
||||||
|
while (is.read () != -1) ;
|
||||||
|
is.close();
|
||||||
|
// send a 204 response with an empty chunked body
|
||||||
|
t.sendResponseHeaders (204, 0);
|
||||||
|
t.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -49,6 +49,21 @@ public class GetSystemProperties {
|
|||||||
private static final String VALUE4 = "test.property.value4";
|
private static final String VALUE4 = "test.property.value4";
|
||||||
|
|
||||||
public static void main(String[] argv) throws Exception {
|
public static void main(String[] argv) throws Exception {
|
||||||
|
// Save a copy of the original system properties
|
||||||
|
Properties props = System.getProperties();
|
||||||
|
|
||||||
|
try {
|
||||||
|
// replace the system Properties object for any modification
|
||||||
|
// in case jtreg caches a copy
|
||||||
|
System.setProperties(new Properties(props));
|
||||||
|
runTest();
|
||||||
|
} finally {
|
||||||
|
// restore original system properties
|
||||||
|
System.setProperties(props);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void runTest() throws Exception {
|
||||||
RuntimeMXBean mbean = ManagementFactory.getRuntimeMXBean();
|
RuntimeMXBean mbean = ManagementFactory.getRuntimeMXBean();
|
||||||
|
|
||||||
// Print all system properties
|
// Print all system properties
|
||||||
@ -88,7 +103,10 @@ public class GetSystemProperties {
|
|||||||
Map<String,String> props2 = mbean.getSystemProperties();
|
Map<String,String> props2 = mbean.getSystemProperties();
|
||||||
// expect the system properties returned should be
|
// expect the system properties returned should be
|
||||||
// same as the one before adding KEY3 and KEY4
|
// same as the one before adding KEY3 and KEY4
|
||||||
props1.equals(props2);
|
if (!props1.equals(props2)) {
|
||||||
|
throw new RuntimeException("Two copies of system properties " +
|
||||||
|
"are expected to be equal");
|
||||||
|
}
|
||||||
|
|
||||||
System.out.println("Test passed.");
|
System.out.println("Test passed.");
|
||||||
}
|
}
|
||||||
|
@ -40,8 +40,21 @@ import java.lang.management.RuntimeMXBean;
|
|||||||
public class PropertiesTest {
|
public class PropertiesTest {
|
||||||
private static int NUM_MYPROPS = 3;
|
private static int NUM_MYPROPS = 3;
|
||||||
public static void main(String[] argv) throws Exception {
|
public static void main(String[] argv) throws Exception {
|
||||||
Properties sysProps = System.getProperties();
|
// Save a copy of the original system properties
|
||||||
|
Properties props = System.getProperties();
|
||||||
|
|
||||||
|
try {
|
||||||
|
// replace the system Properties object for any modification
|
||||||
|
// in case jtreg caches a copy
|
||||||
|
System.setProperties(new Properties(props));
|
||||||
|
runTest(props.size());
|
||||||
|
} finally {
|
||||||
|
// restore original system properties
|
||||||
|
System.setProperties(props);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void runTest(int sysPropsCount) throws Exception {
|
||||||
// Create a new system properties using the old one
|
// Create a new system properties using the old one
|
||||||
// as the defaults
|
// as the defaults
|
||||||
Properties myProps = new Properties( System.getProperties() );
|
Properties myProps = new Properties( System.getProperties() );
|
||||||
@ -65,10 +78,10 @@ public class PropertiesTest {
|
|||||||
System.out.println(i++ + ": " + key + " : " + value);
|
System.out.println(i++ + ": " + key + " : " + value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props.size() != NUM_MYPROPS + sysProps.size()) {
|
if (props.size() != NUM_MYPROPS + sysPropsCount) {
|
||||||
throw new RuntimeException("Test Failed: " +
|
throw new RuntimeException("Test Failed: " +
|
||||||
"Expected number of properties = " +
|
"Expected number of properties = " +
|
||||||
NUM_MYPROPS + sysProps.size() +
|
NUM_MYPROPS + sysPropsCount +
|
||||||
" but found = " + props.size());
|
" but found = " + props.size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* @test
|
/* @test
|
||||||
* @bug 4313887 6838333
|
* @bug 4313887 6838333 6891404
|
||||||
* @summary Unit test for java.nio.file.attribute.AclFileAttribueView
|
* @summary Unit test for java.nio.file.attribute.AclFileAttribueView
|
||||||
* @library ../..
|
* @library ../..
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user