auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected boolean canDoAction() { if(! super.canDoAction()) { return false; } GlusterVolumeEntity volume = getGlusterVolume(); if (!volume.isOnline()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_ALREADY_STOPPED); addCanDoActionMessage(String.format("$volumeName %1$s", volume.getName())); return false; } <START> if (volume.getAsyncTask() != null && volume.getAsyncTask().getStatus() == JobExecutionStatus.STARTED) { <END> if (volume.getAsyncTask().getType() == GlusterTaskType.REBALANCE) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_CANNOT_STOP_REBALANCE_IN_PROGRESS); } } return true; }</code><technical_language>new utility class GlusterTaskUtils</technical_language>

Target:
protected boolean canDoAction() { if(! super.canDoAction()) { return false; } GlusterVolumeEntity volume = getGlusterVolume(); if (!volume.isOnline()) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_ALREADY_STOPPED); addCanDoActionMessage(String.format("$volumeName %1$s", volume.getName())); return false; } if (GlusterTaskUtils.isTaskOfType(volume, GlusterTaskType.REBALANCE) && GlusterTaskUtils.isTaskStatus(volume, JobExecutionStatus.STARTED)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_GLUSTER_VOLUME_CANNOT_STOP_REBALANCE_IN_PROGRESS); } return true; }
Source:
<code>public void onMessage(ReadRowsResponse response) { <START> call.request(1); <END> if (builder == null) { builder = new RowMerger(); } builder.addPartialRow(response); if (builder.isRowCommitted()) { Row builtRow = builder.buildRow(); builder = null; if (builtRow == null) { } else { observer.onNext(builtRow); } } }</code><technical_language>sense request a batch a time</technical_language>

Target:
public void onMessage(ReadRowsResponse response) { if (builder == null) { builder = new RowMerger(); } builder.addPartialRow(response); outstandingRequestCount.decrementAndGet(); if (builder.isRowCommitted()) { Row builtRow = builder.buildRow(); builder = null; if (builtRow == null) { } else { observer.onNext(builtRow); } } }
Source:
<code>public void onClick(DialogInterface dialog, int which) { if (which == AlertDialog.BUTTON_POSITIVE) { <START> String username = mUsernameET.getText().toString().trim(); <END> String password = mPasswordET.getText().toString().trim(); mHandler.proceed(username, password); dialog.dismiss(); } else if (which == AlertDialog.BUTTON_NEGATIVE) { dialog.dismiss(); mWebView.stopLoading(); ((AuthenticatorActivity)getActivity()).doNegativeAuthenticatioDialogClick(); } }</code><technical_language>trim username password</technical_language>

Target:
public void onClick(DialogInterface dialog, int which) { if (which == AlertDialog.BUTTON_POSITIVE) { String username = mUsernameET.getText().toString(); String password = mPasswordET.getText().toString(); mHandler.proceed(username, password); } else if (which == AlertDialog.BUTTON_NEGATIVE) { mWebView.stopLoading(); ((AuthenticatorActivity)getActivity()).doNegativeAuthenticatioDialogClick(); } dialog.dismiss(); }
Source:
<code>public List<IDatabaseConnection> getConnections( boolean hidePassword ) throws ConnectionServiceException { ensureDataAccessPermission(); List<IDatabaseConnection> connectionList = null; try { connectionList = datasourceMgmtSvc.getDatasources(); if ( hidePassword ) { for ( IDatabaseConnection conn : connectionList ) { sanitizer.unsanitizeConnectionParameters( conn ); conn.setPassword( null ); <START> } <END> } else { for ( IDatabaseConnection conn : connectionList ) { sanitizer.unsanitizeConnectionParameters( conn ); } } } catch ( DatasourceMgmtServiceException dme ) { String message = Messages.getErrorString( "ConnectionServiceImpl.ERROR_0002_UNABLE_TO_GET_CONNECTION_LIST", dme.getLocalizedMessage() ); logger.error( message ); throw new ConnectionServiceException( message, dme ); } return connectionList; }</code><technical_language>Suggestion: **for {}** block do: if ( hidePassword ) { conn.setPassword( null ); }</technical_language>

Target:
public List<IDatabaseConnection> getConnections( boolean hidePassword ) throws ConnectionServiceException { ensureDataAccessPermission(); List<IDatabaseConnection> connectionList = null; try { connectionList = datasourceMgmtSvc.getDatasources(); for ( IDatabaseConnection conn : connectionList ) { sanitizer.unsanitizeConnectionParameters( conn ); if ( hidePassword ) { conn.setPassword( null ); } } } catch ( DatasourceMgmtServiceException dme ) { String message = Messages.getErrorString( "ConnectionServiceImpl.ERROR_0002_UNABLE_TO_GET_CONNECTION_LIST", dme.getLocalizedMessage() ); logger.error( message ); throw new ConnectionServiceException( message, dme ); } return connectionList; }
Source:
<code>public void setUp() { user = properties.getUserName(); password = properties.getPassword(); loginPage = new LoginPage(driver); homePage = new HomePage(driver); participantPage = new ParticipantPage(driver); participantEditPage = new ParticipantEditPage(driver); <START> if (homePage.expectedUrlPath() != currentPage().urlPath()) { <END> loginPage.login(user , password); } }</code><technical_language>compare Strings "!=" "==", equals methods instead if strings null org.apache.commons.lang.StringUtils.equals</technical_language>

Target:
public void setUp() { user = properties.getUserName(); password = properties.getPassword(); loginPage = new LoginPage(driver); homePage = new HomePage(driver); participantPage = new ParticipantPage(driver); participantEditPage = new ParticipantEditPage(driver); if (!StringUtils.equals(homePage.expectedUrlPath(), currentPage().urlPath())) { loginPage.login(user , password); } }
Source:
<code>private URL createURL(KeenProject project, String eventCollection) { try { <START> String rawPath = new URI(null, null, eventCollection, null).getRawPath(); <END> String path = String.format(Locale.US, "%s/%s/projects/%s/events/%s", getBaseUrl(), KeenConstants.API_VERSION, project.getProjectId(), rawPath); return new URL(path); } catch (URISyntaxException e) { KeenLogging.log("Event collection name has invalid character to encode", e); } catch (MalformedURLException e) { KeenLogging.log("Url you create is malformed or there is not legal protocol in string you specified", e); } return null; }</code><technical_language>encodedCollectionName</technical_language>

Target:
private URL createURL(KeenProject project, String eventCollection) { try { String encodedCollectionName = new URI(null, null, eventCollection, null).getRawPath(); String path = String.format(Locale.US, "%s/%s/projects/%s/events/%s", getBaseUrl(), KeenConstants.API_VERSION, project.getProjectId(), encodedCollectionName); return new URL(path); } catch (URISyntaxException e) { KeenLogging.log("Event collection name has invalid character to encode", e); } catch (MalformedURLException e) { KeenLogging.log("Url you create is malformed or there is not legal protocol in string you specified", e); } return null; }
Source:
<code>protected ICommand getCreateCommand(CreateElementRequest req) { EObject owner = req.getContainer(); EReference eref = req.getContainmentFeature(); if (eref == null) { return UnexecutableCommand.INSTANCE; } <START> if (owner instanceof Component && eref.equals(UMLPackage.eINSTANCE.getClass_NestedClassifier()) && req.getElementType().getEClass().equals(UMLPackage.eINSTANCE.getComponent())) { <END> return UnexecutableCommand.INSTANCE; } return super.getCreateCommand(req); }</code><technical_language>I change equals() invocations == (which is more usual form anyways) request superclass implementation able do useful</technical_language>

Target:
protected ICommand getCreateCommand(CreateElementRequest req) { EObject owner = req.getContainer(); EReference eref = req.getContainmentFeature(); if (eref == null) { return UnexecutableCommand.INSTANCE; } if (owner instanceof Component && eref == UMLPackage.eINSTANCE.getClass_NestedClassifier() && req.getElementType().getEClass() == UMLPackage.eINSTANCE.getComponent()) { return UnexecutableCommand.INSTANCE; } return super.getCreateCommand(req); }
Source:
<code><START> public List<String> splitJson(JsonNode jsonNode) throws JsonParseException, JsonMappingException, IOException { <END> List<String> splittedJsonElements = new ArrayList<>(); ObjectMapper mapper = new ObjectMapper(); if (jsonNode.isArray()) { ArrayNode arrayNode = (ArrayNode) jsonNode; for (int i = 0; i < arrayNode.size(); i++) { JsonNode individualElement = arrayNode.get(i); splittedJsonElements.add(mapper.writeValueAsString(individualElement)); } } else { splittedJsonElements.add(mapper.writeValueAsString(jsonNode)); } return splittedJsonElements; }</code><technical_language>exceptions subclasses of IOException. Do need here</technical_language>

Target:
public List<String> splitJson(JsonNode jsonNode) throws IOException { List<String> splittedJsonElements = new ArrayList<>(); ObjectMapper mapper = new ObjectMapper(); if (jsonNode.isArray()) { for (JsonNode element : (ArrayNode) jsonNode) { splittedJsonElements.add(writeJsonNode(mapper, element)); } } else { splittedJsonElements.add(writeJsonNode(mapper, jsonNode)); } return splittedJsonElements; }
Source:
<code>public void nextJsonObject_ArrayOfElements() throws JsonParseException, IOException { String element1 = normalizeJson("{bre: 'sss', arr: ['1112', 'abc']}"); String element2 = normalizeJson("{bre: 'sss', arr: ['1112', 'abc'], dd: 'ssssxx'}"); String content = "[" + element1 +", " + element2 + "]"; JsonParser jsonParser = jsonFactory.createParser(content); JsonToken jsonToken = jsonUtils.nextJsonObject(jsonParser); <START> assertEquals(content.replaceAll("\\s", ""), jsonParser.readValueAsTree().toString()); <END> jsonToken = jsonUtils.nextJsonObject(jsonParser); assertNull(jsonToken); }</code><technical_language>in content = ..., add normalizeJson("[" + element1 , ...) remove replaceAll here</technical_language>

Target:
public void nextJsonObject_ArrayOfElements() throws JsonParseException, IOException { String element1 = normalizeJson("{bre: 'sss', arr: ['1112', 'abc']}"); String element2 = normalizeJson("{bre: 'sss', arr: ['1112', 'abc'], dd: 'ssssxx'}"); String content = "[" + element1 +"," + element2 + "]"; JsonParser jsonParser = jsonFactory.createParser(content); JsonToken jsonToken = jsonUtils.nextJsonObject(jsonParser); assertEquals(content, jsonParser.readValueAsTree().toString()); jsonToken = jsonUtils.nextJsonObject(jsonParser); assertNull(jsonToken); }
Source:
<code>Mono<PagedResponse<ModelData>> listModelsSinglePageAsync(ListModelOptions listModelOptions, Context context){ return protocolLayer.getDigitalTwinModels().listSinglePageAsync( <START> (List<String>) listModelOptions.getDependenciesFor(), <END> listModelOptions.getIncludeModelDefinition(), new DigitalTwinModelsListOptions().setMaxItemCount(listModelOptions.getMaxItemCount()), context); }</code><technical_language>define listModelOptions.getDependenciesFor a List with? If PL is restrictive, advantage in public API flexible? Is a risk of running conversion errors simply casting a List -> a for-each loop better: <LINK_0></technical_language>

Target:
Mono<PagedResponse<ModelData>> listModelsSinglePageAsync(ListModelOptions listModelOptions, Context context){ return protocolLayer.getDigitalTwinModels().listSinglePageAsync( listModelOptions.getDependenciesFor(), listModelOptions.getIncludeModelDefinition(), new DigitalTwinModelsListOptions().setMaxItemCount(listModelOptions.getMaxItemCount()), context); }
Source:
<code>private void addTrace(ITmfStateSystem ss, Builder<@NonNull TimeGraphEntryModel> builder, int quark, long parentId) { int <START> jaegerSpansQuark; <END> try { jaegerSpansQuark = ss.getQuarkRelative(quark, SpanLifeStateProvider.JAEGER_QUARK); } catch (AttributeNotFoundException e) { return; } builder.add(new TimeGraphEntryModel(parentId, -1, ss.getAttributeName(quark), ss.getStartTime(), ss.getCurrentEndTime())); int ustSpansQuark; try { ustSpansQuark = ss.getQuarkRelative(quark, SpanLifeStateProvider.UST_QUARK); } catch (AttributeNotFoundException e) { addChildren(ss, builder, jaegerSpansQuark, parentId); return; } addUstChildren(ss, builder, jaegerSpansQuark, ustSpansQuark, parentId); }</code><technical_language>rename</technical_language>

Target:
private void addTrace(ITmfStateSystem ss, Builder<@NonNull TimeGraphEntryModel> builder, int quark, long parentId) { List<@NonNull Integer> logsQuarks; try { int logsQuark = ss.getQuarkRelative(quark, IOpenTracingConstants.LOGS); logsQuarks = ss.getSubAttributes(logsQuark, false); } catch (AttributeNotFoundException e) { logsQuarks = new ArrayList<>(); } int openTracingSpansQuark; try { openTracingSpansQuark = ss.getQuarkRelative(quark, SpanLifeStateProvider.OPEN_TRACING_QUARK); } catch (AttributeNotFoundException e) { return; } builder.add(new TimeGraphEntryModel(parentId, ITmfStateSystem.ROOT_ATTRIBUTE, ss.getAttributeName(quark), ss.getStartTime(), ss.getCurrentEndTime())); int ustSpansQuark; try { ustSpansQuark = ss.getQuarkRelative(quark, SpanLifeStateProvider.UST_QUARK); } catch (AttributeNotFoundException e) { addChildren(ss, builder, openTracingSpansQuark, parentId, logsQuarks); return; } addUstChildren(ss, builder, openTracingSpansQuark, ustSpansQuark, parentId, logsQuarks); }
Source:
<code>public void notLeader() { synchronized (lock) { if (running) { try { <START> kubeClient.checkAndUpdateConfigMap( configMapName, configMap -> { if (KubernetesLeaderElector.hasLeadership(configMap, lockIdentity)) { configMap.getData().remove(LEADER_ADDRESS_KEY); configMap.getData().remove(LEADER_SESSION_ID_KEY); return Optional.of(configMap); } return Optional.empty(); } <END> ).get(); } catch (Exception e) { fatalErrorHandler.onFatalError( new LeaderElectionException( "Could not remove leader information from ConfigMap " + configMapName, e)); } leaderElectionEventHandler.onRevokeLeadership(); if (!leaderElectorRunFuture.isDone()) { leaderElectorRunFuture.complete(null); } leaderElectorRunFuture = CompletableFuture.runAsync(leaderElector::run, ioExecutor); FutureUtils.assertNoException(leaderElectorRunFuture); } } }</code><technical_language>I wondering this DefaultLeaderElectionService decide receiving onRevokeLeadership callback. decide call writeLeaderInformation(LeaderInformation.empty())</technical_language>

Target:
public void notLeader() { leaderElectionEventHandler.onRevokeLeadership(); leaderElector.run(); }
Source:
<code>private <T> T getProperty(VariantType type, String property, T defaultValue, Class<T> expectedType) { String systemPropertyName = String.format("aerogear.%s.%s", type.getTypeName(), property); <START> String value = System.getProperty(systemPropertyName, defaultValue.toString()); <END> if (expectedType == String.class) { return (T) value; } else if (expectedType == Integer.class) { return (T) Integer.valueOf(value); } else { throw new IllegalStateException("Unexpected type: " + expectedType); } }</code><technical_language><LINK_0></technical_language>

Target:
private <T> T getProperty(VariantType type, String property, T defaultValue, Class<T> expectedType) { String systemPropertyName = String.format("aerogear.%s.%s", type.getTypeName(), property); if (expectedType == String.class) { return (T) ConfigurationUtils.tryGetProperty(systemPropertyName, (String) defaultValue); } else if (expectedType == Integer.class) { return (T) ConfigurationUtils.tryGetIntegerProperty(systemPropertyName, (Integer) defaultValue); } else { throw new IllegalStateException("Unexpected type: " + expectedType); } }
Source:
<code><START> public static <O extends JavaSource<O>> int getBasicArrayDimension(String name) <END> { int count = 0; if (name != null) { for (char c : name.toCharArray()) { if (c == '[') { count++; } } } return count; }</code><technical_language>is this method parameterized</technical_language>

Target:
public static int getBasicArrayDimension(String name) { int count = 0; if (name != null) { for (char c : name.toCharArray()) { if (c == '[') { count++; } } } return count; }
Source:
<code>public String toString() { <START> return "AffinityEnforcerThreadInterceptor{" + "type='" + group + '\'' + ", cores=" + cores + '}'; <END> }</code><technical_language>Is this toString valid</technical_language>

Target:
public String toString() { return "ThreadAffinityController{" + "group='" + group + '\'' + ", cores=" + cores + '}'; }
Source:
<code>private boolean validateAntHome() { ClasspathModel model = getModel(); IClasspathEntry userEntry = model.getUserEntry(); for (IClasspathEntry entrie : userEntry.getEntries()) { <START> ClasspathEntry entry = (ClasspathEntry) entrie; <END> IRuntimeClasspathEntry runtimeEntry = entry.getDelegate(); if (runtimeEntry instanceof AntHomeClasspathEntry) { try { ((AntHomeClasspathEntry) runtimeEntry).resolveAntHome(); } catch (CoreException ce) { setErrorMessage(ce.getStatus().getMessage()); return false; } break; } } return true; }</code><technical_language>loop var, cast ClasspathEntry calling getDelegate()</technical_language>

Target:
private boolean validateAntHome() { ClasspathModel model = getModel(); IClasspathEntry userEntry = model.getUserEntry(); for (IClasspathEntry entry : userEntry.getEntries()) { IRuntimeClasspathEntry runtimeEntry = ((ClasspathEntry) entry).getDelegate(); if (runtimeEntry instanceof AntHomeClasspathEntry) { try { ((AntHomeClasspathEntry) runtimeEntry).resolveAntHome(); } catch (CoreException ce) { setErrorMessage(ce.getStatus().getMessage()); return false; } break; } } return true; }
Source:
<code>public void setTopics(String[] topics) { ArrayList<String> temp = new ArrayList<>(); <START> for (String topic: Arrays.asList(topics)) { <END> if (topic != null && topic.length() != 0) { temp.add(topic); } } temp.toArray(this.topics); }</code><technical_language>iterate topics</technical_language>

Target:
public void setTopics(String[] topics) { List<String> temp = new ArrayList<>(); for (String topic: topics) { if (topic != null && topic.length() != 0) { temp.add(topic); } } this.topics = temp.toArray(new String[temp.size()]); }
Source:
<code>public static PageViewAvroRecord buildPageViewRecord(PageView pageView) { PageViewAvroRecord record = new PageViewAvroRecord(); <START> record.put(0, pageView.userId); <END> record.put(1, pageView.country); record.put(2, pageView.pageId); return record; }</code><technical_language>cleaner do record.userId = pageView.userId? for other fields below</technical_language>

Target:
public static PageViewAvroRecord buildPageViewRecord(PageView pageView) { PageViewAvroRecord record = new PageViewAvroRecord(); record.userId = pageView.userId; record.country = pageView.country; record.pageId = pageView.pageId; return record; }
Source:
<code><START> public MessageChannel bindDynamicPubSubProducer(String name) { <END> MessageChannel channel = this.directChannelProvider.lookupSharedChannel(name); if (channel == null) { channel = this.directChannelProvider.createAndRegisterChannel(name); bindPubSubProducer(name, channel); } return channel; }</code><technical_language>is bindDynamicProducer synchronized, this not? I need more this MessageBus stuff is from, determine behaviour is correct for this methods, I hope provide correct answer</technical_language>

Target:
public synchronized MessageChannel bindDynamicPubSubProducer(String name) { MessageChannel channel = this.directChannelProvider.lookupSharedChannel(name); if (channel == null) { channel = this.directChannelProvider.createAndRegisterChannel(name); bindPubSubProducer(name, channel); } return channel; }
Source:
<code><START> public QueryRequest process(Source source, QueryRequest input) <END> throws PluginExecutionException, StopProcessingException { String methodName = "process"; LOGGER.trace(ENTERING, methodName); QueryRequest newQueryRequest = input; if (input != null) { Query query = input.getQuery(); if (query != null) { Subject subject = getSubject(input); HashMap<String, Set<String>> securityMap = new HashMap<>(); for (Map.Entry<String, List<String>> attributeMapping : attributeMap.entrySet()) { securityMap.put(attributeMapping.getKey(), new HashSet<>(attributeMapping.getValue())); } Attribute attr = new AttributeImpl(Metacard.SECURITY, securityMap); boolean subjectCanViewInvalidData = securityMap.isEmpty() ? false : checkPermissions(attr, subject, CollectionPermission.READ_ACTION); List<Filter> filters = new ArrayList<>(); if (!subjectCanViewInvalidData || !showErrors) { filters.add(filterBuilder.attribute(Validation.VALIDATION_ERRORS).is().empty()); } if (!subjectCanViewInvalidData || !showWarnings) { filters.add(filterBuilder.attribute(Validation.VALIDATION_WARNINGS).is().empty()); } if (!filters.isEmpty()) { QueryImpl newQuery = new QueryImpl( filterBuilder.allOf(filterBuilder.allOf(filters), query), query.getStartIndex(), query.getPageSize(), query.getSortBy(), query.requestsTotalResultsCount(), query.getTimeoutMillis()); newQueryRequest = new QueryRequestImpl( newQuery, input.isEnterprise(), input.getSourceIds(), input.getProperties()); } } } LOGGER.trace(EXITING, methodName); return newQueryRequest; }</code><technical_language>This method a bit I easier understand if split 2-3 methods</technical_language>

Target:
public QueryRequest process(Source source, QueryRequest input) throws StopProcessingException { String methodName = "process"; LOGGER.trace(ENTERING, methodName); QueryRequest newQueryRequest = input; if (input != null) { Query query = input.getQuery(); if (query != null) { boolean subjectCanViewInvalidData = canViewInvalidData(input); List<Filter> filters = new ArrayList<>(); if (!subjectCanViewInvalidData || !showErrors) { filters.add(filterBuilder.attribute(Validation.VALIDATION_ERRORS).is().empty()); } if (!subjectCanViewInvalidData || !showWarnings) { filters.add(filterBuilder.attribute(Validation.VALIDATION_WARNINGS).is().empty()); } if (!filters.isEmpty()) { QueryImpl newQuery = new QueryImpl( filterBuilder.allOf(filterBuilder.allOf(filters), query), query.getStartIndex(), query.getPageSize(), query.getSortBy(), query.requestsTotalResultsCount(), query.getTimeoutMillis()); newQueryRequest = new QueryRequestImpl( newQuery, input.isEnterprise(), input.getSourceIds(), input.getProperties()); } } } LOGGER.trace(EXITING, methodName); return newQueryRequest; }
Source:
<code><START> public static ValidationResult setAndValidateCpuProfile(VmBase vmBase, Guid userId) { <END> if (vmBase.getCpuProfileId() == null) { return assignFirstCpuProfile(vmBase, userId); } CpuProfileValidator validator = new CpuProfileValidator(vmBase.getCpuProfileId()); ValidationResult result = validator.isParentEntityValid(vmBase.getClusterId()); if (!result.isValid()) { return result; } if (!checkPermissions(vmBase.getCpuProfileId(), userId)) { return new ValidationResult(EngineMessage.ACTION_TYPE_NO_PERMISSION_TO_ASSIGN_CPU_PROFILE, String.format("$cpuProfileId %s", vmBase.getCpuProfileId()), String.format("$cpuProfileName %s", validator.getProfile().getName())); } return ValidationResult.VALID; }</code><technical_language>move method purpose? public methods first, helpers, private</technical_language>

Target:
public static ValidationResult setAndValidateCpuProfile(VmBase vmBase, Guid userId) { if (vmBase.getCpuProfileId() == null) { return assignFirstCpuProfile(vmBase, userId); } CpuProfileValidator validator = new CpuProfileValidator(vmBase.getCpuProfileId()); ValidationResult result = validator.isParentEntityValid(vmBase.getClusterId()); if (!result.isValid()) { return result; } if (!isProfilePermitted(vmBase.getCpuProfileId(), userId)) { return new ValidationResult(EngineMessage.ACTION_TYPE_NO_PERMISSION_TO_ASSIGN_CPU_PROFILE, String.format("$cpuProfileId %s", vmBase.getCpuProfileId()), String.format("$cpuProfileName %s", validator.getProfile().getName())); } return ValidationResult.VALID; }
Source:
<code>public void run() { while (true) { <START> LOG.info("Sync loop"); <END> try { msgCountDown.await(); } catch (final InterruptedException e) { throw new RuntimeException(e); } for (final String slaveId : slaveIds) { LOG.log(Level.INFO, "Sending a message to {0}", slaveId); aggregationMaster.send(RemoteEMDriver.AGGREGATION_CLIENT_ID, slaveId, codec.encode(MSG_FROM_DRIVER)); } msgCountDown = new CountDownLatch(RemoteEMDriver.EVAL_NUM); } }</code><technical_language>Please remove this log, level fine</technical_language>

Target:
public void run() { while (true) { try { msgCountDown.await(); } catch (final InterruptedException e) { throw new RuntimeException(e); } for (final String slaveId : workerIds) { LOG.log(Level.INFO, "Sending a message to {0}", slaveId); aggregationMaster.send(RemoteEMDriver.AGGREGATION_CLIENT_ID, slaveId, codec.encode(MSG_FROM_DRIVER)); } msgCountDown = new CountDownLatch(RemoteEMDriver.EVAL_NUM); } }
Source:
<code>public Resource filter(ApiRequest request, Object original, Resource converted) { <START> IdFormatter idFormatter = ApiContext.getContext().getIdFormatter(); <END> Identity identity = null; if (original instanceof Account) { Account account = (Account) original; if (AccountConstants.PROJECT_KIND.equalsIgnoreCase(account.getKind())) { return converted; } if (account.getExternalId() != null && account.getExternalIdType() != null) { identity = identityManager.getIdentity( new Identity(account.getExternalIdType(), account.getExternalId()).getId()); } else { if (!AccountConstants.PROJECT_KIND.equalsIgnoreCase(account.getKind())) { identity = identityManager.getIdentity( new Identity(ProjectConstants.RANCHER_ID, String.valueOf(account.getId())).getId()); } } } if (identity != null) { if (idFormatter != null) { converted.getFields().put("identity", idFormatter.formatId("identity", identity.getId())); } else { converted.getFields().put("identity", identity.getId()); } } return converted; }</code><technical_language>of this code touch DB? If this means listing accounts pretty slow</technical_language>

Target:
public Resource filter(ApiRequest request, Object original, Resource converted) { IdFormatter idFormatter = ApiContext.getContext().getIdFormatter(); Identity identity = null; if (original instanceof Account) { Account account = (Account) original; if (AccountConstants.PROJECT_KIND.equalsIgnoreCase(account.getKind())) { return converted; } if (account.getExternalId() != null && account.getExternalIdType() != null) { identity = new Identity(account.getExternalIdType(), account.getExternalId()); } else { if (!AccountConstants.PROJECT_KIND.equalsIgnoreCase(account.getKind())) { identity = new Identity(ProjectConstants.RANCHER_ID, String.valueOf(account.getId())); } } } if (identity != null) { if (idFormatter != null) { converted.getFields().put("identity", idFormatter.formatId("identity", identity.getId())); } else { converted.getFields().put("identity", identity.getId()); } } return converted; }
Source:
<code>public Void call() throws Exception { try (ScmClient scmClient = parent.createScmClient()) { <START> if (isNullOrEmpty(factor) && isNullOrEmpty(state)) { <END> System.out.println("No filter. List all."); scmClient.listPipelines().forEach(System.out::println); } else { scmClient.listPipelines().stream() .filter(p -> ((isNullOrEmpty(factor) || (p.getFactor().toString().compareToIgnoreCase(factor) == 0)) && (isNullOrEmpty(state) || (p.getPipelineState().toString().compareToIgnoreCase(state) == 0)))) .forEach(System.out::println); } return null; } }</code><technical_language>Strings.isNullOrEmpty here</technical_language>

Target:
public Void call() throws Exception { try (ScmClient scmClient = parent.createScmClient()) { if (isNullOrEmpty(factor) && isNullOrEmpty(state)) { scmClient.listPipelines().forEach(System.out::println); } else { scmClient.listPipelines().stream() .filter(p -> ((isNullOrEmpty(factor) || (p.getFactor().toString().compareToIgnoreCase(factor) == 0)) && (isNullOrEmpty(state) || (p.getPipelineState().toString().compareToIgnoreCase(state) == 0)))) .forEach(System.out::println); } return null; } }
Source:
<code>public static Map<storage_domains, Integer> getSpaceRequirementsForStorageDomains(Map<DiskImage, storage_domains> imageToDomainMap) { <START> Map<storage_domains, Integer> map = new HashMap<storage_domains, Integer>(); <END> if (!imageToDomainMap.isEmpty()) { for(Map.Entry<DiskImage, storage_domains> entry : imageToDomainMap.entrySet()) { storage_domains domain = entry.getValue(); int size = (int) entry.getKey().getActualDiskWithSnapshotsSize(); if (map.containsKey(domain)) { map.put(domain, map.get(domain) + size); } else { map.put(domain, size); } } } return map; }</code><technical_language>unneeded check : imageToDomainMap.isEmpty(). is , nay case</technical_language>

Target:
public static Map<storage_domains, Long> getSpaceRequirementsForStorageDomains(Map<DiskImage, storage_domains> imageToDomainMap) { Map<storage_domains, Long> map = new HashMap<storage_domains, Long>(); for(Map.Entry<DiskImage, storage_domains> entry : imageToDomainMap.entrySet()) { storage_domains domain = entry.getValue(); long size = Math.round(entry.getKey().getActualDiskWithSnapshotsSize()); if (map.containsKey(domain)) { map.put(domain, map.get(domain) + size); } else { map.put(domain, size); } } return map; }
Source:
<code>public final void onInit() throws Exception { super.onInit(); if (this.executor != null) { Assert.state(getDispatcher().getHandlerCount() == 0, "When providing an Executor, you cannot subscribe() until the channel " + "bean is fully initialized by the framework. Do not subscribe in a @Bean definition"); if (!(this.executor instanceof ErrorHandlingTaskExecutor)) { if (this.errorHandler == null) { this.errorHandler = new MessagePublishingErrorHandler( new BeanFactoryChannelResolver(this.getBeanFactory())); } this.executor = new ErrorHandlingTaskExecutor(this.executor, this.errorHandler); } this.dispatcher = new BroadcastingDispatcher(this.executor); getDispatcher().setIgnoreFailures(this.ignoreFailures); getDispatcher().setApplySequence(this.applySequence); getDispatcher().setMinSubscribers(this.minSubscribers); } else if (this.errorHandler != null) { logger.warn("When 'executor' is not provided the 'errorHandler' is ignored and " + "exceptions are thrown directly within the sending Thread"); <START> } <END> if (this.maxSubscribers == null) { Integer maxSubscribers = getIntegrationProperty(IntegrationProperties.CHANNELS_MAX_BROADCAST_SUBSCRIBERS, Integer.class); this.setMaxSubscribers(maxSubscribers); } getDispatcher().setBeanFactory(this.getBeanFactory()); getDispatcher().setMessageHandlingTaskDecorator(task -> { if (PublishSubscribeChannel.this.executorInterceptorsSize > 0) { return new MessageHandlingTask(task); } else { return task; } }); }</code><technical_language>include componentName in message</technical_language>

