Author: jerome
Date: 2008-12-12 12:14:06 +0100 (Fri, 12 Dec 2008)
New Revision: 3069
Modified:
software_suite_v2/software/control_center/branches/new_paths/control_center/sources/com/tuxdroid/cc/settings/IUUIDChecker.java
Log:
* Improved IUUIDChecker , now it dosn't get new gadgets if installation was not
made with tuxsetup.exe installer.
Modified:
software_suite_v2/software/control_center/branches/new_paths/control_center/sources/com/tuxdroid/cc/settings/IUUIDChecker.java
===================================================================
---
software_suite_v2/software/control_center/branches/new_paths/control_center/sources/com/tuxdroid/cc/settings/IUUIDChecker.java
2008-12-12 10:23:12 UTC (rev 3068)
+++
software_suite_v2/software/control_center/branches/new_paths/control_center/sources/com/tuxdroid/cc/settings/IUUIDChecker.java
2008-12-12 11:14:06 UTC (rev 3069)
@@ -51,7 +51,12 @@
public IUUIDChecker()
{
+ CcCommons.logger.append("Getting installer UUID", true);
newIUUID = InstallerPaths.getIUUID();
+ if(newIUUID == null)
+ {
+ newIUUID = "0";
+ }
}
@@ -61,6 +66,7 @@
*/
private String getCurrentUUID(File IUUIDFile)
{
+ CcCommons.logger.append("Getting current IUUID", true);
String line = "IUUID=0";
try
@@ -75,13 +81,19 @@
{
buff.close();
}
+
}
catch (IOException ioe)
{
+ CcCommons.logger.appendError(ioe.getStackTrace());
System.out.println("Read error: " + ioe.toString());
}
- return line.substring(line.indexOf("=") +1).trim();
+ if(!line.substring(line.indexOf("=")
+1).trim().equalsIgnoreCase("null"))
+ {
+ return line.substring(line.indexOf("=") +1).trim();
+ }
+ return "0";
}
@@ -93,16 +105,27 @@
{
try
{
+ if((IUUID == null) || (IUUID.equals("null")))
+ {
+ IUUID = "0";
+ }
+
+ CcCommons.logger.append("Generating installer UUID: " +
IUUID, true);
BufferedWriter out = new BufferedWriter(new
FileWriter(IUUIDFile));
out.write(String.format("IUUID=%s", IUUID));
out.close();
+ CcCommons.logger.appendDone();
}
- catch (IOException e) {}
+ catch (IOException e)
+ {
+ CcCommons.logger.appendError(e.getStackTrace());
+ }
}
private void update(File from, File to)
{
+ CcCommons.logger.append("Updating " + to.getAbsolutePath(),
true);
if(!to.exists())
{
to.mkdirs();
@@ -124,7 +147,11 @@
//And finally copy attitunes.
try {
FileUtils.copyDirectory(from, to);
- } catch (IOException e) {
+ CcCommons.logger.appendDone();
+ }
+ catch (IOException e)
+ {
+ CcCommons.logger.appendError(e.getStackTrace());
e.printStackTrace();
}
}
@@ -204,22 +231,29 @@
{
currentIUUID = this.getCurrentUUID(iuuidFile);
-
- if(!(currentIUUID.trim().equals(newIUUID.trim())))
+ System.out.println(newIUUID);
+ try
{
- //then IUUID has changed, so update needed.
- JOptionPane.showMessageDialog(null,
CcCommons.language.messages.getSoftwareUpdateMessage(),
-
CcCommons.language.getTitle(), JOptionPane.WARNING_MESSAGE);
-
- if(this.updateAttitunes)
- this.updateAttitunes();
- if(this.updateGadgets)
- this.updateGadgets();
- if(this.updateTools)
- this.updateTools();
-
- this.generateIUUIDFile(iuuidFile,
this.newIUUID);
+
if(!(currentIUUID.trim().equals(newIUUID.trim())))
+ {
+ //then IUUID has changed, so update
needed.
+ JOptionPane.showMessageDialog(null,
CcCommons.language.messages.getSoftwareUpdateMessage(),
+
CcCommons.language.getTitle(), JOptionPane.WARNING_MESSAGE);
+
+ if(this.updateAttitunes)
+ this.updateAttitunes();
+ if(this.updateGadgets)
+ this.updateGadgets();
+ if(this.updateTools)
+ this.updateTools();
+
+ this.generateIUUIDFile(iuuidFile,
this.newIUUID);
+ }
}
+ catch(NullPointerException e)
+ {
+ CcCommons.logger.append("IUUID cannot be
'null'.", true);
+ }
}
}
}
------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you. Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn