Skip to content

Commit 5a4e374

Browse files
fthevenetjerboaa
authored andcommitted
8309959: JFR: Display N/A for missing data amount
Reviewed-by: stuefe, sgehwolf Backport-of: 9872a14192ce3964b934c19ab685342ffd396986
1 parent 6c81bf5 commit 5a4e374

File tree

1 file changed

+6
-4
lines changed
  • src/jdk.jfr/share/classes/jdk/jfr/internal

1 file changed

+6
-4
lines changed

src/jdk.jfr/share/classes/jdk/jfr/internal/Utils.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,13 @@ private static enum TimespanUnit {
126126
}
127127
}
128128

129-
// handle Long.MIN_VALUE as a special case since its absolute value is negative
130129
private static String formatDataAmount(String formatter, long amount) {
131-
int exp = (amount == Long.MIN_VALUE) ? 6 : (int) (Math.log(Math.abs(amount)) / Math.log(1024));
132-
char unitPrefix = "kMGTPE".charAt(exp - 1);
133-
return String.format(formatter, amount / Math.pow(1024, exp), unitPrefix);
130+
if (amount == Long.MIN_VALUE) {
131+
return "N/A";
132+
}
133+
int exp = (int) (Math.log(Math.abs(amount)) / Math.log(1024));
134+
char unit = "kMGTPE".charAt(exp - 1);
135+
return String.format(formatter, amount / Math.pow(1024, exp), unit);
134136
}
135137

136138
public static String formatBytesCompact(long bytes) {

0 commit comments

Comments
 (0)