Commit e6165c95 authored by Maxime Lefrançois's avatar Maxime Lefrançois
Browse files

trace IOException

parent 68cc26cc
Loading
Loading
Loading
Loading
−5

File deleted.

−131

File deleted.

−305

File deleted.

+15 −8
Changes for src/main/java/fr/emse/gitlab/saref/managers/RepositoryFactory.java: 15 added lines, 8 removed lines.
Original line number Diff line number Diff line
@@ -138,13 +138,10 @@ public class RepositoryFactory extends SAREFErrorLogger {
					errorLogger.warn(msg);
					throw new SAREFPipelineException(msg);
				} 
				SAREFVersionName vn = guessVersion(project, directory);
				if (isTarget && vn == null) {
				originalVersionName = guessVersion(project, directory);
				if (isTarget && originalVersionName.equals(SAREFVersionName.DEFAULT)) {
					final String msg = getMessage(MESSAGE.develop_branch, originalBranch);
					errorLogger.warn(msg);
					originalVersionName = SAREFVersionName.DEFAULT;
				} else {
					originalVersionName = vn; 
				}
			} else {
				int major = Integer.parseInt(m.group(SAREF.REGEX_VERSION_MAJOR_VAR));
@@ -162,11 +159,17 @@ public class RepositoryFactory extends SAREFErrorLogger {
			readVersions(git, repository);
			return repository;
		} catch (IOException ex) {
			LOG.trace("IOException " + ex, ex);
			if (pipeline.mode == Mode.RELEASE) {
				throw new SAREFPipelineException(getMessage(MESSAGE.release_git), ex);
			}
			return new SAREFRepository(directory, project, false, SAREFVersionName.DEFAULT, null);
			final SAREFVersionName versionName = guessVersion(project, directory);
			final SAREFRepository repository = new SAREFRepository(directory, project, false, versionName, null);
			SAREFVersion version = new SAREFVersion(repository, versionName, null, null, null);
			repository.getVersions().put(versionName, version);
			return repository;
		} catch (GitAPIException ex) {
			LOG.trace("GitAPIException " + ex, ex);
			throw new SAREFPipelineException("Unexpected Git APIException", ex);
		}
	}
@@ -178,9 +181,13 @@ public class RepositoryFactory extends SAREFErrorLogger {
			SAREFNamedGraph namedGraph = new SAREFNamedGraph("null");
			SAREF.loadModel(namedGraph, ontologyFile, errorLogger);
			String uri = namedGraph.getModel().listObjectsOfProperty(OWL2.versionIRI).next().asResource().getURI();
			return SAREF.extractVersionName(uri);
			SAREFVersionName versionName = SAREF.extractVersionName(uri);
			if(versionName == null) {
				return SAREFVersionName.DEFAULT;
			}
			return versionName;
		} catch (Exception ex) {
			return null;
			return SAREFVersionName.DEFAULT;
		}
	}