import java.util.prefs.*;
import java.net.URL;
import java.net.URLConnection;
+import org.altusmetrum.AltosLib.*;
public class AltosSiteMapCache extends JLabel {
public static boolean fetchMap(File file, String url) {
try {
u = new URL(url);
} catch (java.net.MalformedURLException e) {
- System.out.printf("Malformed URL '%s'\n", url);
return false;
}
in.close();
if (offset != contentLength) {
- System.out.printf("Bad length %d != %d\n",
- offset, contentLength);
return false;
}
} catch (IOException e) {
- System.out.printf("IO exception reading URL\n");
return false;
}
out.flush();
out.close();
} catch (FileNotFoundException e) {
- System.out.printf("Can't create file\n");
return false;
} catch (IOException e) {
if (file.exists()) {
file.delete();
}
- System.out.printf("IO exception writing file\n");
return false;
}
return true;