Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

can not decompile class javax.crypto.Cipher in jdk10 with FernFlower #55

Open
gMan1990 opened this issue Nov 11, 2018 · 2 comments
Open
Labels
Milestone

Comments

@gMan1990
Copy link

gMan1990 commented Nov 11, 2018

  • MyEclipse Enterprise Workbench
    Version: CI 2018.9.0
    Build id: 16.0.0-20180903
  • ecd 3.1.1.201811062102
  • java version "10.0.1" 2018-04-17
    Java(TM) SE Runtime Environment 18.3 (build 10.0.1+10)
    Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.1+10, mixed mode)
java.lang.NullPointerException
        at java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1769)
        at java.base/java.util.regex.Matcher.reset(Matcher.java:416)
        at java.base/java.util.regex.Matcher.<init>(Matcher.java:253)
        at java.base/java.util.regex.Pattern.matcher(Pattern.java:1130)
        at org.sf.feeling.decompiler.util.UnicodeUtil.decode(UnicodeUtil.java:21)
        at org.sf.feeling.decompiler.fernflower.FernFlowerDecompiler.decompile(FernFlowerDecompiler.java:118)
        at org.sf.feeling.decompiler.fernflower.FernFlowerDecompiler.decompileFromArchive(FernFlowerDecompiler.java:164)
        at org.sf.feeling.decompiler.editor.BaseDecompilerSourceMapper.decompile(BaseDecompilerSourceMapper.java:314)
        at org.sf.feeling.decompiler.editor.BaseDecompilerSourceMapper.findSource(BaseDecompilerSourceMapper.java:168)
        at org.sf.feeling.decompiler.editor.DecompilerSourceMapper.findSource(DecompilerSourceMapper.java:72)
        at org.sf.feeling.decompiler.editor.JavaDecompilerClassFileEditor.doOpenBuffer(JavaDecompilerClassFileEditor.java:173)
        at org.sf.feeling.decompiler.editor.JavaDecompilerClassFileEditor.doOpenBuffer(JavaDecompilerClassFileEditor.java:148)
        at org.sf.feeling.decompiler.editor.JavaDecompilerClassFileEditor.doSetInput(JavaDecompilerClassFileEditor.java:358)
        at org.sf.feeling.decompiler.actions.OpenClassWithContributionFactory$OpenClassesAction.run(OpenClassWithContributionFactory.java:134)
        at org.eclipse.jface.action.Action.runWithEvent(Action.java:473)
        at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:565)
        at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:397)
        at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
        at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4247)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1508)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1531)
        at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1516)
        at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1320)
        at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4091)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3712)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1170)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
        at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1059)
        at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
        at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:667)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:597)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:656)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:592)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1498)

?? which can ?? JD, Jad, CFR, Procyon??

@RobertZenz RobertZenz added the bug label Nov 11, 2018
@RobertZenz RobertZenz added this to the 3.2 milestone Nov 11, 2018
@RobertZenz
Copy link
Collaborator

I'm not sure, but I believe FernFlower fails to decompile that class and the plugin does not handle that case very well. Have you tried another decompiler?

@helospark
Copy link

Problem probably is the modularization of JRE.

JarExtractor tries to extract the class file from jar file here
However in Java 9+ jrt-fs.jar no longer contains the classfile, it has been moved to the proprietary modules file in the JRE root.
This affects all of the JRE classes (and probably other modularized class files), however most have attached source in the src.zip shipped with the JRE, however javax classes seems to be missing it, causing this issue.

Solution could be to read using jrt scheme, like:

Path p = Paths.get(URI.create("jrt:/modules/java.base/javax/crypto/Cipher.class"));
byte[] bytes = Files.readAllBytes(p);

and write this to the temporary class file if we are dealing with modularized files.

helospark added a commit to helospark/ecd that referenced this issue Nov 15, 2018
helospark added a commit to helospark/ecd that referenced this issue Nov 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants