package com.handmark.pulltorefresh.configuration.xml;

import java.io.IOException;
import java.io.InputStream;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;

import android.content.Context;
import android.content.res.AssetManager;
import android.util.Log;
/**
 * Parser of assets/pulltorefresh.xml creation factory 
 * @author Wonjun Kim
 */
class ExtendedConfigXmlParserFactory {
	
	private static final String LOG_TAG = ExtendedConfigXmlParserFactory.class.getName();
	/**
	 * pulltorefresh.xml path in assets folder
	 */
	private static final String XML_PATH_IN_ASSETS = "pulltorefresh.xml";
	/**
	 * pulltorefresh.xml encoding type
	 */
	private static final String DEFAULT_ENCODING_TYPE = "utf-8";
	/**
	 * Create a parser of assets/pulltorefresh.xml 
	 * @param context
	 * @return {@code parser} if creating parser has done, or {@code null} if an error occured during creation
	 */
	public static XmlPullParser createParser(Context context) {
		AssetManager am = context.getAssets();
		XmlPullParser parser = null;
		try {
			InputStream is = am.open(XML_PATH_IN_ASSETS);
			parser = XmlPullParserFactory.newInstance().newPullParser();
			parser.setInput(is, DEFAULT_ENCODING_TYPE);
			
		} catch (XmlPullParserException e) {
			Log.w(LOG_TAG, "The error occurs below when generating parser.", e);
			// explicitly assign null
			parser = null;
		} catch (IOException e) {
			Log.w(LOG_TAG, "Loading "+XML_PATH_IN_ASSETS+" file has failed.", e);
			// explicitly assign null
			parser = null;
		}
		
		// NOTE: this code makes a fatal error. so omit the code.
		// am.close();
		
		return parser;
	}
}

package com.handmark.pulltorefresh.configuration.xml;

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

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;

import android.content.Context;
import android.content.res.AssetManager;
import android.util.Log;
/**
 * Parser of assets/pulltorefresh.xml creation factory 
 * @author Wonjun Kim
 */
class ExtendedConfigXmlParserFactory {
	
	private static final String LOG_TAG = ExtendedConfigXmlParserFactory.class.getName();
	/**
	 * pulltorefresh.xml path in assets folder
	 */
	private static final String XML_PATH_IN_ASSETS = "pulltorefresh.xml";
	/**
	 * pulltorefresh.xml encoding type
	 */
	private static final String DEFAULT_ENCODING_TYPE = "utf-8";
	/**
	 * Create a parser of assets/pulltorefresh.xml 
	 * @param context
	 * @return {@code parser} if creating parser has done, or {@code null} if an error occured during creation
	 */
	public static XmlPullParser createParser(Context context) {
		AssetManager am = context.getAssets();
		XmlPullParser parser = null;
		try {
			InputStream is = am.open(XML_PATH_IN_ASSETS);
			parser = XmlPullParserFactory.newInstance().newPullParser();
			parser.setInput(is, DEFAULT_ENCODING_TYPE);
			
		} catch (FileNotFoundException e) {
			Log.d(LOG_TAG, "The configuration file 'assets/" + XML_PATH_IN_ASSETS + "' is missing. But the file is just an option. It is necessary only if you want to customize something in Pull To Refresh.");
			// explicitly assign null
			parser = null;
		} catch (XmlPullParserException e) {
			Log.w(LOG_TAG, "The error occurs below when generating parser.", e);
			// explicitly assign null
			parser = null;
		} catch (IOException e) {
			Log.w(LOG_TAG, "Loading "+XML_PATH_IN_ASSETS+" file has failed.", e);
			// explicitly assign null
			parser = null;
		}
		
		// NOTE: this code makes a fatal error. so omit the code.
		// am.close();
		
		return parser;
	}
}

Send the debug message from ExtendXmlConfigParserFactory.createParser() method when FileNotFoundException throws