Made it easier to run custom clients from filesystem.

This commit is contained in:
Travis Burtrum 2010-07-13 18:48:27 -04:00 committed by moparisthebest
parent 1babe85e4d
commit 0d4801d0d3
3 changed files with 27 additions and 19 deletions

View File

@ -87,25 +87,32 @@ public class CRCClassLoader extends ClassLoader {
return;
} catch (IOException e) {
//e.printStackTrace();
// if we don't have a backupURL, just go ahead and rethrow this exception, can't do anything more
if (backupURL == null)
throw e;
}
System.out.println("CRC checksum failed, downloading new file.");
if (backupURL != null) {
// URLConnection uc = new URL(backupURL).openConnection();
// InputStream in = uc.getInputStream();
// FileOutputStream fos = new FileOutputStream(jarFileLoc);
// byte[] buffer = new byte[1024];
// int len;
// while ((len = in.read(buffer)) >= 0)
System.out.println("CRC checksum failed, downloading new file.");
// URLConnection uc = new URL(backupURL).openConnection();
// InputStream in = uc.getInputStream();
// FileOutputStream fos = new FileOutputStream(jarFileLoc);
// byte[] buffer = new byte[1024];
// int len;
// while ((len = in.read(buffer)) >= 0)
// fos.write(buffer, 0, len);
// fos.flush();
// in.close();
// fos.close();
// fos.flush();
// in.close();
// fos.close();
// use Update instead
new Update(backupURL, jarFileLoc, true);
// use Update instead
new Update(backupURL, jarFileLoc, true);
setup(jarFileLoc);
setup(jarFileLoc);
}
if (getCRC() != expectedCRC) {
String s = "CRC checksum failed. crc:" + getCRC() + " expected:" + expectedCRC;

View File

@ -20,7 +20,7 @@
package org.moparscape.security;
import org.moparscape.MainPanel;
import org.moparscape.Debug;
import java.security.Permission;
import java.security.Permissions;
@ -50,7 +50,8 @@ public class SecurityManager extends java.lang.SecurityManager {
//if the key already exists, just return, we only support setting the permissions once
if (permissionMap.containsKey(cl))
return;
perms.setReadOnly();
perms.setReadOnly(); // no need for this anymore
permissionMap.put(cl, perms);
}
@ -160,7 +161,7 @@ public class SecurityManager extends java.lang.SecurityManager {
// if we get all the way down here, the permission was denied and wasn't an exception, so throw an exception
System.err.println("denying: " + perm.toString());
if (org.moparscape.MainPanel.debug()) {
if (Debug.debug()) {
// class stack for debugging
for (int x = 1; x < c.length; x++) System.out.println(x + ": " + c[x].getName());
@ -185,7 +186,7 @@ public class SecurityManager extends java.lang.SecurityManager {
// java.library.path=/opt/jdk1.6.0_18/jre/lib/i386/server:/opt/jdk1.6.0_18/jre/lib/i386:/opt/jdk1.6.0_18/jre/../lib/i386:.::/usr/java/packages/lib/i386:/lib:/usr/lib
// to allow recursively everything under allowedDir
allowedDir += "-";
MainPanel.debug("allowedDir: " + allowedDir);
Debug.debug("allowedDir: " + allowedDir);
Permissions permissions = new Permissions();
//permissions.add(new java.security.AllPermission());

View File

@ -20,7 +20,7 @@
package org.moparscape.userver;
import org.moparscape.MainPanel;
import org.moparscape.Debug;
import java.io.IOException;
import java.net.HttpURLConnection;
@ -168,7 +168,7 @@ public abstract class Server extends Thread {
}
public void handleException(Exception e) {
if (MainPanel.debug()) {
if (Debug.debug()) {
//String myName = this.getClass().getName();
//if (myName.equals("org.moparscape.userver.v508.OndemandServer443")) return;
System.err.print("Server error: ");