launcher/src/wombat/launcher/Wombat.java
private static void checkForUpdates() throws IOException {
		// Get the new version file.
		String newVersionFile = download(UpdateVersionFile);
		Scanner s = new Scanner(newVersionFile);
		List<Version> newVersions = new ArrayList<Version>();
		while (s.hasNextLine()) {
			String line = s.nextLine().trim();
			if ("".equals(line)) continue;
			Version v = new Version(line);
			if (v.Filename == null) continue;
			newVersions.add(v);
		}
		s.close();

		// Check each new version against what we already have.
		List<Version> toUpdate = new ArrayList<Version>();
		for (Version newV : newVersions) {
			boolean haveIt = false;
			for (Version oldV : Versions) {
				if (newV.Name.equals(oldV.Name)
						&& ((newV.OS == null && oldV.OS == null)
								|| (newV.OS != null && newV.OS.equals(oldV.OS)))
						&& oldV.compareTo(newV) >= 0) {
					haveIt = true;
					break;
				}
			}
			
			if (!haveIt)
				toUpdate.add(newV);
		}
		
		// If there are any that we don't have, notify the user.
		if (!toUpdate.isEmpty()) {
			String updatedFiles = "";
			for (Version v : toUpdate)
				updatedFiles += "- " + v.Filename + "\n";
					
			if (JOptionPane.NO_OPTION == 
					JOptionPane.showConfirmDialog(
							null, 
							"An update to Wombat is available.\n\n" +
							"The following files have been updated:\n" + 
								updatedFiles +  
								"\n" + 
								"Do you want to download the new files?\n",
							"Update available", 
							JOptionPane.YES_NO_OPTION))
				return;
			
			installThese(toUpdate);
			
			JOptionPane.showMessageDialog(
					null, 
					"The updates have been downloaded.\n" + 
							"They will be automatically installed the next time you restart Wombat.", 
					"Updates installed", 
					JOptionPane.INFORMATION_MESSAGE);
		}
	}
/**
	 * Check for updates in the background.
	 * @throws IOException If we have an issues getting the new version file.
	 */
Check for updates in the background.
@throws IOException If we have an issues getting the new version file.
Check for updates in the background . @throws IOException If we have an issues getting the new version file .
private static void checkForUpdates() throws IOException {
		String newVersionFile = download(UpdateVersionFile);
		Scanner s = new Scanner(newVersionFile);
		List<Version> newVersions = new ArrayList<Version>();
		while (s.hasNextLine()) {
			String line = s.nextLine().trim();
			if ("".equals(line)) continue;
			Version v = new Version(line);
			if (v.Filename == null) continue;
			newVersions.add(v);
		}
		s.close();
		List<Version> toUpdate = new ArrayList<Version>();
		for (Version newV : newVersions) {
			boolean haveIt = false;
			for (Version oldV : Versions) {
				if (newV.Name.equals(oldV.Name)
						&& ((newV.OS == null && oldV.OS == null)
								|| (newV.OS != null && newV.OS.equals(oldV.OS)))
						&& oldV.compareTo(newV) >= 0) {
					haveIt = true;
					break;
				}
			}
			if (!haveIt)
				toUpdate.add(newV);
		}
		if (!toUpdate.isEmpty()) {
			String updatedFiles = "";
			for (Version v : toUpdate)
				updatedFiles += "- " + v.Filename + "\n";
			if (JOptionPane.NO_OPTION == 
					JOptionPane.showConfirmDialog(
							null, 
							"An update to Wombat is available.\n\n" +
							"The following files have been updated:\n" + 
								updatedFiles +  
								"\n" + 
								"Do you want to download the new files?\n",
							"Update available", 
							JOptionPane.YES_NO_OPTION))
				return;
			installThese(toUpdate);
			JOptionPane.showMessageDialog(
					null, 
					"The updates have been downloaded.\n" + 
							"They will be automatically installed the next time you restart Wombat.", 
					"Updates installed", 
					JOptionPane.INFORMATION_MESSAGE);
		}
	}
private static void checkForUpdates ( ) throws IOException { String newVersionFile = download ( UpdateVersionFile ) ; Scanner s = new Scanner ( newVersionFile ) ; List < Version > newVersions = new ArrayList < Version > ( ) ; while ( s . hasNextLine ( ) ) { String line = s . nextLine ( ) . trim ( ) ; if ( "" . equals ( line ) ) continue ; Version v = new Version ( line ) ; if ( v . Filename == null ) continue ; newVersions . add ( v ) ; } s . close ( ) ; List < Version > toUpdate = new ArrayList < Version > ( ) ; for ( Version newV : newVersions ) { boolean haveIt = false ; for ( Version oldV : Versions ) { if ( newV . Name . equals ( oldV . Name ) && ( ( newV . OS == null && oldV . OS == null ) || ( newV . OS != null && newV . OS . equals ( oldV . OS ) ) ) && oldV . compareTo ( newV ) >= 0 ) { haveIt = true ; break ; } } if ( ! haveIt ) toUpdate . add ( newV ) ; } if ( ! toUpdate . isEmpty ( ) ) { String updatedFiles = "" ; for ( Version v : toUpdate ) updatedFiles += "- " + v . Filename + "\n" ; if ( JOptionPane . NO_OPTION == JOptionPane . showConfirmDialog ( null , "An update to Wombat is available.\n\n" + "The following files have been updated:\n" + updatedFiles + "\n" + "Do you want to download the new files?\n" , "Update available" , JOptionPane . YES_NO_OPTION ) ) return ; installThese ( toUpdate ) ; JOptionPane . showMessageDialog ( null , "The updates have been downloaded.\n" + "They will be automatically installed the next time you restart Wombat." , "Updates installed" , JOptionPane . INFORMATION_MESSAGE ) ; } }
Check for updates in the background.
Check for updates in the background .
// Get the new version file. // Check each new version against what we already have. // If there are any that we don't have, notify the user.