auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void updateIdentifiersAssignsExternalIdEvenWhenAlreadyAssigned() { mockHealthCodeAndAccountRetrieval(); AccountSubstudy as = AccountSubstudy.create(STUDY.getIdentifier(), "substudyB", ID); as.setExternalId(EXTERNAL_ID); account.setAccountSubstudies(Sets.newHashSet(as)); BridgeUtils.setRequestContext( new RequestContext.Builder().withCallerSubstudies(ImmutableSet.of("substudyB")).build()); when(accountDao.authenticate(STUDY, EMAIL_PASSWORD_SIGN_IN)).thenReturn(account); ExternalIdentifier newExtId = ExternalIdentifier.create(STUDY.getStudyIdentifier(), "newExternalId"); newExtId.setSubstudyId("substudyA"); when(externalIdService.getExternalId(STUDY.getStudyIdentifier(), "newExternalId", false)).thenReturn(newExtId); IdentifierUpdate update = new IdentifierUpdate(EMAIL_PASSWORD_SIGN_IN, null, null, "newExternalId"); participantService.updateIdentifiers(STUDY, CONTEXT, update); verify(accountDao).updateAccount(eq(account), notNull(Consumer.class)); <START> assertEquals("newExternalId", Iterables.getFirst(account.getAccountSubstudies(), null).getExternalId()); <END> assertEquals(ImmutableSet.of("substudyA", "substudyB"), BridgeUtils.getRequestContext().getCallerSubstudies()); }</code><technical_language>verify substudies external IDs</technical_language>

Target:
public void updateIdentifiersAssignsExternalIdEvenWhenAlreadyAssigned() { mockHealthCodeAndAccountRetrieval(); AccountSubstudy as = AccountSubstudy.create(STUDY.getIdentifier(), "substudyB", ID); as.setExternalId(EXTERNAL_ID); account.setAccountSubstudies(Sets.newHashSet(as)); BridgeUtils.setRequestContext( new RequestContext.Builder().withCallerSubstudies(ImmutableSet.of("substudyB")).build()); when(accountDao.authenticate(STUDY, EMAIL_PASSWORD_SIGN_IN)).thenReturn(account); ExternalIdentifier newExtId = ExternalIdentifier.create(STUDY.getStudyIdentifier(), "newExternalId"); newExtId.setSubstudyId("substudyA"); when(externalIdService.getExternalId(STUDY.getStudyIdentifier(), "newExternalId", false)).thenReturn(newExtId); IdentifierUpdate update = new IdentifierUpdate(EMAIL_PASSWORD_SIGN_IN, null, null, "newExternalId"); participantService.updateIdentifiers(STUDY, CONTEXT, update); verify(accountDao).updateAccount(eq(account), notNull(Consumer.class)); assertEquals(2, account.getAccountSubstudies().size()); Set<String> substudyIds = account.getAccountSubstudies().stream() .map(AccountSubstudy::getSubstudyId).collect(Collectors.toSet()); Set<String> externalIds = account.getAccountSubstudies().stream() .map(AccountSubstudy::getExternalId).collect(Collectors.toSet()); assertEquals(ImmutableSet.of("substudyA", "substudyB"), substudyIds); assertEquals(ImmutableSet.of(EXTERNAL_ID, "newExternalId"), externalIds); assertEquals(ImmutableSet.of("substudyA", "substudyB"), BridgeUtils.getRequestContext().getCallerSubstudies()); }
Source:
<code>public long getImposedExpirationDate () { long imposedExpirationDate = -1; <START> if (mCapabilities.getFilesSharingPublicExpireDateEnforced().isTrue()) { <END> imposedExpirationDate = DateUtils.addDaysToDate( new Date(), mCapabilities.getFilesSharingPublicExpireDateDays() ).getTime(); } return imposedExpirationDate; }</code><technical_language>I add a NULL check for mCapabilities this condition</technical_language>

Target:
private long getImposedExpirationDate () { long imposedExpirationDate = -1; if (mCapabilities!= null && mCapabilities. getFilesSharingPublicExpireDateEnforced().isTrue()) { imposedExpirationDate = DateUtils.addDaysToDate( new Date(), mCapabilities.getFilesSharingPublicExpireDateDays() ).getTime(); } return imposedExpirationDate; }
Source:
<code><START> public Map<String, String> getHeaders() { <END> return headers; }</code><technical_language>I talking creating a subclass of ConfigServicePropertySourceLocator</technical_language>

Target:
protected Map<String, String> getHeaders() { return headers; }
Source:
<code>public Response doImport(Action action) { validateParameters(action, "storageDomain.id|name"); ImportRepoImageParameters importParameters = new ImportRepoImageParameters(); importParameters.setSourceRepoImageId(id); importParameters.setSourceStorageDomainId(getStorageDomainId()); importParameters.setStoragePoolId(getDataCenterId(getStorageDomainId(action))); importParameters.setStorageDomainId(getStorageDomainId(action)); if (action.isSetImportAsTemplate()) { if (action.isImportAsTemplate()) { validateParameters(action, "cluster.id|name"); importParameters.setClusterId(getClusterId(action)); if (action.isSetTemplate() && action.getTemplate().isSetName()) { importParameters.setTemplateName(action.getTemplate().getName()); } } importParameters.setImportAsTemplate(action.isImportAsTemplate()); } if (action.isSetDisk()) { if (action.getDisk().isSetName()) { importParameters.setDiskAlias(action.getDisk().getName()); } if (action.getDisk().isSetAlias()) { importParameters.setDiskAlias(action.getDisk().getAlias()); } } EntityResolver resolver = new SimpleIdResolver( org.ovirt.engine.api.model.Disk.class, <START> Disk.class, <END> VdcQueryType.GetDiskByDiskId, IdQueryParameters.class ); return doAction(VdcActionType.ImportRepoImage, importParameters, action, resolver); }</code><technical_language>Se above, try import model classes fully qualified names for backend classes</technical_language>

