auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void run(final long iterationDurationNanos, final long ttlNanos) throws Throwable { final Supplier<Long> s = new Supplier<Long>() { private long value; @Override public Long get() { return ++value; } }; final Supplier<Long> m = memoize(s, ttlNanos); final Collection<Future<Void>> results = new ArrayList<>(); final long beginNanos = System.nanoTime(); for (int tid = 0; tid < numberOfThreads; tid++) { results.add(ex.submit(() -> { Long previousValue = m.get(); assertNotNull(previousValue); assertTrue(previousValue > 0); final long firstSupplierCallNanos = System.nanoTime(); boolean guaranteedIteration = false; long now; while ((now = System.nanoTime()) < beginNanos + iterationDurationNanos <START> || now < firstSupplierCallNanos + ttlNanos || (guaranteedIteration = !guaranteedIteration)) { <END> if (Thread.currentThread().isInterrupted()) { throw new InterruptedException(); } final Long newValue = m.get(); assertNotNull(newValue); assertTrue(String.format("newValue=%s, previousValue=%s", newValue, previousValue), newValue >= previousValue); previousValue = newValue; } return null; })); } finishAllThreads(results); final long actualNumberOfIncrements = s.get() - 1; testIncrementCounts(actualNumberOfIncrements, iterationDurationNanos, ttlNanos); }</code><technical_language>Notice expirationNanos is compared in Memoizer.memoize: long nanos = expirationNanos; - nanos >= 0; A delta is compared 0 comparing >= nanos. for fun :)</technical_language>

Target:
private void run(final long iterationDurationNanos, final long ttlNanos) throws Throwable { final Supplier<Long> s = new Supplier<Long>() { private long value; @Override public Long get() { return ++value; } }; final Supplier<Long> m = memoize(s, ttlNanos); final Collection<Future<Void>> results = new ArrayList<>(); final long beginNanos = System.nanoTime(); for (int tid = 0; tid < numberOfThreads; tid++) { results.add(ex.submit(() -> { Long previousValue = m.get(); assertNotNull(previousValue); assertTrue(previousValue > 0); final long firstSupplierCallNanos = System.nanoTime(); boolean guaranteedIteration = false; long now; while ((now = System.nanoTime()) - beginNanos < iterationDurationNanos || now - firstSupplierCallNanos < ttlNanos || (guaranteedIteration = !guaranteedIteration)) { if (Thread.currentThread().isInterrupted()) { throw new InterruptedException(); } final Long newValue = m.get(); assertNotNull(newValue); assertTrue(String.format("newValue=%s, previousValue=%s", newValue, previousValue), newValue >= previousValue); previousValue = newValue; } return null; })); } finishAllThreads(results); final long actualNumberOfIncrements = s.get() - 1; testIncrementCounts(actualNumberOfIncrements, iterationDurationNanos, ttlNanos); }
Source:
<code>public IndexOrder[] orderCapability( ValueGroup... valueGroups ) { if ( support( valueGroups ) ) { <START> return new IndexOrder[]{IndexOrder.ASCENDING}; <END> } return new IndexOrder[0]; }</code><technical_language>do need new arrays time right</technical_language>

Target:
public IndexOrder[] orderCapability( ValueGroup... valueGroups ) { if ( support( valueGroups ) ) { return SUPPORTED_ORDER; } return EMPTY_ORDER; }
Source:
<code>public boolean isAnyErrorChild(long taskId) { return handle.createQuery( "select parent_id from tasks" + " where id in (" + "select max(t.id) from tasks t join task_details td on t.id=td.id" + <START> " where parent_id = :parentId group by td.full_name" + <END> ") and (" + "state = " + TaskStateCode.ERROR.get() + " or state = " + TaskStateCode.GROUP_ERROR.get() + ") limit 1" ) .bind("parentId", taskId) .mapTo(Long.class) .first() != null; }</code><technical_language>write group clause next new line</technical_language>

Target:
public boolean isAnyErrorChild(long taskId) { return handle.createQuery( "select parent_id from tasks" + " where id in (" + "select max(t.id) from tasks t join task_details td on t.id = td.id" + " where parent_id = :parentId" + " group by td.full_name" + ") and (" + "state = " + TaskStateCode.ERROR.get() + " or state = " + TaskStateCode.GROUP_ERROR.get() + ") limit 1" ) .bind("parentId", taskId) .mapTo(Long.class) .first() != null; }
Source:
<code><START> public List<Account> getNewAccounts(long updatedSince) throws SQLException { <END> return accountDao.getNewAccounts(updatedSince); }</code><technical_language>change return type List Collection in this file</technical_language>

Target:
public Collection<Account> getNewAccounts(long updatedSince) throws SQLException { return accountDao.getNewAccounts(updatedSince); }
Source:
<code>protected Call enqueue(Request request, okhttp3.Callback requestCallback) { Context context = ButterApplication.getAppContext(); PackageInfo pInfo; String versionName = "0.0.0"; try { pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); versionName = pInfo.versionName; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } request = request .newBuilder().removeHeader("User-Agent") .addHeader("User-Agent", String.format( "Mozilla/5.0 (Linux; U; Android %s; %s; %s Build/%s) AppleWebkit/534.30 (KHTML, like Gecko) PT/%s", Build.VERSION.RELEASE, LocaleUtils.getCurrentAsString(), Build.MODEL, Build.DISPLAY, versionName)).build(); Call call = super.enqueue(request, requestCallback); <START> synchronized (ongoingCalls) { <END> ongoingCalls.add(call); } return call; }</code><technical_language>In some scenarios this produce a bottleneck if do multiple request for kind of movies provider instance (as popcorn does). OkHttp Dispatcher handle calls internally calls accesible queuedCalls() runningCalls(), In opinion cancel tag mechanism is logic moved Media Base provider providers clean possible</technical_language>

