From: Hendrik <nh...@us...> - 2007-05-26 23:46:19
|
Update of /cvsroot/arianne/stendhal/src/games/stendhal/client/update In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv1715/src/games/stendhal/client/update Modified Files: Tag: VERSION_00_RELEASE_60 Bootstrap.java Log Message: Backported fixed to 0.60 * convert game name to folder name using lower case because ... * fall back to self build client in case of a SecurityException because ... * clear jar.properties in case an error was thrown which indicates a incompatible jar mix Index: Bootstrap.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/client/update/Bootstrap.java,v retrieving revision 1.43 retrieving revision 1.43.4.1 diff -C2 -d -r1.43 -r1.43.4.1 *** Bootstrap.java 9 May 2007 19:02:27 -0000 1.43 --- Bootstrap.java 26 May 2007 23:46:18 -0000 1.43.4.1 *************** *** 7,11 **** import java.io.InputStream; import java.io.OutputStream; - import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.net.URL; --- 7,10 ---- *************** *** 96,101 **** pathSep = System.getProperty("file.separator"); ! String stendhal=ClientGameConfiguration.get("GAME_NAME"); ! System.out.println("GAME: "+stendhal); jarFolder = System.getProperty("user.home") + pathSep + stendhal + pathSep + "jar" + pathSep; --- 95,100 ---- pathSep = System.getProperty("file.separator"); ! String stendhal=ClientGameConfiguration.get("GAME_NAME").toLowerCase(); ! System.out.println("GAME: " + stendhal); jarFolder = System.getProperty("user.home") + pathSep + stendhal + pathSep + "jar" + pathSep; *************** *** 198,208 **** Method method = clazz.getMethod("process", String.class, Properties.class, Boolean.class); method.invoke(clazz.newInstance(), jarFolder, bootProp, initialDownload); } catch (Exception e) { e.printStackTrace(System.err); ! JOptionPane ! .showMessageDialog( ! null, ! "Something nasty happened while trying to build classpath for UpdateManager.\r\nPlease open a bug report at http://sf.net/projects/arianne with this error message:\r\n" ! + e); } } --- 197,207 ---- Method method = clazz.getMethod("process", String.class, Properties.class, Boolean.class); method.invoke(clazz.newInstance(), jarFolder, bootProp, initialDownload); + } catch (SecurityException e) { + throw e; } catch (Exception e) { e.printStackTrace(System.err); ! JOptionPane.showMessageDialog(null, ! "Something nasty happened while trying to build classpath for UpdateManager.\r\nPlease open a bug report at http://sf.net/projects/arianne with this error message:\r\n" ! + e); } } *************** *** 233,253 **** method.invoke(null, (Object) args); } catch (Throwable e) { ! if (e instanceof InvocationTargetException) { ! unexspectedErrorHandling(e); ! } else { ! JOptionPane ! .showMessageDialog( ! null, ! "Something nasty happened while trying to build classpath.\r\nPlease open a bug report at http://sf.net/projects/arianne with this error message:\r\n" ! + e); ! e.printStackTrace(System.err); ! try { ! Class clazz = Class.forName(className); ! Method method = clazz.getMethod("main", args.getClass()); ! method.invoke(null, (Object) args); ! } catch (Exception err) { ! err.printStackTrace(System.err); ! } ! } } --- 232,236 ---- method.invoke(null, (Object) args); } catch (Throwable e) { ! unexspectedErrorHandling(e); } *************** *** 288,296 **** } if (isSigned()) { // official client, look for updates and integrate additinal .jar files System.err.println("Integrating old updates and looking for new ones"); ! AccessController.doPrivileged(new PrivilegedBoot<Object>(className, args)); ! } else { // self build client, do not try to update it System.err.println("Self build client, starting without update .jar-files"); --- 271,289 ---- } + boolean startSelfBuild = true; if (isSigned()) { + startSelfBuild = false; // official client, look for updates and integrate additinal .jar files System.err.println("Integrating old updates and looking for new ones"); ! try { ! AccessController.doPrivileged(new PrivilegedBoot<Object>(className, args)); ! } catch (SecurityException e) { ! // partly update ! System.err.println("Got SecurityException most likly because singed jars files from the official distribution have been included into a self build client." + e); ! startSelfBuild = true; ! } ! } ! ! if (startSelfBuild) { // self build client, do not try to update it System.err.println("Self build client, starting without update .jar-files"); *************** *** 318,326 **** if (e instanceof OutOfMemoryError) { JOptionPane.showMessageDialog(null, "Sorry, an OutOfMemoryError occured. Please restart Stendhal."); } else { ! JOptionPane ! .showMessageDialog( ! null, ! "An unexspected error occured.\r\nPlease open a bug report at http://sf.net/projects/arianne with this error message:\r\n" + e); } --- 311,327 ---- if (e instanceof OutOfMemoryError) { JOptionPane.showMessageDialog(null, "Sorry, an OutOfMemoryError occured. Please restart Stendhal."); + } else if (e instanceof LinkageError) { + int res = JOptionPane.showConfirmDialog(null, "Sorry an error occured because of an inconsistant update state. Clear updates so that they are downloaded again after restarting Stendhal?", + "Stendhal", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); + if (res == JOptionPane.YES_OPTION) { + bootProp.remove("load"); + try { + saveBootProp(); + } catch (IOException e1) { + JOptionPane.showMessageDialog(null, "Could not write jar.properties"); + } + } } else { ! JOptionPane.showMessageDialog(null, "An unexspected error occured.\r\nPlease open a bug report at http://sf.net/projects/arianne with this error message:\r\n" + e); } |