Comments (5)
Update:
I have added some native peer methods in gov.nasa.jpf.vm.JPF_java_util_zip_ZipFile
peer class so we can allow host JVM to handle methods of ZipFile
class. By adding this, I got object of ZipEntry
class. Now I am not getting NullPointerException
, but I am not able to cast this ZipEntry
object into JarEntry
object. Here is the stack trace of error:
gov.nasa.jpf.vm.NoUncaughtExceptionsProperty
java.lang.ClassCastException: java.util.zip.ZipEntry cannot be cast to java.util.jar.JarEntry
at java.util.zip.ZipFile$1.getEntry(ZipFile.java:161)
at java.util.jar.JarFile.getEntry0(JarFile.java:584)
at java.util.jar.JarFile.getManEntry(JarFile.java:946)
at java.util.jar.JarFile.getManifestFromReference(JarFile.java:416)
at java.util.jar.JarFile.getManifest(JarFile.java:408)
at com.example.JarReader.main(JarReader.java:24)
from jpf-core.
I think the object should be returned as an instance of JarEntry
rather than ZipEntry
, so the cast to the subclass (JarEntry) succeeds.
from jpf-core.
Update:
I have added some native peer methods in
gov.nasa.jpf.vm.JPF_java_util_zip_ZipFile
peer class so we can allow host JVM to handle methods ofZipFile
class. By adding this, I got object ofZipEntry
class. Now I am not gettingNullPointerException
, but I am not able to cast thisZipEntry
object intoJarEntry
object. Here is the stack trace of error:gov.nasa.jpf.vm.NoUncaughtExceptionsProperty java.lang.ClassCastException: java.util.zip.ZipEntry cannot be cast to java.util.jar.JarEntry at java.util.zip.ZipFile$1.getEntry(ZipFile.java:161) at java.util.jar.JarFile.getEntry0(JarFile.java:584) at java.util.jar.JarFile.getManEntry(JarFile.java:946) at java.util.jar.JarFile.getManifestFromReference(JarFile.java:416) at java.util.jar.JarFile.getManifest(JarFile.java:408) at com.example.JarReader.main(JarReader.java:24)
@pparizek @cyrille-artho I found a reason for this error.
Please look at this implementation of native peer for getEntry
method of ZipFile
class:
@MJI
public int getEntry__Ljava_lang_String_2Ljava_util_function_Function_2__Ljava_util_zip_ZipEntry_2(MJIEnv env, int thisRef, int entryNameRef, int funcRef) {
ZipFileProxy zfp = getZFP(env, thisRef);
if (zfp == null) {
return MJIEnv.NULL;
}
String name = env.getStringObject(entryNameRef);
ZipEntry entry = zfp.zf.getEntry(name);
if (entry == null) {
return MJIEnv.NULL;
}
return createZipEntryObject(env, entry);
in this method I am calling getEntry(String)
which will return object of ZipEntry
but I have to call getEntry(String,Function)
so we can get object of any class which is extending ZipEntry
based on a function we are passing and due to this we were getting ClassCastException
.
from jpf-core.
Now my question is, can we somehow get the object of the Function
class from the funcRef
variable?
from jpf-core.
There are ways to get the application-level objects that correspond to the descriptors (int values) at the JPF-native level. See JPF_java_lang_reflect_Constructor.getMethodInfo
. However, it looks like you want to call the function instead? Would code such as the one in class JPF_gov_nasa_jpf_SerializationConstructor.java
, method newInstance___3Ljava_lang_Object_2__Ljava_lang_Object_2
work for you (if you adapt it to your circumstance; in that method, a coonstructor is called, so a call on an existing instance is a bit different).
from jpf-core.
Related Issues (20)
- java.lang.NoSuchMethodError: java.lang.String.getBytes([BIIBI) HOT 13
- cannot find native jdk.internal.misc.CDS.isDumpingClassList0 HOT 43
- StringIndexOutOfBoundsException HOT 5
- `java.net.URI.toURI` broken
- Java 17: BufferMismatch now depends on native code: JPF crashes (missing native peer) if byte buffers differ
- `BufferTest.testCharBufferConstructor` uses random bytes HOT 96
- Test "gov.nasa.jpf.test.java.io.ObjectStreamTest and gov.nasa.jpf.test.java.io.testSimpleReadbackOk" Fails on Java 17 HOT 18
- Test "gov.nasa.jpf.test.java.concurrent.SemaphoreTest" fails on OpenJDK-17 HOT 16
- Assistance Needed with Deadlock Detection in JPF HOT 5
- "gov.nasa.jpf.test.java.concurrent.CountDownLatchTest" and "gov.nasa.jpf.test.java.concurrent.ExecutorServiceTest" fails on Java-17 HOT 16
- "gov.nasa.jpf.test.java.concurrent.ConcurrentSkipListMapTest" fails on Java-17 HOT 6
- Add support for package metadata in `JarClassFileContainer`
- Investigate `java.lang.invoke.MethodHandles$Lookup.findVarHandle` HOT 19
- Compiler warnings under Java 17 HOT 35
- java.lang.NoSuchMethodException: SharedSecrets.setJavaNetInetAddressAccess HOT 4
- Need Implementation of `JarFile`
- "record" feature in jpf-core/java-17 HOT 39
- "Sealed Class and Interface" feature of "OpenJDK-17" on JPF/java-17 HOT 9
- NumericValueChecker incorrectly reports out-of-range error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jpf-core.