jive論壇反編譯

wangj688發表於2004-07-09
有那位高手能給我反編譯如下檔案.我用的小穎1.4和Decomp3.5.5.77反編譯出來以後,檔案有錯誤,檔案中出現goto語句,但是java是不支援goto語句的,顯然反編譯出來是錯誤的.編譯後的檔案如下:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: LicenseManager.java

package com.jivesoftware.base;

import com.jivesoftware.jdom.JDOMException;
import com.jivesoftware.util.StringUtils;
import java.io.*;
import java.security.KeyFactory;
import java.security.Signature;
import java.security.spec.X509EncodedKeySpec;
import java.util.*;

// Referenced classes of package com.jivesoftware.base:
// License, LicenseException, LicenseWrapper, Log,
// JiveGlobals

public final class LicenseManager
{

private static List licenses = null;

private LicenseManager()
{
}

public static void validateLicense(String product, String version)
throws LicenseException
{
loadLicenses();
if(!licenses.isEmpty())
{
int needsVersion = Integer.parseInt(version.substring(0, 1));
for(int i = 0; i < licenses.size(); i++)
{
License license = (License)licenses.get(i);
int hasVersion = Integer.parseInt(license.getVersion().substring(0, 1));
if(isValidProduct(product, license) && hasVersion >= needsVersion)
return;
}

String productNames = "";
for(int i = 0; i < licenses.size(); i++)
{
License license = (License)licenses.get(i);
if(i != 0)
productNames = productNames + ", ";
productNames = productNames + license.getProduct() + " " + license.getVersion();
}

throw new LicenseException("You are not licensed to use this product. You are licensed for the following product(s): " + productNames + "; required product: " + product + " " + version + ".");
} else
{
throw new LicenseException("You do not have a valid license for this product. Please check the jiveHome/logs/jive.error.log file for error messages.");
}
}

public static void reloadLicenses()
{
if(licenses != null)
licenses.clear();
licenses = null;
loadLicenses();
}

public static Iterator getLicenses()
{
if(licenses == null)
return Collections.EMPTY_LIST.iterator();
List licenseProxies = new ArrayList();
for(int i = 0; i < licenses.size(); i++)
licenseProxies.add(new LicenseWrapper((License)licenses.get(i)));

return licenseProxies.iterator();
}

public static int getNumClusterMembers()
{
int allowedMembers = 1;
Iterator licenses = getLicenses();
do
{
if(!licenses.hasNext())
break;
LicenseWrapper licenseWrapper = (LicenseWrapper)licenses.next();
if(licenseWrapper.getNumClusterMembers() < allowedMembers)
allowedMembers = licenseWrapper.getNumClusterMembers();
if(allowedMembers == 1)
allowedMembers = licenseWrapper.getNumClusterMembers();
} while(true);
return allowedMembers;
}

static boolean validate(License license)
throws Exception
{
String publicKey = "308201b73082012c06072a8648ce3804013082011f02818100fd7f53811d75122952df4a9c2eece4e7f611b7523cef4400c31e3f80b6512669455d402251fb593d8d58fabfc5f5ba30f6cb9b556cd7813b801d346ff26660b76b9950a5a49f9fe8047b1022c24fbba9d7feb7c61bf83b57e7c6a8a6150f04fb83f6d3c51ec3023554135a169132f675f3ae2b61d72aeff22203199dd14801c70215009760508f15230bccb292b982a2eb840bf0581cf502818100f7e1a085d69b3ddecbbcab5c36b857b97994afbbfa3aea82f9574c0b3d0782675159578ebad4594fe67107108180b449167123e84c281613b7cf09328cc8a6e13c167a8b547c8d28e0a3ae1e2bb3a675916ea37f0bfa213562f1fb627a01243bcca4f1bea8519089a883dfe15ae59f06928b665e807b552564014c3bfecf492a038184000281800af088055b9304337d285bd946e095465b6d16472e8fc4c29ab735d46fed6140236a3227a2afce0ec54d0002cb95a4988a3e545b1c58c030515c24ecc3de6763fca3f09e05ca568a594d370b879a338043ee3c5a6fe26e95c2b749ce4a8150cd61dd0459e6d5d0862a1ca857c8efc55c73ef3e883ca89eb8358b7147d06d854a";
byte pub[] = StringUtils.decodeHex(publicKey);
X509EncodedKeySpec pubKeySpec = new X509EncodedKeySpec(pub);
KeyFactory keyFactory = KeyFactory.getInstance("DSA");
java.security.PublicKey pubKey = keyFactory.generatePublic(pubKeySpec);
Signature sig = Signature.getInstance("DSA");
sig.initVerify(pubKey);
Log.debug("Validating license. License fingerprint:");
Log.debug(StringUtils.encodeHex(license.getFingerprint()));
sig.update(license.getFingerprint());
return sig.verify(StringUtils.decodeHex(license.getLicenseSignature()));
}

private static synchronized void loadLicenses()
{
String files[];
int i;
if(licenses != null)
return;
licenses = new ArrayList();
File f = new File(JiveGlobals.getJiveHome());
files = f.list();
i = 0;
_L3:
if(i >= files.length) goto _L2; else goto _L1
_L1:
File file;
String filename = files;
file = new File(JiveGlobals.getJiveHome(), filename);
if(file.isDirectory() || !filename.startsWith("jive") || !filename.endsWith(".license"))
continue; /* Loop/switch isn't completed */
if(!file.canRead())
{
Log.error("The \"" + file.getName() + "\" license file was found" + ", but Jive does not have permission to read it.");
continue; /* Loop/switch isn't completed */
}
License license;
Log.debug("Found potential license " + file.getName());
BufferedReader in = new BufferedReader(new FileReader(file));
StringBuffer text = new StringBuffer();
char buf[] = new char[1024];
int len;
while((len = in.read(buf)) >= 0)
{
int j = 0;
while(j < len)
{
char ch = buf[j];
if(Character.isLetter(ch) || Character.isDigit(ch) || ch == '+' || ch == '/' || ch == '=')
text.append(ch);
j++;
}
}
in.close();
String xml = StringUtils.decodeBase64(text.toString());
Log.debug(xml);
license = License.fromXML(xml);
if(license.getLicenseID() == 1L)
{
Log.error("The license \"" + file.getName() + "\" is out of date and is no longer " + "valid. Please use a new license file.");
continue; /* Loop/switch isn't completed */
}
long now;
if(license.getExpiresDate() == null)
break MISSING_BLOCK_LABEL_415;
now = System.currentTimeMillis();
if(license.getExpiresDate().getTime() < now)
{
Log.error("The license \"" + file.getName() + "\" is expired.");
continue; /* Loop/switch isn't completed */
}
if(!validate(license))
{
Log.error("The license \"" + file.getName() + "\" is not valid.");
continue; /* Loop/switch isn't completed */
}
try
{
licenses.add(license);
continue; /* Loop/switch isn't completed */
}
catch(Exception e)
{
Log.error(e);
if(e instanceof JDOMException)
Log.error("The license \"" + file.getName() + "\" is corrupt.");
else
Log.error("There was an error reading the license \"" + file.getName() + "\":" + e.getMessage());
i++;
}
goto _L3
_L2:
if(licenses.isEmpty())
Log.error("No valid license files were found in " + JiveGlobals.getJiveHome() + ".");
return;
}

private static boolean isValidProduct(String product, License license)
{
product = product.intern();
String licenseProduct = license.getProduct().intern();
if(licenseProduct.indexOf("Jive Forums") >= 0)
{
if("Jive Forums Lite" == product || "Jive Forums Basic" == product)
return licenseProduct == "Jive Forums Lite" || licenseProduct == "Jive Forums Professional" || licenseProduct == "Jive Forums Enterprise";
if("Jive Forums Professional" == product)
return licenseProduct == "Jive Forums Professional" || licenseProduct == "Jive Forums Enterprise";
if("Jive Forums Enterprise" == product)
return licenseProduct == "Jive Forums Enterprise";
else
return false;
}
if(licenseProduct.indexOf("Jive Knowledge Base") >= 0)
{
if("Jive Knowledge Base Professional" == product)
return licenseProduct == "Jive Knowledge Base Professional" || licenseProduct == "Jive Knowledge Base Enterprise";
if("Jive Knowledge Base Enterprise" == product)
return licenseProduct == "Jive Knowledge Base Enterprise";
else
return false;
}
if(licenseProduct.indexOf("Jive XMPP") >= 0)
return product == licenseProduct;
else
return false;
}

}



我的class檔案如附件,那位高手能正確反編譯出來,小弟不勝感激!wangj688g146L32ySv.class

相關文章