diff options
| author | 2014-09-18 00:17:43 -0400 | |
|---|---|---|
| committer | 2014-09-18 00:17:43 -0400 | |
| commit | c65a64fc89169456febc1b4c953dbcfbafdc5f0e (patch) | |
| tree | 136b8145423724c8a3392ff89edc492262cc995d /src/cuchaz/enigma/gui/GuiController.java | |
| parent | changed "Show Calls" menu to search for calls to the default constructor when... (diff) | |
| download | enigma-fork-c65a64fc89169456febc1b4c953dbcfbafdc5f0e.tar.gz enigma-fork-c65a64fc89169456febc1b4c953dbcfbafdc5f0e.tar.xz enigma-fork-c65a64fc89169456febc1b4c953dbcfbafdc5f0e.zip | |
added better error handling for source export
added checks to make sure we don't try to decopmile classes outside of the jar
Diffstat (limited to '')
| -rw-r--r-- | src/cuchaz/enigma/gui/GuiController.java | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/cuchaz/enigma/gui/GuiController.java b/src/cuchaz/enigma/gui/GuiController.java index c0fb2e4..3f54ecd 100644 --- a/src/cuchaz/enigma/gui/GuiController.java +++ b/src/cuchaz/enigma/gui/GuiController.java | |||
| @@ -170,7 +170,7 @@ public class GuiController | |||
| 170 | return m_deobfuscator.hasMapping( m_deobfuscator.obfuscateEntry( deobfEntry ) ); | 170 | return m_deobfuscator.hasMapping( m_deobfuscator.obfuscateEntry( deobfEntry ) ); |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | public boolean entryIsObfuscatedIdenfitier( Entry deobfEntry ) | 173 | public boolean entryIsInJar( Entry deobfEntry ) |
| 174 | { | 174 | { |
| 175 | return m_deobfuscator.isObfuscatedIdentifier( m_deobfuscator.obfuscateEntry( deobfEntry ) ); | 175 | return m_deobfuscator.isObfuscatedIdentifier( m_deobfuscator.obfuscateEntry( deobfEntry ) ); |
| 176 | } | 176 | } |
| @@ -268,6 +268,10 @@ public class GuiController | |||
| 268 | // get the reference target class | 268 | // get the reference target class |
| 269 | EntryReference<Entry,Entry> obfReference = m_deobfuscator.obfuscateReference( deobfReference ); | 269 | EntryReference<Entry,Entry> obfReference = m_deobfuscator.obfuscateReference( deobfReference ); |
| 270 | ClassEntry obfClassEntry = obfReference.getClassEntry().getOuterClassEntry(); | 270 | ClassEntry obfClassEntry = obfReference.getClassEntry().getOuterClassEntry(); |
| 271 | if( !m_deobfuscator.isObfuscatedIdentifier( obfClassEntry ) ) | ||
| 272 | { | ||
| 273 | throw new IllegalArgumentException( "Entry must be in the jar!" ); | ||
| 274 | } | ||
| 271 | if( m_currentObfClass == null || !m_currentObfClass.equals( obfClassEntry ) ) | 275 | if( m_currentObfClass == null || !m_currentObfClass.equals( obfClassEntry ) ) |
| 272 | { | 276 | { |
| 273 | // deobfuscate the class, then navigate to the reference | 277 | // deobfuscate the class, then navigate to the reference |
| @@ -347,6 +351,11 @@ public class GuiController | |||
| 347 | { | 351 | { |
| 348 | // decompile,deobfuscate the bytecode | 352 | // decompile,deobfuscate the bytecode |
| 349 | CompilationUnit sourceTree = m_deobfuscator.getSourceTree( classEntry.getClassName() ); | 353 | CompilationUnit sourceTree = m_deobfuscator.getSourceTree( classEntry.getClassName() ); |
| 354 | if( sourceTree == null ) | ||
| 355 | { | ||
| 356 | // decompilation of this class is not supported | ||
| 357 | return; | ||
| 358 | } | ||
| 350 | String source = m_deobfuscator.getSource( sourceTree ); | 359 | String source = m_deobfuscator.getSource( sourceTree ); |
| 351 | m_index = m_deobfuscator.getSourceIndex( sourceTree, source ); | 360 | m_index = m_deobfuscator.getSourceIndex( sourceTree, source ); |
| 352 | m_gui.setSource( m_index.getSource() ); | 361 | m_gui.setSource( m_index.getSource() ); |
| @@ -365,7 +374,7 @@ public class GuiController | |||
| 365 | { | 374 | { |
| 366 | deobfuscatedTokens.add( token ); | 375 | deobfuscatedTokens.add( token ); |
| 367 | } | 376 | } |
| 368 | else if( entryIsObfuscatedIdenfitier( reference.entry ) ) | 377 | else if( entryIsInJar( reference.entry ) ) |
| 369 | { | 378 | { |
| 370 | obfuscatedTokens.add( token ); | 379 | obfuscatedTokens.add( token ); |
| 371 | } | 380 | } |