Target:
public Response doImport(Action action) { validateParameters(action, "storageDomain.id|name"); ImportRepoImageParameters importParameters = new ImportRepoImageParameters(); importParameters.setSourceRepoImageId(id); importParameters.setSourceStorageDomainId(getStorageDomainId()); importParameters.setStoragePoolId(getDataCenterId(getStorageDomainId(action))); importParameters.setStorageDomainId(getStorageDomainId(action)); if (action.isSetImportAsTemplate()) { if (action.isImportAsTemplate()) { validateParameters(action, "cluster.id|name"); importParameters.setClusterId(getClusterId(action)); if (action.isSetTemplate() && action.getTemplate().isSetName()) { importParameters.setTemplateName(action.getTemplate().getName()); } } importParameters.setImportAsTemplate(action.isImportAsTemplate()); } if (action.isSetDisk()) { if (action.getDisk().isSetName()) { importParameters.setDiskAlias(action.getDisk().getName()); } if (action.getDisk().isSetAlias()) { importParameters.setDiskAlias(action.getDisk().getAlias()); } } EntityResolver resolver = new SimpleIdResolver( Disk.class, org.ovirt.engine.core.common.businessentities.Disk.class, VdcQueryType.GetDiskByDiskId, IdQueryParameters.class ); return doAction(VdcActionType.ImportRepoImage, importParameters, action, resolver); }
Source:
<code>public static List<Variable> getVariablesByRegex( Collection<Variable> variables, String regex) { List<Variable> shortlistedVariables = new ArrayList<Variable>(); <START> if (variables != null || regex == null) { <END> for (Variable var : variables) { if (var.getTitle().matches(regex)) { shortlistedVariables.add(var); } } } return shortlistedVariables; }</code><technical_language>shortcut variables == null, need regex conditions</technical_language>

Target:
public static List<Variable> getVariablesByRegex( Collection<Variable> variables, String regex) { List<Variable> shortlistedVariables = new ArrayList<Variable>(); if (variables != null && regex != null) { for (Variable var : variables) { if (var.getTitle().matches(regex)) { shortlistedVariables.add(var); } } } return shortlistedVariables; }
Source:
<code>public Iterable<Notification> iterate() { <START> return Collections.emptyList(); <END> }</code><technical_language>@prondzyn I return a real collection instead empty one. create collection constructor, size of collection a parameter</technical_language>

Target:
public Iterable<Notification> iterate() { return this.notifications; }
Source:
<code>private void writeObject( final ObjectOutputStream oos ) throws IOException { try { <START> Thread.sleep( 1000L ); <END> oos.writeObject( value ); } catch ( final InterruptedException e ) { e.printStackTrace(); } }</code><technical_language>is need do a thread-sleep. If want enforce a order of operations, do latches. This wont slow unit tests</technical_language>

Target:
private void writeObject( final ObjectOutputStream oos ) throws IOException { try { if ( writeStartedSignal != null ) { writeStartedSignal.countDown(); } if ( readStartedSignal != null ) { readStartedSignal.await(); } Thread.sleep( 100 ); oos.writeObject( value ); } catch ( final InterruptedException e ) { e.printStackTrace(); } }
Source:
<code>void populateUidAndFlags(Cursor cursor) throws MessagingException { setUid(cursor.getString(cursor.getColumnIndex("uid"))); String flagList = cursor.getString(cursor.getColumnIndex("flags")); if (flagList != null && flagList.length() > 0) { String[] flags = flagList.split(","); for (String flag : flags) { try { setFlagInternal(Flag.valueOf(flag), true); } catch (Exception e) { if (!"X_BAD_FLAG".equals(flag)) { <START> Timber.w("Unable to parse flag %s", flag); <END> } } } } boolean deleted = (cursor.getInt(cursor.getColumnIndex("deleted")) == 1); boolean read = (cursor.getInt(cursor.getColumnIndex("read")) == 1); boolean flagged = (cursor.getInt(cursor.getColumnIndex("flagged")) == 1); boolean answered = (cursor.getInt(cursor.getColumnIndex("answered")) == 1); boolean forwarded = (cursor.getInt(cursor.getColumnIndex("forwarded")) == 1); setFlagInternal(Flag.DELETED, deleted); setFlagInternal(Flag.SEEN, read); setFlagInternal(Flag.FLAGGED, flagged); setFlagInternal(Flag.ANSWERED, answered); setFlagInternal(Flag.FORWARDED, forwarded); }</code><technical_language>check for X_BAD_FLAG first</technical_language>

Target:
void populateUidAndFlags(Cursor cursor) throws MessagingException { setUid(cursor.getString(cursor.getColumnIndex("uid"))); String flagList = cursor.getString(cursor.getColumnIndex("flags")); if (flagList != null && flagList.length() > 0) { String[] flags = flagList.split(","); for (String flag : flags) { if ("X_BAD_FLAG".equals(flag)) { continue; } try { setFlagInternal(Flag.valueOf(flag), true); } catch (Exception e) { Timber.w("Unable to parse flag %s", flag); } } } boolean deleted = (cursor.getInt(cursor.getColumnIndex("deleted")) == 1); boolean read = (cursor.getInt(cursor.getColumnIndex("read")) == 1); boolean flagged = (cursor.getInt(cursor.getColumnIndex("flagged")) == 1); boolean answered = (cursor.getInt(cursor.getColumnIndex("answered")) == 1); boolean forwarded = (cursor.getInt(cursor.getColumnIndex("forwarded")) == 1); setFlagInternal(Flag.DELETED, deleted); setFlagInternal(Flag.SEEN, read); setFlagInternal(Flag.FLAGGED, flagged); setFlagInternal(Flag.ANSWERED, answered); setFlagInternal(Flag.FORWARDED, forwarded); }
Source:
<code>public void start() { if (running) return; if (!readConfig()) return; if (!openPipe()) return; log.info("Starting watchdog thread"); running = true; Runtime.getRuntime().addShutdownHook(shutdownHook); timer = new Timer("watchdog", true); <START> timer.schedule(tick, <END> 0, intervalMillis); }</code><technical_language>scheduleAtFixedRate</technical_language>

