Error while decompiling java class: ItemCollectionInvalidIndex: constants: requested 15873, limit 63 - java

I am decompiling java application, and i have already done with 99% .class files. But, I have a problem with couple of them: error while decompilation (errors are same type).
Example:
Procyon: java.lang.IllegalArgumentException: Argument 'index' must be in the range [0, 63], but value was: 15873...
CFR:
Can not load the class specified:
org.benf.cfr.reader.util.CannotLoadClassException: Modules_4.class - java.lang.IndexOutOfBoundsException: Constant pool has 62 entries - attempted to access entry #30318
JDCore: returns null
Jadx:
ERROR - jadx error: Error load file: Modules_4.class
jadx.core.utils.exceptions.JadxRuntimeException: Error load file: Modules_4.class
at jadx.api.JadxDecompiler.loadFiles(JadxDecompiler.java:121)
at jadx.api.JadxDecompiler.load(JadxDecompiler.java:88)
at jadx.cli.JadxCLI.processAndSave(JadxCLI.java:34)
at jadx.cli.JadxCLI.main(JadxCLI.java:19)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 15873 out of bounds for length 63
Fernflower:
Job Output:
java.lang.IndexOutOfBoundsException: Index 15873 out of bounds for length 63
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)...
JAD:
Parsing Modules_4.class...The class file version is 50.0 (only 45.3, 46.0 and 47.0 are supported)
ItemCollectionInvalidIndex: constants: requested 15873, limit 63
download .class file
What is wrong?

There is nothing wrong with all decompilers i have mentioned before.
It was a constant_pool_count issue. It happened because of some JPHP decompiler offset troubles. So, if you are trying to reverse jphp applications, use your own software to delim .phb to .class blocks with couple of bytes before each of them

Related

H2O AI : Unsupported MOJO model 'word2vec'

I have 3 h2o models:
$ ls dataset/mojo
1. DeepLearning_model_python_1582176092021_2.zip
2. StackedEnsemble_BestOfFamily_AutoML_20200220_073620.zip
3. Word2Vec_model_python_1582176092021_1.zip
The binary models for these 3 were generated on v3.28.0.3, but I am trying to upgrade the h2o version and productionize it onto v3.30.0.5
So i converted those 3 binaries successfully to MOJO models (as listed above)
When trying to upload these mojo models using the h2o.upload_mojo, for Word2Vec alone, am getting the error:
In [15]: w2v_path = 'dataset/mojo/Word2Vec_model_python_1582176092021_1.zip'
In [16]: w2v_model = h2o.upload_mojo(w2v_path)
generic Model Build progress: | (failed) | 0%
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-16-734005ed70a8> in <module>
----> 1 w2v_model = h2o.upload_mojo(w2v_path)
~/.envs/h2o-test/lib/python3.8/site-packages/h2o/h2o.py in upload_mojo(mojo_path)
2149 frame_key = response["destination_frame"]
2150 mojo_estimator = H2OGenericEstimator(model_key = get_frame(frame_key))
-> 2151 mojo_estimator.train()
2152 print(mojo_estimator)
2153 return mojo_estimator
~/.envs/h2o-test/lib/python3.8/site-packages/h2o/estimators/estimator_base.py in train(self, x, y, training_frame, offset_column, fold_column, weights_column, validation_frame, max_runtime_secs, ignored_columns, model_id, verbose)
113 validation_frame=validation_frame, max_runtime_secs=max_runtime_secs,
114 ignored_columns=ignored_columns, model_id=model_id, verbose=verbose)
--> 115 self._train(parms, verbose=verbose)
116
117 def train_segments(self, x=None, y=None, training_frame=None, offset_column=None, fold_column=None,
~/.envs/h2o-test/lib/python3.8/site-packages/h2o/estimators/estimator_base.py in _train(self, parms, verbose)
205 return
206
--> 207 job.poll(poll_updates=self._print_model_scoring_history if verbose else None)
208 model_json = h2o.api("GET /%d/Models/%s" % (rest_ver, job.dest_key))["models"][0]
209 self._resolve_model(job.dest_key, model_json)
~/.envs/h2o-test/lib/python3.8/site-packages/h2o/job.py in poll(self, poll_updates)
75 if self.status == "FAILED":
76 if (isinstance(self.job, dict)) and ("stacktrace" in list(self.job)):
---> 77 raise EnvironmentError("Job with key {} failed with an exception: {}\nstacktrace: "
78 "\n{}".format(self.job_key, self.exception, self.job["stacktrace"]))
79 else:
OSError: Job with key $03010a64051932d4ffffffff$_8d0c64127137bd1eef16202889cf4fca failed with an exception: java.lang.IllegalArgumentException: Unsupported MOJO model 'word2vec'.
stacktrace:
java.lang.IllegalArgumentException: Unsupported MOJO model 'word2vec'.
at hex.generic.Generic$MojoDelegatingModelDriver.computeImpl(Generic.java:99)
at hex.ModelBuilder$Driver.compute2(ModelBuilder.java:248)
at hex.generic.Generic$MojoDelegatingModelDriver.compute2(Generic.java:78)
at water.H2O$H2OCountedCompleter.compute(H2O.java:1557)
at jsr166y.CountedCompleter.exec(CountedCompleter.java:468)
at jsr166y.ForkJoinTask.doExec(ForkJoinTask.java:263)
at jsr166y.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:974)
at jsr166y.ForkJoinPool.runWorker(ForkJoinPool.java:1477)
at jsr166y.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:104)
The other two models succeed without any issues, and returns a valid model_id. Any idea what the issue here is, coz from docs its understood that all three model types are supported by MOJO
I tried this with a cluster of 2 pods on K8s with 2Gi/1cpu memory each, but results in same outcome as above.
Word2Vec is not currently in the list of allowed algos to import back into H2O.
The documentation is a little bit confusing and needs improvement. MOJO is a way to take H2O models into production. Those are usable outside of H2O using H2O's genmodel. Some of those MOJOs are importable back into H2O and inspected. But not all of them. The first two algorithms listed are supported. Unfortunately, Word2Vec is not.
I've created a JIRA to track this issue. We should be able to enable at least scoring.

