auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public NodeProvisioner.PlannedNode build() { KubernetesCloud cloud = getCloud(); PodTemplate t = getTemplate(); try { return new NodeProvisioner.PlannedNode(t.getDisplayName(), Futures.immediateFuture(KubernetesSlave .builder() .podTemplate(cloud.getUnwrappedTemplate(t)) .cloud(cloud) .build()), getNumExecutors()); } catch (IOException | Descriptor.FormException e) { <START> throw new RuntimeException(e); <END> } }</code><technical_language>retain original behavior, this return a failing Future. checked exceptions with</technical_language>

Target:
public NodeProvisioner.PlannedNode build() { KubernetesCloud cloud = getCloud(); PodTemplate t = getTemplate(); Future f; try { KubernetesSlave agent = KubernetesSlave .builder() .podTemplate(cloud.getUnwrappedTemplate(t)) .cloud(cloud) .build(); f = Futures.immediateFuture(agent); } catch (IOException | Descriptor.FormException e) { f = Futures.immediateFailedFuture(e); } return new NodeProvisioner.PlannedNode(t.getDisplayName(), f, getNumExecutors()); }
Source:
<code>public Mono<EventHubManagementNode> getManagementNode() { if (isDisposed()) { return Mono.error(logger.logExceptionAsError(new IllegalStateException(String.format( "connectionId[%s]: Connection is disposed. Cannot get management instance", connectionId)))); } return getReactorConnection().then(Mono.fromCallable(() -> { <START> if (managementChannel == null) { <END> this.managementChannel = new ManagementChannel( createRequestResponseChannel(MANAGEMENT_SESSION_NAME, MANAGEMENT_LINK_NAME, MANAGEMENT_ADDRESS), eventHubName, tokenCredential, tokenManagerProvider, this.messageSerializer, scheduler); } return managementChannel; })); }</code><technical_language>This synchronized declare this.managementChannel AtomicReference</technical_language>

Target:
public Mono<EventHubManagementNode> getManagementNode() { if (isDisposed()) { return Mono.error(logger.logExceptionAsError(new IllegalStateException(String.format( "connectionId[%s]: Connection is disposed. Cannot get management instance", connectionId)))); } return getReactorConnection().then(Mono.fromCallable(this::getOrCreateManagementChannel)); }
Source:
<code>private void unshift() { isEnteringActionName = false; Integer editorAction; try { editorAction = Integer.parseInt(actionName.toString()); } catch (Exception e) { editorAction = ACTION_CODES_MAP.get(actionName.toString().toLowerCase()); } if (editorAction == null) { Log.i(TAG, String.format("There is no known action code for '%s'", actionName.toString())); getCurrentInputConnection().commitText(actionName.toString(), 1); <START> } else { <END> Log.i(TAG, String.format("Matched '%s' to editor action code %s ", actionName.toString(), editorAction)); getCurrentInputConnection().performEditorAction(editorAction); } actionName = new StringBuilder(); }</code><technical_language>for them, input word typed. @driver.execute_script 'mobile: performEditorAction', { action: 'nonword' } Maybe, this behaviour users command send. putting list of actions in Log.i</technical_language>

Target:
private void unshift() { isEnteringActionName = false; Integer editorAction; try { editorAction = Integer.parseInt(actionName.toString()); } catch (Exception e) { editorAction = ACTION_CODES_MAP.get(actionName.toString().toLowerCase()); } if (editorAction == null) { Log.i(TAG, String.format("There is no known action code for '%s'. " + "Available action names: %s", actionName.toString(), ACTION_CODES_MAP.keySet())); getCurrentInputConnection().commitText(actionName.toString(), 1); } else { Log.i(TAG, String.format("Matched '%s' to editor action code %s", actionName.toString(), editorAction)); if (!getCurrentInputConnection().performEditorAction(editorAction)) { Log.w(TAG, String.format("Cannot perform editor action %s on the focused element", editorAction)); } } actionName = new StringBuilder(); }
Source:
<code>public Table get(String name) throws TableManagerException { try { Table table = metadataManager.get(name); if (table == null) { <START> throw new TableManagerException(TableManagerException.ErrorCode.TABLE_NOT_FOUND, "table_does_not_exists"); <END> } return table; } catch (TableManagerException e) { throw e; } catch (Exception e) { throw new TableManagerException(TableManagerException.ErrorCode.INTERNAL_ERROR, e); } }</code><technical_language>exist .. underscores? Also, add tablename for this error is coming</technical_language>

Target:
public Table get(String name) throws TableManagerException { try { Table table = metadataManager.get(name); if (table == null) { throw new TableManagerException(TableManagerException.ErrorCode.TABLE_NOT_FOUND, String.format("table does not exists table=%s", name)); } return table; } catch (TableManagerException e) { throw e; } catch (Exception e) { throw new TableManagerException(TableManagerException.ErrorCode.INTERNAL_ERROR, e); } }
Source:
<code>private void initLocalizationEditor() { localeBox = new ListBox(); selectedLocale = new Label(); String currentLocale = LocaleInfo.getCurrentLocale().getLocaleName(); String[] localeNames = LocaleInfo.getAvailableLocaleNames(); for (String localeName : localeNames) { if(!DEFAULT.equals(localeName)) { String nativeName = LocaleInfo.getLocaleNativeDisplayName(localeName); localeBox.addItem(nativeName, localeName); if (localeName.equals(currentLocale)) { localeBox.setSelectedIndex(localeBox.getItemCount() - 1); selectedLocale.setText(localeBox.getItemText(localeBox.getSelectedIndex())); } } } if (clientAgentType.isIE8OrBelow()) { selectedLocale.getElement().getStyle().setOpacity(0); } localeBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { String localeName = localeBox.getValue(localeBox.getSelectedIndex()); String localeString = ""; <START> if (!DEFAULT.equals(localeName)) { <END> localeString = "?locale=" + localeName; } Window.open(FrontendUrlUtils.getCurrentPageURL() + localeString, "_self", ""); } }); }</code><technical_language>This 'if' is redundant, localeName default default is added locale box</technical_language>

