简体   繁体   中英

How to make changes in Java classes of a jar file

Issue

I have arcGIS jar file integrated into one of my Android projects and want to make some modifications in the java classes within the jar file. I modified the jar using the decompiler tool Jd-GUI tool and able to edit the java class. Now I am again creating the jar of the same folder with the updated class (OAuthView) in this case.

The problem here is after integrating this updated jar file in the same Android project I am unable to compile my project properly.

Why I need to do changes in the arcGIS (esri) )OAuthView Java class: * The application is failed in the security testing Reason: Cross Site Scripting (Java Injection), the report said this line in OAuthView Class is creating an issue:

setJavaScriptEnabled(true)

What I am looking for: Any possible way to overcome this issue.

Screenshot (Error Log)

错误日志截图

One issue I suspect is, many times when you decompile the jar everything is not decompiled correctly. Hence when you pack the jar again the issue crops up. Here is what you can do.

  1. Rename extension of the jar file to .zip file
  2. Extract the zip file
  3. Now decompile only 1 file (Not the entire jar file)
  4. Once it is decompiled, make your code change and copy the .class file and replace it with the old one.
  5. After replacing the old file with new one.
  6. Zip the folder again.
  7. Rename the extension of the zipped file from .jar to .zip

If the issue still persists then try changing the decompiler program and repeat the above steps again.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM