auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void buildGetBlobOptionsTest() throws RestServiceException { doBuildGetBlobOptionsTest(null, null, true, true); doBuildGetBlobOptionsTest("bytes=0-7", ByteRange.fromOffsetRange(0, 7), true, false); doBuildGetBlobOptionsTest("bytes=234-56679090", ByteRange.fromOffsetRange(234, 56679090), true, false); doBuildGetBlobOptionsTest("bytes=1-", ByteRange.fromStartOffset(1), true, false); doBuildGetBlobOptionsTest("bytes=12345678-", ByteRange.fromStartOffset(12345678), true, false); doBuildGetBlobOptionsTest("bytes=-8", ByteRange.fromLastNBytes(8), true, false); doBuildGetBlobOptionsTest("bytes=-123456789", ByteRange.fromLastNBytes(123456789), true, false); doBuildGetBlobOptionsTest("bytes=0-abcd", null, false, false); doBuildGetBlobOptionsTest("bytes=0as23-44444444", null, false, false); doBuildGetBlobOptionsTest("bytes=22-7777777777777777777777777777777777777777777", null, false, false); doBuildGetBlobOptionsTest("bytes=22--53", null, false, false); doBuildGetBlobOptionsTest("bytes=223-34", null, false, false); doBuildGetBlobOptionsTest("bytes=-34ab", null, false, false); doBuildGetBlobOptionsTest("bytes=--12", null, false, false); doBuildGetBlobOptionsTest("bytes=-12-", null, false, false); doBuildGetBlobOptionsTest("bytes=12ab-", null, false, false); doBuildGetBlobOptionsTest("bytes=---", null, false, false); doBuildGetBlobOptionsTest("btes=3-5", null, false, false); }

Target:
public void buildGetBlobOptionsTest() throws RestServiceException { doBuildGetBlobOptionsTest(null, null, true, true); doBuildGetBlobOptionsTest("bytes=0-7", ByteRange.fromOffsetRange(0, 7), true, false); doBuildGetBlobOptionsTest("bytes=234-56679090", ByteRange.fromOffsetRange(234, 56679090), true, false); doBuildGetBlobOptionsTest("bytes=1-", ByteRange.fromStartOffset(1), true, false); doBuildGetBlobOptionsTest("bytes=12345678-", ByteRange.fromStartOffset(12345678), true, false); doBuildGetBlobOptionsTest("bytes=-8", ByteRange.fromLastNBytes(8), true, false); doBuildGetBlobOptionsTest("bytes=-123456789", ByteRange.fromLastNBytes(123456789), true, false); String[] badRanges = {"bytes=0-abcd", "bytes=0as23-44444444", "bytes=22-7777777777777777777777777777777777777777777", "bytes=22--53", "bytes=223-34", "bytes=-34ab", "bytes=--12", "bytes=-12-", "bytes=12ab-", "bytes=---", "btes=3-5", "bytes=345", "bytes=3.14-22", "bytes=3-6.2", "bytes=", "bytes=-", "bytes= -"}; for (String badRange : badRanges) { doBuildGetBlobOptionsTest(badRange, null, false, false); } }
Source:
private Injector newRootInjector(final PluginGuiceEnvironment env) { List<Module> modules = Lists.newArrayListWithCapacity(4); if (getApiType() == ApiType.PLUGIN) { modules.add(env.getSysModule()); } modules.add(new AbstractModule() { @Override protected void configure() { bind(PluginUser.class).toInstance(getPluginUser()); bind(String.class) .annotatedWith(PluginName.class) .toInstance(getName()); bind(String.class) .annotatedWith(PluginCanonicalWebUrl.class) .toInstance(pluginCanonicalWebUrl); bind(File.class) .annotatedWith(PluginData.class) .toProvider(new Provider<File>() { private volatile boolean ready; @Override public File get() { synchronized (dataDir) { if (!ready) { if (!dataDir.exists() && !dataDir.mkdirs()) { throw new ProvisionException(String.format( "Cannot create %s for plugin %s", dataDir.getAbsolutePath(), getName())); } ready = true; } } return dataDir; } }); } }); return Guice.createInjector(modules); }

Target:
private Injector newRootInjector(final PluginGuiceEnvironment env) { List<Module> modules = Lists.newArrayListWithCapacity(4); if (getApiType() == ApiType.PLUGIN) { modules.add(env.getSysModule()); } modules.add(new AbstractModule() { @Override protected void configure() { bind(PluginUser.class).toInstance(getPluginUser()); bind(String.class) .annotatedWith(PluginName.class) .toInstance(getName()); bind(String.class) .annotatedWith(PluginCanonicalWebUrl.class) .toInstance(pluginCanonicalWebUrl); bind(File.class) .annotatedWith(PluginData.class) .toProvider(new Provider<File>() { private volatile boolean ready; @Override public File get() { if (!ready) { synchronized (dataDir) { if (!ready) { if (!dataDir.exists() && !dataDir.mkdirs()) { throw new ProvisionException(String.format( "Cannot create %s for plugin %s", dataDir.getAbsolutePath(), getName())); } ready = true; } } } return dataDir; } }); } }); return Guice.createInjector(modules); }
Source:
public static List<NodeAndData> getChildDataAndWatchForNewChildren( ZKWatcher zkw, String baseNode) throws KeeperException { List<String> nodes = ZKUtil.listChildrenAndWatchForNewChildren(zkw, baseNode); if (nodes != null) { List<NodeAndData> newNodes = new ArrayList<>(); for (String node : nodes) { if (Thread.interrupted()) { return new ArrayList<>(); } String nodePath = ZNodePaths.joinZNode(baseNode, node); byte[] data = ZKUtil.getDataAndWatch(zkw, nodePath); newNodes.add(new NodeAndData(nodePath, data)); } return newNodes; } return null; }

Target:
public static List<NodeAndData> getChildDataAndWatchForNewChildren( ZKWatcher zkw, String baseNode) throws KeeperException { List<String> nodes = ZKUtil.listChildrenAndWatchForNewChildren(zkw, baseNode); if (nodes != null) { List<NodeAndData> newNodes = new ArrayList<>(); for (String node : nodes) { if (Thread.interrupted()) { return Collections.emptyList(); } String nodePath = ZNodePaths.joinZNode(baseNode, node); byte[] data = ZKUtil.getDataAndWatch(zkw, nodePath); newNodes.add(new NodeAndData(nodePath, data)); } return newNodes; } return null; }
Source:
public boolean isDisambiguationPage() { if (hasProperties()) { return properties.isDisambiguationPage(); } else { throw new NullPointerException("No PageProperties object exists for this PageTitle!"); } }

Target:
public boolean isDisambiguationPage() { if (hasProperties()) { return properties.isDisambiguationPage(); } else { return false; } }
Source:
private <T extends IResource> T execute(HttpMethod method, String kind, String namespace, String name, String subresource, IResource payload) { if(ResourceKind.LIST.equals(kind)) throw new UnsupportedOperationException("Generic create operation not supported for resource type 'List'"); namespace = ResourceKind.PROJECT.equals(kind) ? null : namespace; final URL endpoint = new URLBuilder(this.baseUrl, typeMapper) .kind(kind) .name(name) .namespace(namespace) .subresource(subresource) .build(); try { Request.Builder builder = newRequestBuilderTo(endpoint.toString()); if(HttpMethod.GET != method) { builder.method(method.toString(), RequestBody.create(MediaType.parse(MEDIATYPE_APPLICATION_JSON), payload == null ? "" : payload.toJson(true))); } Request request = builder.build(); LOGGER.debug("About to make request {}", request); try(Response result = client.newCall(request).execute()){ String response = result.body().string(); LOGGER.debug(response); return (T) factory.create(response); } } catch (IOException e){ throw new OpenShiftException(e, "Unable to execute request to %s", endpoint); } }

Target:
private <T extends IResource> T execute(HttpMethod method, String kind, String namespace, String name, String subresource, IResource payload) { return execute(method.toString(), kind, namespace, name, subresource, payload); }
Source:
public ListenableFuture<List<SampleRowKeysResponse>> sampleRowKeysAsync( SampleRowKeysRequest request) { return BigtableAsyncUtilities.performAsyncRpc(retryOptions, request, sampleRowKeysAsync, executorService); }

Target:
public ListenableFuture<List<SampleRowKeysResponse>> sampleRowKeysAsync( SampleRowKeysRequest request) { return BigtableAsyncUtilities.performRetryingAsyncRpc(retryOptions, request, sampleRowKeysAsync, executorService); }
Source:
String generateValue() { return RandomStringUtils.random(valueSize, true, true); }

Target:
protected String generateValue() { return RandomStringUtils.random(valueSize, true, true); }
Source:
private GrantedAccess grantLocks(LockRequests requests, GrantedAccess rights) { Map<URI, AbstractLock> locks = createStreamOfLockRequests(requests) .map(requestedLock -> Pair.of(requestedLock.getKey(), getInitializedGrantedPermissions(requestedLock.getKey()).addAGrantedLock(requests.getUser(), requestedLock.getValue(), streamManagement, immutableReadFileManagement, rights))) .collect(Collectors.toMap(entry -> entry.getKey(), entry -> entry.getValue())); return new GrantedAccess(requests.getUser(), locks, this); }

Target:
private GrantedAccess grantLocks(LockRequests requests, GrantedAccess rights) { Map<URI, AbstractLock> locks = createStreamOfLockRequests(requests) .map(requestedLock -> Pair.of(requestedLock.getKey(), getInitializedGrantedPermissions(requestedLock.getKey()).addAGrantedLock(requests.getUser(), requestedLock.getValue(), streamManagement, immutableReadFileManagement, rights))) .collect(Collectors.toMap(Pair::getKey, Pair::getValue)); return new GrantedAccess(requests.getUser(), locks, this); }
Source:
public static JMXServer getInstance() { return jmxServer; }

Target:
public static Optional<JMXServer> getInstance() { return Optional.ofNullable(jmxServer); }
Source:
public void preProcessModule(Module module) { Properties props = new Properties(); props.put(XD_MODULE_NAME_KEY, module.getName()); props.put(XD_MODULE_INDEX_KEY, module.getDeploymentMetadata().getIndex()); props.put(XD_MODULE_TYPE_KEY, module.getType().name()); module.addProperties(props); }

Target:
public void preProcessModule(Module module) { Properties props = new Properties(); props.setProperty(XD_MODULE_NAME_KEY, module.getName()); props.setProperty(XD_MODULE_INDEX_KEY, String.valueOf(module.getDeploymentMetadata().getIndex())); props.setProperty(XD_MODULE_TYPE_KEY, module.getType().name()); module.addProperties(props); }
Source:
public boolean isActive() { long inactiveAge = System.currentTimeMillis() - lastAccessTime; long sessionTimeout = 1000 * getHiveConf().getLong(GrillConfConstants.GRILL_SESSION_TIMEOUT_SECONDS, GrillConfConstants.GRILL_SESSION_TIMEOUT_SECONDS_DEFAULT); return inactiveAge < sessionTimeout; }

Target:
public boolean isActive() { long inactiveAge = System.currentTimeMillis() - lastAccessTime; return inactiveAge < sessionTimeout; }
Source:
private static void validateIssuer(Issuer issuer) throws WSSecurityException { if (SamlConstants.URN_OASIS_NAMES.equals(issuer.getFormat())) { if (!StringUtils.isBlank(issuer.getSPProvidedID())) { throw new WSSecurityException(ErrorCode.FAILED_CHECK, SamlConstants.SECURITY_ASSERTION_ISSUER_FORMAT + "" + SamlConstants.URN_OASIS_NAMES + "" + "and" + SamlConstants.SECURITY_ASSERTION_ISSUER + " " + IS_PRESENT); } if (!StringUtils.isBlank(issuer.getNameQualifier())) { throw new WSSecurityException(ErrorCode.FAILED_CHECK, SamlConstants.SECURITY_ASSERTION_ISSUER_FORMAT + "" + SamlConstants.URN_OASIS_NAMES + "" + "and" + SamlConstants.SECURITY_ASSERTION_ISSUER + " " + IS_PRESENT); } if (!StringUtils.isBlank(issuer.getSPNameQualifier())) { throw new WSSecurityException(ErrorCode.FAILED_CHECK, SamlConstants.SECURITY_ASSERTION_ISSUER_FORMAT + "" + SamlConstants.URN_OASIS_NAMES + "" + "and" + SamlConstants.SECURITY_ASSERTION_ISSUER + " " + IS_PRESENT); } } }

