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
Contributed-by: ramanand.patil@oracle.com
#
# Copyright (c) 2012, 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
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
default: all
include $(SPEC)
include MakeBase.gmk
################################################################################
# Put the libraries here. Different locations for different target OS types.
ifneq ($(OPENJDK_TARGET_OS), windows)
HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
BASE_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)
else
HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/bin
BASE_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base
endif
################################################################################
#
# Import hotspot
#
# Don't import jsig library for static builds
ifneq ($(STATIC_BUILD), true)
JSIG_IMPORT = jsig.*
else
JSIG_IMPORT =
endif
HOTSPOT_BASE_IMPORT_FILES := \
$(addprefix $(LIBRARY_PREFIX), jvm.* $(JSIG_IMPORT) jvm_db.* jvm_dtrace.*) \
Xusage.txt \
#
$(eval $(call SetupCopyFiles,COPY_HOTSPOT_BASE, \
SRC := $(HOTSPOT_LIB_DIR), \
DEST := $(BASE_INSTALL_LIBRARIES_HERE), \
FILES := $(shell $(FIND) $(HOTSPOT_LIB_DIR) -type f \
-a \( -name DUMMY $(addprefix -o$(SPACE)-name$(SPACE), $(HOTSPOT_BASE_IMPORT_FILES)) \) )))
ifeq ($(OPENJDK_TARGET_OS), windows)
$(eval $(call SetupCopyFiles,COPY_HOTSPOT_BASE_JVMLIB, \
SRC := $(HOTSPOT_DIST)/lib, \
DEST := $(BASE_INSTALL_LIBRARIES_HERE), \
FILES := $(wildcard $(HOTSPOT_DIST)/lib/*.lib)))
endif
BASE_TARGETS := $(COPY_HOTSPOT_BASE) $(COPY_HOTSPOT_BASE_JVMLIB)
################################################################################
ifneq ($(STATIC_BUILD), true)
ifeq ($(OPENJDK_TARGET_OS), macosx)
JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig$(SHARED_LIBRARY_SUFFIX).dSYM) \
$(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
else
JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.debuginfo) \
$(wildcard $(HOTSPOT_DIST)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig.diz) )
endif
ifneq ($(OPENJDK_TARGET_OS), windows)
ifeq ($(JVM_VARIANT_SERVER), true)
BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/server/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
ifneq (, $(JSIG_DEBUGINFO))
BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/server/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
endif
endif
ifeq ($(JVM_VARIANT_CLIENT), true)
BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/client/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
ifneq (, $(JSIG_DEBUGINFO))
BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/client/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
endif
endif
ifneq ($(OPENJDK_TARGET_OS), macosx)
ifeq ($(JVM_VARIANT_MINIMAL1), true)
BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
ifneq (,$(JSIG_DEBUGINFO))
BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/minimal/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
endif
endif
endif
endif
endif
$(BASE_INSTALL_LIBRARIES_HERE)/server/%$(SHARED_LIBRARY_SUFFIX): $(BASE_INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
ifeq ($(OPENJDK_TARGET_OS), macosx)
$(BASE_INSTALL_LIBRARIES_HERE)/server/%.dSYM : $(BASE_INSTALL_LIBRARIES_HERE)/%.dSYM
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
$(BASE_INSTALL_LIBRARIES_HERE)/server/%.diz : $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
$(MKDIR) -p $(@D)
$(RM) $@
$(RM) $@.tmp $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
$(LN) -s ../$(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM
$(RM) $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
$(MV) $@.tmp $@
else
$(BASE_INSTALL_LIBRARIES_HERE)/server/%.debuginfo: $(BASE_INSTALL_LIBRARIES_HERE)/%.debuginfo
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
$(BASE_INSTALL_LIBRARIES_HERE)/server/%.diz: $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
$(MKDIR) -p $(@D)
$(RM) $@
$(RM) $@.tmp $(basename $@).debuginfo
$(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
$(RM) $(basename $@).debuginfo
$(MV) $@.tmp $@
endif
$(BASE_INSTALL_LIBRARIES_HERE)/client/%$(SHARED_LIBRARY_SUFFIX): $(BASE_INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
ifeq ($(OPENJDK_TARGET_OS), macosx)
$(BASE_INSTALL_LIBRARIES_HERE)/client/%.dSYM : $(BASE_INSTALL_LIBRARIES_HERE)/%.dSYM
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
$(BASE_INSTALL_LIBRARIES_HERE)/client/%.diz : $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
$(MKDIR) -p $(@D)
$(RM) $@
$(RM) $@.tmp $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
$(LN) -s ../$(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F))$(SHARED_LIBRARY_SUFFIX).dSYM
$(RM) $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
$(MV) $@.tmp $@
else
$(BASE_INSTALL_LIBRARIES_HERE)/client/%.debuginfo: $(BASE_INSTALL_LIBRARIES_HERE)/%.debuginfo
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
$(BASE_INSTALL_LIBRARIES_HERE)/client/%.diz: $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
$(MKDIR) -p $(@D)
$(RM) $@
$(RM) $@.tmp $(basename $@).debuginfo
$(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
$(RM) $(basename $@).debuginfo
$(MV) $@.tmp $@
endif
$(BASE_INSTALL_LIBRARIES_HERE)/minimal/%$(SHARED_LIBRARY_SUFFIX): $(BASE_INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
ifneq ($(OPENJDK_TARGET_OS), macosx)
$(BASE_INSTALL_LIBRARIES_HERE)/minimal/%.debuginfo: $(BASE_INSTALL_LIBRARIES_HERE)/%.debuginfo
$(MKDIR) -p $(@D)
$(RM) $@
$(LN) -s ../$(@F) $@
$(BASE_INSTALL_LIBRARIES_HERE)/minimal/%.diz: $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
$(MKDIR) -p $(@D)
$(RM) $@
$(RM) $@.tmp $(basename $@).debuginfo
$(LN) -s ../$(basename $(@F)).debuginfo $(basename $@).debuginfo
$(CD) $(@D) && $(ZIP) -q -y $@.tmp $(basename $(@F)).debuginfo
$(RM) $(basename $@).debuginfo
$(MV) $@.tmp $@
endif
################################################################################
ifeq ($(OPENJDK_TARGET_OS), windows)
$(eval $(call SetupCopyFiles,BASE_COPY_LIBS_BIN, \
SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
DEST := $(JDK_OUTPUTDIR)/bin, \
FILES := $(filter-out %.lib, $(BASE_TARGETS))))
$(eval $(call SetupCopyFiles,BASE_COPY_LIBS_LIB, \
SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
DEST := $(JDK_OUTPUTDIR)/lib, \
FILES := $(filter %.lib, $(BASE_TARGETS))))
else
$(eval $(call SetupCopyFiles,BASE_COPY_LIBS, \
SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
DEST := $(JDK_OUTPUTDIR)/lib, \
FILES := $(BASE_TARGETS)))
endif
################################################################################
all: $(BASE_TARGETS) $(BASE_COPY_LIBS_BIN) $(BASE_COPY_LIBS_LIB) \
$(BASE_COPY_LIBS)
.PHONY: default all