Target:
protected Call enqueue(Request request, okhttp3.Callback requestCallback) { Context context = ButterApplication.getAppContext(); PackageInfo pInfo; String versionName = "0.0.0"; try { pInfo = context.getPackageManager().getPackageInfo(context.getPackageName(), 0); versionName = pInfo.versionName; } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } request = request .newBuilder().removeHeader("User-Agent") .addHeader("User-Agent", String.format( "Mozilla/5.0 (Linux; U; Android %s; %s; %s Build/%s) AppleWebkit/534.30 (KHTML, like Gecko) PT/%s", Build.VERSION.RELEASE, LocaleUtils.getCurrentAsString(), Build.MODEL, Build.DISPLAY, versionName)).build(); return super.enqueue(request, requestCallback); }
Source:
<code>private void onAddAddressesToClipboard(Address[] addresses){ <START> if(mMessage != null){ <END> try{ String addressesToCopy = ""; for(Address addressTemp : addresses){ addressesToCopy += addressTemp.getAddress() + " "; } addressesToCopy = addressesToCopy.substring(0,addressesToCopy.length()-1); ClipboardManager.getInstance(mContext).setText("addresses", addressesToCopy); Toast.makeText(mContext, R.string.copy_address_to_clipboard, Toast.LENGTH_LONG).show(); } catch (Exception e){ Log.e(K9.LOG_TAG, "Couldn't add addresses to clipboard"); } } }</code><technical_language>This check is unnecessary mMessage is method. Also, time get mMessage dereferenced in code paths lead here</technical_language>

Target:
private void onAddAddressesToClipboard(Address[] addresses){ StringBuilder addressesToCopy = new StringBuilder(); for(Address addressTemp : addresses){ addressesToCopy.append(addressTemp.getAddress() + " "); } addressesToCopy = addressesToCopy.deleteCharAt(addressesToCopy.length()-1); ClipboardManager.getInstance(mContext).setText("addresses", addressesToCopy.toString()); Toast.makeText(mContext, createMessage(addresses.length), Toast.LENGTH_LONG).show(); }
Source:
<code>public void checkContainers() { if ( currentCandidates.size() == 0 ) { currentCandidates.addAll(getCandidates()); } int count = 0; Iterator<String> iterator = currentCandidates.iterator(); while ( iterator.hasNext() ) { if ( count++ >= maxPerInterval ) { <START> LOG.info("Stopping at " + maxPerInterval); <END> break; } String containerPath = iterator.next(); iterator.remove(); ByteBuffer path = ByteBuffer.wrap(containerPath.getBytes()); Request request = new Request(null, 0, 0, ZooDefs.OpCode.deleteContainer, path, null); try { LOG.info("Attempting to delete candidate container: " + containerPath); requestProcessor.processRequest(request); } catch (Exception e) { LOG.error("Could not delete container: " + containerPath, e); } } }</code><technical_language>imho, maxPerSecond is (simpler understand)</technical_language>

Target:
public void checkContainers() throws InterruptedException { long minIntervalMs = getMinIntervalMs(); for (String containerPath : getCandidates()) { long startMs = Time.currentElapsedTime(); ByteBuffer path = ByteBuffer.wrap(containerPath.getBytes()); Request request = new Request(null, 0, 0, ZooDefs.OpCode.deleteContainer, path, null); try { LOG.info("Attempting to delete candidate container: %s", containerPath); requestProcessor.processRequest(request); } catch (Exception e) { LOG.error(String.format("Could not delete container: %s" , containerPath), e); } long elapsedMs = Time.currentElapsedTime() - startMs; long waitMs = minIntervalMs - elapsedMs; if (waitMs > 0) { Thread.sleep(waitMs); } } }
Source:
<code><START> public List<ActionValueObjectResponseDto> getActionValueObjectResponseDto() { <END> return this.actionValueObjectResponseDtoList; }</code><technical_language>Choosing method names deviate Java Bean naming conventions problems for Orika mapping framework's default mapping strategies. For a field named actionValueObjectResponseDtoList getter ehould getActionValueObjectResponseDtoList() (or a field actionValueObjectResponseDtos getter getActionValueObjectResponseDtos())</technical_language>

Target:
public List<ActionResponseDto> getActionValueObjectResponseDto() { return new ArrayList<ActionResponseDto>(this.actionValueObjectResponseDtoList); }
Source:
<code>public void testBlogAndArticleAreNotIndexedInDraftStatus() throws Exception { Transaction tx = fullTextSession.beginTransaction(); List<Blog> blogEntries = getBlogEntries(); <START> assertThat( blogEntries ).as( "Blog is explicit intercepted" ).excludes( blog ); <END> assertThat( blogEntries ).as( "Article is inherently intercepted" ).excludes( article ); tx.commit(); }</code><technical_language>If end amending this commit, fix message "explicitly"</technical_language>

Target:
public void testBlogAndArticleAreNotIndexedInDraftStatus() throws Exception { Transaction tx = fullTextSession.beginTransaction(); List<Blog> blogEntries = getBlogEntries(); assertThat( blogEntries ).as( "Blog is explicitly intercepted" ).excludes( blog ); assertThat( blogEntries ).as( "Article is inherently intercepted" ).excludes( article ); tx.commit(); }
Source:
<code>public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((fField == null) ? 0 : fField.hashCode()); result = prime * result + (fNot ? 1231 : 1237); <START> result = prime * result + ((fPattern == null) ? 0 : fPattern.hashCode()); <END> result = prime * result + ((fRegex == null) ? 0 : fRegex.hashCode()); return result; }</code><technical_language>fPattern is derived fRegex need considered for hashCode() equals()</technical_language>

Target:
public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((fField == null) ? 0 : fField.hashCode()); result = prime * result + (fNot ? 1231 : 1237); result = prime * result + ((fRegex == null) ? 0 : fRegex.hashCode()); return result; }
Source:
<code>private void deleteSelfFromLambdaEvents(User user) { lambdaEventDAO.findByUser(user).stream() <START> .filter(lambdaEvent -> lambdaEvent.getUser() == user) <END> .forEach(lambdaEvent -> lambdaEvent.setUser(null)); }</code><technical_language>difference this filter DAO findByUser</technical_language>

Target:
private void deleteSelfFromLambdaEvents(User user) { lambdaEventDAO.findByUser(user).stream().forEach(lambdaEvent -> lambdaEvent.setUser(null)); }
Source:
<code>public void should_fail_if_no_methods_are_expected_and_methods_are_available() { TreeSet<String> expectedMethods = newTreeSet("publicMethod", "protectedMethod", "privateMethod", "finalize", "wait", "equals", "toString", "hashCode", "getClass", "clone", "notify", "notifyAll"); BigDecimal javaVersion = new BigDecimal(System.getProperty("java.specification.version")); <START> if (javaVersion.compareTo(new BigDecimal("14")) < 0) { <END> expectedMethods.add("registerNatives"); } assertThatExceptionOfType(AssertionError.class).isThrownBy(() -> classes.assertHasMethods(someInfo(), actual)) .withMessage(format(shouldNotHaveMethods(actual, false, expectedMethods).create())); }</code><technical_language>extract new BigDecimal("14") a constant</technical_language>

Target:
public void should_fail_if_no_methods_are_expected_and_methods_are_available() { SortedSet<String> expectedMethods = newTreeSet("publicMethod", "protectedMethod", "privateMethod", "finalize", "wait", "equals", "toString", "hashCode", "getClass", "clone", "notify", "notifyAll"); if (isJavaVersionBefore14()) { expectedMethods.add("registerNatives"); } assertThatAssertionErrorIsThrownBy(() -> classes.assertHasMethods(someInfo(), actual)) .withMessage(format(shouldNotHaveMethods(actual, false, expectedMethods).create())); }
Source:
<code>public String toString() { return "Alert{" + "name=" + name + ", expression=" + expression + ", cronEntry=" + cronEntry + ", enabled=" + enabled + <START> ", missingDataNotificationEnabled=" + missingDataNotificationEnabled + ", notifications=" + notifications + ", triggers=" + triggers + <END> ", owner=" + owner + '}'; }</code><technical_language>Add shared state</technical_language>

Target:
public String toString() { return "Alert{" + "name=" + name + ", expression=" + expression + ", cronEntry=" + cronEntry + ", enabled=" + enabled + ", missingDataNotificationEnabled=" + missingDataNotificationEnabled + ", notifications=" + notifications + ", triggers=" + triggers + ", owner=" + owner + ", shared=" + shared + '}'; }
Source:
<code>public TextTrackScore( Format format, Parameters parameters, int trackFormatSupport, @Nullable String selectedAudioLanguage) { isWithinRendererCapabilities = isSupported(trackFormatSupport, false); int maskedSelectionFlags = format.selectionFlags & ~parameters.disabledTextTrackSelectionFlags; <START> isDefault = (format.selectionFlags & C.SELECTION_FLAG_DEFAULT) != 0; <END> isForced = (maskedSelectionFlags & C.SELECTION_FLAG_FORCED) != 0; preferredLanguageScore = getFormatLanguageScore(format, parameters.preferredTextLanguage); selectedAudioLanguageScore = getFormatLanguageScore(format, selectedAudioLanguage); trackHasNoLanguage = formatHasNoLanguage(format); selectUndeterminedTextLanguage = parameters.selectUndeterminedTextLanguage; stringDefinesNoLang = stringDefinesNoLanguage(selectedAudioLanguage); }</code><technical_language>needs maskedSelectionFlags too</technical_language>

Target:
public TextTrackScore( Format format, Parameters parameters, int trackFormatSupport, @Nullable String selectedAudioLanguage) { isWithinRendererCapabilities = isSupported(trackFormatSupport, false); int maskedSelectionFlags = format.selectionFlags & ~parameters.disabledTextTrackSelectionFlags; isDefault = (maskedSelectionFlags & C.SELECTION_FLAG_DEFAULT) != 0; isForced = (maskedSelectionFlags & C.SELECTION_FLAG_FORCED) != 0; preferredLanguageScore = getFormatLanguageScore(format, parameters.preferredTextLanguage); selectedAudioLanguageScore = getFormatLanguageScore(format, selectedAudioLanguage); trackHasNoLanguage = formatHasNoLanguage(format); hasLanguageMatch = preferredLanguageScore > 0 || (parameters.selectUndeterminedTextLanguage && trackHasNoLanguage); hasSelectedAudioLanguageMatch = (selectedAudioLanguageScore > 0) || (trackHasNoLanguage && stringDefinesNoLanguage(selectedAudioLanguage)); isWithinConstraints = (hasLanguageMatch || isDefault || (isForced && hasSelectedAudioLanguageMatch)); }
Source:
<code>public Map<String, String> getDefaults() { <START> Map<String, String> allDefaults = new HashMap(); <END> allDefaults.putAll(defaults); allDefaults.putAll(logLoadableOptions.getDefaults()); return allDefaults; }</code><technical_language>linked hash map please</technical_language>

Target:
public Map<String, String> getDefaults() { Map<String, String> allDefaults = new LinkedHashMap(super.getDefaults()); allDefaults.putAll(logLoadableOptions.getDefaults()); allDefaults.put(INCLUDE_PARAMETER_VALUES, Boolean.FALSE.toString()); return allDefaults; }
Source:
<code>private void initMessageBusListeners() { _messageBus.subscribe(DomainManager.MESSAGE_ADD_DOMAIN_EVENT, new MessageSubscriber() { @Override public void onPublishMessage(String senderAddress, String subject, Object args) { Long domainId = (Long) args; Domain domain = _domainDao.findById(domainId); try { _domainDao.acquireInLockTable(domain.getId()); List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listAll(); for (NuageVspDeviceVO nuageVspDevice : nuageVspDevices) { HostVO host = findNuageVspHost(nuageVspDevice.getHostId()); SyncDomainCommand cmd = new SyncDomainCommand(domain.getUuid(), domain.getName(), domain.getPath(), true, false); _agentMgr.easySend(host.getId(), cmd); } <START> } catch (Exception e) { <END> s_logger.error(e.getMessage()); } finally { _domainDao.releaseFromLockTable(domain.getId()); } } }); _messageBus.subscribe(DomainManager.MESSAGE_REMOVE_DOMAIN_EVENT, new MessageSubscriber() { @Override public void onPublishMessage(String senderAddress, String subject, Object args) { DomainVO domain = (DomainVO) args; try { List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listAll(); for (NuageVspDeviceVO nuageVspDevice : nuageVspDevices) { HostVO host = findNuageVspHost(nuageVspDevice.getHostId()); SyncDomainCommand cmd = new SyncDomainCommand(domain.getUuid(), domain.getName(), domain.getPath(), false, true); _agentMgr.easySend(host.getId(), cmd); } } catch (Exception e) { s_logger.error(e.getMessage()); } } }); }</code><technical_language>checked unchecked exceptions caught ignored</technical_language>

Target:
private void initMessageBusListeners() { _messageBus.subscribe(DomainManager.MESSAGE_ADD_DOMAIN_EVENT, new MessageSubscriber() { @Override public void onPublishMessage(String senderAddress, String subject, Object args) { Long domainId = (Long) args; Domain domain = _domainDao.findById(domainId); try { _domainDao.acquireInLockTable(domain.getId()); List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listAll(); for (NuageVspDeviceVO nuageVspDevice : nuageVspDevices) { HostVO host = findNuageVspHost(nuageVspDevice.getHostId()); SyncDomainCommand cmd = new SyncDomainCommand(domain.getUuid(), domain.getName(), domain.getPath(), true, false); _agentMgr.easySend(host.getId(), cmd); } } finally { _domainDao.releaseFromLockTable(domain.getId()); } } }); _messageBus.subscribe(DomainManager.MESSAGE_REMOVE_DOMAIN_EVENT, new MessageSubscriber() { @Override public void onPublishMessage(String senderAddress, String subject, Object args) { DomainVO domain = (DomainVO) args; List<NuageVspDeviceVO> nuageVspDevices = _nuageVspDao.listAll(); for (NuageVspDeviceVO nuageVspDevice : nuageVspDevices) { HostVO host = findNuageVspHost(nuageVspDevice.getHostId()); SyncDomainCommand cmd = new SyncDomainCommand(domain.getUuid(), domain.getName(), domain.getPath(), false, true); _agentMgr.easySend(host.getId(), cmd); } } }); }
Source:
<code>public static InputStream getFileInputStream(String filepath, SecretKeySpec symetricKey) { final File file = new File(filepath); InputStream is; try { is = new FileInputStream(file); if (symetricKey != null) { Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.DECRYPT_MODE, symetricKey); is = new BufferedInputStream(new CipherInputStream(is, cipher)); } return is; <START> } catch (FileNotFoundException e) { <END> Log.e(TAG, "Cannot find " + file.getName()); e.printStackTrace(); return null; } catch (InvalidKeyException | NoSuchPaddingException | NoSuchAlgorithmException e) { e.printStackTrace(); throw new RuntimeException(e); } }</code><technical_language>copied this over, is a reason this returns null instead of forwarding result previous method</technical_language>

Target:
public static InputStream getFileInputStream(String filepath, SecretKeySpec symetricKey) throws FileNotFoundException{ final File file = new File(filepath); InputStream is; try { is = new FileInputStream(file); if (symetricKey != null) { Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.DECRYPT_MODE, symetricKey); is = new BufferedInputStream(new CipherInputStream(is, cipher)); } return is; } catch (InvalidKeyException | NoSuchPaddingException | NoSuchAlgorithmException e) { e.printStackTrace(); throw new RuntimeException(e); } }
Source:
<code>public Events list() { if (isFiltered()) { <START> return mapCollection(getBackendCollection(VdcQueryType.GetEventMessages, new GetEventMessagesParameters())); <END> } else { return mapCollection(getBackendCollection()); } }</code><technical_language>query caled GetAllEventMessages</technical_language>

Target:
public Events list() { if (isFiltered()) { return mapCollection(getBackendCollection(VdcQueryType.GetAllEventMessages, new GetEventMessagesParameters())); } else { return mapCollection(getBackendCollection()); } }
Source:
<code>public void mocking_inner_classes_with_wrong_outer_instance() { try { mock(InnerClass.class, withSettings().useConstructor().outerInstance("foo").defaultAnswer(CALLS_REAL_METHODS)); fail(); } catch (MockitoException e) { assertThat(e).hasMessage("Unable to create mock instance of type 'InnerClass'"); <START> assertThat(e.getCause()).hasMessageContaining("Please ensure that it has a constructor that matches these arguments: [foo]"); <END> } }</code><technical_language>I is more useful user types of arguments of argument. If want push this further, inspect existing constructor arguments for class list out user. I find necessary merge this change, though. Food for thought</technical_language>

Target:
public void mocking_inner_classes_with_wrong_outer_instance() { try { mock(InnerClass.class, withSettings().useConstructor().outerInstance(123).defaultAnswer(CALLS_REAL_METHODS)); fail(); } catch (MockitoException e) { assertThat(e).hasMessage("Unable to create mock instance of type 'InnerClass'"); assertThat(e.getCause()).hasMessageContaining( "Please ensure that the target class has a 0-arg constructor" + " and that it's indeed an inner class of the passed instance of type java.lang.Integer"); } }
Source:
<code>public void attachContainerStdinUnsupported() throws Exception { DockerClient dockerClient = dockerRule.getClient(); Assume.assumeFalse("does not support stdin attach", getFactoryType().supportsStdinAttach()); expectedException.expect(UnsupportedOperationException.class); String snippet = "hello world"; CreateContainerResponse container = dockerClient.createContainerCmd(DEFAULT_IMAGE) .withCmd("echo", snippet) .withTty(false) .withAttachStdin(true) .withAttachStdout(true) .withAttachStderr(true) .exec(); LOG.info("Created container: {}", container.toString()); assertThat(container.getId(), not(is(emptyString()))); AttachContainerTestCallback callback = new AttachContainerTestCallback() { @Override public void onNext(Frame frame) { assertThat(frame.getStreamType(), equalTo(StreamType.STDOUT)); super.onNext(frame); } }; InputStream stdin = new ByteArrayInputStream("".getBytes()); <START> <END> dockerClient.attachContainerCmd(container.getId()) .withStdErr(true) .withStdOut(true) .withFollowStream(true) .withLogs(true) .withStdIn(stdin) .exec(callback); callback.awaitCompletion(30, TimeUnit.SECONDS); callback.close(); }</code><technical_language>I this line stay. Otherwise, completion happen</technical_language>

Target:
public void attachContainerStdinUnsupported() throws Exception { DockerClient dockerClient = dockerRule.getClient(); Assume.assumeFalse("does not support stdin attach", getFactoryType().supportsStdinAttach()); expectedException.expect(UnsupportedOperationException.class); String snippet = "hello world"; CreateContainerResponse container = dockerClient.createContainerCmd(DEFAULT_IMAGE) .withCmd("echo", snippet) .withTty(false) .withAttachStdin(true) .withAttachStdout(true) .withAttachStderr(true) .exec(); LOG.info("Created container: {}", container.toString()); assertThat(container.getId(), not(is(emptyString()))); AttachContainerTestCallback callback = new AttachContainerTestCallback() { @Override public void onNext(Frame frame) { assertThat(frame.getStreamType(), equalTo(StreamType.STDOUT)); super.onNext(frame); } }; InputStream stdin = new ByteArrayInputStream("".getBytes()); dockerClient.attachContainerCmd(container.getId()) .withStdErr(true) .withStdOut(true) .withFollowStream(true) .withLogs(true) .withStdIn(stdin) .exec(callback); assertFalse("Processing of the response is not expected to be started" + " because `attachContainerCmd` with stdin is not supported", callback.awaitStarted(5, SECONDS)); dockerClient.startContainerCmd(container.getId()).exec(); callback.awaitCompletion(30, TimeUnit.SECONDS); callback.close(); }
Source:
<code>public static void init() { <START> if (Display.getCurrent() != null && Display.getCurrent().getThread() == Thread.currentThread()) { <END> fail("SWTBot test needs to run in a non-UI thread. Make sure that \"Run in UI thread\" is unchecked in your launch configuration or" + " that useUIThread is set to false in the pom.xml"); } Thread.currentThread().setName("SWTBot Thread"); SWTBotPreferences.TIMEOUT = 20000; fLogger.addAppender(new NullAppender()); fBot = new SWTWorkbenchBot(); SWTBotUtil.closeView("welcome", fBot); SWTBotUtil.switchToTracingPerspective(); SWTBotUtil.waitForJobs(); }</code><technical_language>I move this check Util class. SWTBotUtil.checkNonUIThread</technical_language>