Target:
private static void validateIssuer(Issuer issuer) throws WSSecurityException { if (SamlConstants.URN_OASIS_NAMES.equals(issuer.getFormat())) { if (StringUtils.isNotBlank(issuer.getSPProvidedID())) { throw new WSSecurityException(ErrorCode.FAILED_CHECK, SamlConstants.SECURITY_ASSERTION_ISSUER_FORMAT + " " + SamlConstants.URN_OASIS_NAMES + " " + "and" + SamlConstants.SECURITY_ASSERTION_ISSUER + " " + IS_PRESENT); } if (StringUtils.isNotBlank(issuer.getNameQualifier())) { throw new WSSecurityException(ErrorCode.FAILED_CHECK, SamlConstants.SECURITY_ASSERTION_ISSUER_FORMAT + " " + SamlConstants.URN_OASIS_NAMES + " " + "and" + SamlConstants.SECURITY_ASSERTION_ISSUER + " " + IS_PRESENT); } if (StringUtils.isNotBlank(issuer.getSPNameQualifier())) { throw new WSSecurityException(ErrorCode.FAILED_CHECK, SamlConstants.SECURITY_ASSERTION_ISSUER_FORMAT + " " + SamlConstants.URN_OASIS_NAMES + " " + "and" + SamlConstants.SECURITY_ASSERTION_ISSUER + " " + IS_PRESENT); } } }
Source:
public final void doAperiodicRun() { try { if(thread!=null && thread.isAlive()) { logger.log(getSlowLoggingLevel(), name+" thread is still running. Execution aborted."); return; } thread = new Thread(new Runnable() { public void run() { logger.log(getNormalLoggingLevel(), "Started "+name); long startTime = System.currentTimeMillis(); StreamTaskListener l = createListener(); try { l.getLogger().printf("Started at %tc%n", new Date(startTime)); ACL.impersonate(ACL.SYSTEM); try { execute(l); } finally { long stopTime = System.currentTimeMillis(); l.getLogger().printf("Finished at %tc. %dms%n", new Date(stopTime), stopTime - startTime); } } catch (IOException e) { e.printStackTrace(l.fatalError(e.getMessage())); } catch (InterruptedException e) { e.printStackTrace(l.fatalError("aborted")); } finally { l.closeQuietly(); } logger.log(getNormalLoggingLevel(), "Finished {0}. {1,number} ms", new Object[]{name, System.currentTimeMillis() - startTime}); } },name+" thread"); thread.start(); } catch (Throwable t) { logger.log(Level.SEVERE, name+" thread failed with error", t); } }

Target:
public final void doAperiodicRun() { try { if(thread!=null && thread.isAlive()) { logger.log(getSlowLoggingLevel(), "{0} thread is still running. Execution aborted.", name); return; } thread = new Thread(new Runnable() { public void run() { logger.log(getNormalLoggingLevel(), "Started {0}", name); long startTime = System.currentTimeMillis(); long stopTime; StreamTaskListener l = createListener(); try { l.getLogger().printf("Started at %tc%n", new Date(startTime)); ACL.impersonate(ACL.SYSTEM); execute(l); } catch (IOException e) { e.printStackTrace(l.fatalError(e.getMessage())); } catch (InterruptedException e) { e.printStackTrace(l.fatalError("aborted")); } finally { stopTime = System.currentTimeMillis(); try { l.getLogger().printf("Finished at %tc. %dms%n", new Date(stopTime), stopTime - startTime); } finally { l.closeQuietly(); } } logger.log(getNormalLoggingLevel(), "Finished {0}. {1,number} ms", new Object[]{name, stopTime - startTime}); } },name+" thread"); thread.start(); } catch (Throwable t) { logger.log(Level.SEVERE, name+" thread failed with error", t); } }
Source:
public String processForm(HttpServletRequest request, @ModelAttribute("queuedReports") QueuedReport editedReport, BindingResult errors, @RequestParam(value = "repeatIntervalUnits", required = false) String repeatIntervalUnits ) throws Exception { HttpSession httpSession = request.getSession(); QueuedReportService queuedReportService = Context.getService(QueuedReportService.class); repeatIntervalUnits = repeatIntervalUnits.toLowerCase().trim(); if (editedReport.getRepeatInterval() == null || editedReport.getRepeatInterval() < 0) { editedReport.setRepeatInterval(0); } else if (editedReport.getRepeatInterval() > 0) { if (OpenmrsUtil.nullSafeEquals(repeatIntervalUnits, "minutes")) { editedReport.setRepeatInterval(editedReport.getRepeatInterval() * 60); } else if (OpenmrsUtil.nullSafeEquals(repeatIntervalUnits, "hours")) { editedReport.setRepeatInterval(editedReport.getRepeatInterval() * 60 * 60); } else { editedReport.setRepeatInterval(editedReport.getRepeatInterval() * 60 * 60 * 24); } } if (request.getParameter("purge") != null) { try { queuedReportService.purgeQueuedReport(editedReport); httpSession.setAttribute(WebConstants.OPENMRS_MSG_ATTR, "The report was successfully removed"); return SUCCESS_VIEW; } catch (DataIntegrityViolationException e) { httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "error.object.inuse.cannot.purge"); return FORM_VIEW; } catch (APIException e) { httpSession.setAttribute(WebConstants.OPENMRS_ERROR_ATTR, "error.general: " + e.getLocalizedMessage()); return FORM_VIEW; } } queuedReportService.saveQueuedReport(editedReport); httpSession.setAttribute(WebConstants.OPENMRS_MSG_ATTR, "Report queued for processing."); return SUCCESS_VIEW; }

Target:
public String processForm(HttpServletRequest request, @ModelAttribute("queuedReports") QueuedReport editedReport, BindingResult errors, @RequestParam(value = "repeatIntervalUnits", required = false) String repeatIntervalUnits ) throws Exception { HttpSession httpSession = request.getSession(); QueuedReportService queuedReportService = Context.getService(QueuedReportService.class); repeatIntervalUnits = repeatIntervalUnits.toLowerCase().trim(); if (editedReport.getRepeatInterval() == null || editedReport.getRepeatInterval() < 0) { editedReport.setRepeatInterval(0); } else if (editedReport.getRepeatInterval() > 0) { if (OpenmrsUtil.nullSafeEquals(repeatIntervalUnits, "minutes")) { editedReport.setRepeatInterval(editedReport.getRepeatInterval() * 60); } else if (OpenmrsUtil.nullSafeEquals(repeatIntervalUnits, "hours")) { editedReport.setRepeatInterval(editedReport.getRepeatInterval() * 60 * 60); } else { editedReport.setRepeatInterval(editedReport.getRepeatInterval() * 60 * 60 * 24); } } queuedReportService.saveQueuedReport(editedReport); httpSession.setAttribute(WebConstants.OPENMRS_MSG_ATTR, "Report queued for processing."); return SUCCESS_VIEW; }
Source:
private void updateActionAvailability() { ArrayList<LibvirtSecretModel> secrets = getSelectedItems() != null ? Linq.<LibvirtSecretModel> cast(getSelectedItems()) : new ArrayList<LibvirtSecretModel>(); getEditCommand().setIsExecutionAllowed(secrets.size() > 0); getRemoveCommand().setIsExecutionAllowed(secrets.size() > 0); }