Target:
public final void onInit() throws Exception { super.onInit(); if (this.executor != null) { Assert.state(getDispatcher().getHandlerCount() == 0, "When providing an Executor, you cannot subscribe() until the channel " + "bean is fully initialized by the framework. Do not subscribe in a @Bean definition"); if (!(this.executor instanceof ErrorHandlingTaskExecutor)) { if (this.errorHandler == null) { this.errorHandler = new MessagePublishingErrorHandler( new BeanFactoryChannelResolver(this.getBeanFactory())); } this.executor = new ErrorHandlingTaskExecutor(this.executor, this.errorHandler); } this.dispatcher = new BroadcastingDispatcher(this.executor); getDispatcher().setIgnoreFailures(this.ignoreFailures); getDispatcher().setApplySequence(this.applySequence); getDispatcher().setMinSubscribers(this.minSubscribers); } else if (this.errorHandler != null) { if (this.logger.isWarnEnabled()) { this.logger.warn("The 'errorHandler' is ignored for the '" + getComponentName() + "' (an 'executor' is not provided) and exceptions will be thrown " + "directly within the sending Thread"); } } if (this.maxSubscribers == null) { Integer maxSubscribers = getIntegrationProperty(IntegrationProperties.CHANNELS_MAX_BROADCAST_SUBSCRIBERS, Integer.class); this.setMaxSubscribers(maxSubscribers); } getDispatcher().setBeanFactory(this.getBeanFactory()); getDispatcher().setMessageHandlingTaskDecorator(task -> { if (PublishSubscribeChannel.this.executorInterceptorsSize > 0) { return new MessageHandlingTask(task); } else { return task; } }); }
Source:
<code>private <START> ArrayList<DataChangedEvent> <END> getReuseChangedEvents( Set<IComponentNamePO> reuseChangedCompNames) { ArrayList<DataChangedEvent> events = new ArrayList<DataChangedEvent>(); for (IComponentNamePO compName : reuseChangedCompNames) { events.add(new DataChangedEvent(compName, DataState.ReuseChanged, UpdateState.all)); } return events; }</code><technical_language>Please interfaces possible</technical_language>

Target:
private List<DataChangedEvent> getReuseChangedEvents( Set<IComponentNamePO> reuseChangedCompNames) { List<DataChangedEvent> events = new ArrayList<DataChangedEvent>(); for (IComponentNamePO compName : reuseChangedCompNames) { events.add(new DataChangedEvent(compName, DataState.ReuseChanged, UpdateState.all)); } return events; }
Source:
<code>public Iterable<Directive> process(final XML xml) throws IOException { final String rebase = this.profile.text( "/p/entry[@key='merge']/entry[@key='rebase']", "false" ); if ("true".equals(rebase)) { final Issue.Smart issue = new TalkIssues(this.github, xml).get(); issue.close(); <START> issue.comments().post("Closed manually because of rebase mode"); <END> } return new Directives(); }</code><technical_language>@vkuchyn English give explanation people of people working this understand :) I suggest: > Rultor closed this pull request for .rultor.yml of rebasing merging. GitHub mark rebased pull requests merged, rebasing entails a change in commit hashes. files merged merged rebase option set. please move this string resource bundle contains other strings please ? :)</technical_language>

Target:
public Iterable<Directive> process(final XML xml) throws IOException { final String rebase = this.profile.text( "/p/entry[@key='merge']/entry[@key='rebase']", "false" ); if ("true".equals(rebase)) { final Issue.Smart issue = new TalkIssues(this.github, xml).get(); issue.close(); issue.comments().post( ClosePullRequest.PHRASES.getString( "ClosePullRequest.explanation" ) ); } return new Directives(); }
Source:
<code>protected Vector<URL> searchResourcesInBundles(String name) { Vector<URL> urlList = new Vector<URL>(); <START> for (Bundle b : m_bundles) { <END> try { Enumeration resources = b.getResources(name); while (resources != null && resources.hasMoreElements()) { URL url = (URL) resources.nextElement(); urlList.add(url); } } catch (Exception e) { } } return urlList; }</code><technical_language>this method overridable, add a (protected) accessor for m_bundles well</technical_language>

Target:
protected Vector<URL> searchResourcesInBundles(String name) { Vector<URL> urlList = new Vector<URL>(); for (Bundle b : getBundles()) { try { Enumeration resources = b.getResources(name); while (resources != null && resources.hasMoreElements()) { URL url = (URL) resources.nextElement(); urlList.add(url); } } catch (Exception e) { } } return urlList; }
Source:
<code>public void refreshItem(T item) { Objects.requireNonNull(item, NULL_ITEM_ERROR_MESSAGE); getItems().filter(i -> equals(item, i)).findFirst() <START> .ifPresent(i -> dataProviderSupplier.get().refreshItem(i)); <END> }</code><technical_language>is this item calling refresh ??? If I data provider & communicator, item provided in event update - basically this code here, understanding, loose changes objects if matching identifiers. explain this: bean: Person:{ id=0, name="Liam" } new bean Person:{ id=0, name="William" } identifier is id field. new bean refresh, this code finds bean identifier. passes bean data provider fires event. data communicator event bean for refreshing update is missed. I missing</technical_language>

Target:
public void refreshItem(T item) { Objects.requireNonNull(item, NULL_ITEM_ERROR_MESSAGE); getItems() .filter(i -> equals(item, i)) .findFirst() .ifPresent(i -> dataProviderSupplier.get().refreshItem(item)); }
Source:
<code>public Set<ImmutableBitSet> getUniqueKeys(TableScan rel, RelMetadataQuery mq, boolean ignoreNulls) { final List<ImmutableBitSet> keys = rel.getTable().getKeys(); if (keys.isEmpty()) { return null; <START> } <END> for (ImmutableBitSet key : keys) { assert rel.getTable().isKey(key); } return ImmutableSet.copyOf(keys); }</code><technical_language>L233~L235 removed</technical_language>