Target:
private void initLocalizationEditor() { localeBox = new ListBox(); selectedLocale = new Label(); String currentLocale = LocaleInfo.getCurrentLocale().getLocaleName(); String[] localeNames = LocaleInfo.getAvailableLocaleNames(); boolean foundDefault = false; for (String localeName : localeNames) { if(!DEFAULT.equals(localeName)) { String nativeName = LocaleInfo.getLocaleNativeDisplayName(localeName); localeBox.addItem(nativeName, localeName); if (localeName.equals(currentLocale)) { foundDefault = true; localeBox.setSelectedIndex(localeBox.getItemCount() - 1); selectedLocale.setText(localeBox.getItemText(localeBox.getSelectedIndex())); } } } if(!foundDefault) { localeBox.setSelectedIndex(0); selectedLocale.setText(localeBox.getItemText(localeBox.getSelectedIndex())); } if (clientAgentType.isIE8OrBelow()) { selectedLocale.getElement().getStyle().setOpacity(0); } localeBox.addChangeHandler(new ChangeHandler() { @Override public void onChange(ChangeEvent event) { String localeString = "?locale=" + localeBox.getValue(localeBox.getSelectedIndex()); Window.open(FrontendUrlUtils.getCurrentPageURL() + localeString, "_self", ""); } }); }
Source:
<code>private static boolean isHtml5(final InputStream body) { final Document document; try { body.mark(Integer.MAX_VALUE); document = parseBody(body); body.reset(); } catch (final Exception ex) { <START> return false; <END> } final DocumentType doctype = document.getDoctype(); return doctype != null && "html".equalsIgnoreCase(doctype.getName()) && doctype.getSystemId() == null && doctype.getPublicId() == null; }</code><technical_language>@mbarbieri log exception thrown in a INFO DEBUG message</technical_language>

Target:
private static boolean isHtml5(final InputStream body) throws IOException { Opt<Document> document = new Opt.Empty<Document>(); boolean valid = true; try { body.mark(Integer.MAX_VALUE); document = new Opt.Single<Document>( DocumentBuilderFactory .newInstance() .newDocumentBuilder() .parse(body) ); body.reset(); } catch (final SAXException ex) { valid = false; } catch (final ParserConfigurationException ex) { throw new IOException(ex); } return valid && document.get().getDoctype() != null && "html".equalsIgnoreCase(document.get().getDoctype().getName()) && document.get().getDoctype().getSystemId() == null && document.get().getDoctype().getPublicId() == null; }
Source:
<code>StackOpParser(KXmlParser parser) { <START> super(parser); <END> }</code><technical_language>removing public in constructor</technical_language>

Target:
public StackOpParser(KXmlParser parser) { super(parser); }
Source:
<code>public static boolean checkImageConfiguration(storage_domain_static storageDomain, DiskImageBase diskInfo, List<String> messages, boolean isCopyCollapse) { boolean result = true; if ((diskInfo.getvolume_type() == VolumeType.Preallocated && diskInfo.getvolume_format() == VolumeFormat.COW) <START> || (!isCopyCollapse && isStorageBlockDevice(storageDomain) && volumeNotSupportedForBlockDevice(diskInfo)) <END> || diskInfo.getvolume_format() == VolumeFormat.Unassigned || diskInfo.getvolume_type() == VolumeType.Unassigned) { result = false; messages.add(VdcBllMessages.ACTION_TYPE_FAILED_DISK_CONFIGURATION_NOT_SUPPORTED.toString()); } return result; }</code><technical_language>Consider changing 'volumeNotSupportForBlockDevice' 'isVolumeSupportForBlockDevice'</technical_language>

Target:
public static boolean checkImageConfiguration(storage_domain_static storageDomain, DiskImageBase diskInfo, List<String> messages, boolean isCopyCollapse) { boolean result = true; if ((diskInfo.getvolume_type() == VolumeType.Preallocated && diskInfo.getvolume_format() == VolumeFormat.COW) || (!isCopyCollapse && isStorageBlockDevice(storageDomain) && isVolumeNotSupportedForBlockDevice(diskInfo)) || diskInfo.getvolume_format() == VolumeFormat.Unassigned || diskInfo.getvolume_type() == VolumeType.Unassigned) { result = false; messages.add(VdcBllMessages.ACTION_TYPE_FAILED_DISK_CONFIGURATION_NOT_SUPPORTED.toString()); } return result; }
Source:
<code>protected <S extends Message> S getPart(Class<S> partStateClass) { final AggregatePartRepository<I, ?> repo = getRepository(partStateClass); final AggregatePart<I, ?, ?> aggregatePart = repo.loadOrCreate(getId()); <START> @SuppressWarnings("unchecked") END> final S partState = (S) aggregatePart.getState(); return partState; }</code><technical_language>In case try making #getRepository return AggregatePartRepository<I, S>. This checks type cast in #getRepository method. S a result of #getState able get rid of this suppression</technical_language>

Target:
protected <S extends Message, A extends AggregatePart<I, S, ?>> S getPart(Class<S> partStateClass) { final AggregatePartRepository<I, A> repo = getRepository(partStateClass); final AggregatePart<I, S, ?> aggregatePart = repo.loadOrCreate(getId()); final S partState = aggregatePart.getState(); return partState; }
Source:
<code>private void init() { inflate(getContext(), R.layout.item_page_list_entry, this); ButterKnife.bind(this); setLayoutParams(new <START> AbsListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, <END> ViewGroup.LayoutParams.WRAP_CONTENT)); final int topBottomPadding = 16; setPadding(0, DimenUtil.roundedDpToPx(topBottomPadding), 0, DimenUtil.roundedDpToPx(topBottomPadding)); setBackgroundColor(ResourceUtil.getThemedColor(getContext(), R.attr.paper_color)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { setForeground(ContextCompat.getDrawable(getContext(), ResourceUtil.getThemedAttributeId(getContext(), R.attr.selectableItemBackground))); } FeedbackUtil.setToolbarButtonLongPressToast(primaryActionView); FeedbackUtil.setToolbarButtonLongPressToast(secondaryActionView); }</code><technical_language>This assumes a PageItemView a child of a ListView, is true. problem is ListView class, able adapt correctly general ViewGroup layout params. I a solution leave this code as-is, BottomContentView (where crash is happening), instantiate PageItemView, give a new set of ListView layout params: itemView.setLayoutParams(new ListView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); eventually replace remaining ListViews RecyclerView, this fix unnecessary, automatically removed</technical_language>

