Weird JavaGuard error? - java

I am using JavaGuard to obfuscate one of my .jar files and got this error:
# ERROR - corrupt class file: me/project/main/Main.class java.io.IOException: Incompatible version number for class file
format: 52 / 0 at
net.sf.javaguard.classfile.ClassFile.read(ClassFile.java:160) at
net.sf.javaguard.classfile.ClassFile.create(ClassFile.java:116) at
net.sf.javaguard.GuardDB.addClasses(GuardDB.java:415) at
net.sf.javaguard.GuardDB.startObfuscate(GuardDB.java:274) at
net.sf.javaguard.GuardDB.obfuscate(GuardDB.java:243) at
JavaGuard.obfuscate(JavaGuard.java:322) at
JavaGuard.start(JavaGuard.java:179) at
JavaGuard.main(JavaGuard.java:146)
What can I do to fix this? My code compiles fine and the .jar export has no errors. I have no problems with my code or .java files.

It looks like you are compiling your code using Java 8, then using a version of javaguard that does not understand Java 8 class formats. The format: 52 in the exception message is the class format version, indicating Java 8. This Wikipedia entry lists the possible values and the corresponding Java versions https://en.wikipedia.org/wiki/Java_class_file
This is hardly surprising - the last javaguard release appears to be a 1.0 beta in 2002. You may need to use another tool

For the "//INTERNAL ERROR//" thing you can use Luyten decompiler; It'll get your code.
For the "# ERROR - corrupt class file: me/project/main/Main.class java.io.IOException: Incompatible version number for class file format: 52 / 0 at" error, you may want to use a newer version of proguard.
I had this problem (using proguard maven plugin) and got it resolved using the 5.3.2.

Related

Why won't Palantir QS 3.8 recognise its own XML export?

Hello Palantir community on StackOverflow - if you exist?
I'm having a problem with pXML and PXZ files on a QuickStart instance (see below for details). If I export from Graph (even if only a few relatively small Objects), then try and reimport that file, I get the error message,
Error: The file [file path & name] is not a valid .pxz file:
com.palantir.exceptionPalantirUserMessageException. Unexpected error
while validating PalantirXML; please see the log for details.
The log will then give some version of,
Value " with length = '0' is not faced-valid with respect to minLength
'1' for type #AnonType_namedataSource;.
Multiple Java error references will then follow (195, 131, 384, 318, etc).
So this seems to be an issue with Palantir writing an XML file badly, then not recognising it when you try to reimport.
The XML file itself seems ok - it's not very small, all the XML tags close off, etc. But clearly there's a value somewhere that's meant to be a positive, and it's not being populated in the correct way. The errant tag isn't obvious, if that's the case.
Weirdly, I can usually export a single Object (or maybe two or three) - but not if the Object is too complex (eg has lots of Properties).
I'm using an installation of Palantir Quick Start 3.8 (3.8.2.8.603030, Java Version: 1.6.0_30 Sun Microsystems Inc. - Java HotSpot(TM) 64-Bit Server VM build 20.5-b03 64-bit).
I've tried various configurations of Java updates (6.3 32 & 64, 7.25 32 & 64, no Java update (Pal 3.8 comes with 6.3).
The computer is an Intel, 2.7 Ghz with 16 GB of RAM, running Windows 7 (SP1), 64bt.
I tried disabling the AV (McAfee) and Windows firewall - no difference.
I'll leave it there for now - very grateful for any advice / suggestions.
R
That's an old version of Palantir! I worked on the code you're seeing errors with through many versions of Gotham. The problem is that the first step in the import process is validating the pXML against its .xsd file. While writing, the library makes sure the XML is syntactically valid, but doesn't verify it against the schema.
That error makes it sound like a DataSource is missing some value that's required by the schema. Exporting from a new Investigation may work, but this bug would need to be fixed by a Palantir developer.
You could also try it later version where it may be fixed already.

Why couldn't "org.antlr.v4.runetime.misc.TestRig" not be found or load?

So, here's my problem. I've got my ANTLR4 code successfully compiled, without errors and now I want to test it out. The ANTLR4 Documentation tells me, to test my applications, I shall do this:
java org.antlr.v4.runtime.misc.TestRig
I've tried this and got following error:
Error: Main Class org.antlr.v4.runtime.misc.TestRig couldn't be found or load.
I've checked if my CLASSPATH wasn't set, but everything was correctly set as it should be. I also tried moving the file directly to my test folder and opened CMD there and tried it again, I occur the same error. Searching in the Internet didn't help, as no one seemed to have occurred this error with ANTLR4 before.
Specs:
Java 1.7.0.55
ANTLR 4.4
There seems to be something wrong with your classpath, contrary to your belief everything is okay.
When I download the ANTLR 4 JAR and run TestRig:
wget http://www.antlr.org/download/antlr-4.4-complete.jar
...
java -cp antlr-4.4-complete.jar org.antlr.v4.runtime.misc.TestRig
I see the following on my console:
java org.antlr.v4.runtime.misc.TestRig GrammarName startRuleName
[-tokens] [-tree] [-gui] [-ps file.ps] [-encoding encodingname]
[-trace] [-diagnostics] [-SLL]
[input-filename(s)]
Use startRuleName='tokens' if GrammarName is a lexer grammar.
Omitting input-filename makes rig read from stdin.