Target:
public void start() { if (running) return; if (!readConfig()) return; if (!openPipe()) return; log.info("Starting watchdog thread"); running = true; Runtime.getRuntime().addShutdownHook(shutdownHook); timer = new Timer("watchdog", true); timer.scheduleAtFixedRate(tick, 0, intervalMillis); }
Source:
<code>public int build(OutputStream out, OutputStream err, IProgressMonitor monitor) { int status = STATUS_ERROR_LAUNCH; try { if (monitor == null) { monitor = new NullProgressMonitor(); } SubMonitor progress = SubMonitor.convert(monitor, getNumCommands()); progress.subTask(ManagedMakeMessages.getResourceString("MakeBuilder.Invoking_Command") + getCommandLine()); ICommandLauncher launcher = createLauncher(); launcher.showCommand(true); fProcess = launcher.execute(fCmd.getCommand(), fCmd.getArgs(), mapToStringArray(fCmd.getEnvironment()), fCmd.getCWD(), monitor); if (fProcess != null) { try { fProcess.getOutputStream().close(); } catch (IOException e) { } int st = launcher.waitAndRead(wrap(out), wrap(err), <START> progress.split(getNumCommands())); <END> switch (st) { case ICommandLauncher.OK: status = fProcess.exitValue() == 0 ? STATUS_OK : STATUS_ERROR_BUILD; break; case ICommandLauncher.COMMAND_CANCELED: status = STATUS_CANCELLED; break; case ICommandLauncher.ILLEGAL_COMMAND: default: status = STATUS_ERROR_LAUNCH; break; } } fErrMsg = launcher.getErrorMessage(); if (fErrMsg != null && !fErrMsg.isEmpty()) { printMessage(fErrMsg, err); } } catch (CoreException e) { ManagedBuilderCorePlugin.log(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, "Error launching command [" + fCmd.getCommand() + "]", e)); status = STATUS_ERROR_LAUNCH; } finally { monitor.done(); } return status; }</code><technical_language>pass progress</technical_language>

Target:
public int build(OutputStream out, OutputStream err, IProgressMonitor monitor) { int status = STATUS_ERROR_LAUNCH; try { SubMonitor progress = SubMonitor.convert(monitor, ManagedMakeMessages.getResourceString("MakeBuilder.Invoking_Command") + getCommandLine(), getNumCommands()); ICommandLauncher launcher = createLauncher(); launcher.showCommand(true); fProcess = launcher.execute(fCmd.getCommand(), fCmd.getArgs(), mapToStringArray(fCmd.getEnvironment()), fCmd.getCWD(), progress); if (fProcess != null) { try { fProcess.getOutputStream().close(); } catch (IOException e) { } int st = launcher.waitAndRead(wrap(out), wrap(err), progress.split(getNumCommands())); switch (st) { case ICommandLauncher.OK: status = fProcess.exitValue() == 0 ? STATUS_OK : STATUS_ERROR_BUILD; break; case ICommandLauncher.COMMAND_CANCELED: status = STATUS_CANCELLED; break; case ICommandLauncher.ILLEGAL_COMMAND: default: status = STATUS_ERROR_LAUNCH; break; } } fErrMsg = launcher.getErrorMessage(); if (fErrMsg != null && !fErrMsg.isEmpty()) { printMessage(fErrMsg, err); } } catch (CoreException e) { ManagedBuilderCorePlugin.log(new Status(IStatus.ERROR, ManagedBuilderCorePlugin.PLUGIN_ID, "Error launching command [" + fCmd.getCommand() + "]", e)); status = STATUS_ERROR_LAUNCH; } finally { monitor.done(); } return status; }
Source:
<code>private GraphTraversal<Vertex, Vertex> traversalFromIndex(Collection collection, QuickSearch quickSearch) { Index<Node> index = indexManager().forNodes(getIndexName(collection)); IndexHits<Node> hits = index.query(QUICK_SEARCH, createQuery(quickSearch)); List<Long> ids = StreamSupport.stream(hits.spliterator(), false).map(h -> h.getId()).collect(toList()); <START> return ids.isEmpty() ? EmptyGraphTraversal.instance() : traversal.V(ids); <END> }</code><technical_language>I commit message capture changes in this commit. I right</technical_language>

Target:
private GraphTraversal<Vertex, Vertex> traversalFromIndex(Collection collection, QuickSearch quickSearch) { Index<Node> index = getQuickSearchIndex(collection); IndexHits<Node> hits = index.query(QUICK_SEARCH, createQuery(quickSearch)); List<Long> ids = StreamIterator.stream(hits.iterator()).map(h -> h.getId()).collect(toList()); return ids.isEmpty() ? EmptyGraphTraversal.instance() : traversal().V(ids); }
Source:
<code>public void close(IProject project) throws RemoteSyncException { JGitRepo repo = getLocalJGitRepo(project, null); if (repo != null) { repo.close(); } Iterator<Map.Entry<IPath, JGitRepo>> it = localDirectoryToJGitRepoMap.entrySet().iterator(); <START> while (it.hasNext()) { <END> Map.Entry<IPath, JGitRepo> entry = it.next(); if (entry.getValue() == repo) { it.remove(); } } }</code><technical_language>this need thread safe</technical_language>

Target:
public synchronized void close(IProject project) throws RemoteSyncException { JGitRepo repo = getLocalJGitRepo(project, null); if (repo != null) { repo.close(); } Iterator<Map.Entry<IPath, JGitRepo>> it = localDirectoryToJGitRepoMap.entrySet().iterator(); while (it.hasNext()) { Map.Entry<IPath, JGitRepo> entry = it.next(); if (entry.getValue() == repo) { it.remove(); } } }
Source:
<code>protected String getNamespaceId() { try { return Tables.getNamespaceId(inst, tableId); } catch (TableNotFoundException e) { <START> return null; <END> } }</code><technical_language>return null here</technical_language>

Target:
protected String getNamespaceId() { try { return Tables.getNamespaceId(inst, tableId); } catch (TableNotFoundException e) { throw new RuntimeException(e); } }
Source:
<code>public static void execute(final InformationModel informationModel, final IVortoCodeGenerator codeGenerator, final InvocationContext invocationContext) { MessageDisplayFactory.getMessageDisplay().display( "Generating code using " + codeGenerator.getServiceKey()); Job job = new Job("Generating Code using " + codeGenerator.getServiceKey()) { @Override protected IStatus run(IProgressMonitor monitor) { monitor.beginTask( "Invoking generator [" + codeGenerator.getServiceKey() + "]", 1); IGenerationResult generatedResult = null; try { generatedResult = ((IVortoCodeGenerator) codeGenerator).generate(informationModel,invocationContext); } catch (Exception e) { <START> GenerationResultZip output = new GenerationResultZip(informationModel,codeGenerator.getServiceKey()); <END> Generated generated = new Generated("generation_error.log", "/generated", e.getMessage()); output.write(generated); generatedResult = output; } CodeGenerationHelper.createEclipseProject(ModelIdFactory.newInstance(informationModel), codeGenerator.getServiceKey(), generatedResult); monitor.worked(1); if (monitor.isCanceled()) { monitor.done(); return Status.CANCEL_STATUS; } monitor.done(); return Status.OK_STATUS; } @Override public boolean belongsTo(Object family) { return family == CODE_GEN_JOBFAMILY; } }; job.setUser(true); job.schedule(); }</code><technical_language>Eclipse Client Toolset error.log. Instead ideal, if message is outputted Eclipse Console MessageDisplay.error()</technical_language>

