Ticket #7395: 7395.patch

File 7395.patch, 2.6 KB (added by simon04, 12 years ago)
  • src/org/openstreetmap/josm/gui/GettingStarted.java

    diff --git a/src/org/openstreetmap/josm/gui/GettingStarted.java b/src/org/openstreetmap/josm/gui/GettingStarted.java
    index 6fbdaca..648e433 100644
    a b public class GettingStarted extends JPanel {  
    9090         * Additionally check if JOSM has been updated and refresh MOTD
    9191         */
    9292        @Override
    93         protected boolean isCacheValid() {
     93        protected boolean isCacheValid(byte[] data) {
    9494            // We assume a default of myVersion because it only kicks in in two cases:
    9595            // 1. Not yet written - but so isn't the interval variable, so it gets updated anyway
    9696            // 2. Cannot be written (e.g. while developing). Obviously we don't want to update
    9797            // everytime because of something we can't read.
    9898            return (Main.pref.getInteger("cache.motd.html.version", -999) == myVersion)
    99             && Main.pref.get("cache.motd.html.lang").equals(myLang);
     99                    && Main.pref.get("cache.motd.html.lang").equals(myLang)
     100                    && data.length > 128; // a MOTD w/ less than 128 bytes indicateS necessity to update (see #7395)
    100101        }
    101102    }
    102103
  • src/org/openstreetmap/josm/io/CacheCustomContent.java

    diff --git a/src/org/openstreetmap/josm/io/CacheCustomContent.java b/src/org/openstreetmap/josm/io/CacheCustomContent.java
    index dbb2ec3..5392b7b 100644
    a b public abstract class CacheCustomContent<T extends Throwable> {  
    6464     * This function serves as a comfort hook to perform additional checks if the cache is valid
    6565     * @return True if the cached copy is still valid
    6666     */
    67     protected boolean isCacheValid() {
     67    protected boolean isCacheValid(byte[] data) {
    6868        return true;
    6969    }
    7070
    public abstract class CacheCustomContent<T extends Throwable> {  
    8686     */
    8787    public byte[] updateIfRequired() throws T {
    8888        if (Main.pref.getInteger("cache." + ident, 0) + updateInterval < new Date().getTime()/1000
    89                 || !isCacheValid())
     89                || !isCacheValid(getData()))
    9090            return updateForce();
    9191        return getData();
    9292    }
    public abstract class CacheCustomContent<T extends Throwable> {  
    9797     */
    9898    public String updateIfRequiredString() throws T {
    9999        if (Main.pref.getInteger("cache." + ident, 0) + updateInterval < new Date().getTime()/1000
    100                 || !isCacheValid())
     100                || !isCacheValid(getData()))
    101101            return updateForceString();
    102102        return getDataString();
    103103    }