changeset 11569:9d4e8b341e60

8145388: URLConnection.guessContentTypeFromStream returns image/jpg for some JPEG images Summary: 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
author rpatil
date Tue, 02 Feb 2016 18:30:22 +0530
parents 2cdb8c0719ad
children 30062b742727
files src/share/classes/java/net/URLConnection.java
diffstat 1 files changed, 2 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/net/URLConnection.java	Tue Feb 02 11:44:09 2016 +0300
+++ b/src/share/classes/java/net/URLConnection.java	Tue Feb 02 18:30:22 2016 +0530
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2016, 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
@@ -1515,7 +1515,7 @@
         }
 
         if (c1 == 0xFF && c2 == 0xD8 && c3 == 0xFF) {
-            if (c4 == 0xE0) {
+            if (c4 == 0xE0 || c4 == 0xEE) {
                 return "image/jpeg";
             }
 
@@ -1530,10 +1530,6 @@
                  c11 == 0)) {
                 return "image/jpeg";
             }
-
-            if (c4 == 0xEE) {
-                return "image/jpg";
-            }
         }
 
         if (c1 == 0xD0 && c2 == 0xCF && c3 == 0x11 && c4 == 0xE0 &&