Merge branch 'feature/always_include_repo_name' into 'master'
Always include repo name in exception toasts See merge request fdroid/fdroidclient!966
This commit is contained in:
		
						commit
						34b24a5b60
					
				@ -142,7 +142,7 @@ public class IndexUpdater {
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            throw new UpdateException("Error getting F-Droid index file", e);
 | 
			
		||||
            throw new UpdateException(repo, "Error getting F-Droid index file", e);
 | 
			
		||||
        } catch (InterruptedException e) {
 | 
			
		||||
            // ignored if canceled, the local database just won't be updated
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
@ -205,7 +205,7 @@ public class IndexUpdater {
 | 
			
		||||
        InputStream indexInputStream = null;
 | 
			
		||||
        try {
 | 
			
		||||
            if (downloadedFile == null || !downloadedFile.exists()) {
 | 
			
		||||
                throw new UpdateException(downloadedFile + " does not exist!");
 | 
			
		||||
                throw new UpdateException(repo, downloadedFile + " does not exist!");
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Due to a bug in Android 5.0 Lollipop, the inclusion of bouncycastle causes
 | 
			
		||||
@ -229,7 +229,7 @@ public class IndexUpdater {
 | 
			
		||||
 | 
			
		||||
            long timestamp = repoDetailsToSave.getAsLong(RepoTable.Cols.TIMESTAMP);
 | 
			
		||||
            if (timestamp < repo.timestamp) {
 | 
			
		||||
                throw new UpdateException("index.jar is older that current index! "
 | 
			
		||||
                throw new UpdateException(repo, "index.jar is older that current index! "
 | 
			
		||||
                        + timestamp + " < " + repo.timestamp);
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@ -240,7 +240,7 @@ public class IndexUpdater {
 | 
			
		||||
            assertSigningCertFromXmlCorrect();
 | 
			
		||||
            commitToDb();
 | 
			
		||||
        } catch (SAXException | ParserConfigurationException | IOException e) {
 | 
			
		||||
            throw new UpdateException("Error parsing index", e);
 | 
			
		||||
            throw new UpdateException(repo, "Error parsing index", e);
 | 
			
		||||
        } finally {
 | 
			
		||||
            FDroidApp.enableBouncyCastleOnLollipop();
 | 
			
		||||
            Utils.closeQuietly(indexInputStream);
 | 
			
		||||
@ -347,22 +347,22 @@ public class IndexUpdater {
 | 
			
		||||
 | 
			
		||||
        private static final long serialVersionUID = -4492452418826132803L;
 | 
			
		||||
 | 
			
		||||
        public UpdateException(String message) {
 | 
			
		||||
            super(message);
 | 
			
		||||
        public UpdateException(Repo repo, String message) {
 | 
			
		||||
            super((repo != null ? repo.name + ": " : "") + message);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public UpdateException(String message, Exception cause) {
 | 
			
		||||
            super(message, cause);
 | 
			
		||||
        public UpdateException(Repo repo, String message, Exception cause) {
 | 
			
		||||
            super((repo != null ? repo.name + ": " : "") + message, cause);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public static class SigningException extends UpdateException {
 | 
			
		||||
        public SigningException(String message) {
 | 
			
		||||
            super("Repository was not signed correctly: " + message);
 | 
			
		||||
            super(null, "Repository was not signed correctly: " + message);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public SigningException(Repo repo, String message) {
 | 
			
		||||
            super((repo == null ? "Repository" : repo.name) + " was not signed correctly: " + message);
 | 
			
		||||
            super(repo, "Repository was not signed correctly: " + message);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -176,7 +176,7 @@ public class IndexV1Updater extends IndexUpdater {
 | 
			
		||||
                    if (downloader != null) {
 | 
			
		||||
                        FileUtils.deleteQuietly(downloader.outputFile);
 | 
			
		||||
                    }
 | 
			
		||||
                    throw new IndexUpdater.UpdateException("Error getting F-Droid index file", e2);
 | 
			
		||||
                    throw new IndexUpdater.UpdateException(repo, "Error getting F-Droid index file", e2);
 | 
			
		||||
                } catch (InterruptedException e2) {
 | 
			
		||||
                    // ignored if canceled, the local database just won't be updated
 | 
			
		||||
                }
 | 
			
		||||
@ -185,7 +185,7 @@ public class IndexV1Updater extends IndexUpdater {
 | 
			
		||||
            if (downloader != null) {
 | 
			
		||||
                FileUtils.deleteQuietly(downloader.outputFile);
 | 
			
		||||
            }
 | 
			
		||||
            throw new IndexUpdater.UpdateException("Error getting F-Droid index file", e);
 | 
			
		||||
            throw new IndexUpdater.UpdateException(repo, "Error getting F-Droid index file", e);
 | 
			
		||||
        } catch (InterruptedException e) {
 | 
			
		||||
            // ignored if canceled, the local database just won't be updated
 | 
			
		||||
        }
 | 
			
		||||
@ -278,7 +278,7 @@ public class IndexV1Updater extends IndexUpdater {
 | 
			
		||||
        long timestamp = (Long) repoMap.get("timestamp") / 1000;
 | 
			
		||||
 | 
			
		||||
        if (repo.timestamp > timestamp) {
 | 
			
		||||
            throw new IndexUpdater.UpdateException("index.jar is older that current index! "
 | 
			
		||||
            throw new IndexUpdater.UpdateException(repo, "index.jar is older that current index! "
 | 
			
		||||
                    + timestamp + " < " + repo.timestamp);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -106,7 +106,7 @@ public class RepoPersister {
 | 
			
		||||
        try {
 | 
			
		||||
            context.getContentResolver().applyBatch(TempApkProvider.getAuthority(), apkOperations);
 | 
			
		||||
        } catch (RemoteException | OperationApplicationException e) {
 | 
			
		||||
            throw new IndexUpdater.UpdateException("An internal error occurred while updating the database", e);
 | 
			
		||||
            throw new IndexUpdater.UpdateException(repo, "An internal error occurred while updating the database", e);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -122,7 +122,7 @@ public class RepoPersister {
 | 
			
		||||
            context.getContentResolver().applyBatch(TempAppProvider.getAuthority(), appOperations);
 | 
			
		||||
            return getIdsForPackages(appsToSave);
 | 
			
		||||
        } catch (RemoteException | OperationApplicationException e) {
 | 
			
		||||
            throw new IndexUpdater.UpdateException("An internal error occurred while updating the database", e);
 | 
			
		||||
            throw new IndexUpdater.UpdateException(repo, "An internal error occurred while updating the database", e);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user