You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Siwakorn Srisakaokul (JIRA)" <ji...@apache.org> on 2014/01/23 18:16:40 UTC
[jira] [Updated] (HBASE-10407) String Format Exception
[ https://issues.apache.org/jira/browse/HBASE-10407?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Siwakorn Srisakaokul updated HBASE-10407:
-----------------------------------------
Attachment: hbase.patch
> String Format Exception
> -----------------------
>
> Key: HBASE-10407
> URL: https://issues.apache.org/jira/browse/HBASE-10407
> Project: HBase
> Issue Type: Bug
> Components: hadoop2
> Affects Versions: 0.99.0
> Reporter: Siwakorn Srisakaokul
> Priority: Trivial
> Attachments: hbase.patch
>
>
> There is a bug in {{hbase/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MetricMutableQuantiles.java:91/92}}. When the parameter {{name}} contains a %, it will cause a format exception by String.Format(...).
> *Here is a simple patch to fix it*
> {code:title=hbase.patch|borderStyle=solid}
> From 43a4b247f5ac69f57264b2c1b20dcca8205514c4 Mon Sep 17 00:00:00 2001
> From: Siwakorn Srisakaokul <sp...@gmail.com>
> Date: Wed, 22 Jan 2014 10:09:26 -0800
> Subject: [PATCH] Format Patch
> ---
> .../org/apache/hadoop/metrics2/lib/MetricMutableQuantiles.java | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
> diff --git a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MetricMutableQuantiles.java b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MetricMutableQuantiles.java
> index b01f88b..c399323 100644
> --- a/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MetricMutableQuantiles.java
> +++ b/hbase-hadoop2-compat/src/main/java/org/apache/hadoop/metrics2/lib/MetricMutableQuantiles.java
> @@ -82,14 +82,12 @@ public class MetricMutableQuantiles extends MutableMetric implements MetricHisto
> "Number of %s for %s with %ds interval", lsName, desc, interval));
> // Construct the MetricsInfos for the quantiles, converting to percentiles
> quantileInfos = new MetricsInfo[quantiles.length];
> - String nameTemplate = ucName + "%dthPercentile" + interval + "sInterval"
> - + uvName;
> - String descTemplate = "%d percentile " + lvName + " with " + interval
> - + " second interval for " + desc;
> + String nameTemplate = "%s%dthPercentile%dsInterval%s";
> + String descTemplate = "%d percentile %s with %d second interval for %s";
> for (int i = 0; i < quantiles.length; i++) {
> int percentile = (int) (100 * quantiles[i].quantile);
> - quantileInfos[i] = info(String.format(nameTemplate, percentile),
> - String.format(descTemplate, percentile));
> + quantileInfos[i] = info(String.format(nameTemplate, ucName, percentile, interval, uvName),
> + String.format(descTemplate, percentile, lvName, interval, desc));
> }
>
> estimator = new MetricSampleQuantiles(quantiles);
> --
> 1.8.5.2
> {code}
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)