提交 aeea9f85 编写于 作者: R rpatil

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
上级 bbd59214
/* /*
* 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. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -1515,7 +1515,7 @@ public abstract class URLConnection { ...@@ -1515,7 +1515,7 @@ public abstract class URLConnection {
} }
if (c1 == 0xFF && c2 == 0xD8 && c3 == 0xFF) { if (c1 == 0xFF && c2 == 0xD8 && c3 == 0xFF) {
if (c4 == 0xE0) { if (c4 == 0xE0 || c4 == 0xEE) {
return "image/jpeg"; return "image/jpeg";
} }
...@@ -1530,10 +1530,6 @@ public abstract class URLConnection { ...@@ -1530,10 +1530,6 @@ public abstract class URLConnection {
c11 == 0)) { c11 == 0)) {
return "image/jpeg"; return "image/jpeg";
} }
if (c4 == 0xEE) {
return "image/jpg";
}
} }
if (c1 == 0xD0 && c2 == 0xCF && c3 == 0x11 && c4 == 0xE0 && if (c1 == 0xD0 && c2 == 0xCF && c3 == 0x11 && c4 == 0xE0 &&
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册