Target:
public static void execute(final InformationModel informationModel, final IVortoCodeGenerator codeGenerator, final InvocationContext invocationContext) { MessageDisplayFactory.getMessageDisplay().display( "Generating code using " + codeGenerator.getServiceKey()); Job job = new Job("Generating Code using " + codeGenerator.getServiceKey()) { @Override protected IStatus run(IProgressMonitor monitor) { monitor.beginTask( "Invoking generator [" + codeGenerator.getServiceKey() + "]", 1); IGenerationResult generatedResult = null; try { generatedResult = ((IVortoCodeGenerator) codeGenerator).generate(informationModel,invocationContext); } catch (Exception e) { MessageDisplayFactory.getMessageDisplay().displayError(e); return Status.CANCEL_STATUS; } CodeGenerationHelper.createEclipseProject(ModelIdFactory.newInstance(informationModel), codeGenerator.getServiceKey(), generatedResult); monitor.worked(1); if (monitor.isCanceled()) { monitor.done(); return Status.CANCEL_STATUS; } monitor.done(); return Status.OK_STATUS; } @Override public boolean belongsTo(Object family) { return family == CODE_GEN_JOBFAMILY; } }; job.setUser(true); job.schedule(); }
Source:
<code>private boolean showView(String viewId) { IWorkbench workbench = PlatformUI.getWorkbench(); <START> if (workbench != null) { <END> IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow(); if (activeWorkbenchWindow != null) { try { activeWorkbenchWindow.getActivePage().showView(viewId, null, IWorkbenchPage.VIEW_ACTIVATE); return true; } catch (PartInitException e) { CheatSheetPlugin.logError("Error while activating view: " + viewId, e); } } } return false; }</code><technical_language>This is</technical_language>

Target:
private boolean showView(String viewId) { IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow activeWorkbenchWindow = workbench.getActiveWorkbenchWindow(); if (activeWorkbenchWindow != null) { try { activeWorkbenchWindow.getActivePage().showView(viewId, null, IWorkbenchPage.VIEW_ACTIVATE); return true; } catch (PartInitException e) { CheatSheetPlugin.logError("Error while activating view: " + viewId, e); } } return false; }
Source:
<code>public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { try { switch (response.getStatusCode()) { case 401: Multimap<String, String> headers = command.getCurrentRequest().getHeaders(); if (headers != null && headers.containsKey("X-Auth-User") <START> && headers.containsKey("X-Auth-Key") && !headers.containsKey("X-Auth-Token")) { <END> return false; } else { closeClientButKeepContentStream(response); Integer count = retryCountMap.getIfPresent(command); if(count!=null) { if(count.intValue() >= 4 ) { logger.debug("too many 401s - giving up after: " + count.intValue()); return false; } else { logger.debug("invalidating authentication token - retry " + count.intValue()); retryCountMap.put(command, new Integer(count.intValue()+1)); Uninterruptibles.sleepUninterruptibly(5, TimeUnit.SECONDS); authenticationResponseCache.invalidateAll(); return true; } } else { logger.debug("invalidating authentication token - first time"); retryCountMap.put(command, new Integer(1)); authenticationResponseCache.invalidateAll(); return true; } } } return false; } finally { releasePayload(response); } }</code><technical_language>constants for headers somewhere</technical_language>

Target:
public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) { try { switch (response.getStatusCode()) { case 401: Multimap<String, String> headers = command.getCurrentRequest().getHeaders(); if (headers != null && headers.containsKey(AuthHeaders.AUTH_USER) && headers.containsKey(AuthHeaders.AUTH_KEY) && !headers.containsKey(AuthHeaders.AUTH_TOKEN)) { return false; } else { closeClientButKeepContentStream(response); Integer count = retryCountMap.getUnchecked(command); if (count >= AUTH_RETRIES) { logger.debug("too many 401s - giving up after: %s for %s", count, command); return false; } else { logger.debug("invalidating authentication token - retry %s for %s", count, command); retryCountMap.put(command, count + 1); authenticationResponseCache.invalidateAll(); Uninterruptibles.sleepUninterruptibly(5, TimeUnit.SECONDS); return true; } } } return false; } finally { releasePayload(response); } }
Source:
<code>public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionList = new ArrayList<PermissionSubject>(); permissionList.add(new PermissionSubject(MultiLevelAdministrationHandler.SYSTEM_OBJECT_ID, VdcObjectType.System, <START> ActionGroup.INJECT_EXTERNAL_TASKS)); <END> return permissionList; }</code><technical_language>enum of ActionGroup changed INJECT_TASKS, a action group for internal job /step created</technical_language>

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionList = new ArrayList<PermissionSubject>(); permissionList.add(new PermissionSubject(MultiLevelAdministrationHandler.SYSTEM_OBJECT_ID, VdcObjectType.System, getParameters().getActionType().getActionGroup())); return permissionList; }
Source:
<code>public Queue(String name, boolean durable, boolean exclusive, boolean autoDelete, Map<String, Object> arguments) { Assert.notNull(name, "'name' cannot be null"); this.name = name; this.actualName = StringUtils.hasText(name) ? name <START> : (AnonymousQueue.Base64UrlNamingStrategy.DEFAULT.generateName() + "_awaiting_declaration"); <END> this.durable = durable; this.exclusive = exclusive; this.autoDelete = autoDelete; this.arguments = arguments; }</code><technical_language>do this introduce classes tangle: AnonymousQueue extends Queue</technical_language>