Target:
private void updateActionAvailability() { ArrayList<LibvirtSecretModel> secrets = getSelectedItems() != null ? Linq.<LibvirtSecretModel> cast(getSelectedItems()) : new ArrayList<LibvirtSecretModel>(); getEditCommand().setIsExecutionAllowed(secrets.size() == 1); getRemoveCommand().setIsExecutionAllowed(secrets.size() > 0); }
Source:
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { if ("http".equals(context.getHttpRequest().getUrl().getProtocol())) { return Mono.error(new RuntimeException("Token credentials require a URL using the HTTPS protocol scheme")); } return next.clone().process() .doOnNext(httpResponse -> { try { httpResponse.getBody().subscribe().dispose(); } catch (RuntimeException ignored) { logger.logExceptionAsWarning(ignored); } }) .map(res -> res.getHeaderValue(WWW_AUTHENTICATE)) .map(header -> extractChallenge(header, BEARER_TOKEN_PREFIX)) .flatMap(map -> { cache.setTokenRequest(new TokenRequestContext().addScopes(map.get("resource") + "/.default")); return cache.getToken(); }) .flatMap(token -> { context.getHttpRequest().setHeader(AUTHORIZATION, BEARER_TOKEN_PREFIX + token.getToken()); return next.process(); }); }

Target:
public Mono<HttpResponse> process(HttpPipelineCallContext context, HttpPipelineNextPolicy next) { if (!context.getHttpRequest().getUrl().getProtocol().startsWith("https")) { return Mono.error(new RuntimeException("Token credentials require a URL using the HTTPS protocol scheme")); } return next.clone().process() .doOnNext(httpResponse -> { try { httpResponse.getBody().subscribe().dispose(); } catch (RuntimeException ignored) { logger.logExceptionAsWarning(ignored); } }) .map(res -> res.getHeaderValue(WWW_AUTHENTICATE)) .map(header -> extractChallenge(header, BEARER_TOKEN_PREFIX)) .flatMap(map -> { cache.setTokenRequest(new TokenRequestContext().addScopes(map.get("resource") + "/.default")); return cache.getToken(); }) .flatMap(token -> { context.getHttpRequest().setHeader(AUTHORIZATION, BEARER_TOKEN_PREFIX + token.getToken()); return next.process(); }); }
Source:
private static List<ResourceLocator> orderedResources0(String classpathResourceName) throws IOException { ClassLoader classLoader = ResourceLocator.classLoader(); List<String> names = new ArrayList<>(); List<ResourceLocator> result = new ArrayList<>(); for (String dir : RESOURCE_DIRS) { String name = CONFIG_PACKAGE + dir + "/" + classpathResourceName; names.add(name); List<URL> urls = Collections.list(classLoader.getResources(name)); switch (urls.size()) { case 0: continue; case 1: result.add(ResourceLocator.ofClasspathUrl(urls.get(0))); break; default: ResourceLocator baseResource = ResourceLocator.ofClasspathUrl(urls.get(0)); for (int i = 1; i < urls.size(); i++) { ResourceLocator otherResource = ResourceLocator.ofClasspathUrl(urls.get(1)); if (!baseResource.getByteSource().contentEquals(otherResource.getByteSource())) { log.severe("More than one file found on the classpath: " + name + ": " + urls); throw new IllegalStateException("More than one file found on the classpath: " + name + ": " + urls); } } result.add(baseResource); break; } } if (result.isEmpty()) { log.severe("No resource files found on the classpath: " + names); throw new IllegalStateException("No files found on the classpath: " + names); } log.config(() -> "Resources found: " + result); return result; }

Target:
private static List<ResourceLocator> orderedResources0(String classpathResourceName) throws IOException { ClassLoader classLoader = ResourceLocator.classLoader(); List<String> names = new ArrayList<>(); List<ResourceLocator> result = new ArrayList<>(); for (String dir : RESOURCE_DIRS) { String name = CONFIG_PACKAGE + dir + "/" + classpathResourceName; names.add(name); List<URL> urls = Collections.list(classLoader.getResources(name)); switch (urls.size()) { case 0: continue; case 1: result.add(ResourceLocator.ofClasspathUrl(urls.get(0))); break; default: ResourceLocator baseResource = ResourceLocator.ofClasspathUrl(urls.get(0)); for (int i = 1; i < urls.size(); i++) { ResourceLocator otherResource = ResourceLocator.ofClasspathUrl(urls.get(i)); if (!baseResource.getByteSource().contentEquals(otherResource.getByteSource())) { log.severe("More than one file found on the classpath: " + name + ": " + urls); throw new IllegalStateException("More than one file found on the classpath: " + name + ": " + urls); } } result.add(baseResource); break; } } if (result.isEmpty()) { log.severe("No resource files found on the classpath: " + names); throw new IllegalStateException("No files found on the classpath: " + names); } log.config(() -> "Resources found: " + result); return result; }
Source:
public ClaimedTaskRest fromModel(ClaimedTask obj) { ClaimedTaskRest taskRest = new ClaimedTaskRest(); XmlWorkflowItem witem = obj.getWorkflowItem(); taskRest.setId(obj.getID()); taskRest.setWorkflowitem(workflowItemConverter.convert(witem)); taskRest.setAction(obj.getActionID()); taskRest.setStep(obj.getStepID()); return taskRest; }

Target:
public ClaimedTaskRest fromModel(ClaimedTask obj) { ClaimedTaskRest taskRest = new ClaimedTaskRest(); XmlWorkflowItem witem = obj.getWorkflowItem(); taskRest.setId(obj.getID()); taskRest.setWorkflowitem(workflowItemConverter.convert(witem)); taskRest.setAction(obj.getActionID()); taskRest.setStep(obj.getStepID()); taskRest.setOwner(epersonConverter.convert(obj.getOwner())); return taskRest; }
Source:
public VdcParameter deserializeKey(String key, DeserializationContext ctxt) throws IOException { String[] tokens = key.split(";"); return VdcParameter.getExisting(tokens[2]); }