Target:
private void init() { inflate(getContext(), R.layout.item_page_list_entry, this); ButterKnife.bind(this); setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); final int topBottomPadding = 16; setPadding(0, DimenUtil.roundedDpToPx(topBottomPadding), 0, DimenUtil.roundedDpToPx(topBottomPadding)); setBackgroundColor(ResourceUtil.getThemedColor(getContext(), R.attr.paper_color)); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { setForeground(ContextCompat.getDrawable(getContext(), ResourceUtil.getThemedAttributeId(getContext(), R.attr.selectableItemBackground))); } FeedbackUtil.setToolbarButtonLongPressToast(primaryActionView); FeedbackUtil.setToolbarButtonLongPressToast(secondaryActionView); }
Source:
<code>protected void executeCommand() { final DiskImage newDiskImage = getParameters().getDiskImage(); if (newDiskImage != null) { <START> TransactionSupport.executeInNewTransaction(new TransactionMethod<Void>() { <END> @Override public Void runInTransaction() { addDiskImageToDb(newDiskImage, getCompensationContext()); getReturnValue().setActionReturnValue(newDiskImage.getId()); getReturnValue().setSucceeded(true); return null; } }); } }</code><technical_language>a new transaction is needed here</technical_language>

Target:
protected void executeCommand() { final DiskImage newDiskImage = getParameters().getDiskImage(); if (newDiskImage != null) { addDiskImageToDb(newDiskImage, getCompensationContext()); getReturnValue().setActionReturnValue(newDiskImage.getId()); getReturnValue().setSucceeded(true); } }
Source:
<code>public void shouldLoadCsvToDirectory() throws Exception { try (Session directorySession = directoryService.open("continent")) { assertNull(directorySession.getEntry("atlantis")); Map<String, Object> params = new HashMap<>(); params.put("directoryName", "continent"); params.put("duplicateManagement", BaseDirectoryDescriptor.DataLoadingPolicy.UPDATE_DUPLICATE.toString()); OperationParameters oparams = new OperationParameters(LoadDirectoryWithCSV.ID, params); <START> Blob blob = Blobs.createBlob(FileUtils.getResourceFileFromContext("testdirectorydata/continent_local.csv"), <END> "text/csv", UTF_8.name(), ("testdirectorydata/continent_local.csv")); ctx.setInput(blob); OperationChain chain = new OperationChain("fakeChain"); chain.add(oparams); service.run(ctx, chain); assertNotNull(directorySession.getEntry("atlantis")); } }</code><technical_language>UTF_8.name() -> null, default. Remove redundant parentheses filename</technical_language>

Target:
public void shouldLoadCsvToDirectory() throws Exception { try (Session directorySession = directoryService.open("continent")) { assertFalse(directorySession.hasEntry("atlantis")); OperationParameters params = new OperationParameters(LoadFromCSV.ID, Map.of("directoryName", "continent", "dataLoadingPolicy", "reject_duplicate")); Blob blob = Blobs.createBlob(FileUtils.getResourceFileFromContext("testdirectorydata/continent_local.csv"), "text/csv", null, "testdirectorydata/continent_local.csv"); ctx.setInput(blob); OperationChain chain = new OperationChain("fakeChain"); chain.add(params); service.run(ctx, chain); assertTrue(directorySession.hasEntry("atlantis")); } }
Source:
<code>public static void submit(final PatchSet.Id patchSetId, final IdentifiedUser user, final ReviewDb db, final MergeOp.Factory opFactory, final MergeQueue merger) throws OrmException { final Change.Id changeId = patchSetId.getParentKey(); final PatchSetApproval approval = createSubmitApproval(patchSetId, user, db); db.patchSetApprovals().upsert(Collections.singleton(approval)); final Change updatedChange = db.changes().atomicUpdate(changeId, new AtomicUpdate<Change>() { @Override public Change update(Change change) { if (change.getStatus() == Change.Status.NEW) { change.setStatus(Change.Status.SUBMITTED); <START> change.setMergeable(true); <END> ChangeUtil.updated(change); } return change; } }); if (updatedChange.getStatus() == Change.Status.SUBMITTED) { merger.merge(opFactory, updatedChange.getDest()); } }</code><technical_language>merge fail below. set this merge</technical_language>

Target:
public static void submit(final PatchSet.Id patchSetId, final IdentifiedUser user, final ReviewDb db, final MergeOp.Factory opFactory, final MergeQueue merger) throws OrmException { final Change.Id changeId = patchSetId.getParentKey(); final PatchSetApproval approval = createSubmitApproval(patchSetId, user, db); db.patchSetApprovals().upsert(Collections.singleton(approval)); final Change updatedChange = db.changes().atomicUpdate(changeId, new AtomicUpdate<Change>() { @Override public Change update(Change change) { if (change.getStatus() == Change.Status.NEW) { change.setStatus(Change.Status.SUBMITTED); ChangeUtil.updated(change); } return change; } }); if (updatedChange.getStatus() == Change.Status.SUBMITTED) { merger.merge(opFactory, updatedChange.getDest()); } }
Source:
<code>@Test public void lenientQuotedNonFiniteDoubles() throws IOException { String json = "[\"NaN\", \"-Infinity\", \"Infinity\"]"; JsonReader reader = newReader(json); reader.setLenient(true); reader.beginArray(); <START> assertThat(Double.isNaN(reader.nextDouble())).isTrue(); <END> assertThat(reader.nextDouble()).isEqualTo(Double.NEGATIVE_INFINITY, Offset.offset(0d)); assertThat(reader.nextDouble()).isEqualTo(Double.POSITIVE_INFINITY, Offset.offset(0d)); reader.endArray(); }</code><technical_language>assertThat(reader.nextDouble()).isNaN()</technical_language>

Target:
@Test public void lenientQuotedNonFiniteDoubles() throws IOException { String json = "[\"NaN\", \"-Infinity\", \"Infinity\"]"; JsonReader reader = newReader(json); reader.setLenient(true); reader.beginArray(); assertThat(reader.nextDouble()).isNaN(); assertThat(reader.nextDouble()).isEqualTo(Double.NEGATIVE_INFINITY); assertThat(reader.nextDouble()).isEqualTo(Double.POSITIVE_INFINITY); reader.endArray(); }
Source:
<code>public void run() { while (deletedCount.get() < putCount) { try { final String blobIdStr = deleteBlobIds.poll(50, TimeUnit.MILLISECONDS); if (blobIdStr != null) { deletedCount.incrementAndGet(); logger.trace("Deleting blob " + blobIdStr); Callback<Void> callback = new Callback<Void>() { @Override public void onCompletion(Void result, Exception exception) { logger.trace("Deletion completed for " + blobIdStr); countDownLatch.countDown(); if (exception != null) { logger.error("Deletion of " + blobIdStr + " failed with ", exception); } } }; deleteHelper.deleteBlobAndValidate(blobIdStr, deleteHelper.getErrorCodeForNoError(), callback); } } catch (InterruptedException e) { <START> logger.error(" Interrupted Exception thrown in , exception ", e); <END> } } try { countDownLatch.await(); } catch (InterruptedException e) { logger.error(" Interrupted Exception thrown while waiting for deletion to complete , exception ", e); } }</code><technical_language>change fix error messages in this next? I done in #509, this is in first, discard changes</technical_language>

Target:
public void run() { while (deletedCount.get() < putCount) { try { final String blobIdStr = deleteBlobIds.poll(50, TimeUnit.MILLISECONDS); if (blobIdStr != null) { deletedCount.incrementAndGet(); logger.trace("Deleting blob " + blobIdStr); Callback<Void> callback = new Callback<Void>() { @Override public void onCompletion(Void result, Exception exception) { logger.trace("Deletion completed for " + blobIdStr); countDownLatch.countDown(); if (exception != null) { logger.error("Deletion of " + blobIdStr + " failed with ", exception); } } }; deleteHelper.deleteBlobAndValidate(blobIdStr, deleteHelper.getErrorCodeForNoError(), callback); } } catch (InterruptedException e) { logger.error("Delete operation interrupted", e); } } try { countDownLatch.await(); } catch (InterruptedException e) { logger.error("Waiting for delete operations to complete interrupted", e); } }
Source:
<code>public String getDefaultValue() { <START> Preconditions.checkState(defaultValueComputed); <END> return computedDefaultValue; }</code><technical_language>I prefer throwing AssertionError if this is a check a future programmer error, a protection a state system find in for unspecified reason. But, a blocker</technical_language>

Target:
public String getDefaultValue() { Preconditions.checkState(defaultValueComputed, "precomputeDefaultValue() must be called before calling this method"); return computedDefaultValue; }
Source:
<code>private List<String> splitConditionClause( String clause ) throws KettleSQLException { List<String> strings = new ArrayList<String>(); String[] operators = new String[] { "<>", ">=", "=>", "<=", "=<", "<", ">", "=", " REGEX ", " IN ", " IS NOT NULL", " IS NULL", " LIKE", "CONTAINS " }; int[] functions = new int[] { Condition.FUNC_NOT_EQUAL, Condition.FUNC_LARGER_EQUAL, Condition.FUNC_LARGER_EQUAL, Condition.FUNC_SMALLER_EQUAL, Condition.FUNC_SMALLER_EQUAL, Condition.FUNC_SMALLER, Condition.FUNC_LARGER, Condition.FUNC_EQUAL, Condition.FUNC_REGEXP, Condition.FUNC_IN_LIST, Condition.FUNC_NOT_NULL, Condition.FUNC_NULL, Condition.FUNC_LIKE, Condition.FUNC_CONTAINS }; int index = 0; while ( index < clause.length() ) { index = ThinUtil.skipChars( clause, index, '\'', '"' ); for ( String operator : operators ) { if ( index <= clause.length() - operator.length() ) { if ( clause.substring( index ).toUpperCase().startsWith( operator ) ) { int functionIndex = Const.indexOfString( operator, operators ); boolean negation = false; String left = Const.trim( clause.substring( 0, index ) ); String op = Condition.functions[functions[functionIndex]]; String right = Const.trim( clause.substring( index + operator.length() ) ); if ( Pattern.matches( "^NULL$", right.toUpperCase() ) ) { op = Condition.functions[Condition.FUNC_TRUE]; negation = true; right = ""; } <START> <END> return Arrays.<String>asList( left, op, right, String.valueOf( negation ) ); } } } index++; } return strings; }</code><technical_language>@denis8703 weird constructing a Condition in this method, return a string array needs interpreted a Condition constructed. check for ^NULL$ in right expression done in parseAtomicCondition</technical_language>

Target:
private List<String> splitConditionClause( String clause ) throws KettleSQLException { List<String> strings = new ArrayList<String>(); String[] operators = new String[] { "<>", ">=", "=>", "<=", "=<", "<", ">", "=", " REGEX ", " IN ", " IS NOT NULL", " IS NULL", " LIKE", "CONTAINS " }; int[] functions = new int[] { Condition.FUNC_NOT_EQUAL, Condition.FUNC_LARGER_EQUAL, Condition.FUNC_LARGER_EQUAL, Condition.FUNC_SMALLER_EQUAL, Condition.FUNC_SMALLER_EQUAL, Condition.FUNC_SMALLER, Condition.FUNC_LARGER, Condition.FUNC_EQUAL, Condition.FUNC_REGEXP, Condition.FUNC_IN_LIST, Condition.FUNC_NOT_NULL, Condition.FUNC_NULL, Condition.FUNC_LIKE, Condition.FUNC_CONTAINS }; int index = 0; while ( index < clause.length() ) { index = ThinUtil.skipChars( clause, index, '\'', '"' ); for ( String operator : operators ) { if ( index <= clause.length() - operator.length() ) { if ( clause.substring( index ).toUpperCase().startsWith( operator ) ) { int functionIndex = Const.indexOfString( operator, operators ); String left = Const.trim( clause.substring( 0, index ) ); String op = Condition.functions[functions[functionIndex]]; String right = Const.trim( clause.substring( index + operator.length() ) ); return Arrays.<String>asList( left, op, right ); } } } index++; } return strings; }
Source:
<code>public final void checkAnyPermission(@Nonnull Permission... permissions) { boolean failed = !hasAnyPermission(permissions); Authentication authentication = Jenkins.getAuthentication(); if (failed) { <START> String permissionsDisplayName = Arrays.stream(permissions) <END> .map(p -> p.group.title + "/" + p.name) .collect(Collectors.joining(", ")); String errorMessage; if (permissions.length == 1) { errorMessage = Messages.AccessDeniedException2_MissingPermission(authentication.getName(), permissionsDisplayName); } else { errorMessage = Messages.AccessDeniedException_MissingPermissions(authentication.getName(), permissionsDisplayName); } throw new AccessDeniedException(errorMessage); } }</code><technical_language>if empty set of permissions passed in this work expected? (permissionsDisplayName empty string) - error message correct</technical_language>

Target:
public final void checkAnyPermission(@Nonnull Permission... permissions) { if (permissions.length == 0) { throw new IllegalArgumentException("At least one permission must be provided"); } boolean failed = !hasAnyPermission(permissions); Authentication authentication = Jenkins.getAuthentication(); if (failed) { String permissionsDisplayName = Arrays.stream(permissions) .map(p -> p.group.title + "/" + p.name) .collect(Collectors.joining(", ")); String errorMessage; if (permissions.length == 1) { errorMessage = Messages.AccessDeniedException2_MissingPermission(authentication.getName(), permissionsDisplayName); } else { errorMessage = Messages.AccessDeniedException_MissingPermissions(authentication.getName(), permissionsDisplayName); } throw new AccessDeniedException(errorMessage); } }
Source:
<code>protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CREATE); addCustomValue(GlusterConstants.VOLUME_SNAPSHOT_NAME, getParameters().getSnapshot().getSnapshotName()); <START> addCustomValue("ClusterName", <END> getVdsGroupName()); }</code><technical_language>vdsGroupName parameter, custom variable required</technical_language>

Target:
protected void setActionMessageParameters() { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__CREATE); addCustomValue(GlusterConstants.VOLUME_SNAPSHOT_NAME, getParameters().getSnapshot().getSnapshotName()); }
Source:
<code>public static SSLContext getTrustContext() { try { if (getAlreadyCreated()) { return sslContext; } setAlreadyCreated(); TrustManager[] trustAllCerts = new TrustManager[1]; trustAllCerts[0] = new TrustAllManager(); sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, trustAllCerts, new SecureRandom()); HttpsURLConnection.setDefaultHostnameVerifier( new HostnameVerifier() { public boolean verify(String urlHostName, SSLSession session) { return true; } } ); } catch (NoSuchAlgorithmException e) { throw new RemoteException("Unable to find suitable algorithm while attempting to communicate with remote server.", e); } catch (KeyManagementException e) { throw new RemoteException("Key Management exception while attempting to communicate with remote server.", e); <START> } finally { <END> return sslContext; } }</code><technical_language>finally a return statement</technical_language>

Target:
public static SSLContext getTrustContext() throws RemoteException { try { if (getAlreadyCreated()) { return sslContext; } setAlreadyCreated(); TrustManager[] trustAllCerts = new TrustManager[1]; trustAllCerts[0] = new TrustAllManager(); sslContext = SSLContext.getInstance("TLS"); sslContext.init(null, trustAllCerts, new SecureRandom()); HttpsURLConnection.setDefaultHostnameVerifier( new HostnameVerifier() { public boolean verify(String urlHostName, SSLSession session) { return true; } } ); } catch (NoSuchAlgorithmException e) { throw new RemoteException("Unable to find suitable algorithm while attempting to communicate with remote server.", e); } catch (KeyManagementException e) { throw new RemoteException("Key Management exception while attempting to communicate with remote server.", e); } return sslContext; }
Source:
<code>public void addImport(boolean enabled, String importType, String importFormat, String importBundle, Properties config) { <START> addImport(enabled, importType, importFormat, importBundle, config, null); <END> }</code><technical_language>send empty Properties dont deal null</technical_language>

Target:
public void addImport(boolean enabled, String importType, String importFormat, String importBundle, Properties config) { addImport(enabled, importType, importFormat, importBundle, config, new Properties()); }
Source:
<code>private DetectionConfigDTO generateDetectionConfig(Map<String, Object> yamlConfigMap, Map<String, Object> detectionProperties, Map<String, Object> qualityProperties, String cron) { DetectionConfigDTO config = new DetectionConfigDTO(); config.setName(MapUtils.getString(yamlConfigMap, PROP_DETECTION_NAME)); config.setDescription(MapUtils.getString(yamlConfigMap, PROP_DESC_NAME)); config.setDescription(MapUtils.getString(yamlConfigMap, PROP_DESC_NAME)); config.setLastTimestamp(System.currentTimeMillis()); config.setOwners(filterOwners(ConfigUtils.getList(yamlConfigMap.get(PROP_OWNERS)))); config.setProperties(detectionProperties); config.setDataQualityProperties(qualityProperties); config.setComponentSpecs(this.metricAttributesMap.getAllComponenets()); config.setCron(cron); config.setActive(MapUtils.getBooleanValue(yamlConfigMap, PROP_ACTIVE, true)); config.setYaml(yamlConfig); <START> config.setBackfillStart(parseTimeStampLong(yamlConfigMap.get(PROP_BACKFILL_START))); <END> List<DatasetConfigDTO> datasetConfigs = this.metricAttributesMap.getAllDatasets(); if (MapUtils.getString(yamlConfigMap, PROP_CRON) == null && datasetConfigs.stream().allMatch(c -> c.bucketTimeGranularity().getUnit().equals(TimeUnit.DAYS)) && datasetConfigs.stream().allMatch(c -> c.getDataSource().equals(PinotThirdEyeDataSource.DATA_SOURCE_NAME))) { config.setDataAvailabilitySchedule(true); } return config; }</code><technical_language>I a utility for this. try MapUtils ConfigUtils</technical_language>

Target:
private DetectionConfigDTO generateDetectionConfig(Map<String, Object> yamlConfigMap, Map<String, Object> detectionProperties, Map<String, Object> qualityProperties, String cron) { DetectionConfigDTO config = new DetectionConfigDTO(); config.setName(MapUtils.getString(yamlConfigMap, PROP_DETECTION_NAME)); config.setDescription(MapUtils.getString(yamlConfigMap, PROP_DESC_NAME)); config.setDescription(MapUtils.getString(yamlConfigMap, PROP_DESC_NAME)); config.setOwners(filterOwners(ConfigUtils.getList(yamlConfigMap.get(PROP_OWNERS)))); config.setLastTimestamp(longValue(yamlConfigMap.get(PROP_LAST_TIMESTAMP))); config.setProperties(detectionProperties); config.setDataQualityProperties(qualityProperties); config.setComponentSpecs(this.metricAttributesMap.getAllComponenets()); config.setCron(cron); config.setActive(MapUtils.getBooleanValue(yamlConfigMap, PROP_ACTIVE, true)); config.setYaml(yamlConfig); List<DatasetConfigDTO> datasetConfigs = this.metricAttributesMap.getAllDatasets(); if (MapUtils.getString(yamlConfigMap, PROP_CRON) == null && datasetConfigs.stream().allMatch(c -> c.bucketTimeGranularity().getUnit().equals(TimeUnit.DAYS)) && datasetConfigs.stream().allMatch(c -> c.getDataSource().equals(PinotThirdEyeDataSource.DATA_SOURCE_NAME))) { config.setDataAvailabilitySchedule(true); } return config; }
Source:
<code>protected @NonNull ITmfStateProvider createStateProvider() { <START> ITmfTrace trace = getTrace(); if (!(trace instanceof TmfExperiment)) { throw new IllegalStateException(); } <END> return new ContainerStateProvider((TmfExperiment) trace); }</code><technical_language>this in .canExecute(ITmfTrace trace)</technical_language>

Target:
protected @NonNull ITmfStateProvider createStateProvider() { return new ContainerStateProvider((TmfExperiment) checkNotNull(getTrace())); }
Source:
<code>public void update(SolGame game) { body.update(game); if (obstacle != null) { if (obstacle instanceof SolObjectEntityWrapper) { EntityRef entity = ((SolObjectEntityWrapper) obstacle).getEntity(); if (!wasDamageDealt) { if (config.aoeRadius >= 0) { EntityIterator iterator = game.getEntitySystemManager().getEntityManager().iterate(new Position()); while (iterator.next()) { Vector2 entityPosition = iterator.getEntity().getComponent(Position.class).get().position; if (getPosition().dst2(entityPosition) <= config.aoeRadius) { game.getEntitySystemManager().sendEvent(new DamageEvent(config.dmg), entity); } } } else { game.getEntitySystemManager().sendEvent(new DamageEvent(config.dmg), entity); } } if (config.density > 0) { obstacle = null; wasDamageDealt = true; } <START> collided(game); <END> return; } else { if (!wasDamageDealt) { if (config.aoeRadius >= 0) { game.getObjectManager().doToAllCloserThan(config.aoeRadius, this, (SolObject obj) -> obj.receiveDmg(config.dmg, game, body.getPosition(), config.dmgType) ); } else { obstacle.receiveDmg(config.dmg, game, body.getPosition(), config.dmgType); } } if (config.density > 0) { obstacle = null; wasDamageDealt = true; } else { collided(game); if (config.emTime > 0 && obstacle instanceof SolShip) { ((SolShip) obstacle).disableControls(config.emTime, game); } return; } } } if (lightSource != null) { lightSource.update(true, body.getAngle(), game); } maybeGuide(game); game.getSoundManager().play(game, config.workSound, null, this); }</code><technical_language>assuming putting this in else block :+1:</technical_language>

Target:
public void update(SolGame game) { body.update(game); if (obstacle != null) { if (obstacle instanceof SolObjectEntityWrapper) { EntityRef entity = ((SolObjectEntityWrapper) obstacle).getEntity(); if (!wasDamageDealt) { if (config.aoeRadius >= 0) { EntityIterator iterator = game.getEntitySystemManager().getEntityManager().iterate(new Position()); while (iterator.next()) { Vector2 entityPosition = iterator.getEntity().getComponent(Position.class).get().position; if (getPosition().dst2(entityPosition) <= config.aoeRadius) { game.getEntitySystemManager().sendEvent(new DamageEvent(config.dmg), entity); } } } else { game.getEntitySystemManager().sendEvent(new DamageEvent(config.dmg), entity); } } if (config.density > 0) { obstacle = null; wasDamageDealt = true; } else { collided(game); return; } } else { if (!wasDamageDealt) { if (config.aoeRadius >= 0) { game.getObjectManager().doToAllCloserThan(config.aoeRadius, this, (SolObject obj) -> obj.receiveDmg(config.dmg, game, body.getPosition(), config.dmgType) ); } else { obstacle.receiveDmg(config.dmg, game, body.getPosition(), config.dmgType); } } if (config.density > 0) { obstacle = null; wasDamageDealt = true; } else { collided(game); if (config.emTime > 0 && obstacle instanceof SolShip) { ((SolShip) obstacle).disableControls(config.emTime, game); } return; } } } if (lightSource != null) { lightSource.update(true, body.getAngle(), game); } maybeGuide(game); game.getSoundManager().play(game, config.workSound, null, this); }
Source:
<code>public void testEvaluateByNameWithEmptyParam() { final DMNRuntime runtime = DMNRuntimeUtil.createRuntime("simple-item-def.dmn", this.getClass() ); final DMNModel dmnModel = runtime.getModel("<LINK_0>", "simple-item-def" ); assertThat( dmnModel, notNullValue() ); assertThat( DMNRuntimeUtil.formatMessages( dmnModel.getMessages() ), dmnModel.hasErrors(), is( false ) ); final DMNContext context = DMNFactory.newContext(); context.set( "Monthly Salary", 1000 ); try { String[] decisionNames = new String[]{}; runtime.evaluateByName(dmnModel, context, decisionNames); fail("Should throw an IllegalArgumentException"); } catch (IllegalArgumentException e) { <START> assertTrue(true); <END> } }</code><technical_language>annotate test method @Test(expected = IllegalArgumentException.class). remove try-catch block fail(...) call</technical_language>

Target:
public void testEvaluateByNameWithEmptyParam() { final DMNRuntime runtime = DMNRuntimeUtil.createRuntime("simple-item-def.dmn", this.getClass()); final DMNModel dmnModel = runtime.getModel("<LINK_0>", "simple-item-def"); assertThat(dmnModel, notNullValue()); assertThat(DMNRuntimeUtil.formatMessages(dmnModel.getMessages()), dmnModel.hasErrors(), is(false)); final DMNContext context = DMNFactory.newContext(); context.set("Monthly Salary", 1000); String[] decisionNames = new String[]{}; runtime.evaluateByName(dmnModel, context, decisionNames); }
Source:
<code>public void writeActiveCache(int index) { if (!cacheActiveEnabled) { return; } synchronized (cacheActiveFile) { boolean exist = cacheActiveFile.exists(); try (RandomAccessFile raf = new RandomAccessFile(cacheActiveFile, "rw"); FileChannel fc = raf.getChannel(); FileLock lock = fc.tryLock()) { if (lock != null) { raf.setLength(0); raf.writeBytes(String.valueOf(index)); if (!exist) { boolean ret = cacheActiveFile.setWritable(true, false) && cacheActiveFile.setReadable(true, false); if (!ret) { throw new IOException("Cannot set file rw mode."); } } <START> LOG.debug("Succeed in writing active index " + index <END> + " to cache file " + cacheActiveFile); } } catch (Throwable e) { LOG.warn("Filed to write active index " + index + " to cache file " + cacheActiveFile, e); } } }</code><technical_language>parameterized locking please</technical_language>

Target:
private void writeActiveCache(int index) { if (!cacheActiveEnabled) { return; } synchronized (cacheActiveFile) { try (RandomAccessFile raf = new RandomAccessFile(cacheActiveFile, "rw"); FileChannel fc = raf.getChannel(); FileLock lock = fc.tryLock(0, Long.MAX_VALUE, false)) { if (lock != null) { raf.setLength(0); raf.writeBytes(String.valueOf(index)); boolean ret = cacheActiveFile.setWritable(true, false) && cacheActiveFile.setReadable(true, false); if (!ret) { throw new IOException("Cannot set file rw mode."); } LOG.debug("Succeed in writing active index " + index + " to cache file " + cacheActiveFile); } } catch (Throwable e) { LOG.warn("Failed to write active index " + index + " to cache file " + cacheActiveFile + ", It may be due to permission issues, the " + "dfs.client.failover.cache-active.dir must be properly " + "configured!", e); } } }
Source:
<code>protected boolean hasInferredTypeHeader(MessageProperties properties) { boolean hasInferredTypeHeader = properties.getInferredArgumentType() != null; <START> return hasInferredTypeHeader; <END> }</code><technical_language>reason extract variable. compilator is good optimization, source code is this simplified</technical_language>

Target:
protected boolean hasInferredTypeHeader(MessageProperties properties) { return properties.getInferredArgumentType() != null; }
Source:
<code>public void persistBestPossibleAssignment( Map<String, ResourceAssignment> bestPossibleAssignment) { <START> _bestPossibleAssignment.putAll(bestPossibleAssignment); <END> HelixProperty combinedAssignments = combineAssignments(BEST_POSSIBLE_KEY, bestPossibleAssignment); try { _dataAccessor.compressedBucketWrite(_bestPossiblePath, combinedAssignments); } catch (IOException e) { throw new HelixException("Failed to persist baseline!", e); } }</code><technical_language>_bestPossibleAssignment = bestPossibleAssignment is safer, right? Or, _bestPossibleAssignment.clear() _bestPossibleAssignment.putAll(bestPossibleAssignment);</technical_language>

Target:
public void persistBestPossibleAssignment( Map<String, ResourceAssignment> bestPossibleAssignment) { HelixProperty combinedAssignments = combineAssignments(BEST_POSSIBLE_KEY, bestPossibleAssignment); try { _dataAccessor.compressedBucketWrite(_bestPossiblePath, combinedAssignments); } catch (IOException e) { throw new HelixException("Failed to persist baseline!", e); } _bestPossibleAssignment = bestPossibleAssignment; }
Source:
<code>public void testJunctionIsRemovedButNotContents() throws Exception { <START> TemporaryFolder dir1 = new TemporaryFolder(tmp.getRoot()); <END> dir1.create(); File dir1Root = dir1.getRoot(); File f1 = dir1.newFile(); File j1 = makeJunction(tmp.getRoot(), dir1Root); print(tmp.getRoot()); print(dir1Root); print(j1); Util.deleteRecursive(j1); print(dir1Root); print(tmp.getRoot()); assertTrue(f1.exists()); }</code><technical_language>unneeded - tmp</technical_language>

Target:
public void testJunctionIsRemovedButNotContents() throws Exception { File subdir1 = tmp.newFolder("notJunction"); File f1 = new File(subdir1, "testfile1.txt"); assertTrue("Unable to create temporary file in notJunction directory", f1.createNewFile()); File j1 = makeJunction(tmp.getRoot(), subdir1); Util.deleteRecursive(j1); assertFalse("Windows Junction should have been removed", j1.exists()); assertTrue("Contents of Windows Junction should not be removed", f1.exists()); }
Source:
<code>public Page getOutput() { if ((state != State.FINISHING) || !finishFuture.isDone()) { return null; } state = State.FINISHED; Collection<Slice> fragments = getFutureValue(finishFuture); PageBuilder page = new PageBuilder(fragments.size() + 2, TYPES); BlockBuilder rowsBuilder = page.getBlockBuilder(0); BlockBuilder fragmentBuilder = page.getBlockBuilder(1); BlockBuilder operatorExecutionContextBuilder = page.getBlockBuilder(2); TaskId taskId = operatorContext.getDriverContext().getPipelineContext().getTaskId(); Slice operatorExecutionContext = wrappedBuffer(operatorExecutionContextCodec.toJsonBytes(new OperatorExecutionContext(operatorContext.getDriverContext().getLifespan(), taskId.getStageId().getId(), taskId.getId(), CommitGranularity.TABLE, true))); page.declarePosition(); BIGINT.writeLong(rowsBuilder, rowCount); fragmentBuilder.appendNull(); VARBINARY.writeSlice(operatorExecutionContextBuilder, operatorExecutionContext); for (Slice fragment : fragments) { page.declarePosition(); rowsBuilder.appendNull(); VARBINARY.writeSlice(fragmentBuilder, fragment); <START> VARBINARY.writeSlice(operatorExecutionContextBuilder, operatorExecutionContext); <END> } return page.build(); }</code><technical_language>This write operatorExecutionContext multiple times. PageBuilder here. create block builders directly. block a run length encoded block</technical_language>

Target:
public Page getOutput() { if ((state != State.FINISHING) || !finishFuture.isDone()) { return null; } state = State.FINISHED; Collection<Slice> fragments = getFutureValue(finishFuture); int positionCount = fragments.size() + 1; BlockBuilder rowsBuilder = BIGINT.createBlockBuilder(null, positionCount); BlockBuilder fragmentBuilder = VARBINARY.createBlockBuilder(null, positionCount); rowsBuilder.writeLong(rowCount); fragmentBuilder.appendNull(); for (Slice fragment : fragments) { rowsBuilder.appendNull(); VARBINARY.writeSlice(fragmentBuilder, fragment); } TaskId taskId = operatorContext.getDriverContext().getPipelineContext().getTaskId(); Slice tableCommitContext = wrappedBuffer(tableCommitContextCodec.toJsonBytes( new TableCommitContext( operatorContext.getDriverContext().getLifespan(), taskId.getStageId().getId(), taskId.getId(), CommitGranularity.TABLE, true))); return new Page(positionCount, rowsBuilder.build(), fragmentBuilder.build(), RunLengthEncodedBlock.create(VARBINARY, tableCommitContext, positionCount)); }
Source:
<code>protected boolean set(ItemStack dataHolder, Map<Key<?>, Object> keyValues) { if (!dataHolder.hasTagCompound()) { dataHolder.setTagCompound(new NBTTagCompound()); } int flag = 0; if ((boolean) keyValues.get(Keys.HIDE_ENCHANTMENTS)) { <START> flag += 1; <END> } if ((boolean) keyValues.get(Keys.HIDE_ATTRIBUTES)) { flag += 2; } if ((boolean) keyValues.get(Keys.HIDE_UNBREAKABLE)) { flag += 4; } if ((boolean) keyValues.get(Keys.HIDE_CAN_DESTROY)) { flag += 8; } if ((boolean) keyValues.get(Keys.HIDE_CAN_PLACE)) { flag += 16; } if ((boolean) keyValues.get(Keys.HIDE_MISCELLANEOUS)) { flag += 32; } dataHolder.getTagCompound().setInteger(NbtDataUtil.ITEM_HIDE_FLAGS, flag); return true; }</code><technical_language>Alternatively, bitwise OR</technical_language>

