<commit_before>package de.devisnik.android.mine.data;

import java.io.Closeable;
import java.io.File;
import java.io.IOException;

import android.content.Context;
import android.util.Log;

public abstract class CacheFileCommand<RESULT, STREAM extends Closeable> {
	
	private static final String TAG = CacheFileCommand.class.getSimpleName();
	private final RESULT itsErrorResult;
	private final Context itsContext;
	private final String itsFileName;
	
	public CacheFileCommand(Context context, String fileName, RESULT errorResult) {
		itsContext = context;
		itsFileName = fileName;
		itsErrorResult = errorResult;			
	}
	
	protected final File createCacheFile() {
		return new File(itsContext.getCacheDir(), itsFileName);
	}
	
	abstract STREAM createStream(File file) throws IOException;
	
	public final RESULT execute() {
		STREAM stream = null;
		try {
			stream = createStream(createCacheFile());
			return execute(stream);
		} catch (IOException e) {
			Log.e(TAG, e.getMessage(), e);
			return itsErrorResult;
		} finally {
			if (stream != null)
				try {
					stream.close();
				} catch (IOException e) {
					Log.e(TAG, e.getMessage(), e);
				}
		}

	}
	abstract RESULT execute(STREAM stream) throws IOException;
}
<commit_msg>reduce logging noise for expected exception<commit_after>package de.devisnik.android.mine.data;

import java.io.Closeable;
import java.io.File;
import java.io.IOException;

import android.content.Context;
import android.util.Log;

public abstract class CacheFileCommand<RESULT, STREAM extends Closeable> {
	
	private static final String TAG = CacheFileCommand.class.getSimpleName();
	private final RESULT itsErrorResult;
	private final Context itsContext;
	private final String itsFileName;
	
	public CacheFileCommand(Context context, String fileName, RESULT errorResult) {
		itsContext = context;
		itsFileName = fileName;
		itsErrorResult = errorResult;			
	}
	
	protected final File createCacheFile() {
		return new File(itsContext.getCacheDir(), itsFileName);
	}
	
	abstract STREAM createStream(File file) throws IOException;
	
	public final RESULT execute() {
		STREAM stream = null;
		try {
			stream = createStream(createCacheFile());
			return execute(stream);
		} catch (IOException e) {
			Log.d(TAG, e.getMessage());
			return itsErrorResult;
		} finally {
			if (stream != null)
				try {
					stream.close();
				} catch (IOException e) {
					Log.e(TAG, e.getMessage(), e);
				}
		}

	}
	abstract RESULT execute(STREAM stream) throws IOException;
}

{'fraction_non_alphanumeric': 0.0971611355457817, 'fraction_numerical': 0.0, 'mean_word_length': 4.312101910828026, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3636373', 'n_tokens_mistral': 812, 'n_tokens_neox': 719, 'n_words': 208}