Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Keppler2019-11-18 07:41:57 -0500
committerMichael Keppler2019-11-18 07:43:25 -0500
commitdd5fbd20a40ab0f22d35e41d5db902a612a3b3c6 (patch)
treee48e6ebb41e44d9247eea11513d1557d63752ae6
parent2fe4ef34d94c5bea0820040ff2a12ef17dde12bd (diff)
downloadegit-dd5fbd20a40ab0f22d35e41d5db902a612a3b3c6.tar.gz
egit-dd5fbd20a40ab0f22d35e41d5db902a612a3b3c6.tar.xz
egit-dd5fbd20a40ab0f22d35e41d5db902a612a3b3c6.zip
Fail gracefully in Statistics property page
Show "unknown" in the properties page instead of throwing an exception to the user. The exception is still logged. Has been tested successfully without Ib8a1c557e5e250c5bfdfc888f816d18af6a521e1, which will prohibit the exception. Bug: 553135 Change-Id: Iedb13af486b5cc2951e194d202212959bad22ab2 Signed-off-by: Michael Keppler <Michael.Keppler@gmx.de>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java3
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryStatisticsPage.java7
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties1
3 files changed, 10 insertions, 1 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java
index 4143c09a8..36eea91c3 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/UIText.java
@@ -5091,6 +5091,9 @@ public class UIText extends NLS {
public static String RepositoryStatistics_SpaceNeededOnFilesystem;
/** */
+ public static String RepositoryStatistics_unknown;
+
+ /** */
public static String RevertFailureDialog_Message;
/** */
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryStatisticsPage.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryStatisticsPage.java
index 8badd7583..b443d1f69 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryStatisticsPage.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/repository/RepositoryStatisticsPage.java
@@ -112,7 +112,12 @@ public class RepositoryStatisticsPage extends PropertyPage {
}
private String getStatsAsString(Properties stats, String key) {
- return bigIntFmt.format(firstNonNull(stats.get(key), "")); //$NON-NLS-1$
+ try {
+ return bigIntFmt.format(firstNonNull(stats.get(key), "")); //$NON-NLS-1$
+ } catch (IllegalArgumentException e) {
+ Activator.handleError(e.getMessage(), e, false);
+ return UIText.RepositoryStatistics_unknown;
+ }
}
private static long getStatsAsLong(Properties stats, String key) {
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties
index bce64edb4..67fd434c7 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/uitext.properties
@@ -2048,6 +2048,7 @@ RepositoryStatistics_NrOfPackfiles=Number of packfiles
RepositoryStatistics_NrOfRefs=Number of refs
RepositoryStatistics_SpaceNeededOnFilesystem=Space needed on file system
RepositoryStatistics_PackedObjects=Packed objects
+RepositoryStatistics_unknown=unknown
RewordHandler_CommitNotOnCurrentBranch=The selected commit cannot be reworded because it is not on the currently checked-out branch.
RewordHandler_Error_Title=Error Rewording Commit
RewordHandler_ErrorCheckingIfCommitIsOnCurrentBranch=Error checking if commit is on current branch

Back to the top