// Path: src/org/openchain/certification/I18N.java
// public final class I18N {
// 	
// 	static final Logger logger = LoggerFactory.getLogger(I18N.class);
// 
// 	private static final String BASE_RESOURCE_NAME = "messages"; //$NON-NLS-1$
// 
// 	/**
// 	 * @param key Key for the resource file
// 	 * @param language tag in IETF RFC 5646 format
// 	 * @return
// 	 */
// 	public static String getMessage(String key, String language, Object... args) {
// 		if (language == null) {
// 			language = User.DEFAULT_LANGUAGE;
// 		}
// 		Locale locale = Locale.forLanguageTag(language);
// 		if (locale == null) {
// 			logger.warn("Language "+language+" not supported by Java.  Using default language"); //$NON-NLS-1$ //$NON-NLS-2$
// 			locale = Locale.forLanguageTag(User.DEFAULT_LANGUAGE);
// 			if (locale == null) {
// 				logger.error("No locale for the default language"); //$NON-NLS-1$
// 				throw(new RuntimeException("No local for the default language")); //$NON-NLS-1$
// 			}
// 		}
// 		ResourceBundle.Control utf8Control = new Utf8ResourceBundleControl();
// 		ResourceBundle bundle = ResourceBundle.getBundle(BASE_RESOURCE_NAME, locale, utf8Control);
// 		String template = bundle.getString(key);
// 		try {
// 			MessageFormat mf = new MessageFormat(template, locale);
// 			return mf.format(args, new StringBuffer(), null).toString();
// 		} catch(IllegalArgumentException ex) {
// 			logger.error("Invalid argument for message template with key `"+key+"`: "+template, ex);
// 			return template;
// 		}
// 	}
// 
// }