Target:
public Set<ImmutableBitSet> getUniqueKeys(TableScan rel, RelMetadataQuery mq, boolean ignoreNulls) { final List<ImmutableBitSet> keys = rel.getTable().getKeys(); for (ImmutableBitSet key : keys) { assert rel.getTable().isKey(key); } return ImmutableSet.copyOf(keys); }
Source:
<code>private void setUserName() { View navHeaderView = navigationView.getHeaderView(0); TextView username = navHeaderView.findViewById(R.id.username); AccountManager accountManager = AccountManager.get(this); Account[] allAccounts = accountManager.getAccountsByType(BuildConfig.ACCOUNT_TYPE); if (allAccounts.length != 0) { username.setText(allAccounts[0].name); } ImageView userIcon = navHeaderView.findViewById(R.id.user_icon); userIcon.setOnClickListener(v -> { drawerLayout.closeDrawer(navigationView); AchievementsActivity.startYourself(NavigationBaseActivity.this); }); TextView userName = navHeaderView.findViewById(R.id.username); <START> userName.setOnClickListener(v -> { <END> drawerLayout.closeDrawer(navigationView); AchievementsActivity.startYourself(NavigationBaseActivity.this); }); }</code><technical_language>I sense extract onclick listener a method something, do simply need duplicate code, instead call a function :)</technical_language>

Target:
private void setUserName() { View navHeaderView = navigationView.getHeaderView(0); TextView username = navHeaderView.findViewById(R.id.username); AccountManager accountManager = AccountManager.get(this); Account[] allAccounts = accountManager.getAccountsByType(BuildConfig.ACCOUNT_TYPE); if (allAccounts.length != 0) { username.setText(allAccounts[0].name); } ImageView userIcon = navHeaderView.findViewById(R.id.user_icon); makeClickable(userIcon, NavigationBaseActivity.this, AchievementsActivity.class); TextView userName = navHeaderView.findViewById(R.id.username); makeClickable(userName, NavigationBaseActivity.this, AchievementsActivity.class); }
Source:
<code>void publish(StatsWrapper statsWrapper) throws IOException { if (!statsOutputFile.exists()) { statsOutputFile.createNewFile(); } <START> OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(statsOutputFile)); <END> DatumWriter<StatsWrapper> statsWrapperDatumWriter = new SpecificDatumWriter<StatsWrapper>(StatsWrapper.class); JsonEncoder jsonEncoder = EncoderFactory.get().jsonEncoder(StatsWrapper.getClassSchema(), outputStream, true); try { statsWrapperDatumWriter.write(statsWrapper, jsonEncoder); jsonEncoder.flush(); outputStream.flush(); } finally { outputStream.close(); } }</code><technical_language>write a temp file rename. StoreDescriptor for eg</technical_language>

Target:
void publish(StatsWrapper statsWrapper) throws IOException { File tempFile = new File(statsOutputFile.getAbsolutePath() + ".tmp"); if (tempFile.createNewFile()) { OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(tempFile)); DatumWriter<StatsWrapper> statsWrapperDatumWriter = new SpecificDatumWriter<StatsWrapper>(StatsWrapper.class); JsonEncoder jsonEncoder = EncoderFactory.get().jsonEncoder(StatsWrapper.getClassSchema(), outputStream, true); try { statsWrapperDatumWriter.write(statsWrapper, jsonEncoder); jsonEncoder.flush(); outputStream.flush(); } finally { outputStream.close(); } if (!tempFile.renameTo(statsOutputFile)) { throw new IOException( "Failed to rename " + tempFile.getAbsolutePath() + " to " + statsOutputFile.getAbsolutePath()); } } else { throw new IOException("Temporary file creation failed when publishing stats " + tempFile.getAbsolutePath()); } }
Source:
<code>public QueueConfiguration getQueueConfiguration() { return new QueueConfiguration(name) .setAddress(address) .setId(id) .setRoutingType(routingType) <START> .setFilterString(filter == null ? null : filter.getFilterString()) <END> .setDurable(isDurable()) .setUser(user) .setMaxConsumers(maxConsumers) .setExclusive(exclusive) .setGroupRebalance(groupRebalance) .setGroupBuckets(groupBuckets) .setGroupFirstKey(groupFirstKey) .setLastValue(false) .setLastValue(null) .setNonDestructive(nonDestructive) .setPurgeOnNoConsumers(purgeOnNoConsumers) .setConsumersBeforeDispatch(consumersBeforeDispatch) .setDelayBeforeDispatch(delayBeforeDispatch) .setAutoDelete(autoDelete) .setAutoDeleteDelay(autoDeleteDelay) .setAutoDeleteMessageCount(autoDeleteMessageCount) .setRingSize(ringSize) .setConfigurationManaged(configurationManaged) .setTemporary(temporary) .setInternal(internalQueue) .setTransient(refCountForConsumers instanceof TransientQueueManagerImpl) .setAutoCreated(autoCreated); }</code><technical_language>rebase, this is fixed in master</technical_language>

Target:
public QueueConfiguration getQueueConfiguration() { return new QueueConfiguration(name) .setAddress(address) .setId(id) .setRoutingType(routingType) .setFilterString(filter == null ? null : filter.getFilterString()) .setDurable(isDurable()) .setUser(user) .setMaxConsumers(maxConsumers) .setExclusive(exclusive) .setGroupRebalance(groupRebalance) .setGroupBuckets(groupBuckets) .setGroupFirstKey(groupFirstKey) .setLastValue(false) .setLastValueKey((String) null) .setNonDestructive(nonDestructive) .setPurgeOnNoConsumers(purgeOnNoConsumers) .setConsumersBeforeDispatch(consumersBeforeDispatch) .setDelayBeforeDispatch(delayBeforeDispatch) .setAutoDelete(autoDelete) .setAutoDeleteDelay(autoDeleteDelay) .setAutoDeleteMessageCount(autoDeleteMessageCount) .setRingSize(ringSize) .setConfigurationManaged(configurationManaged) .setTemporary(temporary) .setInternal(internalQueue) .setTransient(refCountForConsumers instanceof TransientQueueManagerImpl) .setAutoCreated(autoCreated); }
Source:
<code>public PreparedOperationWithReactiveStream<Cursor> prepare() { <START> Checks.checkNotNull(query, "Please specify query"); <END> if (getResolver == null) { getResolver = DefaultGetResolver.INSTANCE; } return new PreparedGetCursor( storIOContentProvider, getResolver, query ); }</code><technical_language>Static method import please</technical_language>

