下面列出了怎么用java.util.jar.JarException的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* process the signature block file. Goes through the .SF file
* and adds code signers for each section where the .SF section
* hash was verified against the Manifest section.
*
*
*/
public void process(Hashtable<String, CodeSigner[]> signers,
List<Object> manifestDigests)
throws IOException, SignatureException, NoSuchAlgorithmException,
JarException, CertificateException
{
// calls Signature.getInstance() and MessageDigest.getInstance()
// need to use local providers here, see Providers class
Object obj = null;
try {
obj = Providers.startJarVerification();
processImpl(signers, manifestDigests);
} finally {
Providers.stopJarVerification(obj);
}
}
/**
* process the signature block file. Goes through the .SF file
* and adds code signers for each section where the .SF section
* hash was verified against the Manifest section.
*
*
*/
public void process(Hashtable<String, CodeSigner[]> signers,
List<Object> manifestDigests)
throws IOException, SignatureException, NoSuchAlgorithmException,
JarException, CertificateException
{
// calls Signature.getInstance() and MessageDigest.getInstance()
// need to use local providers here, see Providers class
Object obj = null;
try {
obj = Providers.startJarVerification();
processImpl(signers, manifestDigests);
} finally {
Providers.stopJarVerification(obj);
}
}
/**
* process the signature block file. Goes through the .SF file
* and adds code signers for each section where the .SF section
* hash was verified against the Manifest section.
*
*
*/
public void process(Hashtable<String, CodeSigner[]> signers,
List<Object> manifestDigests)
throws IOException, SignatureException, NoSuchAlgorithmException,
JarException, CertificateException
{
// calls Signature.getInstance() and MessageDigest.getInstance()
// need to use local providers here, see Providers class
Object obj = null;
try {
obj = Providers.startJarVerification();
processImpl(signers, manifestDigests);
} finally {
Providers.stopJarVerification(obj);
}
}
/**
* process the signature block file. Goes through the .SF file
* and adds code signers for each section where the .SF section
* hash was verified against the Manifest section.
*
*
*/
public void process(Hashtable<String, CodeSigner[]> signers,
List<Object> manifestDigests)
throws IOException, SignatureException, NoSuchAlgorithmException,
JarException, CertificateException
{
// calls Signature.getInstance() and MessageDigest.getInstance()
// need to use local providers here, see Providers class
Object obj = null;
try {
obj = Providers.startJarVerification();
processImpl(signers, manifestDigests);
} finally {
Providers.stopJarVerification(obj);
}
}
/**
* process the signature block file. Goes through the .SF file
* and adds code signers for each section where the .SF section
* hash was verified against the Manifest section.
*
*
*/
public void process(Hashtable<String, CodeSigner[]> signers,
List<Object> manifestDigests)
throws IOException, SignatureException, NoSuchAlgorithmException,
JarException, CertificateException
{
// calls Signature.getInstance() and MessageDigest.getInstance()
// need to use local providers here, see Providers class
Object obj = null;
try {
obj = Providers.startJarVerification();
processImpl(signers, manifestDigests);
} finally {
Providers.stopJarVerification(obj);
}
}
/**
* process the signature block file. Goes through the .SF file
* and adds code signers for each section where the .SF section
* hash was verified against the Manifest section.
*
*
*/
public void process(Hashtable<String, CodeSigner[]> signers,
List<Object> manifestDigests)
throws IOException, SignatureException, NoSuchAlgorithmException,
JarException, CertificateException
{
// calls Signature.getInstance() and MessageDigest.getInstance()
// need to use local providers here, see Providers class
Object obj = null;
try {
obj = Providers.startJarVerification();
processImpl(signers, manifestDigests);
} finally {
Providers.stopJarVerification(obj);
}
}
/**
* process the signature block file. Goes through the .SF file
* and adds code signers for each section where the .SF section
* hash was verified against the Manifest section.
*
*
*/
public void process(Hashtable<String, CodeSigner[]> signers,
List<Object> manifestDigests)
throws IOException, SignatureException, NoSuchAlgorithmException,
JarException, CertificateException
{
// calls Signature.getInstance() and MessageDigest.getInstance()
// need to use local providers here, see Providers class
Object obj = null;
try {
obj = Providers.startJarVerification();
processImpl(signers, manifestDigests);
} finally {
Providers.stopJarVerification(obj);
}
}
/**
* process the signature block file. Goes through the .SF file
* and adds code signers for each section where the .SF section
* hash was verified against the Manifest section.
*
*
*/
public void process(Hashtable<String, CodeSigner[]> signers,
List<Object> manifestDigests)
throws IOException, SignatureException, NoSuchAlgorithmException,
JarException, CertificateException
{
// calls Signature.getInstance() and MessageDigest.getInstance()
// need to use local providers here, see Providers class
Object obj = null;
try {
obj = Providers.startJarVerification();
processImpl(signers, manifestDigests);
} finally {
Providers.stopJarVerification(obj);
}
}
private static void modifyTarget(File originalRuntime, String mergeRenamePrefix, File outputRuntime, boolean watermark, byte[]... classFiles) throws JarException, IOException {
Engine engine = new Engine(originalRuntime, mergeRenamePrefix);
for(byte[] classFile : classFiles){
engine.process(classFile);
}
if(watermark){
engine.addFile(WATERMARK, WATERMARK.getBytes(), true);
}
engine.save(outputRuntime);
}
private static void modifyTarget(File originalRuntime, String mergeRenamePrefix, File outputRuntime, boolean watermark, byte[]... classFiles) throws JarException, IOException {
Engine engine = new Engine(originalRuntime, mergeRenamePrefix);
for(byte[] classFile : classFiles){
engine.process(classFile);
}
if(watermark){
engine.addFile(WATERMARK, WATERMARK.getBytes(), true);
}
engine.save(outputRuntime);
}
/**
* java.util.jar.JarException#JarException(java.lang.String)
*/
public void test_Constructor() throws Exception {
JarException ex = new JarException();
JarException ex1 = new JarException("Test string");
JarException ex2 = new JarException(null);
assertNotSame(ex, ex1);
assertNotSame(ex.getMessage(), ex1.getMessage());
assertNotSame(ex, ex2);
assertSame(ex.getMessage(), ex2.getMessage());
}
public Engine(File jar, String mergeRenamePrefix) throws JarException, IOException {
this.mergeRenamePrefix = mergeRenamePrefix;
this.jarModifier = new JarModifier(jar);
this.jarName = jar.getName();
this.originalEntries = new HashSet<String>(jarModifier.getJarEntrySet());
}
public Engine(File jar, String mergeRenamePrefix, ClassLoader[] classLoaders) throws JarException, IOException {
this(jar, mergeRenamePrefix);
this.classLoaders = classLoaders;
}
public Engine(File jar, String mergeRenamePrefix) throws JarException, IOException {
this.mergeRenamePrefix = mergeRenamePrefix;
this.jarModifier = new JarModifier(jar);
this.jarName = jar.getName();
this.originalEntries = new HashSet<String>(jarModifier.getJarEntrySet());
}
public Engine(File jar, String mergeRenamePrefix, ClassLoader[] classLoaders) throws JarException, IOException {
this(jar, mergeRenamePrefix);
this.classLoaders = classLoaders;
}
/**
* java.util.jar.JarException#JarException(java.lang.String)
*/
public void test_ConstructorLjava_lang_String1() throws Exception {
assertEquals("Jar Exception", new JarException("Jar Exception").getMessage());
}
/**
* java.util.jar.JarException#JarException()
*/
public void test_Constructor_void() throws Exception {
new JarException();
}
public void test_ConstructorLjava_lang_String() throws Exception {
JarException ex1 = new JarException("Test string");
JarException ex2 = new JarException(null);
assertNotSame(ex1, ex2);
assertNotSame(ex1.getMessage(), ex2.getMessage());
}