Re: HttpCookie.domainMatches("hostname.local", "hostname") return false

2011-03-01 Thread Sean Chou
Hi,
   If there's no different opinions or objection, can someone raise a bug on
the Oracle bug system for me please?
   Thanks.


2011/2/22 Sean Chou 

> Hi,
>I find that HttpCookie.domainMatches("hostname.local", "hostname")
> returns false, which may be a bug.
>According to spec, the effective host name of "hostname" is
> "hostname.local", which is string
> exactly the same with the first parameter. Thus the method should return
> true for this invocation.
>
>I attached the simple testcase here:
> // Testcase
> import java.net.HttpCookie;
>
> public class DomainMatchTest{
>
>public static void main(String args[]){
>   // "true" should be printed, but get "false".
>   System.out.println(HttpCookie.domainMatches("hostname.local",
> "hostname"));
>}
>
> }
> // End of testcase
>
> Any comments?
>
> --
> Best Regards,
> Sean Chou
>
>


-- 
Best Regards,
Sean Chou


URLConnection.guessContentTypeFromStream() does not support UTF8 and UTF32 with BOM

2011-03-01 Thread Charles Lee

Hi guys,

With test case[1] below, you can see guessContent does not support 
UTF8/32 BOM. This problem could be solved with the patch[2].

The patch is straight forward:
1. read more bytes since UTF32
2. add xml type support in utf8 and utf32 BOM.

[1] test case:
public  static  void main(String[] args)throws  IOException {
String  header ="

hg: jdk7/tl/jdk: 7022624: use try-with-resources in java.io tests

2011-03-01 Thread stuart . marks
Changeset: 98d2d57d9e73
Author:smarks
Date:  2011-03-01 15:05 -0800
URL:   http://hg.openjdk.java.net/jdk7/tl/jdk/rev/98d2d57d9e73

7022624: use try-with-resources in java.io tests
Reviewed-by: alanb

! test/java/io/File/SetLastModified.java
! test/java/io/FileOutputStream/AtomicAppend.java
! test/java/io/OutputStreamWriter/Encode.java
! test/java/io/PrintStream/EncodingConstructor.java
! test/java/io/PrintStream/FailingConstructors.java
! test/java/io/Serializable/evolution/RenamePackage/install/SerialDriver.java
! test/java/io/Serializable/evolution/RenamePackage/test/SerialDriver.java



hg: jdk7/tl/langtools: 7021183: 269: assertion failure getting enclosing element of an undefined name

2011-03-01 Thread jonathan . gibbons
Changeset: 938dda0bec17
Author:jjg
Date:  2011-03-01 12:00 -0800
URL:   http://hg.openjdk.java.net/jdk7/tl/langtools/rev/938dda0bec17

7021183: 269: assertion failure getting enclosing element of an undefined name
Reviewed-by: mcimadamore

! src/share/classes/com/sun/tools/javac/code/Symtab.java
+ test/tools/javac/processing/model/TestSymtabItems.java



Re: URI ignores invalid ipv6 address while parsing authority

2011-03-01 Thread Chris Hegarty
On 03/ 1/11 09:58 AM, Jing LV wrote:
> Hello,
> 
> According to authority component RFC2396, if host name is a domain name
> there should be no "[" and "]". However if we put a hostname like
> "[www.abc.com]" while creating a URI, it silently accept, no error is
> reported. I suppose this is a bug. A testcase can be found below:
> 
>  try {
>  uri = new URI("ftp", "[www.abc.com]", "/dir1/dir2", "query", 
> "frag");
>  } catch (URISyntaxException e) {
>  // Expected
>  System.out.printf("Should reach here");
>  }
> 
> And if we print uri.getAuthority() we'll get a null value.
> I think the problem is caused by ipv6 address, which is enclosed with
> "[]", but a normal hostname does not.

This does appear to be strange.  appendAuthority will ignore  any
authority  in square brackets that does not contain a ':' . The internal
string representation of the uri will then parse without failure,
because parseHierarchical allows  empty authority component as long as
it's followed by a non-empty path, query component, or fragment component.

I filed CR 7023363: "URI("ftp", "[www.abc.com]", "/dir1/dir2", "query",
"frag") should throw URISyntaxException", for this.

appendAuthority should probably treat [www.abc.com] as a regular
authority and this would them be caught in parseHierarchical and
URISyntaxException thrown.

-Chris.

> 
> Any comments?
> 


hg: jdk7/tl/jdk: 7023034: Files.createTempDirectory((Path)null, "temp") does not throw NPE

2011-03-01 Thread alan . bateman
Changeset: b7e763a573a4
Author:alanb
Date:  2011-03-01 12:03 +
URL:   http://hg.openjdk.java.net/jdk7/tl/jdk/rev/b7e763a573a4