Target:
public Queue(String name, boolean durable, boolean exclusive, boolean autoDelete, Map<String, Object> arguments) { Assert.notNull(name, "'name' cannot be null"); this.name = name; this.actualName = StringUtils.hasText(name) ? name : (Base64UrlNamingStrategy.DEFAULT.generateName() + "_awaiting_declaration"); this.durable = durable; this.exclusive = exclusive; this.autoDelete = autoDelete; this.arguments = arguments; }
Source:
<code>public TransformerDescriptors( List<ServiceReference> metacardTransformers, List<ServiceReference> queryResponseTransformers) { <START> this.metacardTransformers = getTransformerDescriptors(metacardTransformers); <END> this.queryResponseTransformers = getTransformerDescriptors(queryResponseTransformers); }</code><technical_language>This is handle transformers added removed runtime. lists set currently transformers time this object is created change that. I thinking this object maintain lists of ServiceReferences instead of maps iterate get transformer properties. getMetacardTransformers() getQueryResponseTransformers() like: java public List<Map<String, String>> getMetacardTransformers() { return getTransformerDescriptors(metacardTransformers); } public List<Map<String, String>> getQueryResponseTransformers() { return getTransformerDescriptors(queryResponseTransformers); } metacardTransformers queryResponseTransformers List<ServiceReference>s. need add Map<String, String> getMetacardTransformer(String id) Map<String, String> getQueryResponseTransformer(String id) functions easier for clients of this class</technical_language>

Target:
public TransformerDescriptors( List<ServiceReference> metacardTransformers, List<ServiceReference> queryResponseTransformers) { this.metacardTransformers = metacardTransformers; this.queryResponseTransformers = queryResponseTransformers; }
Source:
<code>private Credentials translateUser(String user, String password) { Credentials credentials = null; int separator = user.lastIndexOf("@"); if (separator != -1) { credentials = new Credentials(); credentials.setPassword(password); <START> credentials.setProfile(user.substring(separator + 1)); <END> credentials.setUsername(user.substring(0, separator)); } return credentials; }</code><technical_language>check if profile is valid, if not, assume credentials (return null)</technical_language>

Target:
private Credentials translateUser(String user, String password) { Credentials credentials = null; int separator = user.lastIndexOf("@"); if (separator != -1) { String profile = user.substring(separator + 1); List<String> profiles = (List<String>) getServletContext().getAttribute(SSOUtils.SSO_PROFILES); if (StringUtils.isNotEmpty(profile) && profiles.contains(profile)) { credentials = new Credentials(); credentials.setPassword(password); credentials.setProfile(profile); credentials.setUsername(user.substring(0, separator)); } } return credentials; }
Source:
<code><START> public String getAsStringForNonNumber() { <END> return isBoolean() ? getAsBooleanWrapper().toString() : (String) value; }</code><technical_language>private. want add a new API a lot of justification</technical_language>

Target:
private String getAsStringForNonNumber() { return isBoolean() ? getAsBooleanWrapper().toString() : (String) value; }
Source:
<code>synchronized void removeTransferRecordFromDB(final int id) { S3ClientReference.remove(id); dbUtil.deleteTransferRecords(id); if (dbUtil.getTransferById(id).file.startsWith("aws-s3")) { <START> String path = dbUtil.getRecordUri(id).getPath(); <END> new File(path).delete(); } }</code><technical_language>I this is a reference a Uri database entry for this upload, temporary File. dbUtil.getTransferById(id).file give path File. Also, I need obtain File path dbUtil.deleteTransferRecords(id); is called. Otherwise, transfer record anymore :) Lastly, getTransferById(id) return null, good add a null check obtaining it</technical_language>

Target:
synchronized void removeTransferRecordFromDB(final int id) { TransferRecord transferRecord = dbUtil.getTransferById(id); if (transferRecord != null) { String path = transferRecord.file; String fileName = new File(path).getName(); if (fileName.startsWith(TEMP_FILE_PREFIX)) { new File(path).delete(); } } S3ClientReference.remove(id); dbUtil.deleteTransferRecords(id); }
Source:
<code>public static @Nullable NavigableMap<Long, String> mapFromNmTextFile(File mappingFile) { NavigableMap<Long, String> map = new TreeMap<>(); try (FileReader fr = new FileReader(mappingFile); BufferedReader reader = new BufferedReader(fr);) { for (String line = reader.readLine(); line != null; line = reader.readLine()) { line = line.trim(); String[] elems = line.split(" ", 3); if (elems.length == 3) { try { <START> BigInteger bigInt = new BigInteger(stripLeadingZeros(elems[0]), 16); <END> Long address = bigInt.longValue(); String name = elems[elems.length - 1]; map.put(address, name); } catch (NumberFormatException e) { } } } } catch (FileNotFoundException e) { return null; } catch (IOException e) { } if (map.isEmpty()) { return null; } return ImmutableSortedMap.copyOf(map); }</code><technical_language>long.decode? Long.parse</technical_language>

Target:
public static @Nullable NavigableMap<Long, String> mapFromNmTextFile(File mappingFile) { NavigableMap<Long, String> map = new TreeMap<>(); try (FileReader fr = new FileReader(mappingFile); BufferedReader reader = new BufferedReader(fr);) { for (String line = reader.readLine(); line != null; line = reader.readLine()) { line = line.trim(); String[] elems = line.split(" ", 3); if (elems.length == 3) { try { long address = Long.parseLong(stripLeadingZeros(elems[0]), 16); String name = elems[elems.length - 1]; map.put(address, name); } catch (NumberFormatException e) { } } } } catch (FileNotFoundException e) { return null; } catch (IOException e) { } if (map.isEmpty()) { return null; } return ImmutableSortedMap.copyOf(map); }
Source:
<code>public MultiWriteResponse addExplicitEquivalence(HttpServletRequest req, HttpServletResponse resp) { try { PossibleApplication possibleApplication = validateApplicationConfiguration(req, resp); if (possibleApplication.getErrorSummary().isPresent()) { return multiWriteError(req, resp, possibleApplication.getErrorSummary().get()); } Application application = possibleApplication.getApplication().get(); List<String> uris = parseList(req.getParameter(URIS)); List<String> ids = parseList(req.getParameter(IDS)); if (uris.size() + ids.size() != 2) { throw new IllegalArgumentException("Must specify exactly two " + URIS + " or " + IDS); } List<Content> contents = resolveContent(uris, ids); if (contents.size() != 2 || contents.get(0).equals(contents.get(1))) { <START> throw new IllegalArgumentException("Must specify exactly two pieces of content"); <END> } for (Content content : contents) { validateApplicationForExplicitEquiv(content.getPublisher(), application); } Content firstContent = contents.get(0); Content secondContent = contents.get(1); List<String> updatedIds = new ArrayList<>(2); addExplicitEquivalence(firstContent, secondContent).ifPresent(updatedIds::add); addExplicitEquivalence(secondContent, firstContent).ifPresent(updatedIds::add); if (updatedIds.isEmpty()) { throw new IllegalArgumentException("Content is already explicitly equived"); } resp.setStatus(HttpServletResponse.SC_OK); return new MultiWriteResponse(updatedIds); } catch (Exception e) { return multiWriteError(req, resp, AtlasErrorSummary.forException(e)); } }</code><technical_language>Change message "Must distinct pieces of content"</technical_language>

