]> git.gag.com Git - debian/openrocket/blobdiff - src/net/sf/openrocket/communication/UpdateInfoRetriever.java
Updates for 0.9.5
[debian/openrocket] / src / net / sf / openrocket / communication / UpdateInfoRetriever.java
index d67ea3354da90f086bcb3f9a70d94a65189a1634..4fd0782461b417289f21520d3bd2c2662cc6f88d 100644 (file)
@@ -124,6 +124,7 @@ public class UpdateInfoRetriever {
                        try {
                                doConnection();
                        } catch (IOException e) {
+                               System.out.println("fetching update failed: " + e);
                                return;
                        }
                }
@@ -152,12 +153,14 @@ public class UpdateInfoRetriever {
                                                        System.getProperty("java.version")));
                        connection.setRequestProperty("X-OpenRocket-Country", 
                                        Communicator.encode(System.getProperty("user.country") + " " +
-                                                       Communicator.encode(System.getProperty("user.timezone"))));
+                                                       System.getProperty("user.timezone")));
                        
                        InputStream is = null;
                        try {
                                connection.connect();
                                
+                               System.out.println("response code: " + connection.getResponseCode());
+                               
                                if (connection.getResponseCode() == Communicator.UPDATE_INFO_NO_UPDATE_CODE) {
                                        // No updates are available
                                        info = new UpdateInfo();
@@ -166,15 +169,19 @@ public class UpdateInfoRetriever {
                                
                                if (connection.getResponseCode() != Communicator.UPDATE_INFO_UPDATE_AVAILABLE) {
                                        // Error communicating with server
+                                       System.out.println("Unknown response code: " + connection.getResponseCode());
                                        return;
                                }
                                
-                               if (!Communicator.UPDATE_INFO_CONTENT_TYPE.equalsIgnoreCase(
-                                               connection.getContentType())) {
+                               String contentType = connection.getContentType();
+                               if (contentType == null || 
+                                               contentType.toLowerCase().indexOf(Communicator.UPDATE_INFO_CONTENT_TYPE) < 0) {
                                        // Unknown response type
+                                       System.out.println("Unknown Content-type received:"+contentType);
                                        return;
                                }
                                
+                               System.out.println("Update is available");
                                
                                // Update is available, parse input
                                is = connection.getInputStream();
@@ -206,12 +213,13 @@ public class UpdateInfoRetriever {
                                if (version == null || version.length() == 0 || 
                                                version.equalsIgnoreCase(Prefs.getVersion())) {
                                        // Invalid response
+                                       System.out.println("Invalid version received, ignoring.");
                                        return;
                                }
                                
                                
                                info = new UpdateInfo(version, updates);
-                               
+                               System.out.println("Found update: " + info);
                        } finally {
                                try {
                                        if (is != null)