path.Utf8Value() return const string which will destroy after define jar_file_path,therefore the jar_file_path is Dangling pointer.
You can check this bug with a long jar file name,in my machine it is 15 bytes like abcdefghijk.jar.That will throw TypeError: Jar file was empty .
Just create a std::string variable and get it's content pointer can fix this bug.
path.Utf8Value()
returnconst string
which will destroy after definejar_file_path
,therefore thejar_file_path
is Dangling pointer. You can check this bug with a long jar file name,in my machine it is 15 bytes likeabcdefghijk.jar
.That will throwTypeError: Jar file was empty
. Just create astd::string
variable and get it's content pointer can fix this bug.