java.awt.color.CMMException: LCMS error 12288

ImageIO.read works for most of my images but throwing this exception for a particular jpg image.
im = ImageIO.read(this.getClass().getResourceAsStream("plan3v2.jpg"));
this line throwing exception:
Exception in thread "main" java.awt.color.CMMException: LCMS error 12288
at sun.java2d.cmm.lcms.LCMS.getProfileData(Native Method)
at java.awt.color.ICC_Profile.getData(ICC_Profile.java:1310)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.setImageData(JPEGImageReader.java:652)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImageHeader(Native Method)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readNativeHeader(JPEGImageReader.java:593)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.checkTablesOnly(JPEGImageReader.java:338)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.gotoImage(JPEGImageReader.java:470)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readHeader(JPEGImageReader.java:586)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:1004)
at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:984)
at javax.imageio.ImageIO.read(ImageIO.java:1438)
at javax.imageio.ImageIO.read(ImageIO.java:1342)
at TestClass.run(TestClass.java:13)
at TestClass.main(TestClass.java:8)
Not sure what the error "LCMS error 12288" mean.
Is there any alternative api that can read such images?
Thanks in advance.
The "LCMS error" exception message you see, originates from the LittleCMS color management module, that was introduced first in OpenJDK, but has now replaced KCMS (the original Kodak CMM used by Sun in their Java implementations) in Oracle JDK8.
Assuming the image is the same as referred to from this RedHat bug report (it has the same file name, and causes the same exception), the TwelveMonkeys ImageIO JPEGImageReader plugin can read it*.
The embedded ICC profile in the image is corrupt, so it is simply ignored by my reader, but the image is fully readable and looks okay still.
To use the plugin, you only need to place the plugin with dependencies on class path (see example). Your existing code should then just work as before (without the exception that is). No need to change or recompile anything.
*) I've only tested on JDK 1.6 and OpenJDK 7 on OS X and JDK 7 and 8 on Windows, but it shouldn't matter. :-)
What version of jre are you using? It appears this is fixed in 1.7.60.
http://bugs.java.com/view_bug.do?bug_id=6839133
https://bugs.openjdk.java.net/browse/JDK-6839133

Compiling PlayN Flash samples

I've been following this guide to get playn up and running in eclipse indigo. Hit some major bumps along the way (the largest being swithing to gwt 2.3) but I've managed to get it compiling the as files. The problem is when it starts to create the swf I get this flash compilation error:
C:\Users\ted\AppData\Local\Temp\1351877287607-0\testsgameflash.as(145): col: 220 Error: Incorrect number of arguments. Expected no more than 1.
function $replace_0(this$static,from,to){var regex;if(from<256){regex=toPowerOfTwoString(from);regex='\\x'+'00'.substring(regex.length)+regex}else{regex=String.fromCharCode(from)}return this$static.replace(RegExp(regex,'g'),String.fromCharCode(to))}
C:\Users\ted\AppData\Local\Temp\1351877287607-0\testsgameflash.as(146): col: 131 Error: Incorrect number of arguments. Expected no more than 1.
function $replaceAll(this$static,regex,replace){replace=__translateReplaceString(replace);return this$static.replace(RegExp(regex,'g'),replace)}
It looks like it is casting the value as 'RegExp' instead of creating a new instance of RegExp. I'm not sure where the mess up is and I just wondering what I can do to fix it and get everything compiled

Trying to install Sean Corfield's scripting for ColdFusion project, getting class not found errors

Hi I'm trying to install this tool 'Sean Corfield's scripting for ColdFusion project.' on my server - problem is I am getting "Class not found: com.caucho.quercus.script.QuercusScriptEngineFactory " errors, I have java 1.6 installed.... I'm not sure how where to get these extra classes ... any help?
[opensuse 11 system, CF8 java 1.6]
-thanks
-sean
Did you follow the installation instructions for the cfphp, as per the "example.cfm" page:
Installation:
1. Copy lib/quercus.jar and lib/resin-util.jar to WEB-INF/cfusion/lib/
(multiserver) or coldfusion8/lib (standalone)
2. Restart ColdFusion 8.
3. Optionally copy customtags/php.cfm into your custom tags path.
The important thing is that the quercus.jar is accessible to the JVM. Your error message indicates that the JVM can't find the jar.

Categories