Dropwizard - On deployment, application fails to run due to a malformed yml file

We are trying to add in automated metrics to our Java Application, with Dropwizard metrics. So far, the config.yml file looks like this:
metrics:
reporters:
- type: log
logger: metrics
frequency: 5 minute
includes: "io.dropwizard.jetty.MutableServletContextHandler.active-requests","io.dropwizard.jetty.MutableServletContextHandler.active-dispatches","io.dropwizard.jetty.MutableServletContextHandler.active-suspended"
When running this project, we get an error stating that the yaml file is malformed:
io.dropwizard.configuration.ConfigurationParsingException: test/config.yml has an error:
* Malformed YAML at line: 24, column: 82; while parsing a block mapping
in 'reader', line 20, column 5:
- type: log
^
expected <block end>, but found FlowEntry
in 'reader', line 23, column 81:
... tContextHandler.active-requests","io.dropwizard.jetty.MutableSer ...
^
What exactly is wrong with the way the yaml is written here? My understanding is that the indentation, the spaces, and not having commas in within quotes were correct for this, and we're not able to find any other issues.
Just change line 6 to
includes: [io.dropwizard.jetty.MutableServletContextHandler.active-requests,io.dropwizard.jetty.MutableServletContextHandler.active-dispatches,io.dropwizard.jetty.MutableServletContextHandler.active-suspended]

Android Studio build file R broken