7023034: Files.createTempDirectory((Path)null, "temp") does not throw NPE
Reviewed-by: forax

! src/share/classes/java/nio/file/Files.java
! test/java/nio/file/Files/TemporaryFiles.java



Re: Does OpenJDK support bitmap image with JarURLConnection?

2011-03-01 Thread Chris Hegarty
Interesting... I would have guessed bmp would be supported too.  It
doesn't appear to be specific to JarURLConnection, raw file urls also
exhibit the same behavior.

Wow, last time content-types.properties was meaningfully changed was
1999, when PNG was added! I don't have any specific objection to adding it.

-Chris.


On 03/ 1/11 09:27 AM, Jing LV wrote:
> Hello,
> 
> It is a little odd to me that I find OpenJDK JarURLConnection does not
> support bmp file. The testcase below:
> 
> public static void main(String[] args) throws MalformedURLException, 
> IOException {
>  JarURLConnection conn = (JarURLConnection) new 
> URL("jar:file:/somedir/somejar.jar!/somebmp.bmp").openConnection();
>  System.out.printf("Returned type for the entry should be the known 
> type " +
>  "image/bmp, but it is " + conn.getContentType());
>  }
> 
>  (Need create a somejar.jar containing a bmp file named somebmp.bmp)
> 
>  It should return image/bmp but it does not. I see we may add image/bmp 
> support in the windows\lib\content-types.properties to make the testcase pass.
>  However I am not sure if OpenJDK do want to support it, or there is some 
> reason why OpenJDK don't?
> 
> 


URI ignores invalid ipv6 address while parsing authority

2011-03-01 Thread Jing LV
Hello,

According to authority component RFC2396, if host name is a domain name
there should be no "[" and "]". However if we put a hostname like
"[www.abc.com]" while creating a URI, it silently accept, no error is
reported. I suppose this is a bug. A testcase can be found below:

try {
uri = new URI("ftp", "[www.abc.com]", "/dir1/dir2", "query", 
"frag");
} catch (URISyntaxException e) {
// Expected
System.out.printf("Should reach here");
}

And if we print uri.getAuthority() we'll get a null value.
I think the problem is caused by ipv6 address, which is enclosed with
"[]", but a normal hostname does not.

Any comments?

-- 
Best Regards,
Jimmy, Jing LV




Does OpenJDK support bitmap image with JarURLConnection?

2011-03-01 Thread Jing LV
Hello,

It is a little odd to me that I find OpenJDK JarURLConnection does not
support bmp file. The testcase below:

public static void main(String[] args) throws MalformedURLException, 
IOException {
JarURLConnection conn = (JarURLConnection) new 
URL("jar:file:/somedir/somejar.jar!/somebmp.bmp").openConnection();
System.out.printf("Returned type for the entry should be the known type 
" +
"image/bmp, but it is " + conn.getContentType());
}

(Need create a somejar.jar containing a bmp file named somebmp.bmp)

It should return image/bmp but it does not. I see we may add image/bmp 
support in the windows\lib\content-types.properties to make the testcase pass. 
However I am not sure if OpenJDK do want to support it, or there is some 
reason why OpenJDK don't? 


-- 
Best Regards,
Jimmy, Jing LV




Re: SocketPermission's implies() interesting behavior

2011-03-01 Thread Chris Hegarty

Michael,

Can you please take a look at this change, CR 7021280: "SocketPermission 
trustProxy should accept wildcards".


This patch came from Charles (cc'ed), and I agree with the changes. Can 
you please take a look and give your feedback.


http://cr.openjdk.java.net/~chegar/7021280/webrev.00/webrev/

-Chris.

On 03/ 1/11 02:00 AM, Charles Lee wrote:

On 03/01/2011 02:40 AM, Alan Bateman wrote:

Charles Lee wrote:

On 02/22/2011 05:43 PM, Chris Hegarty wrote:
Hi Chris,

any news for this issue? And where is CR 7021280?

I think there has been issues with bugs.sun.com recently and it's not
keeping up. However this one is there:
http://bugs.sun.com/view_bug.do?bug_id=7021280

-Alan

I see. Should I post the patch there? Or it is waiting for vote?


hg: jdk7/tl/jdk: 7020531: test: java/security/cert/CertificateFactory/openssl/OpenSSLCert.java file not closed after run

2011-03-01 Thread weijun . wang
Changeset: f8bf888edf20
Author:weijun
Date:  2011-03-01 16:22 +0800
URL:   http://hg.openjdk.java.net/jdk7/tl/jdk/rev/f8bf888edf20

7020531: test: java/security/cert/CertificateFactory/openssl/OpenSSLCert.java 
file not closed after run
Reviewed-by: alanb, smarks

! test/ProblemList.txt
! test/java/security/cert/CertificateFactory/openssl/OpenSSLCert.java
! test/sun/security/tools/keytool/NewSize7.java