package com.qikemi.wechat.api.utils;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;

/**
 * 微信公众号默认配置
 * @author XieXianbin
 * @version 1.0
 * 
 */
public class WechatProperties {
	
	private Logger logger = Logger.getLogger(WechatProperties.class);
	
	// WeChat Configure 
	public static String TOKEN = "TOKEN";
	public static String APPID = "APPID";
	public static String APPSECRET = "APPSECRET";
	
	public static Properties wechatProperties;
	
	public static Properties getWechatProperties() {
		if(null == wechatProperties){
			WechatProperties properties = new WechatProperties();
			wechatProperties = properties.getProperties();
		}
		return wechatProperties;
	}
	
	private Properties getProperties(){
		try {
	        InputStream in = this.getClass().getResourceAsStream("/wechat.properties");  
			// 加载属性文件
			Properties properties = new Properties();
			properties.load(in);
			in.close();
			return properties;
		} catch (FileNotFoundException e) {
			logger.warn("FileNotFoundException: ->" + e.getMessage());
		} catch (IOException e) {
			logger.warn("IOException: ->" + e.getMessage());
		}
		return null;
	}
}

@@ -811,16 +811,41 @@
 ties()%7B%0A
+%09%09InputStream in = null;%0A
 %09%09try %7B%0A
@@ -853,28 +853,16 @@
         
-InputStream 
 in = thi
@@ -1005,23 +1005,8 @@
 n);%0A
-%09%09%09in.close();%0A
 %09%09%09r
@@ -1077,32 +1077,55 @@
 r.warn(%22File
+ %5Bwechat.properties%5D 
 Not
+ 
 Found
+ 
 Exception: -
@@ -1190,16 +1190,41 @@
 r.warn(%22
+File %5Bwechat.properties%5D 
 IOExcept
@@ -1251,16 +1251,83 @@
 age());%0A
+%09%09%7Dfinally%7B%0A%09%09%09try %7B%0A%09%09%09%09in.close();%0A%09%09%09%7D catch (IOException e) %7B%7D%0A
 %09%09%7D%0A%09%09re

update exception info