I am working on an android app which has worked and been tested many times. Today, however, in attempting to run the application for further testing, I have encountered the following error message:
C:\Users\1000\AndroidStudioProjects\WarofSol\app\build\generated\source\r\debug\com\blacktentdigital\warofsol\R.java
Error:(1251, 32) error: identifier expected
Error:(1251, 34) error: illegal start of type
Error:(1251, 35) error: identifier expected
Error:Execution failed for task ':app:compileDebugJava'.
Compilation failed; see the compiler error output for details.
>Information:BUILD FAILED
The problem is in the R.java file (as listed above). It is a generated file, so I've never touched it.
The offending line is this:
public static final class drawable {
public static final int 3=0x7f020000;
Hover over the offending line gives the following warning: "Identifier expected | Unexpected token"
Comparisons to other R files reveal that the "3" is not supposed to be a 3, and is evidently corrupted.
Attempts to replace the line or file with older backed-up versions have failed to produce any result because (evidently) the file is regenerating the wrong way each time I attempt the build, and I have no idea what might cause this. As I say, the problem sprang up suddenly without any provocation of which I am aware.
I've also attempted closing the program and restarting the computer to no avail.
Any ideas as to what might cause this and how it might be fixed?
I did get the Same error when i have defined a String in xml file like this.
<string name="3">Settings</string>
Error:
Error:(1426, 32) error: <identifier> expected
Error:(1426, 34) error: illegal start of type
Error:(1426, 35) error: <identifier> expected
Error:Execution failed for task ':app:compileDebugJava'.
> Compilation failed; see the compiler error output for details.
Information:BUILD FAILED
Solution: Resource name must begin with character.
So i have just change String like <string name="S3">Settings</string> and it worked.
So just check if you have any resource name 3 in all your resource file(string.xml, style.xml, attrs.xml) and folder(drawable, layout).
This is a quote from java documentation:
A variable's name can be any legal identifier — an unlimited-length sequence of Unicode letters and digits, beginning with a letter, the dollar sign "$", or the underscore character "_".
And you named drawable with digit, that caused the problem.

Viewing a Compiler error output

I am new to Netbeans and I am given a simple exercise by my professor to find the compiler errors in a given program. This is a simple hello world program but all I get is
Compiling 1 source file to D:\UCC\CS6312-Mobile Devices and Systems\Lab\MyFirstMIDlet\build\compiled
D:\UCC\CS6312-Mobile Devices and Systems\Lab\MyFirstMIDlet\src\myfirstmidlet\MyFirstMIDlet.java:12: error: ';' expected
form.addCommand(exit)
1 error
D:\UCC\CS6312-Mobile Devices and Systems\Lab\MyFirstMIDlet\nbproject\build-impl.xml:359: Compile failed; **see the compiler error output for details.**
BUILD FAILED (total time: 0 seconds)
So I want to know where I can find the details of the compiler errors as I have to include those in my assignment. Thank you
The compile error is the first bit of the error message:
D:\UCC\CS6312-Mobile Devices and Systems\Lab\MyFirstMIDlet\src\myfirstmidlet\MyFirstMIDlet.java:12: error: ';' expected
form.addCommand(exit)
This could mean exactly what it says, and that you're missing a semicolon on this line, but doesn't necessarily - it might be something else that's wrong that's causing the compiler to produce that error. You may also run into the case where you fix that error then have to fix some others that come up afterwards - such is the nature of compilers!

YUICompressor crashes - stackoverflow error

I frequently get what appears to be a stackoverflow error ;-) from YUICompressor. The following is the first part of thousands of error lines that come from attempting to compress a 24074 byte css stylesheet (not the "Caused by java.lang.StackOverflowError about 8 lines down):
iMac1:src jas$ min ../style2.min.css style2.css
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)
Caused by: java.lang.StackOverflowError
at java.lang.Character.codePointAt(Character.java:2335)
at java.util.regex.Pattern$CharProperty.match(Pattern.java:3344)
at java.util.regex.Pattern$Branch.match(Pattern.java:4114)
... (plus 1021 more error lines)
The errors happen usually after adding a couple of lines to the file getting compressed. The css is fine, and works perfectly in the uncompressed format. I don't see a particular pattern to the types of selectors added to the file that cause the errors. In this case, adding the following selector to a previously compressible file resulted in the errors:
#thisisatest
{
margin-left:87px;
}
I am wondering if there is perhaps a flag to java to enlarge the stack that might help. Or if that is not the problem, what is?
EDIT:
As I was posting this question, it dawned on me that I should check the java command to see if there was a parameter to enlarge the stack. Turns out that it is -Xssn, where "n" is a parameter to indicate the stack size. Its default value is 512k. So I tried 1024k but that still led to the stackoverflow. Trying 2048k works however, and I think this could be the solution.
EDIT 2:
While I no longer use this method for minification any longer, to be more specific here is the full command (which I have set up as a shell alias), showing how the -Xss2048k parameter is used:
java -Xss2048k -jar ~/Documents/RepHunter/Website\ Materials/Code/Third\ Party\ Libraries/YUI\ Compressor/yuicompressor-2.4.8.jar --type css -o
As posted in my edit, the solution was to add the parameters to the java command. The clue was the error line at the 5-th "at" line, as follows:
at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)
Caused by: java.lang.StackOverflowError
Seeing that the issue was a "StackOverlowError" ;-) gave the suggestion to try to increase the stack size. The default is 512k. My first try of 1024k did not work. However increasing it to 2048k did work, and I have had no further issues.

Categories

Resources