Path: blob/master/src/hotspot/share/classfile/classFileError.cpp
40949 views
/*1* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#include "precompiled.hpp"25#include "classfile/classFileParser.hpp"26#include "classfile/stackMapTable.hpp"27#include "classfile/verifier.hpp"28#include "classfile/vmSymbols.hpp"29#include "memory/resourceArea.hpp"3031// Keep these in a separate file to prevent inlining3233PRAGMA_DIAG_PUSH34PRAGMA_FORMAT_NONLITERAL_IGNORED3536void ClassFileParser::classfile_parse_error(const char* msg, TRAPS) const {37assert(_class_name != NULL, "invariant");38ResourceMark rm(THREAD);39Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_ClassFormatError(),40msg, _class_name->as_C_string());41}4243void ClassFileParser::classfile_parse_error(const char* msg,44int index,45TRAPS) const {46assert(_class_name != NULL, "invariant");47ResourceMark rm(THREAD);48Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_ClassFormatError(),49msg, index, _class_name->as_C_string());50}5152void ClassFileParser::classfile_parse_error(const char* msg,53const char* name,54TRAPS) const {55assert(_class_name != NULL, "invariant");56ResourceMark rm(THREAD);57Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_ClassFormatError(),58msg, name, _class_name->as_C_string());59}6061void ClassFileParser::classfile_parse_error(const char* msg,62int index,63const char* name,64TRAPS) const {65assert(_class_name != NULL, "invariant");66ResourceMark rm(THREAD);67Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_ClassFormatError(),68msg, index, name, _class_name->as_C_string());69}7071void ClassFileParser::classfile_parse_error(const char* msg,72const char* name,73const char* signature,74TRAPS) const {75assert(_class_name != NULL, "invariant");76ResourceMark rm(THREAD);77Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_ClassFormatError(),78msg, name, signature, _class_name->as_C_string());79}8081void ClassFileParser::classfile_icce_error(const char* msg,82const Klass* k,83TRAPS) const {84assert(_class_name != NULL, "invariant");85ResourceMark rm(THREAD);86Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_IncompatibleClassChangeError(),87msg, _class_name->as_klass_external_name(), k->external_name());88}8990void ClassFileParser::classfile_ucve_error(const char* msg,91const Symbol* class_name,92u2 major,93u2 minor,94TRAPS) const {95ResourceMark rm(THREAD);96Exceptions::fthrow(THREAD_AND_LOCATION, vmSymbols::java_lang_UnsupportedClassVersionError(),97msg, class_name->as_C_string(), major, minor);98}99100PRAGMA_DIAG_POP101102void StackMapStream::stackmap_format_error(const char* msg, TRAPS) {103ResourceMark rm(THREAD);104Exceptions::fthrow(105THREAD_AND_LOCATION,106vmSymbols::java_lang_ClassFormatError(),107"StackMapTable format error: %s", msg108);109}110111112