From ca5e75ac4c721182e79cbdce1a4be7670bc0b5fe Mon Sep 17 00:00:00 2001 From: Woonduk Kang Date: Thu, 27 Sep 2012 07:40:01 +0000 Subject: [PATCH] =?UTF-8?q?[=EA=B0=95=EC=9A=B4=EB=8D=95]=20[LUCYSUS-1744]?= =?UTF-8?q?=20agent=EC=9D=98=20config=20=ED=8C=8C=EC=9D=BC=20=EC=88=98?= =?UTF-8?q?=EC=A0=95.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-commons/trunk@718 84d0f5b1-2673-498c-a247-62c4ff18d310 --- .../java/com/profiler/common/util/PropertyUtils.java | 9 ++++----- .../java/com/profiler/common/hbase/HBaseClientTest.java | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/profiler/common/util/PropertyUtils.java b/src/main/java/com/profiler/common/util/PropertyUtils.java index 255baf8b9..c4f906a92 100644 --- a/src/main/java/com/profiler/common/util/PropertyUtils.java +++ b/src/main/java/com/profiler/common/util/PropertyUtils.java @@ -1,25 +1,24 @@ package com.profiler.common.util; +import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.Properties; public class PropertyUtils { - public static Properties readProperties(String propertyName) { + public static Properties readProperties(String propertyName) throws IOException { return readProperties(propertyName, PropertyUtils.class.getClassLoader()); } - public static Properties readProperties(String propertyName, ClassLoader cl) { + public static Properties readProperties(String propertyName, ClassLoader cl) throws IOException { Properties properties = new Properties(); InputStream stream = cl.getResourceAsStream(propertyName); if (stream == null) { - throw new RuntimeException(propertyName + " not found."); + throw new FileNotFoundException(propertyName + " not found."); } try { properties.load(stream); - } catch (IOException e) { - throw new RuntimeException(propertyName + " load fail. Cause:" + e.getMessage(), e); } finally { try { stream.close(); diff --git a/src/test/java/com/profiler/common/hbase/HBaseClientTest.java b/src/test/java/com/profiler/common/hbase/HBaseClientTest.java index bcfc75e84..fda0f37e9 100644 --- a/src/test/java/com/profiler/common/hbase/HBaseClientTest.java +++ b/src/test/java/com/profiler/common/hbase/HBaseClientTest.java @@ -1,10 +1,8 @@ package com.profiler.common.hbase; -import java.util.*; - +import com.profiler.common.hbase.HBaseQuery.HbaseColumn; import com.profiler.common.util.PropertyUtils; import junit.framework.Assert; - import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.client.Put; @@ -13,7 +11,8 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; -import com.profiler.common.hbase.HBaseQuery.HbaseColumn; +import java.io.IOException; +import java.util.*; public class HBaseClientTest { @@ -22,7 +21,7 @@ public class HBaseClientTest { private static HBaseClient client; @BeforeClass - public static void init() { + public static void init() throws IOException { Properties properties = PropertyUtils.readProperties("test-hbase.properties"); client = new HBaseClient(properties); if (client.isTableExists(TABLE_NAME)) {