Target:
public PreparedOperationWithReactiveStream<Cursor> prepare() { checkNotNull(query, "Please specify query"); if (getResolver == null) { getResolver = DefaultGetResolver.INSTANCE; } return new PreparedGetCursor( storIOContentProvider, getResolver, query ); }
Source:
<code>public void setup() throws TmfTraceException { fTrace = new TmfXmlTraceStubNs(); fTrace.initTrace(null, COUNTER_FILE, ITmfEvent.class); fTrace.addEventAspect(new TmfContentFieldAspect("aspect")); fTrace.addEventAspect(new CounterAspect("counter", "counter")); fTrace.addEventAspect(new CounterAspect("counter", "counter", TmfCpuAspect.class)); fTrace.addEventAspect(new CounterAspect("counter", "counter", TmfCpuAspect.class) { @Override public boolean isCumulative() { return true; } }); assertEquals(8, Iterables.size(fTrace.getEventAspects())); <START> if (fTrace != null) { fStateProvider = CounterStateProvider.create(fTrace); } <END> IStateHistoryBackend backend = StateHistoryBackendFactory.createInMemoryBackend("CounterStateSystem", 0); fSsb = StateSystemFactory.newStateSystem(backend); fStateProvider.assignTargetStateSystem(fSsb); }</code><technical_language>want a silent fail here, extract a local variable trace = fTrace, assert is null instead</technical_language>

Target:
public void setup() throws TmfTraceException { TmfXmlTraceStubNs trace = new TmfXmlTraceStubNs(); trace.initTrace(null, COUNTER_FILE, ITmfEvent.class); trace.addEventAspect(new TmfContentFieldAspect("aspect")); trace.addEventAspect(new CounterAspect("counter", "counter")); trace.addEventAspect(new CounterAspect("counter", "counter", TmfCpuAspect.class)); trace.addEventAspect(new CounterAspect("counter", "counter", TmfCpuAspect.class) { @Override public boolean isCumulative() { return true; } }); assertEquals(8, Iterables.size(trace.getEventAspects())); fStateProvider = CounterStateProvider.create(trace); IStateHistoryBackend backend = StateHistoryBackendFactory.createInMemoryBackend("CounterStateSystem", 0); fSsb = StateSystemFactory.newStateSystem(backend); fStateProvider.assignTargetStateSystem(fSsb); fTrace = trace; }
Source:
<code>private HttpClient getDeleteHttpClient() { return new HttpClient() { @Override public CompletionStage<HttpResponse> execute(final HttpRequest httpRequest) { if (httpRequest.getUrl().contains("version=5")) { return CompletableFuture.completedFuture(HttpResponse.of(409, "{\n" + " \"statusCode\" : 409,\n" + " \"message\" : \"Version mismatch. Concurrent modification.\",\n" + " \"errors\" : [ {\n" + " \"code\" : \"ConcurrentModification\",\n" + " \"message\" : \"Version mismatch. Concurrent modification.\",\n" + " \"currentVersion\" : 7\n" + " } ]\n" + "}")); } else if (httpRequest.getUrl().contains("version=7")) { return CompletableFuture.completedFuture(HttpResponse.of(200, "{\"id\": \"some-id\", \"version\": 7}")); } else { <START> throw new IllegalArgumentException("unexcpected input"); <END> } } @Override public void close() { } }; }</code><technical_language>unexpected</technical_language>

Target:
private HttpClient getDeleteHttpClient() { return new HttpClient() { @Override public CompletionStage<HttpResponse> execute(final HttpRequest httpRequest) { if (httpRequest.getUrl().contains("version=5")) { return CompletableFuture.completedFuture(HttpResponse.of(409, "{\n" + " \"statusCode\" : 409,\n" + " \"message\" : \"Version mismatch. Concurrent modification.\",\n" + " \"errors\" : [ {\n" + " \"code\" : \"ConcurrentModification\",\n" + " \"message\" : \"Version mismatch. Concurrent modification.\",\n" + " \"currentVersion\" : 7\n" + " } ]\n" + "}")); } else if (httpRequest.getUrl().contains("version=7")) { return CompletableFuture.completedFuture(HttpResponse.of(200, "{\"id\": \"some-id\", \"version\": 7}")); } else { throw new IllegalArgumentException("unexpected input"); } } @Override public void close() { } }; }
Source:
<code>public String locateContainer(String alias, List<? extends KieContainerInstance> containerInstances) { if (containerId != null) { logger.debug("Container id has already been found for case and is {}", caseId, containerId); return containerId; } logger.debug("Searching for container id for case id and alias {}", caseId, alias); <START> EntityManager em = EntityManagerFactoryManager.get().getOrCreate("org.jbpm.domain").createEntityManager(); <END> try { containerId = (String)em.createQuery(CONTAINER_ID_QUERY) .setParameter("caseId", caseId) .getSingleResult(); logger.debug("Found container id '{}' for case id {}", containerId, caseId); return containerId; } catch (NoResultException | NonUniqueResultException e) { throw new IllegalArgumentException("Case with id " + caseId + " not found"); } finally { em.close(); } }</code><technical_language>good place persistence unit name constant some shared place KieServerConstants avoid duplication. is in JbpmKieServerExtension CaseKieServerExtension locators</technical_language>

Target:
public String locateContainer(String alias, List<? extends KieContainerInstance> containerInstances) { if (containerId != null) { logger.debug("Container id has already been found for case and is {}", caseId, containerId); return containerId; } logger.debug("Searching for container id for case id and alias {}", caseId, alias); EntityManager em = EntityManagerFactoryManager.get().getOrCreate(KieServerConstants.KIE_SERVER_PERSISTENCE_UNIT_NAME).createEntityManager(); try { containerId = (String)em.createQuery(CONTAINER_ID_QUERY) .setParameter("caseId", caseId) .getSingleResult(); logger.debug("Found container id '{}' for case id {}", containerId, caseId); return containerId; } catch (NoResultException | NonUniqueResultException e) { throw new IllegalArgumentException("Case with id " + caseId + " not found"); } finally { em.close(); } }