Target:
public VdcParameter deserializeKey(String key, DeserializationContext ctxt) throws IOException { return VdcParameter.deserialize(key); }
Source:
public void shouldUpdateChargeToSystemCancel_IfEpdqStatusIs6WithRelevantChargeStatus(String status) { charge = Charge.from(ChargeEntityFixture.aValidChargeEntity() .withStatus(ChargeStatus.fromString(status)) .build()); when(mockChargeService.findByProviderAndTransactionIdFromDbOrLedger(any(), any())).thenReturn(Optional.of(charge)); final String payload = notificationPayloadForTransaction(payId, EPDQ_AUTHORISED_CANCELLED); notificationService.handleNotificationFor(payload); verify(mockChargeNotificationProcessor, times(1)).invoke(payId, charge, SYSTEM_CANCELLATION_FLOW.getSuccessTerminalState(), null); }

Target:
public void shouldUpdateChargeToSystemCancel_IfEpdqStatusIs6WithRelevantChargeStatus(String status) { charge = Charge.from(ChargeEntityFixture.aValidChargeEntity() .withStatus(ChargeStatus.fromString(status)) .withGatewayTransactionId(payId) .build()); when(mockChargeService.findByProviderAndTransactionIdFromDbOrLedger("epdq", payId)) .thenReturn(Optional.of(charge)); final String payload = notificationPayloadForTransaction(payId, EPDQ_AUTHORISED_CANCELLED); notificationService.handleNotificationFor(payload); verify(mockChargeNotificationProcessor, times(1)).invoke(payId, charge, SYSTEM_CANCELLATION_FLOW.getSuccessTerminalState(), null); }
Source:
protected IPageStore newPersistentStore() { StoreSettings storeSettings = application.getStoreSettings(); Bytes maxSizePerSession = storeSettings.getMaxSizePerSession(); File fileStoreFolder = storeSettings.getFileStoreFolder(); if (storeSettings.isEncrypted()) { return new SerializingPageStore(new CryptingPageStore(new DiskPageStore(application.getName(), fileStoreFolder, maxSizePerSession)), getSerializer()); } else { return new DiskPageStore(application.getName(), fileStoreFolder, maxSizePerSession, getSerializer()); } }

Target:
protected IPageStore newPersistentStore() { StoreSettings storeSettings = application.getStoreSettings(); Bytes maxSizePerSession = storeSettings.getMaxSizePerSession(); File fileStoreFolder = storeSettings.getFileStoreFolder(); return new DiskPageStore(application.getName(), fileStoreFolder, maxSizePerSession); }
Source:
public Iterable<RevCommit> call() throws NoHeadException, JGitInternalException { checkState(); if (!startSpecified) { try { ObjectId headId = repo.resolve(Constants.HEAD); if (headId == null) throw new NoHeadException( "No HEAD exists and no explicit starting revision was specified"); add(headId); } catch (IOException e) { throw new JGitInternalException( "An exception occured while trying to add the Id of HEAD", e); } } setState(false); return walk; }

Target:
public Iterable<RevCommit> call() throws NoHeadException, JGitInternalException { checkCallable(); if (!startSpecified) { try { ObjectId headId = repo.resolve(Constants.HEAD); if (headId == null) throw new NoHeadException( "No HEAD exists and no explicit starting revision was specified"); add(headId); } catch (IOException e) { throw new JGitInternalException( "An exception occured while trying to add the Id of HEAD", e); } } setCallable(false); return walk; }
Source:
FutureDerivative addResult(URI path) { FutureDerivative furureDerivative = new FutureDerivative(uriToPath(path)); results.add(furureDerivative); return furureDerivative; }

Target:
FutureDerivative addResult(URI path) { FutureDerivative futureDerivative = new FutureDerivative(uriToPath(path)); results.add(futureDerivative); return futureDerivative; }
Source:
public TrackListLocalCardAdapter getRecyclerViewAdapter() { return new TrackListLocalCardAdapter(mTrackList, new OnTrackInteractionCallback() { @Override public void onTrackDetailsClicked(Track track, View transitionView) { LOG.info(String.format("onTrackDetailsClicked(%s)", track.getTrackID() .toString())); int trackID = (int) track.getTrackID().getId(); TrackDetailsActivity.navigate(getActivity(), transitionView, trackID); } @Override public void onDeleteTrackClicked(Track track) { LOG.info(String.format("onDeleteTrackClicked(%s)", track.getTrackID())); createDeleteTrackDialog(track); } @Override public void onUploadTrackClicked(Track track) { LOG.info(String.format("onUploadTrackClicked(%s)", track.getTrackID())); if (track.hasProperty(Measurement.PropertyKey.SPEED)) { onUploadSingleTrack(track); } else { showSnackbar(R.string.trackviews_cannot_upload_gps_tracks); } } @Override public void onExportTrackClicked(Track track) { LOG.info(String.format("onExportTrackClicked(%s)", track.getTrackID())); if (mUserManager.getUser()!=null) { track.updateMetadata(new TrackMetadata(Util.getVersionString(getActivity()), mUserManager.getUser().getTermsOfUseVersion())); exportTrack(track); } else { showSnackbar(R.string.trackview_cannot_export_track); } } @Override public void onDownloadTrackClicked(Track track, AbstractTrackListCardAdapter .TrackCardViewHolder holder) { } }); }

Target:
public TrackListLocalCardAdapter getRecyclerViewAdapter() { return new TrackListLocalCardAdapter(mTrackList, new OnTrackInteractionCallback() { @Override public void onTrackDetailsClicked(Track track, View transitionView) { LOG.info(String.format("onTrackDetailsClicked(%s)", track.getTrackID() .toString())); int trackID = (int) track.getTrackID().getId(); TrackDetailsActivity.navigate(getActivity(), transitionView, trackID); } @Override public void onDeleteTrackClicked(Track track) { LOG.info(String.format("onDeleteTrackClicked(%s)", track.getTrackID())); createDeleteTrackDialog(track); } @Override public void onUploadTrackClicked(Track track) { LOG.info(String.format("onUploadTrackClicked(%s)", track.getTrackID())); if (track.hasProperty(Measurement.PropertyKey.SPEED)) { onUploadSingleTrack(track); } else { showSnackbar(R.string.trackviews_cannot_upload_gps_tracks); } } @Override public void onExportTrackClicked(Track track) { LOG.info(String.format("onExportTrackClicked(%s)", track.getTrackID())); if (mUserManager.getUser()!=null) { track.updateMetadata(new TrackMetadata(Util.getVersionString(getActivity()), mUserManager.getUser().getTermsOfUseVersion())); } else { track.updateMetadata(new TrackMetadata(Util.getVersionString(getActivity()), null)); } exportTrack(track); } @Override public void onDownloadTrackClicked(Track track, AbstractTrackListCardAdapter .TrackCardViewHolder holder) { } }); }
Source:
public static Matrix4 createRotationMatrix(double yaw, double pitch, double roll) { Matrix4 ret = new Matrix4(); return ret.setToRotation(yaw, pitch, roll); }