Target:
public static void init() { SWTBotUtil.checkNonUIThread(); Thread.currentThread().setName("SWTBot Thread"); SWTBotPreferences.TIMEOUT = 20000; fLogger.addAppender(new NullAppender()); fBot = new SWTWorkbenchBot(); SWTBotUtil.closeView("welcome", fBot); SWTBotUtil.switchToTracingPerspective(); SWTBotUtil.waitForJobs(); }
Source:
<code>private static void kill() throws Exception { String twillId = verifyTwillId(); TwillController controller = twillRunner.lookup(FLUO_APP_NAME, RunIds.fromString(twillId)); <START> if ((controller != null) && controller.isRunning()) { <END> System.out.print("Killing Fluo instance " + getAppInfo()+ "..."); controller.kill(); System.out.println("DONE"); deleteZkData(); } else { System.out.println("WARNING - " + existsButNotRunningMsg()); } }</code><technical_language>running kill it</technical_language>

Target:
private static void kill() throws Exception { String twillId = verifyTwillId(); TwillController controller = twillRunner.lookup(FLUO_APP_NAME, RunIds.fromString(twillId)); if (controller != null) { System.out.print("Killing Fluo instance " + getAppInfo()+ "..."); controller.kill(); System.out.println("DONE"); } else { logExistsButNotRunning(); } deleteZkData(); }
Source:
<code>protected Subject login(String username, String password, String realmName) throws LoginException { <START> CallbackHandler handler = this.getCallbackHandler(username, password); <END> LoginContext ctx = new LoginContext(realmName, handler); ctx.login(); return ctx.getSubject(); }</code><technical_language>Unnecessary this</technical_language>

Target:
protected Subject login(String username, String password, String realmName) throws LoginException { CallbackHandler handler = getCallbackHandler(username, password); LoginContext ctx = new LoginContext(realmName, handler); ctx.login(); return ctx.getSubject(); }
Source:
<code>public void remove() { active = false; world.getEntityManager().unregister(this); server.getEntityIdManager().deallocate(this); DestroyEntitiesMessage message = new DestroyEntitiesMessage(Arrays.asList(id)); for (GlowPlayer player : getWorld().getRawPlayers()) { <START> player.getSession().send(message); <END> } }</code><technical_language>Check if player see</technical_language>

Target:
public void remove() { active = false; world.getEntityManager().unregister(this); server.getEntityIdManager().deallocate(this); }
Source:
<code>public Set<Product> getProvidedProducts() { <START> return this.providedProducts; <END> }</code><technical_language>@wolfdale branding, return SetView</technical_language>

Target:
public Collection<Product> getProvidedProducts() { return new SetView<>(this.providedProducts); }
Source:
<code>private List<?> mapToFormatLineType(final List<String> genVals, final VCFHeaderLineType genValType) { if (genValType == VCFHeaderLineType.String) { return genVals; } final List<Object> genRealTypeVals = new ArrayList<>(genVals.size()); final Function<String, Object> mapperFunc = getMapperFunction(genValType); genVals.forEach(genVal -> { if (!genVal.equals(VCFConstants.MISSING_VALUE_v4)) { genRealTypeVals.add(mapperFunc.apply(genVal)); <START> } <END> }); return genRealTypeVals; }</code><technical_language>else happen if a missing in middle of a list of strings....so "0,1,.,2" convert [0,1,2] [0, 1, null, 2] [0, 1, MISSING_INT_VALUE, 2]</technical_language>

Target:
private List<?> mapToFormatLineType(final List<String> genVals, final VCFHeaderLineType genValType) { final List<Object> genRealTypeVals = new ArrayList<>(genVals.size()); final Function<String, Object> mapperFunc = getMapperFunction(genValType); genVals.forEach(genVal -> genRealTypeVals.add( !genVal.equals(VCFConstants.MISSING_VALUE_v4) ? mapperFunc.apply(genVal) : null)); return genRealTypeVals; }
Source:
<code><START> public static TimedOperation initThread() { <END> if (!trackTime) { return NOOP_TIMED_OPERATION; } return startOperation(TimedOperationCategory.UNACCOUNTED); }</code><technical_language>of callers return this method. Is okay? Is needed</technical_language>

Target:
public static void initThread() { if (!trackTime) { return; } startOperation(TimedOperationCategory.UNACCOUNTED); }
Source:
<code>private static DetailAST getLastLambdaToken(DetailAST lambda) { DetailAST node = lambda.getLastChild(); while (node.getLastChild() != null) { node = node.getLastChild(); <START> } <END> return node; }</code><technical_language>code cleaner DetailAST node = lambda; do { node = node.getLastChild(); } while (node.getLastChild() != null);</technical_language>

Target:
private static DetailAST getLastLambdaToken(DetailAST lambda) { DetailAST node = lambda; do { node = node.getLastChild(); } while (node.getLastChild() != null); return node; }
Source:
<code>public void store() throws WrongPermissionException, NotFileException, IOException, CannotCreateFileException { setProperty(ConfigFile.CONFIG_VERSION_PROPERTY, Integer.toString(CURRENT_CONFIG_VERSION)); try { new <START> OutputStreamFile(storageFile.getPath(), <END> null, Existence.MAY_EXIST, ChangePermission.NOCHANGE, false); } catch (FileAlreadyExistsException | NoSuchFileException | CannotChangePermissionException e) { throw new AssertionError(e); } File tmpOut = File.createTempFile("jackserver-" + storageFile.getName(), ".tmp", storageFile.getParentFile()); try { if (!(tmpOut.setExecutable(false, false) && tmpOut.setWritable(false, false) && tmpOut.setReadable(false, false) && tmpOut.setWritable(true, true) && tmpOut.setReadable(true, true))) { throw new IOException("Failed to set permissions of '" + tmpOut.getPath() + "'"); } try (Writer writer = new OutputStreamWriter(new FileOutputStream(tmpOut), CONFIG_CHARSET)) { store(writer, ""); } if (!tmpOut.renameTo(storageFile)) { throw new IOException("failed to rename temp config file '" + tmpOut); } tmpOut = null; } finally { if (tmpOut != null) { if (!tmpOut.delete()) { logger.log(Level.SEVERE, "Failed to delete temp file '" + tmpOut.getPath() + "'"); } } } }</code><technical_language>OutputStreamFile(@Nonnull String name, @CheckForNull RunnableHooks hooks)</technical_language>

