8145388: URLConnection.guessContentTypeFromStream returns image/jpg for some JPEG images

Since "image/jpg" is not a valid Content Type, the method should return "image/jpeg" when APPn marker segment has 'EE' as a marker type.

Reviewed-by: prr, bpb
This commit is contained in:
Ramanand Patil 2015-12-25 16:45:15 +03:00 committed by Ivan Gerasimov
parent c6d209b505
commit c31b3a5e83

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 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
@ -1550,7 +1550,7 @@ public abstract class URLConnection {
}
if (c1 == 0xFF && c2 == 0xD8 && c3 == 0xFF) {
if (c4 == 0xE0) {
if (c4 == 0xE0 || c4 == 0xEE) {
return "image/jpeg";
}
@ -1565,10 +1565,6 @@ public abstract class URLConnection {
c11 == 0)) {
return "image/jpeg";
}
if (c4 == 0xEE) {
return "image/jpg";
}
}
if (c1 == 0xD0 && c2 == 0xCF && c3 == 0x11 && c4 == 0xE0 &&