Target:
public ExplicitEquivalenceResponse addExplicitEquivalence(HttpServletRequest req, HttpServletResponse resp) { try { List<Content> contents = getContentForExplicitEquivFromRequest(req); Content firstContent = contents.get(0); Content secondContent = contents.get(1); List<ExplicitEquivalenceResponse.EquivalenceLink> equivLinksAdded = new ArrayList<>(2); addExplicitEquivalence(firstContent, secondContent).ifPresent(equivLinksAdded::add); addExplicitEquivalence(secondContent, firstContent).ifPresent(equivLinksAdded::add); if (equivLinksAdded.isEmpty()) { throw new IllegalArgumentException("Content is already explicitly equived"); } resp.setStatus(HttpServletResponse.SC_OK); return new ExplicitEquivalenceResponse(equivLinksAdded, null); } catch (Exception e) { return explicitEquivalenceWriteError(req, resp, AtlasErrorSummary.forException(e)); } }
Source:
<code>protected Void visitParameterizedType(AnnotatedDeclaredType type, ParameterizedTypeTree tree) { if (TreeUtils.isDiamondTree(tree)) { return null; } final TypeElement element = (TypeElement) type.getUnderlyingType().asElement(); if (checker.shouldSkipUses(element)) { return null; } List<AnnotatedTypeParameterBounds> bounds = atypeFactory.typeVariablesFromUse(type, element); DeclaredType declType = type.getUnderlyingType(); <START> TypeElement typeElt = (TypeElement) declType.asElement(); <END> visitor.checkTypeArguments( tree, bounds, type.getTypeArguments(), tree.getTypeArguments(), typeElt.getSimpleName(), typeElt.getTypeParameters()); return null; }</code><technical_language>is a element declared line 456 value</technical_language>

Target:
protected Void visitParameterizedType(AnnotatedDeclaredType type, ParameterizedTypeTree tree) { if (TreeUtils.isDiamondTree(tree)) { return null; } final TypeElement element = (TypeElement) type.getUnderlyingType().asElement(); if (checker.shouldSkipUses(element)) { return null; } List<AnnotatedTypeParameterBounds> bounds = atypeFactory.typeVariablesFromUse(type, element); visitor.checkTypeArguments( tree, bounds, type.getTypeArguments(), tree.getTypeArguments(), element.getSimpleName(), element.getTypeParameters()); return null; }
Source:
<code>public LabelMetadataBuilder setOrigin(String origin) { this.origin = origin; <START> return this; <END> }</code><technical_language>Is fluent required here? a a basic setter instead</technical_language>

Target:
public void setOrigin(String origin) { this.origin = origin; }
Source:
<code>public ResponseEntity<?> create(@Valid @RequestBody final EventType eventType, final Errors errors, final NativeWebRequest request) { if (featureToggleService.isFeatureEnabled(DISABLE_EVENT_TYPE_CREATION)) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } ValidationUtils.invokeValidator(eventTypeOptionsValidator, eventType.getOptions(), errors); <START> if (!applicationService.exists(eventType.getOwningApplication())) { <END> return Responses.create(Problem.valueOf(MoreStatus.UNPROCESSABLE_ENTITY, "owning_application doesn't exist"), request); } if (errors.hasErrors()) { return Responses.create(new ValidationProblem(errors), request); } final Result<Void> result = eventTypeService.create(eventType); if (!result.isSuccessful()) { return Responses.create(result.getProblem(), request); } return status(HttpStatus.CREATED).build(); }</code><technical_language>I need a future-toggle for this feature forbids allowed in past</technical_language>

Target:
public ResponseEntity<?> create(@Valid @RequestBody final EventType eventType, final Errors errors, final NativeWebRequest request) { if (featureToggleService.isFeatureEnabled(DISABLE_EVENT_TYPE_CREATION)) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } ValidationUtils.invokeValidator(eventTypeOptionsValidator, eventType.getOptions(), errors); if (featureToggleService.isFeatureEnabled(CHECK_OWNING_APPLICATION) && !applicationService.exists(eventType.getOwningApplication())) { return Responses.create(Problem.valueOf(MoreStatus.UNPROCESSABLE_ENTITY, "owning_application doesn't exist"), request); } if (errors.hasErrors()) { return Responses.create(new ValidationProblem(errors), request); } setDefaultEventTypeOptions(eventType); final Result<Void> result = eventTypeService.create(eventType); if (!result.isSuccessful()) { return Responses.create(result.getProblem(), request); } return status(HttpStatus.CREATED).build(); }
Source:
<code>public Builder(String nxqlQuery) { <START> Objects.requireNonNull(nxqlQuery, "NXQL query cannot be null"); this.query = nxqlQuery; <END> }</code><technical_language>one-lined lines if wanted</technical_language>

Target:
protected Builder(String nxqlQuery) { this.query = Objects.requireNonNull(nxqlQuery, "NXQL query cannot be null"); }
Source:
<code>public static JSONObject toJsonObject(InputStream inputStream) throws ParseException { try { <START> String inputStr = new String(ByteStreams.toByteArray(inputStream), Charsets.UTF_8); <END> if (inputStr.isBlank()) { return new JSONObject(); } return new JSONObject(inputStr); } catch (IOException | JSONException e) { throw new ParseException(e); } }</code><technical_language>suggestion String inputStr = new String((inputStream.readAllByte()), Charsets.UTF_8); This is java 9</technical_language>