Target:
public void store() throws WrongPermissionException, NotFileException, IOException, CannotCreateFileException { setProperty(ConfigFile.CONFIG_VERSION_PROPERTY, Integer.toString(CURRENT_CONFIG_VERSION)); new OutputStreamFile(storageFile.getPath(), null); File tmpOut = File.createTempFile("jackserver-" + storageFile.getName(), ".tmp", storageFile.getParentFile()); try { if (!(tmpOut.setExecutable(false, false) && tmpOut.setWritable(false, false) && tmpOut.setReadable(false, false) && tmpOut.setWritable(true, true) && tmpOut.setReadable(true, true))) { throw new IOException("Failed to set permissions of '" + tmpOut.getPath() + "'"); } try (Writer writer = new OutputStreamWriter(new FileOutputStream(tmpOut), CONFIG_CHARSET)) { store(writer, ""); } if (!tmpOut.renameTo(storageFile)) { throw new IOException("failed to rename temp config file '" + tmpOut); } tmpOut = null; } finally { if (tmpOut != null) { if (!tmpOut.delete()) { logger.log(Level.SEVERE, "Failed to delete temp file '" + tmpOut.getPath() + "'"); } } } }
Source:
<code>protected static Comment fillCommentEntity(JsonNode jn, Comment comment) { optionalSet(jn, COMMENT_PARENT_ID_FIELD, comment::setParentId); optionalSet(jn, COMMENT_TEXT_FIELD, comment::setText); optionalSet(jn, COMMENT_CREATION_DATE_FIELD, s -> comment.setCreationDate(s == null ? null : Instant.parse(s))); <START> optionalSet(jn, COMMENT_MODIFICATION_DATE_FIELD, <END> s -> comment.setModificationDate(s == null ? null : Instant.parse(s))); if (jn.has(EXTERNAL_ENTITY_ID_FIELD) || jn.has(EXTERNAL_ENTITY_ORIGIN_FIELD) || jn.has(EXTERNAL_ENTITY)) { ExternalEntity externalEntity = (ExternalEntity) comment; optionalSet(jn, EXTERNAL_ENTITY_ID_FIELD, externalEntity::setEntityId); optionalSet(jn, EXTERNAL_ENTITY_ORIGIN_FIELD, externalEntity::setOrigin); optionalSet(jn, EXTERNAL_ENTITY, externalEntity::setEntity); } return comment; }</code><technical_language>s null. this.get(fieldName) returns a JsonNode null if key exists, null</technical_language>

Target:
protected static Comment fillCommentEntity(JsonNode jn, Comment comment) { setIfExist(jn, COMMENT_PARENT_ID_FIELD, comment::setParentId); setIfExist(jn, COMMENT_TEXT_FIELD, comment::setText); setIfExist(jn, COMMENT_CREATION_DATE_FIELD, s -> comment.setCreationDate(s == null ? null : Instant.parse(s))); setIfExist(jn, COMMENT_MODIFICATION_DATE_FIELD, s -> comment.setModificationDate(s == null ? null : Instant.parse(s))); if (jn.has(EXTERNAL_ENTITY_ID_FIELD) || jn.has(EXTERNAL_ENTITY_ORIGIN_FIELD) || jn.has(EXTERNAL_ENTITY)) { ExternalEntity externalEntity = (ExternalEntity) comment; setIfExist(jn, EXTERNAL_ENTITY_ID_FIELD, externalEntity::setEntityId); setIfExist(jn, EXTERNAL_ENTITY_ORIGIN_FIELD, externalEntity::setOrigin); setIfExist(jn, EXTERNAL_ENTITY, externalEntity::setEntity); } return comment; }
Source:
<code>public TagMeasurementFilter(String meterNameRegex, String tagNameRegex, String tagValueRegex) { if (meterNameRegex != null && !meterNameRegex.isEmpty() && !meterNameRegex.equals(".*")) { meterNamePattern = Pattern.compile(meterNameRegex); } else { meterNamePattern = null; <START> } <END> if (tagNameRegex != null && !tagNameRegex.isEmpty() && !tagNameRegex.equals(".*")) { tagNamePattern = Pattern.compile(tagNameRegex); } else { tagNamePattern = null; } if (tagValueRegex != null && !tagValueRegex.isEmpty() && !tagValueRegex.equals(".*")) { tagValuePattern = Pattern.compile(tagValueRegex); } else { tagValuePattern = null; } }</code><technical_language>Create a common function for checking regex compiling</technical_language>

Target:
public TagMeasurementFilter(String meterNameRegex, String tagNameRegex, String tagValueRegex) { meterNamePattern = regexToPatternOrNull(meterNameRegex); tagNamePattern = regexToPatternOrNull(tagNameRegex); tagValuePattern = regexToPatternOrNull(tagValueRegex); }
Source:
<code>private Class<?> load(String className, ClassLoader... cl) throws ClassNotFoundException { final Class<?> clazz = loadSimpleType(className); if (clazz != null) { LOG.trace("Loaded class: as simple type -> {}", className, clazz); return clazz; } for (ClassLoader loader : cl) { LOG.trace("Attempting to load class: using classloader: {}", className, cl); try { Class<?> answer = Class.forName(className, false, loader); if (LOG.isTraceEnabled()) { <START> LOG.trace("Loaded class: using classloader: -> {}", new Object[]{className, cl, answer}); <END> } return answer; } catch (ClassNotFoundException e) { LOG.trace("Class not found: using classloader: {}", className, cl); } } return Class.forName(className, false, FALLBACK_CLASS_LOADER); }</code><technical_language>I remove new Object[] varargs</technical_language>