Target:
public static Matrix4 createRotationMatrix(double yaw, double pitch, double roll) { return new Matrix4().setToRotation(yaw, pitch, roll); }
Source:
public User getUserByActivationKey(String activationKey) { return (User) sessionFactory.getCurrentSession().createCriteria(User.class).add(Restrictions.ilike("activation_key", activationKey, MatchMode.START)).uniqueResult(); }

Target:
public User getUserByActivationKey(String activationKey) { User user = (User) sessionFactory.getCurrentSession().createCriteria(User.class).add(Restrictions.like("activationKey", activationKey, MatchMode.START)).uniqueResult(); if(user != null) { String[] tokens = user.getActivationKey().split(":"); if(tokens[0].equals(activationKey)) { return user; } } return null; }
Source:
private void mockConcat(Path target, Path[] srcArray) throws IOException { Path tmp = new Path(target.getParent(), target.getName() + ".bak"); lfs.rename(target, tmp); OutputStream out = lfs.create(target); try { InputStream in = lfs.open(tmp); try { IOUtils.copyBytes(in, out, 1024); } finally { if (in != null) { in.close(); } lfs.delete(tmp, true); } for (int i = 0; i < srcArray.length; i++) { in = lfs.open(srcArray[i]); try { IOUtils.copyBytes(in, out, 1024); } finally { if (in != null) { in.close(); } lfs.delete(srcArray[i], true); } } } finally { if (out != null) { out.close(); } } }

Target:
private void mockConcat(Path target, Path[] srcArray) throws IOException { Path tmp = new Path(target.getParent(), target.getName() + ".bak"); lfs.rename(target, tmp); try (OutputStream out = lfs.create(target)) { try (InputStream in = lfs.open(tmp)) { IOUtils.copyBytes(in, out, 1024); } lfs.delete(tmp, true); for (int i = 0; i < srcArray.length; i++) { try (InputStream iin = lfs.open(srcArray[i])) { IOUtils.copyBytes(iin, out, 1024); } lfs.delete(srcArray[i], true); } } }
Source:
private static HttpRequestRetryHandler createRetryHandler() { switch ( RETRY_HANDLER_CLASS ) { case "default": if ( DEFAULT_NON_RETRYABLE_CLASSES.equals( RETRY_HANDLER_EXCEPTIONS ) ) { return new DefaultHttpRequestRetryHandler( RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED ); } return new DefaultHttpRequestRetryHandler( RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED, getNonRetryableExceptions() ) { }; case "standard": return new StandardHttpRequestRetryHandler( RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED ); case "auto": return DefaultHttpRequestRetryHandler.INSTANCE; default: try { final ClassLoader classLoader = AbstractHttpClientWagon.class.getClassLoader(); return HttpRequestRetryHandler.class.cast( classLoader.loadClass( RETRY_HANDLER_CLASS ) .getConstructor().newInstance() ); } catch ( final Exception e ) { throw new IllegalArgumentException( e ); } } }

Target:
private static HttpRequestRetryHandler createRetryHandler() { switch ( RETRY_HANDLER_CLASS ) { case "default": if ( StringUtils.isEmpty( RETRY_HANDLER_EXCEPTIONS ) ) { if ( RETRY_HANDLER_COUNT == 3 && !RETRY_HANDLER_REQUEST_SENT_ENABLED ) { return DefaultHttpRequestRetryHandler.INSTANCE; } return new DefaultHttpRequestRetryHandler( RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED ); } return new DefaultHttpRequestRetryHandler( RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED, getNonRetryableExceptions() ) { }; case "standard": return new StandardHttpRequestRetryHandler( RETRY_HANDLER_COUNT, RETRY_HANDLER_REQUEST_SENT_ENABLED ); default: try { final ClassLoader classLoader = AbstractHttpClientWagon.class.getClassLoader(); return HttpRequestRetryHandler.class.cast( classLoader.loadClass( RETRY_HANDLER_CLASS ) .getConstructor().newInstance() ); } catch ( final Exception e ) { throw new IllegalArgumentException( e ); } } }
Source:
ImmutableIntArray getIds() { return new ImmutableIntArray(ids, idsOffset, positionCount); }

Target:
Slice getIds() { return Slices.wrappedIntArray(ids, idsOffset, positionCount); }
Source:
public void addChildElement(PropertyWriter p) { this.childElements.put(p.getElement().getId(), p); if (p instanceof BoundaryEventPropertyWriter) { process.getFlowElements().add(p.getFlowElement()); } else { process.getFlowElements().add(0, p.getFlowElement()); } ElementParameters simulationParameters = p.getSimulationParameters(); if (simulationParameters != null) { this.simulationParameters.add(simulationParameters); } addChildShape(p.getShape()); addChildEdge(p.getEdge()); this.itemDefinitions.addAll(p.getItemDefinitions()); this.rootElements.addAll(p.rootElements); if (p instanceof SubProcessPropertyWriter) { Collection<BasePropertyWriter> childElements = ((SubProcessPropertyWriter) p).getChildElements(); childElements.forEach(el -> { addChildShape(el.getShape()); addChildEdge(el.getEdge()); }); } }

Target:
public void addChildElement(PropertyWriter p) { Processes.addChildElement( p, childElements, process, simulationParameters, itemDefinitions, rootElements); addChildShape(p.getShape()); addChildEdge(p.getEdge()); if (p instanceof SubProcessPropertyWriter) { Collection<BasePropertyWriter> childElements = ((SubProcessPropertyWriter) p).getChildElements(); childElements.forEach(el -> { addChildShape(el.getShape()); addChildEdge(el.getEdge()); }); } }
Source:
boolean isRefreshTokenInvalid() { return httpStatusCode == 401 || httpStatusCode == 403 || (httpStatusCode == 400 && response.error .equals(INVALID_GRANT) || (httpStatusCode == 400 && response.error .equals(WRONG_VERSION))); }