Target:
public static JSONObject toJsonObject(InputStream inputStream) throws ParseException { try { String inputStr = new String((inputStream.readAllBytes()), Charsets.UTF_8); if (inputStr.isBlank()) { return new JSONObject(); } return new JSONObject(inputStr); } catch (IOException | JSONException e) { throw new ParseException(e); } }
Source:
<code>private void setPlatformTextClassifier(@Nullable TextClassifier textClassifier) { android.view.textclassifier.TextClassificationManager <START> textClassificationManager = <END> (android.view.textclassifier.TextClassificationManager) mContext.getSystemService(Context.TEXT_CLASSIFICATION_SERVICE); android.view.textclassifier.TextClassifier platformTextClassifier = textClassifier == null ? null : new PlatformTextClassifier(mContext, textClassifier); textClassificationManager.setTextClassifier(platformTextClassifier); }</code><technical_language>TCM is optional Android system service. Check for null</technical_language>

Target:
private void setPlatformTextClassifier(@Nullable TextClassifier textClassifier) { android.view.textclassifier.TextClassificationManager textClassificationManager = (android.view.textclassifier.TextClassificationManager) mContext.getSystemService(Context.TEXT_CLASSIFICATION_SERVICE); if (textClassificationManager == null) { return; } android.view.textclassifier.TextClassifier platformTextClassifier = textClassifier == null ? null : new PlatformTextClassifier(mContext, textClassifier); textClassificationManager.setTextClassifier(platformTextClassifier); }
Source:
<code>public void searchByEncounter_shouldGetObsInAnEncounter() throws Exception { MockHttpServletRequest req = newGetRequest(getURI(), new Parameter("encounter", "6519d653-393b-4118-9c83-a3715b82d4ac")); SimpleObject result = deserialize(handle(req)); List<Object> results = Util.getResultsList(result); Assert.assertEquals(2, results.size()); List<Object> uuids = Arrays.asList(PropertyUtils.getProperty(results.get(0), "uuid"), PropertyUtils.getProperty( <START> results.get(1), getUuid())); <END> Assert.assertTrue(uuids.contains("39fb7f47-e80a-4056-9285-bd798be13c63")); Assert.assertTrue(uuids.contains("be48cdcb-6a76-47e3-9f2e-2635032f3a9a")); }</code><technical_language>getUuid(), "uuid"</technical_language>

Target:
public void searchByEncounter_shouldGetObsInAnEncounter() throws Exception { MockHttpServletRequest req = newGetRequest(getURI(), new Parameter("encounter", "6519d653-393b-4118-9c83-a3715b82d4ac")); SimpleObject result = deserialize(handle(req)); List<Object> results = Util.getResultsList(result); Assert.assertEquals(2, results.size()); List<Object> uuids = Arrays.asList(PropertyUtils.getProperty(results.get(0), "uuid"), PropertyUtils.getProperty( results.get(1), "uuid")); Assert.assertTrue(uuids.contains("39fb7f47-e80a-4056-9285-bd798be13c63")); Assert.assertTrue(uuids.contains("be48cdcb-6a76-47e3-9f2e-2635032f3a9a")); }
Source:
<code>void execute() { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); boolean enabled = store.getBoolean(Activator.PREF_ENABLE_LAUNCHBAR); injectIntoAll(enabled); eventBroker.subscribe(UIEvents.TrimmedWindow.TOPIC_TRIMBARS, new EventHandler() { @Override public void handleEvent(Event event) { if (!UIEvents.isADD(event)) return; Object newValue = event.getProperty(UIEvents.EventTags.NEW_VALUE); if (newValue instanceof MTrimBar) { MTrimBar trimBar = (MTrimBar) newValue; if (trimBar.getSide() == SideValue.TOP) { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); boolean enabled = store.getBoolean(Activator.PREF_ENABLE_LAUNCHBAR); injectLaunchBar(trimBar, enabled); } } } }); Activator.getDefault().getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(Activator.PREF_ENABLE_LAUNCHBAR)) { boolean enabled = Boolean.parseBoolean(event.getNewValue().toString()); injectIntoAll(enabled); } if (event.getProperty().equals(Activator.PREF_ENABLE_TARGETSELECTOR)) { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); boolean enabled = store.getBoolean(Activator.PREF_ENABLE_LAUNCHBAR); if (enabled){ injectIntoAll(false); injectIntoAll(true); } } <START> if (event.getProperty().equals(Activator.PREF_ENABLE_BUILDBUTTON)) { <END> IPreferenceStore store = Activator.getDefault().getPreferenceStore(); boolean enabled = store.getBoolean(Activator.PREF_ENABLE_LAUNCHBAR); if (enabled){ injectIntoAll(false); injectIntoAll(true); } } } }); }</code><technical_language>if this is code djust do do || in previous if</technical_language>