Target:
private Class<?> load(String className, ClassLoader... cl) throws ClassNotFoundException { final Class<?> clazz = loadSimpleType(className); if (clazz != null) { LOG.trace("Loaded class: as simple type -> {}", className, clazz); return clazz; } for (ClassLoader loader : cl) { LOG.trace("Attempting to load class: using classloader: {}", className, cl); try { Class<?> answer = Class.forName(className, false, loader); if (LOG.isTraceEnabled()) { LOG.trace("Loaded class: using classloader: -> {}", className, cl, answer); } return answer; } catch (ClassNotFoundException e) { LOG.trace("Class not found: using classloader: {}", className, cl); } } return Class.forName(className, false, FALLBACK_CLASS_LOADER); }
Source:
<code>public Object getValue(Session session) { if (opType != OpTypes.LIKE) { return super.getValue(session); } Object leftValue = nodes[LEFT].getValue(session); Object rightValue = nodes[RIGHT].getValue(session); <START> Object escapeValue = (!hasEscape() || nodes[ESCAPE] == null) ? null <END> : nodes[ESCAPE].getValue( session); if (likeObject.isVariable) { synchronized (likeObject) { likeObject.setPattern(session, rightValue, escapeValue, hasEscape() && (nodes[ESCAPE] != null)); return likeObject.compare(session, leftValue); } } return likeObject.compare(session, leftValue); }</code><technical_language>push null check for nodes[ESCAPE] new hasEscape() method</technical_language>

Target:
public Object getValue(Session session) { if (opType != OpTypes.LIKE) { return super.getValue(session); } Object leftValue = nodes[LEFT].getValue(session); Object rightValue = nodes[RIGHT].getValue(session); Object escapeValue = (nodes.length < TERNARY || nodes[ESCAPE] == null) ? null : nodes[ESCAPE].getValue( session); if (likeObject.isVariable) { synchronized (likeObject) { likeObject.setPattern(session, rightValue, escapeValue, (nodes.length == TERNARY) && (nodes[ESCAPE] != null)); return likeObject.compare(session, leftValue); } } return likeObject.compare(session, leftValue); }
Source:
<code>public void testGenerateAdditions() throws Exception { <START> Entity testEntity = ImmutableEntity.builder() <END> .entityType("test") .specializationOf(URI.create("http://example/entity")) .putAdditions("pred1", new String[]{"value1", "value2"}).build(); Entity testEntity2 = ImmutableEntity.builder() .entityType("test") .specializationOf(URI.create("http://example/entity")) .putAdditions("pred2", new String[]{"value3", "value4"}).build(); Entity[] testEntities = new Entity[2]; testEntities[0] = testEntity; testEntities[1] = testEntity2; GenerateRdfPatchFromJsonLdEntity generateRdfPatchFromJsonLdEntity = new GenerateRdfPatchFromJsonLdEntity(testEntities); MyTestRdfPatchSerializer myTestRdfPatchSerializer = new MyTestRdfPatchSerializer(); generateRdfPatchFromJsonLdEntity.generateAdditions(myTestRdfPatchSerializer); assertThat(myTestRdfPatchSerializer.results, is("+ http://example/entity pred1 value1\n" + "+ http://example/entity pred1 value2\n" + "+ http://example/entity pred2 value3\n" + "+ http://example/entity pred2 value4\n")); }</code><technical_language>expose ImmutableEntity. Instead add a static create() method in interface similar done in timbuctoo-instancev4/src/main/java/nl/knaw/huygens/timbuctoo/security/dto/Login.java</technical_language>

Target:
public void testGenerateAdditions() throws Exception { Entity testEntity = createAdditionEntity("test", "http://example/entity", "pred1", new String[]{"value1", "value2"}); Entity testEntity2 = createAdditionEntity("test", "http://example/entity", "pred2", new String[]{"value3", "value4"}); Entity[] testEntities = new Entity[2]; testEntities[0] = testEntity; testEntities[1] = testEntity2; GenerateRdfPatchFromJsonLdEntity generateRdfPatchFromJsonLdEntity = new GenerateRdfPatchFromJsonLdEntity(testEntities); MyTestRdfPatchSerializer basicRdfPatchSerializer = new MyTestRdfPatchSerializer(); generateRdfPatchFromJsonLdEntity.generateAdditions(basicRdfPatchSerializer); assertThat(basicRdfPatchSerializer.getResults(), is("+<http://example/entity> " + "<<LINK_0>> " + "\"\"value1\"\"^^<<LINK_1>> .\\n" + "+<http://example/entity> <<LINK_0>> " + "\"\"value2\"\"^^<<LINK_1>> .\\n" + "+<http://example/entity> <<LINK_2>> " + "\"\"value3\"\"^^<<LINK_1>> .\\n" + "+<http://example/entity> <<LINK_2>> " + "\"\"value4\"\"^^<<LINK_1>> .\\n")); }
Source:
<code>public AwsTargetGroup(AwsLoadBalancerScheme scheme, int port) { this.port = port; this.name = getTargetGroupName(port, scheme); <START> this.instanceIds = new HashSet<>(); <END> }</code><technical_language>this moved field level (practical reason next line is care of if introduce a new constructor)</technical_language>

Target:
public AwsTargetGroup(AwsLoadBalancerScheme scheme, int port) { this.port = port; this.name = getTargetGroupName(port, scheme); }
Source:
<code>public static void main(String[] args) { ShufflingBasedStatisticalSignificance sig = new ShufflingBasedStatisticalSignificance(10000, new Random()); EvaluationRecord e1 = new EvaluationRecord(); EvaluationRecord e2 = new EvaluationRecord(); e1.incrementGold(); sig.addInstance(e1, e2); <START> sig.runSignificanceTest(); <END> logger.info(String.valueOf(sig.precisionSignificance())); logger.info(String.valueOf(sig.recallSignificance())); logger.info(String.valueOf(sig.f1Significance())); }</code><technical_language>this is meant run command line -- please leave System.out.println() for reported statistics</technical_language>

