diff --git a/server/src/com/gip/xyna/xmcp/xfcli/scriptentry/XMOMCompiler.java b/server/src/com/gip/xyna/xmcp/xfcli/scriptentry/XMOMCompiler.java index 8ddb92a14..46b3bf3f6 100644 --- a/server/src/com/gip/xyna/xmcp/xfcli/scriptentry/XMOMCompiler.java +++ b/server/src/com/gip/xyna/xmcp/xfcli/scriptentry/XMOMCompiler.java @@ -1,6 +1,6 @@ /* * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Copyright 2023 Xyna GmbH, Germany + * Copyright 2024 Xyna GmbH, Germany * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -449,13 +450,33 @@ private Set findRelevantRevisions(RuntimeContext toBuild, FileSy relevant.add(toBuild); try { Long revision = source.getRevision(toBuild); + if(revision == null) { + throw new RuntimeException("Could not find " + toBuild + ". Available runtimecontexts:\n" + createRTCListString(source)); + } Stream revisions = source.getDependenciesRecursivly(revision).stream(); relevant.addAll(revisions.map(r -> mapToRuntimeContext(r, source)).collect(Collectors.toSet())); - } catch (XNWH_OBJECT_NOT_FOUND_FOR_PRIMARY_KEY e) { - throw new RuntimeException(e); + } catch (Exception e) { + throw new RuntimeException(e.getMessage()+" Available runtimecontexts:\n" + createRTCListString(source), e); } return relevant; } + + private String createRTCListString(FileSystemXMLSource source) { + StringBuilder sb = new StringBuilder(); + List revisions = new ArrayList<>(source.getRevisions()); + Collections.sort(revisions); + try { + for(Long revision : revisions) { + RuntimeContext rtc = source.getRuntimeContext(revision); + sb.append(rtc).append(": "); + sb.append(source.getXMOMPath(rtc).getParent()); + sb.append("\n"); + } + } catch(Exception e) { + sb.append("ERROR: ").append(e.getMessage()); + } + return sb.toString(); + } private RuntimeContext mapToRuntimeContext(Long revision, FileSystemXMLSource source) { diff --git a/server/src/com/gip/xyna/xmcp/xfcli/scriptentry/util/ExceptionAnalyzer.java b/server/src/com/gip/xyna/xmcp/xfcli/scriptentry/util/ExceptionAnalyzer.java index 5d25c9047..211437cac 100644 --- a/server/src/com/gip/xyna/xmcp/xfcli/scriptentry/util/ExceptionAnalyzer.java +++ b/server/src/com/gip/xyna/xmcp/xfcli/scriptentry/util/ExceptionAnalyzer.java @@ -63,7 +63,7 @@ public void analyzeException(MDMParallelDeploymentException e) { private void analyzeDeployException(Throwable t, GenerationBase gb) { //defined no or multiple unique identifiers - if (t instanceof RuntimeException && t.getMessage().endsWith("unique identifier.")) { + if (t instanceof RuntimeException && t.getMessage() != null && t.getMessage().endsWith("unique identifier.")) { System.out.println("ERROR: " + t.getMessage() + " - check \"xprc.xfractwfe.generation.storable.xmom.interfaces\""); return; } diff --git a/server/src/com/gip/xyna/xprc/xfractwfe/generation/GenerationBase.java b/server/src/com/gip/xyna/xprc/xfractwfe/generation/GenerationBase.java index 7b786d48d..69341c505 100644 --- a/server/src/com/gip/xyna/xprc/xfractwfe/generation/GenerationBase.java +++ b/server/src/com/gip/xyna/xprc/xfractwfe/generation/GenerationBase.java @@ -6914,6 +6914,10 @@ public FileSystemXMLSource(Map> rtcDependenc revisions.put(rtx, revision++); } } + + public Collection getRevisions() { + return revisions.values(); + } public Set getDependenciesRecursivly(Long revision) { Set dependencies = new HashSet<>(); @@ -6929,6 +6933,9 @@ private void getDependenciesRecursivlyInternally(Long revision, Set depene Set deps = rtcDependencies.get(rtc); for (RuntimeContext dep : deps) { Long depRev = revisions.get(dep); + if(depRev == null) { + throw new RuntimeException("Missing dependent RTC: " + dep + "."); + } if (depenedencies.add(depRev)) { getDependenciesRecursivlyInternally(depRev, depenedencies); }