src/main/java/de/blau/android/util/SavingHelper.java
/**
     * Loads and deserializes a single object from the given file Original version was running out of stack, fixed by
     * moving to a thread
     * 
     * @param context Android Context
     * @param filename filename of the save file
     * @param compressed true if the output is gzip-compressed, false if it is uncompressed
     * @param deleteOnFail if true delete the file we tried to load (because it is likely corrupted)
     * @param jdk use the built-in serialisation if true
     * @return the deserialized object if successful, null if loading/deserialization/casting failed
     */
Loads and deserializes a single object from the given file Original version was running out of stack, fixed by
moving to a thread


Loads and deserializes a single object from the given file Original version was running out of stack fixed by moving to a thread
public synchronized T load(@NonNull Context context, @NonNull String filename, boolean compressed, boolean deleteOnFail, boolean jdk) {
        try {
            Log.d(DEBUG_TAG, "preparing to load " + filename);
            LoadThread r = new LoadThread(context, filename, compressed, deleteOnFail, jdk);
            Thread t = new Thread(null, r, LoadThread.DEBUG_TAG, stackSize);
            t.start();
            t.join(60000); 
            Log.d(DEBUG_TAG, "load thread finished");
            return r.getResult();
        } catch (Exception e) { 
            ACRAHelper.nocrashReport(e, e.getMessage());
            return null;
        }
    }
public synchronized T load ( @ NonNull Context context , @ NonNull String filename , boolean compressed , boolean deleteOnFail , boolean jdk ) { try { Log . d ( DEBUG_TAG , "preparing to load " + filename ) ; LoadThread r = new LoadThread ( context , filename , compressed , deleteOnFail , jdk ) ; Thread t = new Thread ( null , r , LoadThread . DEBUG_TAG , stackSize ) ; t . start ( ) ; t . join ( 60000 ) ; Log . d ( DEBUG_TAG , "load thread finished" ) ; return r . getResult ( ) ; } catch ( Exception e ) { ACRAHelper . nocrashReport ( e , e . getMessage ( ) ) ; return null ; } }
Loads and deserializes a single object from the given file Original version was running out of stack, fixed by
 moving to a thread
Loads and deserializes a single object from the given file Original version was running out of stack fixed by moving to a thread
// wait max 60 s for thread to finish TODO this needs to be done differently given this // limits the size of the file that can be loaded // NOSONAR