Target:
public static void main(String[] args) { ShufflingBasedStatisticalSignificance sig = new ShufflingBasedStatisticalSignificance(10000, new Random()); EvaluationRecord e1 = new EvaluationRecord(); EvaluationRecord e2 = new EvaluationRecord(); e1.incrementGold(); sig.addInstance(e1, e2); sig.runSignificanceTest(); System.out.println(sig.precisionSignificance()); System.out.println(sig.recallSignificance()); System.out.println(sig.f1Significance()); }
Source:
<code>private void tryToUpdateParseForAppUpgrade(Context context){ PrefManager.AppInfoPrefManager pmanager = new PrefManager.AppInfoPrefManager(context); <START> Long preVersion = pmanager.getAppVersionCode(); <END> boolean hadNotification = pmanager.isNotificationEnabled(); int curVersion = PropertyUtil.getManifestVersionCode(context); if ( preVersion < curVersion ){ ParseInstallation installation = ParseInstallation.getCurrentInstallation(); String android_id = Secure.getString(getApplicationContext().getContentResolver(), Secure.ANDROID_ID); installation.put("UniqueId",android_id); if ( hadNotification ) { pmanager.setAppUpgradeNeedSyncWithParse(true); } installation.saveInBackground(); } pmanager.setAppVersionCode(curVersion); pmanager.setNotificationEnabled(true); }</code><technical_language>call this previousVersion? abbreviation worth loss of clarity</technical_language>

Target:
private void tryToUpdateParseForAppUpgrade(Context context){ PrefManager.AppInfoPrefManager pmanager = new PrefManager.AppInfoPrefManager(context); Long previousVersion = pmanager.getAppVersionCode(); boolean hadNotification = pmanager.isNotificationEnabled(); int curVersion = PropertyUtil.getManifestVersionCode(context); if ( previousVersion < curVersion ){ ParseInstallation installation = ParseInstallation.getCurrentInstallation(); String android_id = Secure.getString(getApplicationContext().getContentResolver(), Secure.ANDROID_ID); installation.put("UniqueId",android_id); if ( hadNotification ) { pmanager.setAppUpgradeNeedSyncWithParse(true); } installation.saveInBackground(); } pmanager.setAppVersionCode(curVersion); pmanager.setNotificationEnabled(true); }
Source:
<code>private LineDecoderIterator getLineDecoderIterator(T task) { final OffsetDateTime fromDate = OffsetDateTime.ofInstant(task.getFromDate().toInstant(), ZoneId.systemDefault()); <START> final OffsetDateTime toDate = task.getToDate().isPresent() ? <END> OffsetDateTime.ofInstant(task.getToDate().get().toInstant(), ZoneId.systemDefault()) : OffsetDateTime.now(); List<MarketoUtils.DateRange> dateRanges = MarketoUtils.sliceRange(fromDate, toDate, MARKETO_MAX_RANGE_EXTRACT); final Iterator<MarketoUtils.DateRange> iterator = dateRanges.iterator(); return new LineDecoderIterator(iterator, task); }</code><technical_language>toDate is set #validateInputTask so: need check presentation here</technical_language>

Target:
private LineDecoderIterator getLineDecoderIterator(T task) { final OffsetDateTime fromDate = OffsetDateTime.ofInstant(task.getFromDate().toInstant(), ZoneOffset.UTC); final OffsetDateTime toDate = task.getToDate().isPresent() ? OffsetDateTime.ofInstant(task.getToDate().get().toInstant(), ZoneOffset.UTC) : OffsetDateTime.now(ZoneOffset.UTC); List<MarketoUtils.DateRange> dateRanges = MarketoUtils.sliceRange(fromDate, toDate, MARKETO_MAX_RANGE_EXTRACT); final Iterator<MarketoUtils.DateRange> iterator = dateRanges.iterator(); return new LineDecoderIterator(iterator, task); }
Source:
<code>public boolean tryRename(String newName) { try { <START> if (renameHandler == null) { <END> return false; } return renameHandler.apply(this, newName); } catch (Exception e) { throw handleErrorInCallback(e, "renameHandler"); } }</code><technical_language>I inverting this if check improve readability/flow woudl consistent other methods in this class</technical_language>

Target:
public boolean tryRename(String newName) { try { if (!canRename()) { return false; } return renameHandler.apply(this, newName); } catch (Exception e) { throw handleErrorInCallback(e, "renameHandler"); } }
Source:
<code>public boolean isKieContainerUpdateDuringRolloutAllowed(ConfigMap cm, KieServerState newState) { KieServerState state = (KieServerState) xs.fromXML(cm.getData().get(CFG_MAP_DATA_KEY)); for (KieContainerResource container : state.getContainers()) { if (container.getStatus().equals(KieContainerStatus.STARTED) && !newState.getContainers().stream() <START> .noneMatch(c -> c.getContainerId().equals(container.getContainerId()) && <END> c.getStatus().equals(KieContainerStatus.STOPPED))) { logger.warn("Non KieServer process updated KieServerState during DC rollout for STOPPING containers."); return true; } } logger.warn("Non KieServer process updates KieServerState during DC rollout is prohibited!"); return false; }</code><technical_language>please anyMatch() remove negation? I improve readability :)</technical_language>

Target:
public boolean isKieContainerUpdateDuringRolloutAllowed(ConfigMap cm, KieServerState newState) { KieServerState state = (KieServerState) xs.fromXML(cm.getData().get(CFG_MAP_DATA_KEY)); for (KieContainerResource container : state.getContainers()) { if (container.getStatus().equals(KieContainerStatus.STARTED) && newState.getContainers().stream() .anyMatch(c -> c.getContainerId().equals(container.getContainerId()) && c.getStatus().equals(KieContainerStatus.STOPPED))) { logger.warn("Non KieServer process updated KieServerState during DC rollout for STOPPING containers."); return true; } } logger.warn("Non KieServer process updates KieServerState during DC rollout is prohibited!"); return false; }
Source:
<code>private List<WorkflowAction> filterActionsCollection(final List<WorkflowAction> actions, final Role role) throws DotDataException { final List<WorkflowAction> permissionables = new ArrayList<>(actions); if (permissionables.isEmpty()) { return permissionables; } final Iterator<WorkflowAction> iterator = permissionables.iterator(); while (iterator.hasNext()) { <START> final WorkflowAction wa = iterator.next(); <END> if (!permissionAPI.doesRoleHavePermission(wa, PermissionAPI.PERMISSION_USE, role)) { iterator.remove(); } } return permissionables; }</code><technical_language>meaningful names, rename workflowAction</technical_language>

Target:
private List<WorkflowAction> filterActionsCollection(final List<WorkflowAction> actions, final Role role) throws DotDataException { final List<WorkflowAction> permissionables = new ArrayList<>(actions); if (permissionables.isEmpty()) { return permissionables; } final Iterator<WorkflowAction> workflowActionIterator = permissionables.iterator(); while (workflowActionIterator.hasNext()) { final WorkflowAction wa = workflowActionIterator.next(); if (!permissionAPI.doesRoleHavePermission(wa, PermissionAPI.PERMISSION_USE, role)) { workflowActionIterator.remove(); } } return permissionables; }