Target:
protected boolean set(ItemStack dataHolder, Map<Key<?>, Object> keyValues) { if (!dataHolder.hasTagCompound()) { dataHolder.setTagCompound(new NBTTagCompound()); } int flag = 0; if ((boolean) keyValues.get(Keys.HIDE_ENCHANTMENTS)) { flag |= DataConstants.HIDE_ENCHANTMENTS_FLAG; } if ((boolean) keyValues.get(Keys.HIDE_ATTRIBUTES)) { flag |= DataConstants.HIDE_ATTRIBUTES_FLAG; } if ((boolean) keyValues.get(Keys.HIDE_UNBREAKABLE)) { flag |= DataConstants.HIDE_UNBREAKABLE_FLAG; } if ((boolean) keyValues.get(Keys.HIDE_CAN_DESTROY)) { flag |= DataConstants.HIDE_CAN_DESTROY_FLAG; } if ((boolean) keyValues.get(Keys.HIDE_CAN_PLACE)) { flag |= DataConstants.HIDE_CAN_PLACE_FLAG; } if ((boolean) keyValues.get(Keys.HIDE_MISCELLANEOUS)) { flag |= DataConstants.HIDE_MISCELLANEOUS_FLAG; } dataHolder.getTagCompound().setInteger(NbtDataUtil.ITEM_HIDE_FLAGS, flag); return true; }
Source:
<code>public void prepare(InternalEnvironment env, OpenShiftEnvironment osEnv, String workspaceId) throws InfrastructureException { final String subPath = getSubPath(workspaceId); <START> pvcJobExecutor.execute(workspaceId, CREATE_DIRS, subPath); <END> final PersistentVolumeClaim pvc = osEnv.getPersistentVolumeClaims().get(pvcName); if (pvc != null) { return; } final String machineWithSources = getWsAgentServerMachine(env) .orElseThrow(() -> new InfrastructureException("Machine with ws-agent not found")); osEnv.getPersistentVolumeClaims().put(pvcName, newPVC(pvcName, pvcAccessMode, pvcQuantity)); for (Pod pod : osEnv.getPods().values()) { final PodSpec podSpec = pod.getSpec(); for (Container container : podSpec.getContainers()) { final String machine = Names.machineName(pod, container); if (machine.equals(machineWithSources)) { container.getVolumeMounts().add(newVolumeMount(pvcName, projectsPath, subPath)); podSpec.getVolumes().add(newVolume(pvcName, pvcName)); return; } } } }</code><technical_language>rework this: pvcSubPathHelper.createDirsAsync(wsId, subPath); pvcSubPathHelper.removeDirsAsync(wsId, subPath);</technical_language>

Target:
public void prepare(InternalEnvironment env, OpenShiftEnvironment osEnv, String workspaceId) throws InfrastructureException { final String machineWithSources = getWsAgentServerMachine(env) .orElseThrow(() -> new InfrastructureException("Machine with ws-agent not found")); final Map<String, PersistentVolumeClaim> claims = osEnv.getPersistentVolumeClaims(); claims.put(pvcName, newPVC(pvcName, pvcAccessMode, pvcQuantity)); factory.create(workspaceId).persistentVolumeClaims().createIfNotExist(claims.values()); final String subPath = workspaceId + projectsPath; pvcSubPathHelper.createDirs(workspaceId, subPath); for (Pod pod : osEnv.getPods().values()) { final PodSpec podSpec = pod.getSpec(); for (Container container : podSpec.getContainers()) { final String machine = Names.machineName(pod, container); if (machine.equals(machineWithSources)) { container.getVolumeMounts().add(newVolumeMount(pvcName, projectsPath, subPath)); podSpec.getVolumes().add(newVolume(pvcName, pvcName)); return; } } } }
Source:
<code>protected void compute(CoreSession session, List<String> ids, Map<String, Serializable> properties) { Collection<DocumentRef> refs = ids.stream().map(IdRef::new).collect(Collectors.toList()); <START> for (DocumentRef ref : refs) { <END> if (!session.isRecord(ref)) { log.debug("Document is not a record", ref); continue; } Calendar retainUntil = session.getRetentionUntil(ref); if (retainUntil == null) { log.debug("Document was not under retention", ref); continue; } if (isUnderRetention(retainUntil)) { log.debug("Document is still under retention: {}", ref, retainUntil.toInstant()); continue; } try { session.setRetentionUntil(ref, null); sendEvent(session, ref, retainUntil); } catch (NuxeoException e) { log.warn("Cannot reset retention on: {}", ref, e); } } try { session.save(); } catch (PropertyException e) { log.warn("Cannot save session", e); } }</code><technical_language>This list hugged, interesting loop twice</technical_language>

Target:
protected void compute(CoreSession session, List<String> ids, Map<String, Serializable> properties) { Collection<DocumentRef> refs = ids.stream().map(IdRef::new).collect(Collectors.toList()); for (DocumentRef ref : refs) { if (!session.isRecord(ref)) { log.debug("Document: is not a record", ref); continue; } Calendar retainUntil = session.getRetainUntil(ref); if (retainUntil == null) { log.debug("Document: was not under retention", ref); continue; } if (isUnderRetention(retainUntil)) { log.debug("Document: is still under retention: {}", () -> ref, retainUntil::toInstant); continue; } try { session.setRetainUntil(ref, null, null); sendEvent(session, ref, retainUntil); } catch (NuxeoException e) { log.warn("Cannot reset retention on: {}", ref, e); } } try { session.save(); } catch (PropertyException e) { log.warn("Cannot save session", e); } }