import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.locks.ReentrantLock;
import org.eclipse.jgit.api.CloneCommand;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.CanceledException;
import org.eclipse.jgit.api.errors.CheckoutConflictException;
import org.eclipse.jgit.api.errors.DetachedHeadException;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.InvalidConfigurationException;
import org.eclipse.jgit.api.errors.InvalidRefNameException;
import org.eclipse.jgit.api.errors.InvalidRemoteException;
import org.eclipse.jgit.api.errors.NoHeadException;
import org.eclipse.jgit.api.errors.RefAlreadyExistsException;
import org.eclipse.jgit.api.errors.RefNotAdvertisedException;
import org.eclipse.jgit.api.errors.RefNotFoundException;
import org.eclipse.jgit.api.errors.TransportException;
import org.eclipse.jgit.api.errors.WrongRepositoryStateException;
import org.eclipse.jgit.errors.AmbiguousObjectException;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.RevisionSyntaxException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.RepositoryBuilder;
import org.openchain.certification.I18N;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
	 */
	public synchronized void refresh(String language) throws GitRepoException {
		try {
			String fullBranch = repo.getFullBranch();
			if (fullBranch == null || !fullBranch.startsWith("refs/")) {  //$NON-NLS-1$
				// we are in a detached head state
				checkOut(null, null, language);
				git.pull().call();
				checkOut(null, fullBranch, language);
			} else {
				git.pull().call();
			}
		} catch (WrongRepositoryStateException e) {
			logger.error("Wrong repository exception refreshing repo",e);  //$NON-NLS-1$
			throw new GitRepoException(I18N.getMessage("QuestionnaireGitRepo.20", language)); //$NON-NLS-1$
		} catch (InvalidConfigurationException e) {
			logger.error("Invalid configuration exception refreshing repo",e);  //$NON-NLS-1$
			throw new GitRepoException(I18N.getMessage("QuestionnaireGitRepo.20", language)); //$NON-NLS-1$
		} catch (DetachedHeadException e) {
			logger.error("Detached Head exception refreshing repo",e);  //$NON-NLS-1$
			throw new GitRepoException(I18N.getMessage("QuestionnaireGitRepo.20", language)); //$NON-NLS-1$
		} catch (InvalidRemoteException e) {
			logger.error("Invalid remote exception refreshing repo",e);  //$NON-NLS-1$
			throw new GitRepoException(I18N.getMessage("QuestionnaireGitRepo.20", language)); //$NON-NLS-1$
		} catch (CanceledException e) {
			logger.error("Git pull unexpectededly cancelled",e);  //$NON-NLS-1$
			throw new GitRepoException(I18N.getMessage("QuestionnaireGitRepo.20", language)); //$NON-NLS-1$
		} catch (RefNotFoundException e) {
			logger.error("Ref not found exception refreshing repo",e);  //$NON-NLS-1$
			throw new GitRepoException(I18N.getMessage("QuestionnaireGitRepo.20", language)); //$NON-NLS-1$
// Path: src/org/openchain/certification/I18N.java
// public final class I18N {
// 	
// 	static final Logger logger = LoggerFactory.getLogger(I18N.class);
// 
// 	private static final String BASE_RESOURCE_NAME = "messages"; //$NON-NLS-1$
// 
// 	/**
// 	 * @param key Key for the resource file
// 	 * @param language tag in IETF RFC 5646 format
// 	 * @return
// 	 */
// 	public static String getMessage(String key, String language, Object... args) {
// 		if (language == null) {
// 			language = User.DEFAULT_LANGUAGE;
// 		}
// 		Locale locale = Locale.forLanguageTag(language);
// 		if (locale == null) {
// 			logger.warn("Language "+language+" not supported by Java.  Using default language"); //$NON-NLS-1$ //$NON-NLS-2$
// 			locale = Locale.forLanguageTag(User.DEFAULT_LANGUAGE);
// 			if (locale == null) {
// 				logger.error("No locale for the default language"); //$NON-NLS-1$
// 				throw(new RuntimeException("No local for the default language")); //$NON-NLS-1$
// 			}
// 		}
// 		ResourceBundle.Control utf8Control = new Utf8ResourceBundleControl();
// 		ResourceBundle bundle = ResourceBundle.getBundle(BASE_RESOURCE_NAME, locale, utf8Control);
// 		String template = bundle.getString(key);
// 		try {
// 			MessageFormat mf = new MessageFormat(template, locale);
// 			return mf.format(args, new StringBuffer(), null).toString();
// 		} catch(IllegalArgumentException ex) {
// 			logger.error("Invalid argument for message template with key `"+key+"`: "+template, ex);
// 			return template;
// 		}
// 	}
// 
// }


// Path: src/org/openchain/certification/git/QuestionnaireGitRepo.java
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.locks.ReentrantLock;
import org.eclipse.jgit.api.CloneCommand;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.CanceledException;
import org.eclipse.jgit.api.errors.CheckoutConflictException;
import org.eclipse.jgit.api.errors.DetachedHeadException;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.InvalidConfigurationException;
import org.eclipse.jgit.api.errors.InvalidRefNameException;
import org.eclipse.jgit.api.errors.InvalidRemoteException;
import org.eclipse.jgit.api.errors.NoHeadException;
import org.eclipse.jgit.api.errors.RefAlreadyExistsException;
import org.eclipse.jgit.api.errors.RefNotAdvertisedException;
import org.eclipse.jgit.api.errors.RefNotFoundException;
import org.eclipse.jgit.api.errors.TransportException;
import org.eclipse.jgit.api.errors.WrongRepositoryStateException;
import org.eclipse.jgit.errors.AmbiguousObjectException;
import org.eclipse.jgit.errors.IncorrectObjectTypeException;
import org.eclipse.jgit.errors.RevisionSyntaxException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.RepositoryBuilder;
import org.openchain.certification.I18N;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

	 */
	public synchronized void refresh(String language) throws GitRepoException {
		try {
			String fullBranch = repo.getFullBranch();
			if (fullBranch == null || !fullBranch.startsWith("refs/")) {  //$NON-NLS-1$
				// we are in a detached head state
				checkOut(null, null, language);
				git.pull().call();
				checkOut(null, fullBranch, language);
			} else {
				git.pull().call();
			}
		} catch (WrongRepositoryStateException e) {
			logger.error("Wrong repository exception refreshing repo",e);  //$NON-NLS-1$
			throw new GitRepoException(I18N.getMessage("QuestionnaireGitRepo.20", language)); //$NON-NLS-1$
		} catch (InvalidConfigurationException e) {
			logger.error("Invalid configuration exception refreshing repo",e);  //$NON-NLS-1$
			throw new GitRepoException(I18N.getMessage("QuestionnaireGitRepo.20", language)); //$NON-NLS-1$
		} catch (DetachedHeadException e) {
			logger.error("Detached Head exception refreshing repo",e);  //$NON-NLS-1$
			throw new GitRepoException(I18N.getMessage("QuestionnaireGitRepo.20", language)); //$NON-NLS-1$
		} catch (InvalidRemoteException e) {
			logger.error("Invalid remote exception refreshing repo",e);  //$NON-NLS-1$
			throw new GitRepoException(I18N.getMessage("QuestionnaireGitRepo.20", language)); //$NON-NLS-1$
		} catch (CanceledException e) {
			logger.error("Git pull unexpectededly cancelled",e);  //$NON-NLS-1$
			throw new GitRepoException(I18N.getMessage("QuestionnaireGitRepo.20", language)); //$NON-NLS-1$
		} catch (RefNotFoundException e) {
			logger.error("Ref not found exception refreshing repo",e);  //$NON-NLS-1$
			throw new GitRepoException(I18N.getMessage("QuestionnaireGitRepo.20", language)); //$NON-NLS-1$
		} catch (RefNotAdvertisedException e) {