Target:
boolean isRefreshTokenInvalid() { return httpStatusCode == HttpStatus.SC_UNAUTHORIZED || httpStatusCode == HttpStatus.SC_FORBIDDEN || httpStatusCode == HttpStatus.SC_BAD_REQUEST; }
Source:
public void cacheUpdateTriggeredOnNodeChange() throws InterruptedException { final int parralelism = 10; final List<Cache> caches = new ArrayList<>(); for (int i = 0; i < parralelism; ++i) { caches.add(Mockito.mock(Cache.class)); } final List<ZookeeperNodeInvalidator> invalidators = caches .stream() .map(v -> new ZookeeperNodeInvalidator(v, CURATOR, "/xxx/yyy", TimeUnit.MINUTES.toMillis(10))) .collect(Collectors.toList()); invalidators.forEach(ZookeeperNodeInvalidator::start); try { ThreadUtils.sleep(200); for (int idx = 0; idx < 5; ++idx) { invalidators.get(idx % invalidators.size()).notifyUpdate(); ThreadUtils.sleep(200); for (final Cache c : caches) { Mockito.verify(c, Mockito.times(idx + 2)).refresh(); } } } finally { invalidators.forEach(ZookeeperNodeInvalidator::stop); } }

Target:
public void cacheUpdateTriggeredOnNodeChange() throws InterruptedException { final int parralelism = 10; final List<Cache> caches = new ArrayList<>(); for (int i = 0; i < parralelism; ++i) { caches.add(Mockito.mock(Cache.class)); } final List<ZookeeperNodeInvalidator> invalidators = caches .stream() .map(v -> new ZookeeperNodeInvalidator(v, CURATOR, "/xxx/yyy", TimeUnit.MINUTES.toMillis(10))) .collect(Collectors.toList()); invalidators.forEach(ZookeeperNodeInvalidator::start); try { waitForNCachesRefreshes(1, true, caches); for (int idx = 0; idx < 5; ++idx) { invalidators.get(idx % invalidators.size()).notifyUpdate(); waitForNCachesRefreshes(idx + 2, true, caches); } } finally { invalidators.forEach(ZookeeperNodeInvalidator::stop); } }
Source:
public long getSegmentSize(long startAddress) { long size = 0; try { size = getSegmentHandleForAddress(startAddress).getWriteChannel().size(); } catch (IOException e) { log.error("Could not get file size for address ", startAddress, e); } return size; }

Target:
public long getSegmentSize(long startAddress) { long size = 0; try { size = getSegmentHandleForAddress(startAddress).getWriteChannel().size(); } catch (IOException e) { log.error("Could not get file size for startAddress ", startAddress, e); } return size; }
Source:
public ScriptMetadata readObject(ObjectInput input) throws IOException, ClassNotFoundException { Builder builder = new ScriptMetadata.Builder(); builder.name(input.readUTF()).extension(input.readUTF()).mode(ExecutionMode.valueOf(input.readUTF())); builder.parameters(readSet(input)); ((Optional<String>)input.readObject()).ifPresent(s -> builder.language(s)); ((Optional<String>)input.readObject()).ifPresent(s -> builder.role(s)); ((Optional<String>)input.readObject()).ifPresent(s -> builder.reducer(s)); ((Optional<String>)input.readObject()).ifPresent(s -> builder.collator(s)); ((Optional<String>)input.readObject()).ifPresent(s -> builder.combiner(s)); return builder.build(); }

Target:
public ScriptMetadata readObject(ObjectInput input) throws IOException, ClassNotFoundException { String name = input.readUTF(); String extension = input.readUTF(); ExecutionMode mode = ExecutionMode.valueOf(input.readUTF()); Set<String> parameters = (Set<String>) input.readObject(); Optional<String> language = (Optional<String>) input.readObject(); Optional<String> role = (Optional<String>) input.readObject(); Optional<String> reducer = (Optional<String>) input.readObject(); Optional<String> collator = (Optional<String>) input.readObject(); Optional<String> combiner = (Optional<String>) input.readObject(); return new ScriptMetadata(name, language, extension, mode, parameters, role, reducer, collator, combiner); }
Source:
public VirtualReplicatorCluster getVirtualReplicatorCluster() { if (virtualReplicatorCluster == null) { virtualReplicatorCluster = new StaticVcrCluster(cloudConfig, clusterMapConfig, clusterMap); } return virtualReplicatorCluster; }

Target:
synchronized public VirtualReplicatorCluster getVirtualReplicatorCluster() { if (virtualReplicatorCluster == null) { virtualReplicatorCluster = new StaticVcrCluster(cloudConfig, clusterMapConfig, clusterMap); } return virtualReplicatorCluster; }
Source:
public void checkDisplay() { String[] resourceNames = new String[]{FhirResourceService.BINARY_RESOURCE_NAME, FhirResourceService.DOCREF_RESOURCE_NAME, FhirResourceService.PATIENT_RESOURCE_NAME }; for(String resourceName : resourceNames) { boolean hasResource; try { hasResource = checkForResource(resourceName); } catch(ConnectionManagerException e) { LOG.warn(e, e); hasResource = false; } if(hasResource == true) { DisplayHolder.getInstance().setFhirEnabled(hasResource); return; } } DisplayHolder.getInstance().setFhirEnabled(false); }

Target:
public void checkDisplay() { String[] resourceNames = new String[]{FhirResourceService.BINARY_RESOURCE_NAME, FhirResourceService.DOCREF_RESOURCE_NAME, FhirResourceService.PATIENT_RESOURCE_NAME}; for (String resourceName : resourceNames) { boolean hasResource; try { hasResource = checkForResource(resourceName); } catch (ConnectionManagerException e) { LOG.warn(e.getLocalizedMessage(), e); hasResource = false; } if (hasResource) { DisplayHolder.getInstance().setFhirEnabled(hasResource); return; } } DisplayHolder.getInstance().setFhirEnabled(false); }
Source:
public void setID(Serializable iD) { this.iD = iD; }

Target:
public void setID(Serializable iD) { wrappedBuilder.setID(iD); }
Source:
public void addDomainSpecifColumns(ExtendedPagedTable<T> extendedPagedTable, Set<String> columns) { extendedPagedTable.storeColumnToPreferences(); List<ColumnMeta<T>> columnMetas = extendedPagedTable.getColumnMetaList().stream() .filter(cm -> cm.isExtraColumn()) .collect(Collectors.toList()); columnMetas.forEach(colMet -> { if (!columns.contains(colMet.getCaption())) { extendedPagedTable.removeColumnMeta(colMet); } else { columns.remove(colMet.getCaption()); } }); List<ColumnMeta<T>> columnMetaList = (List<ColumnMeta<T>>)extendedPagedTable.getColumnMetaList().stream() .filter(cm -> !cm.isExtraColumn() && columns.contains(cm.getCaption())) .map(colMet -> { Column genericColumn = initGenericColumn(colMet.getCaption()); genericColumn.setSortable(false); return new ColumnMeta<T>(genericColumn, "Var_" + colMet.getCaption(), true, true); }).collect(Collectors.toList()); columns.stream().filter(column -> (columnMetaList.stream().filter(columnMeta -> column.contains(columnMeta.getColumn().getDataStoreName())).collect(Collectors.toList())).size() == 0) .collect(Collectors.toList()) .forEach(column -> { Column genericColumn = initGenericColumn(column); genericColumn.setSortable(false); columnMetaList.add(new ColumnMeta<T>(genericColumn, column, true, true)); }); extendedPagedTable.addColumns(columnMetaList); }