Target:
void execute() { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); boolean enabled = store.getBoolean(Activator.PREF_ENABLE_LAUNCHBAR); injectIntoAll(enabled); eventBroker.subscribe(UIEvents.TrimmedWindow.TOPIC_TRIMBARS, new EventHandler() { @Override public void handleEvent(Event event) { if (!UIEvents.isADD(event)) return; Object newValue = event.getProperty(UIEvents.EventTags.NEW_VALUE); if (newValue instanceof MTrimBar) { MTrimBar trimBar = (MTrimBar) newValue; if (trimBar.getSide() == SideValue.TOP) { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); boolean enabled = store.getBoolean(Activator.PREF_ENABLE_LAUNCHBAR); injectLaunchBar(trimBar, enabled); } } } }); Activator.getDefault().getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (event.getProperty().equals(Activator.PREF_ENABLE_LAUNCHBAR)) { boolean enabled = Boolean.parseBoolean(event.getNewValue().toString()); injectIntoAll(enabled); } if (event.getProperty().equals(Activator.PREF_ENABLE_TARGETSELECTOR)|| event.getProperty().equals(Activator.PREF_ENABLE_BUILDBUTTON)) { IPreferenceStore store = Activator.getDefault().getPreferenceStore(); boolean enabled = store.getBoolean(Activator.PREF_ENABLE_LAUNCHBAR); if (enabled){ injectIntoAll(false); injectIntoAll(true); } } } }); }
Source:
<code>private void initButtons() { mapCenterButton = findViewById(R.id.map_center_button); startGeocodeButton = findViewById(R.id.start_geocode_button); chooseCityButton = findViewById(R.id.choose_city_spinner_button); startGeocodeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (TextUtils.isEmpty(latEditText.getText().toString())) { latEditText.setError(getString(R.string.fill_in_a_value)); } else if (TextUtils.isEmpty(longEditText.getText().toString())) { longEditText.setError(getString(R.string.fill_in_a_value)); } else { if (latCoordinateIsValid(Double.valueOf(latEditText.getText().toString())) && longCoordinateIsValid(Double.valueOf(longEditText.getText().toString()))) { makeGeocodeSearch(new LatLng(Double.valueOf(latEditText.getText().toString()), Double.valueOf(longEditText.getText().toString()))); } else { Toast.makeText(GeocodingActivity.this, R.string.make_valid_lat, Toast.LENGTH_LONG).show(); } } } }); chooseCityButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { showCityListMenu(); } }); mapCenterButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Double targetLat = mapboxMap.getCameraPosition().target.getLatitude(); Double targetLong = mapboxMap.getCameraPosition().target.getLongitude(); setCoordinateEditTexts(mapboxMap.getCameraPosition().target); <START> makeGeocodeSearch(new LatLng(targetLat, targetLong)); <END> } }); }</code><technical_language>This is thing. target. easier get target: target = mapboxMap.getCameraPosition().target; call makeGeocodeSearch(new LatLng(target));</technical_language>

Target:
private void initButtons() { mapCenterButton = findViewById(R.id.map_center_button); startGeocodeButton = findViewById(R.id.start_geocode_button); chooseCityButton = findViewById(R.id.choose_city_spinner_button); startGeocodeButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (TextUtils.isEmpty(latEditText.getText().toString())) { latEditText.setError(getString(R.string.fill_in_a_value)); } else if (TextUtils.isEmpty(longEditText.getText().toString())) { longEditText.setError(getString(R.string.fill_in_a_value)); } else { if (latCoordinateIsValid(Double.valueOf(latEditText.getText().toString())) && longCoordinateIsValid(Double.valueOf(longEditText.getText().toString()))) { makeGeocodeSearch(new LatLng(Double.valueOf(latEditText.getText().toString()), Double.valueOf(longEditText.getText().toString()))); } else { Toast.makeText(GeocodingActivity.this, R.string.make_valid_lat, Toast.LENGTH_LONG).show(); } } } }); chooseCityButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { showCityListMenu(); } }); mapCenterButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { LatLng target = mapboxMap.getCameraPosition().target; setCoordinateEditTexts(target); makeGeocodeSearch(target); } }); }
Source:
<code>public static AndroidSQLite createAndroidSQLite(String path) { SQLiteDatabase db = (path != null) <START> ? SQLiteDatabase.openDatabase(path, null, SQLiteDatabase.CREATE_IF_NECESSARY) <END> : SQLiteDatabase.create(null); return new AndroidSQLite(db); }</code><technical_language>if/else blocks in rest of code, style consistent</technical_language>

Target:
public static AndroidSQLite createAndroidSQLite(String path) { SQLiteDatabase db; if (path != null) { db = SQLiteDatabase.openDatabase(path, null, SQLiteDatabase.CREATE_IF_NECESSARY); } else { db = SQLiteDatabase.create(null); } return new AndroidSQLite(db); }
Source:
<code>private ServiceTemplateInstanceConfiguration getValidServiceTemplateInstanceConfiguration(AbstractTopologyTemplate topology, Map<String, Collection<Long>> nodeIds2situationIds) { QName situationPolicyType = <START> new QName("<LINK_0>", "SituationPolicy_w1-wip1"); <END> Collection<AbstractNodeTemplate> validNodes = new ArrayList<AbstractNodeTemplate>(); Collection<AbstractRelationshipTemplate> validRelations = new ArrayList<AbstractRelationshipTemplate>(); for (AbstractNodeTemplate nodeTemplate : topology.getNodeTemplates()) { Collection<AbstractPolicy> policies = this.getPolicies(situationPolicyType, nodeTemplate); if (policies.isEmpty()) { validNodes.add(nodeTemplate); } else { if (this.isValidUnderSituations(nodeTemplate, nodeIds2situationIds)) { validNodes.add(nodeTemplate); } } } Collection<AbstractNodeTemplate> deployableAndValidNodeSet = this.getDeployableSubgraph(validNodes, nodeIds2situationIds); for (AbstractRelationshipTemplate relations : topology.getRelationshipTemplates()) { if (deployableAndValidNodeSet.contains(relations.getSource()) & deployableAndValidNodeSet.contains(relations.getTarget())) { validRelations.add(relations); } } return new ServiceTemplateInstanceConfiguration(deployableAndValidNodeSet, validRelations); }</code><technical_language>in Types.java</technical_language>

Target:
private ServiceTemplateInstanceConfiguration getValidServiceTemplateInstanceConfiguration(AbstractTopologyTemplate topology, Map<String, Collection<Long>> nodeIds2situationIds) { Collection<AbstractNodeTemplate> validNodes = new ArrayList<AbstractNodeTemplate>(); Collection<AbstractRelationshipTemplate> validRelations = new ArrayList<AbstractRelationshipTemplate>(); for (AbstractNodeTemplate nodeTemplate : topology.getNodeTemplates()) { Collection<AbstractPolicy> policies = this.getPolicies(Types.situationPolicyType, nodeTemplate); if (policies.isEmpty()) { validNodes.add(nodeTemplate); } else if (this.isValidUnderSituations(nodeTemplate, nodeIds2situationIds)) { validNodes.add(nodeTemplate); } } Collection<AbstractNodeTemplate> deployableAndValidNodeSet = this.getDeployableSubgraph(validNodes, nodeIds2situationIds); for (AbstractRelationshipTemplate relations : topology.getRelationshipTemplates()) { if (deployableAndValidNodeSet.contains(relations.getSource()) & deployableAndValidNodeSet.contains(relations.getTarget())) { validRelations.add(relations); } } return new ServiceTemplateInstanceConfiguration(deployableAndValidNodeSet, validRelations); }