Target:
public void addDomainSpecifColumns(ExtendedPagedTable<T> extendedPagedTable, Set<String> columns) { extendedPagedTable.storeColumnToPreferences(); List<GridColumnPreference> gridColumnPreferenceList = removeRedundantColumns(extendedPagedTable, columns); List<ColumnMeta<T>> columnMetaList = renameDomainSpecifColumns(extendedPagedTable, columns); addDomainColumns(columnMetaList, columns); extendedPagedTable.getGridPreferencesStore().getColumnPreferences().addAll(gridColumnPreferenceList); columnMetaList.forEach(columnMeta -> { List<GridColumnPreference> list = gridColumnPreferenceList.stream().filter(gridColumnPreference -> gridColumnPreference.getName().equals(columnMeta.getColumn().getDataStoreName())).collect(Collectors.toList()); extendedPagedTable.getGridPreferencesStore().getColumnPreferences().addAll(list); extendedPagedTable.addColumns(Arrays.asList(columnMeta)); }); }
Source:
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { val cg = ModelSerializer.restoreComputationGraph(ois, true); this.defaultConfiguration = cg.defaultConfiguration; this.configuration = cg.configuration; this.flattenedParams = cg.flattenedParams; this.initCalled = cg.initCalled; this.initDone = cg.initDone; if (cg.getUpdater() != null) this.setUpdater(cg.getUpdater()); }

Target:
private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException { val cg = ModelSerializer.restoreComputationGraph(ois, true); this.defaultConfiguration = cg.defaultConfiguration.clone(); this.configuration = cg.configuration.clone(); this.init(); this.flattenedParams.assign(cg.flattenedParams); if (cg.getUpdater() != null && cg.getUpdater(false).getStateViewArray() != null) this.getUpdater(true).getStateViewArray().assign(cg.getUpdater(false).getStateViewArray()); }
Source:
public int getValue() { return this.ordinal(); }

Target:
public int getValue() { return reason; }
Source:
private static String getParentPidOfPid(String pid) { final String command = String.format("ps -ajx | awk '$2 == \"%s\"' | awk '{print $3}'", pid); return executeCommandUnix(command); }

Target:
public static String getParentPidOfPid(String pid) { final String command = String.format("ps -ef | awk '$2 == \"%s\"' | awk '{print $3}'", pid); return executeCommandUnix(command); }
Source:
public boolean equals(Object o) { if (o instanceof MultipleInstanceCompletionCondition) { MultipleInstanceCompletionCondition other = (MultipleInstanceCompletionCondition) o; return (null != value) ? value.equals(other.value) : null == other.value; } return false; }

Target:
public boolean equals(Object o) { if (o instanceof MultipleInstanceCompletionCondition) { MultipleInstanceCompletionCondition other = (MultipleInstanceCompletionCondition) o; return Objects.equals(value, other.value); } return false; }
Source:
public void destroy() { queryExecutor.shutdown(); try { queryExecutor.awaitTermination(2L, TimeUnit.MINUTES); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IllegalStateException(QUERY_POOL_NAME + " graceful shutdown interrupted.", e); } }

Target:
public void destroy() { queryExecutor.shutdown(); try { queryExecutor.awaitTermination(2L, TimeUnit.MINUTES); } catch (InterruptedException e) { throw new IllegalStateException(QUERY_POOL_NAME + " graceful shutdown interrupted.", e); } }
Source:
protected boolean validate() { initVmTemplate(); if (!super.validate()) { return false; } if (!validateExternalVnicProfileMapping()) { return false; } drMappingHelper.mapVnicProfiles(vmTemplateFromConfiguration.getInterfaces(), getParameters().getExternalVnicProfileMappings()); ArrayList<DiskImage> disks = new ArrayList(getVmTemplate().getDiskTemplateMap().values()); setImagesWithStoragePoolId(getStorageDomain().getStoragePoolId(), disks); getVmTemplate().setImages(disks); if (getParameters().isImagesExistOnTargetStorageDomain() && !validateUnregisteredEntity(vmTemplateFromConfiguration, ovfEntityData)) { return false; } missingUsers = getImportValidator().findMissingUsers(getParameters().getDbUsers()); if (!missingUsers.isEmpty() && !getParameters().isAllowPartialImport()) { log.error("Missing users: {}", missingUsers.stream().collect(Collectors.joining(","))); return failValidation(EngineMessage.USER_MUST_EXIST_IN_DB); } missingRoles = getImportValidator().findMissingRoles(getParameters().getRoleMap()); if (!missingRoles.isEmpty() && !getParameters().isAllowPartialImport()) { log.error("Missing roles: {}", missingRoles.stream().collect(Collectors.joining(", "))); return failValidation(EngineMessage.VALIDATION_ROLE_DOES_NOT_EXIST); } return super.validate(); }

Target:
protected boolean validate() { initVmTemplate(); if (!super.validate()) { return false; } if (!validateExternalVnicProfileMapping()) { return false; } drMappingHelper.mapVnicProfiles(vmTemplateFromConfiguration.getInterfaces(), getParameters().getExternalVnicProfileMappings()); ArrayList<DiskImage> disks = new ArrayList(getVmTemplate().getDiskTemplateMap().values()); setImagesWithStoragePoolId(getStorageDomain().getStoragePoolId(), disks); getVmTemplate().setImages(disks); if (getParameters().isImagesExistOnTargetStorageDomain() && !validateUnregisteredEntity(vmTemplateFromConfiguration, ovfEntityData)) { return false; } log.info("Checking for missing users"); List<DbUser> missingUsers = getImportValidator().findMissingUsers(getParameters().getDbUsers()); getParameters().getDbUsers().removeAll(missingUsers); Set<String> roles = getParameters().getRoleMap().values() .stream() .collect(Collectors.toSet()); roles.addAll(getParameters().getRoleMap().keySet()); log.info("Checking for missing roles"); missingRoles = getImportValidator().findMissingEntities(roles, val -> roleDao.getByName(val)); getParameters().getUserToRoles().forEach((k, v) -> v.removeAll(missingRoles)); return super.validate(); }