auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testJobsDontRunWhenSchedulerPaused() throws Throwable { int initialJobsNumber = refreshAndGetTotalJobCount(); Scheduler schedAdminInterface = schedulerHelper.getSchedulerInterface(); assertTrue(schedAdminInterface.pause()); JobId jobId1 = schedulerHelper.submitJob(new File(simpleJobUrl.toURI()).getAbsolutePath()); JobId jobId2 = schedulerHelper.submitJob(new File(simpleJobUrl.toURI()).getAbsolutePath()); schedulerHelper.waitForEventJobSubmitted(jobId1, EVENT_TIMEOUT); schedulerHelper.waitForEventJobSubmitted(jobId2, EVENT_TIMEOUT); <START> Thread.sleep(5000); <END> JobState js1 = schedulerHelper.getSchedulerInterface().getJobState(jobId1); assertEquals(JobStatus.PENDING, js1.getStatus()); JobState js2 = schedulerHelper.getSchedulerInterface().getJobState(jobId2); assertEquals(JobStatus.PENDING, js2.getStatus()); schedulerHelper.killJob(jobId1.toString()); schedulerHelper.killJob(jobId2.toString()); schedulerHelper.removeJob(jobId1); schedulerHelper.removeJob(jobId2); schedulerHelper.waitForEventJobRemoved(jobId1, EVENT_TIMEOUT); schedulerHelper.waitForEventJobRemoved(jobId2, EVENT_TIMEOUT); assertEquals(initialJobsNumber, refreshAndGetTotalJobCount()); schedulerHelper.checkNodesAreClean(); assertTrue(schedAdminInterface.resume()); }</code><technical_language>15 seconds more reassuring</technical_language>

Target:
public void testJobsDontRunWhenSchedulerPaused() throws Throwable { int initialJobsNumber = refreshAndGetTotalJobCount(); Scheduler schedAdminInterface = schedulerHelper.getSchedulerInterface(); assertTrue(schedAdminInterface.pause()); JobId jobId1 = schedulerHelper.submitJob(new File(simpleJobUrl.toURI()).getAbsolutePath()); JobId jobId2 = schedulerHelper.submitJob(new File(simpleJobUrl.toURI()).getAbsolutePath()); schedulerHelper.waitForEventJobSubmitted(jobId1, EVENT_TIMEOUT); schedulerHelper.waitForEventJobSubmitted(jobId2, EVENT_TIMEOUT); Thread.sleep(10000); JobState js1 = schedulerHelper.getSchedulerInterface().getJobState(jobId1); assertEquals(JobStatus.PENDING, js1.getStatus()); JobState js2 = schedulerHelper.getSchedulerInterface().getJobState(jobId2); assertEquals(JobStatus.PENDING, js2.getStatus()); schedulerHelper.killJob(jobId1.toString()); schedulerHelper.killJob(jobId2.toString()); schedulerHelper.removeJob(jobId1); schedulerHelper.removeJob(jobId2); schedulerHelper.waitForEventJobRemoved(jobId1, EVENT_TIMEOUT); schedulerHelper.waitForEventJobRemoved(jobId2, EVENT_TIMEOUT); assertEquals(initialJobsNumber, refreshAndGetTotalJobCount()); schedulerHelper.checkNodesAreClean(); assertTrue(schedAdminInterface.resume()); }
Source:
<code>public QuorumServer(long id, InetSocketAddress addr) { this.id = id; this.addr = addr; this.electionAddr = null; String checkIPReachableValue = System.getProperty("zookeeper.checkIPTimeout"); <START> if(checkIPReachableValue != null){ <END> this.checkIPReachableTO = Integer.parseInt(checkIPReachableValue); } }</code><technical_language>nit: space if (</technical_language>

Target:
public QuorumServer(long id, InetSocketAddress addr) { this.id = id; this.addr = addr; this.electionAddr = null; }
Source:
<code>private void initPreferenceDefaults() { getPreferenceStore().setDefault(CHANGE_SET_MANAGE, true); getPreferenceStore().setDefault(COMMIT_TEMPLATE, DEFAULT_COMMIT_TEMPLATE); if (getPreferenceStore().getString(COMMIT_TEMPLATE).equals(OLD_DEFAULT_COMMIT_TEMPLATE) || getPreferenceStore().getString(COMMIT_TEMPLATE).equals(OLD_DEFAULT_COMMIT_TEMPLATE2) <START> || getPreferenceStore().getString(COMMIT_TEMPLATE).equals(OLD_DEFAULT_COMMIT_TEMPLATE3)) { <END> getPreferenceStore().setValue(COMMIT_TEMPLATE, DEFAULT_COMMIT_TEMPLATE); } }</code><technical_language>a bunch of templates I in a list/set check if contains template pref store</technical_language>

Target:
private void initPreferenceDefaults() { getPreferenceStore().setDefault(CHANGE_SET_MANAGE, true); getPreferenceStore().setDefault(COMMIT_TEMPLATE, DEFAULT_COMMIT_TEMPLATE); }
Source:
<code><START> public ResponseEntity<List<Commit>> listCommits( <END> @PathVariable("projectId") long projectId, @PathVariable("branchName") String branchName) { return new ResponseEntity<>( getCommitsInProjectUseCase.get(projectId, branchName), HttpStatus.OK); }</code><technical_language>GetCommitResponse is longer anymore. remove this class replace occurrences in tests Commit class</technical_language>

Target:
public ResponseEntity<List<GetCommitResponse>> listCommits( @PathVariable("projectId") long projectId, @PathVariable("branchName") String branchName) { List<Commit> commits = getCommitsInProjectUseCase.get(projectId, branchName); List<GetCommitResponse> result = new ArrayList<>(commits.size()); for (Commit commit : commits) { result.add( new GetCommitResponse() .setName(commit.getName()) .setAnalyzed(commit.isAnalyzed()) .setAuthor(commit.getAuthor()) .setComment(commit.getComment()) .setTimestamp(commit.getTimestamp())); } return new ResponseEntity<>(result, HttpStatus.OK); }
Source:
<code>public void testBug548456_concurrentElementInfoAccess() throws Exception { int iterations = 20; int numberOfThreads = <START> 2; <END> for (int i = 0; i < iterations; ++i) { doTestBug548456_concurrentCallBinaryTypeExists(numberOfThreads); } }</code><technical_language>10 threads I reproduce bug</technical_language>

Target:
public void testBug548456_concurrentElementInfoAccess() throws Exception { int iterations = 20; int numberOfThreads = 10; for (int i = 0; i < iterations; ++i) { doTestBug548456_concurrentCallBinaryTypeExists(numberOfThreads); } }
Source:
<code>public InternalIndexState getInitialState( long indexId, IndexDescriptor descriptor ) { try { NativeSchemaIndexHeaderReader headerReader = new NativeSchemaIndexHeaderReader(); GBPTree.readHeader( pageCache, nativeIndexFileFromIndexId( indexId ), new ReadOnlyMetaNumberLayout(), headerReader ); switch ( headerReader.state ) { case BYTE_FAILED: return InternalIndexState.FAILED; case BYTE_ONLINE: return InternalIndexState.ONLINE; case BYTE_POPULATING: return InternalIndexState.POPULATING; default: throw new IllegalStateException( "Unexpected initial state byte value " + headerReader.state ); } } catch ( IOException e ) { <START> return InternalIndexState.POPULATING; <END> } }</code><technical_language>LuceneSchemaIndexProvider do log.error( "Failed open index:" + indexId + ", requesting re-population.", e );. native well? Also, missing test for this behaviour</technical_language>

Target:
public InternalIndexState getInitialState( long indexId, IndexDescriptor descriptor ) { try { NativeSchemaIndexHeaderReader headerReader = new NativeSchemaIndexHeaderReader(); GBPTree.readHeader( pageCache, nativeIndexFileFromIndexId( indexId ), new ReadOnlyMetaNumberLayout(), headerReader ); switch ( headerReader.state ) { case BYTE_FAILED: return InternalIndexState.FAILED; case BYTE_ONLINE: return InternalIndexState.ONLINE; case BYTE_POPULATING: return InternalIndexState.POPULATING; default: throw new IllegalStateException( "Unexpected initial state byte value " + headerReader.state ); } } catch ( IOException e ) { log.error( "Failed to open index:" + indexId + ", requesting re-population.", e ); return InternalIndexState.POPULATING; } }
Source:
<code>public BibRecord parseRecord(String line) { String regEx = "\\[([0-9]+)\\] (" + authInitialsLastList + ")\\. ([^\\.]+)\\. (?:(?:I|i)n )?(.*) ([1-2][0-9]{3})\\.( .*)?"; Matcher m = Pattern.compile(regEx).matcher(line.trim()); if(m.matches()) { BibRecord out = new BibRecord(m.group(3), authorStringToList(m.group(2)), <START> m.group(4), Pattern.compile(m.group(1)), extractRefYear(m.group(5))); <END> return out; } else return null; }</code><technical_language>This is Pattern.compile() extracted another pattern</technical_language>

Target:
public BibRecord parseRecord(String line) { Matcher m = pattern.matcher(line.trim()); if(m.matches()) { return new BibRecord( m.group(3), authorStringToList(m.group(2)), m.group(4), Pattern.compile(m.group(1)), extractRefYear(m.group(5))); } else { return null; } }
Source:
<code>public PlainIntegerDictionary(DictionaryPage dictionaryPage) throws IOException { super(dictionaryPage); final ByteBuffer dictionaryByteBuf = dictionaryPage.getBytes().toByteBuffer(); intDictionaryContent = new int[dictionaryPage.getDictionarySize()]; IntegerPlainValuesReader intReader = new IntegerPlainValuesReader(); <START> intReader.initFromPage(dictionaryPage.getDictionarySize(), dictionaryByteBuf, dictionaryByteBuf.position()); <END> for (int i = 0; i < intDictionaryContent.length; i++) { intDictionaryContent[i] = intReader.readInteger(); } }</code><technical_language>position() == 0</technical_language>

Target:
public PlainIntegerDictionary(DictionaryPage dictionaryPage) throws IOException { super(dictionaryPage); final ByteBuffer dictionaryByteBuf = dictionaryPage.getBytes().toByteBuffer(); intDictionaryContent = new int[dictionaryPage.getDictionarySize()]; IntegerPlainValuesReader intReader = new IntegerPlainValuesReader(); intReader.initFromPage(dictionaryPage.getDictionarySize(), dictionaryByteBuf, 0); for (int i = 0; i < intDictionaryContent.length; i++) { intDictionaryContent[i] = intReader.readInteger(); } }
Source:
<code>public Response start(Action action) { if (isStartRunOnce(action)) { RunVmOnceParams params = map(map(getEntity(entityType, VdcQueryType.GetVmByVmId, new IdQueryParameters(guid), id, true), new VM()), new RunVmOnceParams(guid)); <START> if (action.isSetVm()) { <END> validateEnums(VM.class, action.getVm()); VM vm = action.getVm(); params = map(vm, params); if (vm.isSetPlacementPolicy() && vm.getPlacementPolicy().isSetHost()) { validateParameters(vm.getPlacementPolicy(), "host.id|name"); params.setDestinationVdsId(getHostId(vm.getPlacementPolicy().getHost())); } } if (action.isSetPause() && action.isPause()) { params.setRunAndPause(true); } return doAction(VdcActionType.RunVmOnce, params, action); } else { RunVmParams params = new RunVmParams(guid); if (action.isSetPause() && action.isPause()) { params.setRunAndPause(true); } return doAction(VdcActionType.RunVm, params, action); } }</code><technical_language>this condition is longer relevant</technical_language>

Target:
public Response start(Action action) { if (action.isSetVm()) { validateEnums(VM.class, action.getVm()); RunVmOnceParams params = map(map(getEntity(entityType, VdcQueryType.GetVmByVmId, new IdQueryParameters(guid), id, true), new VM()), new RunVmOnceParams(guid)); VM vm = action.getVm(); params = map(vm, params); if (vm.isSetPlacementPolicy() && vm.getPlacementPolicy().isSetHost()) { validateParameters(vm.getPlacementPolicy(), "host.id|name"); params.setDestinationVdsId(getHostId(vm.getPlacementPolicy().getHost())); } if (action.isSetPause() && action.isPause()) { params.setRunAndPause(true); } return doAction(VdcActionType.RunVmOnce, params, action); } else { RunVmParams params = new RunVmParams(guid); if (action.isSetPause() && action.isPause()) { params.setRunAndPause(true); } return doAction(VdcActionType.RunVm, params, action); } }
Source:
<code>protected boolean validate() { if (!super.validate()) { return false; } StorageDomain dom = getStorageDomain(); if (dom == null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST); } <START> boolean localFs = isLocalFs(dom); <END> VDS vds = getVds(); StorageDomainToPoolRelationValidator domainPoolValidator = createDomainToPoolValidator(dom); if (!checkStorageDomain()) { return false; } if (!localFs && !validate(domainPoolValidator.isStorageDomainNotInAnyPool())) { return false; } if (localFs && isDomainAttached(dom) && !canDetachDomain(getParameters().getDestroyingPool(), false)) { return false; } if (getParameters().getDoFormat() && !localFs && isStorageDomainAttached(dom)) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_FORMAT_STORAGE_DOMAIN_WITH_ATTACHED_DATA_DOMAIN); } if (vds == null) { if (localFs) { if (!initializeVds()) { return false; } } else { return failValidation(EngineMessage.CANNOT_REMOVE_STORAGE_DOMAIN_INVALID_HOST_ID); } } if (dom.getStorageType().isOpenStackDomain()) { return failValidation(EngineMessage.ERROR_CANNOT_MANAGE_STORAGE_DOMAIN); } return true; }</code><technical_language>This unrelated code now. move used..</technical_language>

Target:
protected boolean validate() { if (!super.validate()) { return false; } StorageDomain dom = getStorageDomain(); if (dom == null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NOT_EXIST); } VDS vds = getVds(); StorageDomainToPoolRelationValidator domainPoolValidator = createDomainToPoolValidator(dom); if (!checkStorageDomain()) { return false; } boolean localFs = isLocalFs(dom); if (!localFs && !validate(domainPoolValidator.isStorageDomainNotInAnyPool())) { return false; } if (localFs && isDomainAttached(dom) && !canDetachDomain(getParameters().getDestroyingPool(), false)) { return false; } if (getParameters().getDoFormat() && !localFs && isStorageDomainAttached(dom)) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_FORMAT_STORAGE_DOMAIN_WITH_ATTACHED_DATA_DOMAIN); } if (vds == null) { if (localFs) { if (!initializeVds()) { return false; } } else { return failValidation(EngineMessage.CANNOT_REMOVE_STORAGE_DOMAIN_INVALID_HOST_ID); } } if (dom.getStorageType().isOpenStackDomain()) { return failValidation(EngineMessage.ERROR_CANNOT_MANAGE_STORAGE_DOMAIN); } return true; }
Source:
<code>public static StatsWidgetPromoDialogFragment newInstance() { <START> StatsWidgetPromoDialogFragment frag = new StatsWidgetPromoDialogFragment(); <END> return frag; }</code><technical_language>Minor nit: frag variable serves purpose - this simply return new StatsWidgetPromoDialogFragment();</technical_language>

Target:
public static StatsWidgetPromoDialogFragment newInstance() { return new StatsWidgetPromoDialogFragment(); }
Source:
<code>private void setExtendedData(Placemark placemark, Metacard metacard) { final ExtendedData extendedData = new ExtendedData(); final Set<AttributeDescriptor> attributeDescriptors = metacard.getMetacardType().getAttributeDescriptors(); for (AttributeDescriptor attributeDescriptor : attributeDescriptors) { final String attributeName = attributeDescriptor.getName(); final Attribute attribute = metacard.getAttribute(attributeName); if (attribute != null) { String attributeValue = convertAttribute(attribute, attributeDescriptor) .toString() .replace("[", "") <START> .replace("]", ""); <END> final Data data = getData(attributeName, attributeValue); extendedData.addToData(data); } } placemark.setExtendedData(extendedData); }</code><technical_language>a regex instead of calls. Ex. toString().replaceAll("\\[|\\], "") want [ ] allowed values - if allowed, need replacing [ ]</technical_language>

Target:
private void setExtendedData(Placemark placemark, Metacard metacard) { final ExtendedData extendedData = new ExtendedData(); final Set<AttributeDescriptor> attributeDescriptors = metacard.getMetacardType().getAttributeDescriptors(); for (AttributeDescriptor attributeDescriptor : attributeDescriptors) { final String attributeName = attributeDescriptor.getName(); final Attribute attribute = metacard.getAttribute(attributeName); if (attribute != null) { Serializable attributeValue = convertAttribute(attribute, attributeDescriptor); if (attributeValue == null) { LOGGER.debug("Attribute converted to null value.", attributeName); } else { final Data data = getData(attributeName, attributeValue.toString()); extendedData.addToData(data); } } } placemark.setExtendedData(extendedData); }
Source:
<code>public synchronized RealmFunctions getFunctions() { checkLoggedIn(); if (functions == null) { <START> functions = new RealmFunctions(); <END> } return functions; }</code><technical_language>need add user argument functions, added needed</technical_language>

Target:
public synchronized Functions getFunctions() { checkLoggedIn(); if (functions == null) { functions = new FunctionsImpl(this); } return functions; }
Source:
<code>public static void main(String[] args) { new Super(); new Constructor().new Inner(); <START> new InnerStatic(); <END> new PublicDefault(); new PackageLocalDefault(); new PrivateDefault(); new PrivateEmptyNoArg(); }</code><technical_language>@Godin Thx! :+1:</technical_language>

Target:
public static void main(String[] args) { new Super(); new Constructor().new Inner(); new InnerStatic(); new PublicDefault(); new PackageLocalDefault(); new PrivateDefault(); new PrivateNonEmptyNoArg(); new PrivateEmptyNoArg(); }
Source:
<code>public CompletableFuture<JobDetails> requestJobDetails(Time timeout) { synchronized (lock) { if (isRunning()) { return getJobMasterGateway().thenCompose(jobMasterGateway -> jobMasterGateway.requestJobDetails( timeout)); } else { <START> int[] tasksPerState = new int[ExecutionState.values().length]; return CompletableFuture.completedFuture(new JobDetails( jobId, jobName, initializationTimestamp, 0, 0, jobStatus, 0, tasksPerState, 0)); <END> } } }</code><technical_language>factor out createInitializingJobDetails</technical_language>

Target:
public CompletableFuture<JobDetails> requestJobDetails(Time timeout) { return requestJobStatus(timeout).thenApply(status -> { int[] tasksPerState = new int[ExecutionState.values().length]; synchronized (lock) { return new JobDetails( jobId, jobName, initializationTimestamp, 0, 0, status, 0, tasksPerState, 0); } }); }
Source:
<code>public static String getImplementationDataStringForSpec(RegisteredType item) { if (item==null || item.getPlan()==null) return null; Object data = item.getPlan().getPlanData(); <START> if (!(data instanceof String)) return null; <END> return (String)data; }</code><technical_language>usages throw in this case</technical_language>

Target:
public static String getImplementationDataStringForSpec(RegisteredType item) { if (item==null || item.getPlan()==null) return null; Object data = item.getPlan().getPlanData(); if (!(data instanceof String)) throw new IllegalStateException("Expected plan data for "+item+" to be a string"); return (String)data; }
Source:
<code>public void testInstantiation() throws Exception { maxChunkSize = random.nextInt(1024 * 1024) + 1; blobSize = maxChunkSize * 5; doPut(); <START> String blobIdStr = (new BlobId(mockClusterMap.getWritablePartitionIds().get(0))).getID(); <END> Callback<ReadableStreamChannel> operationCallback = new Callback<ReadableStreamChannel>() { @Override public void onCompletion(ReadableStreamChannel result, Exception exception) { } }; try { new GetBlobOperation(routerConfig, routerMetrics, mockClusterMap, responseHandler, "invalid_id", operationFuture, operationCallback, operationCompleteCallback, time); Assert.fail("Instantiation of GetReadableStreamChannel operation with an invalid blob id must fail"); } catch (RouterException e) { Assert.assertEquals("Unexpected exception received on creating GetBlobOperation", RouterErrorCode.InvalidBlobId, e.getErrorCode()); } GetBlobOperation op = new GetBlobOperation(routerConfig, routerMetrics, mockClusterMap, responseHandler, blobIdStr, operationFuture, operationCallback, operationCompleteCallback, time); Assert.assertEquals("Callbacks must match", operationCallback, op.getCallback()); Assert.assertEquals("Futures must match", operationFuture, op.getFuture()); Assert.assertEquals("Blob ids must match", blobIdStr, op.getBlobIdStr()); }</code><technical_language>minor: is a blobIdStr set doPut(). new one</technical_language>

Target:
public void testInstantiation() throws Exception { Callback<ReadableStreamChannel> operationCallback = new Callback<ReadableStreamChannel>() { @Override public void onCompletion(ReadableStreamChannel result, Exception exception) { } }; try { new GetBlobOperation(routerConfig, routerMetrics, mockClusterMap, responseHandler, "invalid_id", operationFuture, operationCallback, operationCompleteCallback, blobIdFactory, time); Assert.fail("Instantiation of GetBlobOperation with an invalid blob id must fail"); } catch (RouterException e) { Assert.assertEquals("Unexpected exception received on creating GetBlobOperation", RouterErrorCode.InvalidBlobId, e.getErrorCode()); } blobIdStr = new BlobId(mockClusterMap.getWritablePartitionIds().get(0)).getID(); GetBlobOperation op = new GetBlobOperation(routerConfig, routerMetrics, mockClusterMap, responseHandler, blobIdStr, operationFuture, operationCallback, operationCompleteCallback, blobIdFactory, time); Assert.assertEquals("Callbacks must match", operationCallback, op.getCallback()); Assert.assertEquals("Futures must match", operationFuture, op.getFuture()); Assert.assertEquals("Blob ids must match", blobIdStr, op.getBlobIdStr()); }
Source:
<code>private void checkNewNode( boolean client, boolean canWrite, boolean safe ) throws Exception { try { <START> IgniteEx cl = startClientGrid("newNode"); <END> CacheGroupContext grpCtx = cl.context().cache().cacheGroup(CU.cacheId(DEFAULT_CACHE_NAME)); assertTrue(grpCtx.needsRecovery()); verifyCacheOps(canWrite, safe, cl); validateQuery(safe, cl); } finally { stopGrid("newNode", false); } }</code><technical_language>Client argument check is missed</technical_language>

Target:
private void checkNewNode( boolean client, boolean canWrite, boolean safe ) throws Exception { try { IgniteEx cl = client ? startClientGrid("newNode") : startGrid("newNode"); CacheGroupContext grpCtx = cl.context().cache().cacheGroup(CU.cacheId(DEFAULT_CACHE_NAME)); assertTrue(grpCtx.needsRecovery()); verifyCacheOps(canWrite, safe, cl); validateQuery(safe, cl); } finally { stopGrid("newNode", false); } }
Source:
<code>private void _checkOldGenUsage() { List<MemoryPoolMXBean> memoryPoolBeans = ManagementFactory.getMemoryPoolMXBeans(); for (MemoryPoolMXBean bean : memoryPoolBeans) { if (bean.getType() == MemoryType.HEAP) { String name = bean.getName().toLowerCase(); if (name.contains("old") || name.contains("tenured")) { long oldGenUsed = bean.getUsage().getUsed(); _logger.info("Old Gen Memory = bytes", oldGenUsed); _logger.info("Max JVM Memory = bytes", MAX_MEMORY); <START> if (oldGenUsed > 0.90 * MAX_MEMORY) { <END> _logger.info("JVM heap memory usage has exceeded 90% of the allocated heap memory. Disabling writes to TRIE."); WRITES_TO_TRIE_ENABLED = false; } else if(oldGenUsed < 0.50 * MAX_MEMORY && !WRITES_TO_TRIE_ENABLED) { _logger.info("JVM heap memory usage is below 50% of the allocated heap memory and writes to TRIE is disabled. " + "Enabling writes to TRIE now."); WRITES_TO_TRIE_ENABLED = true; } } } } }</code><technical_language>if this work always. Heap memory young gen if is 10 percent, this true. total heap memory instead of gen memory</technical_language>

Target:
private void _checkOldGenUsage() { List<MemoryPoolMXBean> memoryPoolBeans = ManagementFactory.getMemoryPoolMXBeans(); for (MemoryPoolMXBean bean : memoryPoolBeans) { if (bean.getType() == MemoryType.HEAP) { String name = bean.getName().toLowerCase(); if (name.contains("old") || name.contains("tenured")) { long oldGenUsed = bean.getUsage().getUsed(); _logger.info("Old Gen Memory = bytes", oldGenUsed); _logger.info("Max JVM Memory = bytes", MAX_MEMORY); if (oldGenUsed > 0.90 * MAX_MEMORY) { _logger.info("JVM heap memory usage has exceeded 90% of the allocated heap memory. Disabling writes to TRIE."); _writesToTrieEnabled = false; } else if(oldGenUsed < 0.50 * MAX_MEMORY && !_writesToTrieEnabled) { _logger.info("JVM heap memory usage is below 50% of the allocated heap memory and writes to TRIE is disabled. " + "Enabling writes to TRIE now."); _writesToTrieEnabled = true; } } } } }
Source:
<code>private void parseExcelDocument(File officeFile, String objectID) { String fileType = Files.getFileExtension(officeFile.getAbsolutePath()); Sheet sheet; try { if (fileType.equals(XLSX)) { sheet = new <START> XSSFWorkbook(OPCPackage.open(officeFile.getAbsolutePath())).getSheetAt(0); <END> } else { sheet = new HSSFWorkbook(new FileInputStream(officeFile.getAbsolutePath())).getSheetAt(0); } } catch (OldExcelFormatException e) { showMessage(viewer.getControl().getShell(), SWT.ERROR, "Error", "This version of Excel is not supported."); return; } catch (Exception e) { e.printStackTrace(); showMessage(viewer.getControl().getShell(), SWT.ERROR, "Error", "Couldn't open the file."); return; } DataFormatter formatter = new DataFormatter(); getOpenedView().clearSelection(); if (!objectID.equals(OBJECT_ID_NOT_SPECIFIED)) { Row row = sheet.getRow(Integer.parseInt(objectID)); if (row != null) { CapraExcelRow cRow = new CapraExcelRow(row, officeFile, formatter); if (!cRow.getData().isEmpty()) selection.add(cRow); } } else { for (int i = 0; i <= sheet.getLastRowNum(); i++) { Row row = sheet.getRow(i); if (row != null) { CapraExcelRow cRow = new CapraExcelRow(row, officeFile, formatter); if (!cRow.getData().isEmpty()) selection.add(cRow); } } } }</code><technical_language>is a version of open() takes a file argument</technical_language>

Target:
private void parseExcelDocument(File officeFile, String objectID) { String fileType = Files.getFileExtension(officeFile.getAbsolutePath()); Sheet sheet; try { if (fileType.equals(XLSX)) { sheet = new XSSFWorkbook(OPCPackage.open(officeFile)).getSheetAt(0); } else { sheet = new HSSFWorkbook(new FileInputStream(officeFile)).getSheetAt(0); } } catch (OldExcelFormatException e) { showMessage(viewer.getControl().getShell(), SWT.ERROR, "Error", "This version of Excel is not supported."); return; } catch (Exception e) { e.printStackTrace(); showMessage(viewer.getControl().getShell(), SWT.ERROR, "Error", "Couldn't open the file."); return; } DataFormatter formatter = new DataFormatter(); getOpenedView().clearSelection(); if (!objectID.equals(OBJECT_ID_NOT_SPECIFIED)) { Row row = sheet.getRow(Integer.parseInt(objectID)); if (row != null) { CapraExcelRow cRow = new CapraExcelRow(row, officeFile, formatter); if (!cRow.getData().isEmpty()) selection.add(cRow); } } else { for (int i = 0; i <= sheet.getLastRowNum(); i++) { Row row = sheet.getRow(i); if (row != null) { CapraExcelRow cRow = new CapraExcelRow(row, officeFile, formatter); if (!cRow.getData().isEmpty()) selection.add(cRow); } } } }
Source:
<code>public void onClick(final View v) { ((CoordinatesInputDialog.CalculateState) getActivity()).saveCalculatorState(saveState()); displayToast(R.string.info_calculator_state_saved, true); <START> <END> if (!areCurrentCoordinatesValid(true)) { return; } if (gp != null) { ((CoordinatesInputDialog.CoordinateUpdate) getActivity()).updateCoordinates(gp); } close(); }</code><technical_language>Superfluous empty line</technical_language>

Target:
public void onClick(final View v) { final CalcState currentState = getCurrentState(); setSavedState(currentState); ((CoordinatesInputDialog.CalculateState) getActivity()).saveCalculatorState(currentState); displayToast(R.string.info_calculator_state_saved, true); if (!areCurrentCoordinatesValid()) { return; } if (gp != null) { ((CoordinatesInputDialog.CoordinateUpdate) getActivity()).updateCoordinates(gp); } close(); }
Source:
<code>public synchronized MetricsContext beforeSend() { long start = 0; <START> if (this.sendCount.getAndIncrement() % this.sampleSize == 0 && isFullStatsEnabled()) { <END> start = System.nanoTime(); this.sendRate.increment(start); } return new DefaultChannelMetricsContext(start); }</code><technical_language>reverse? (isFullStatsEnabled() && this.sendCount.getAndIncrement() % this.sampleSize == 0) getAndIncrement() independently of full stat enablement. I missed anything</technical_language>

Target:
public synchronized MetricsContext beforeSend() { long count = this.sendCount.getAndIncrement(); if (isFullStatsEnabled() && count % this.sampleSize == 0) { this.start = System.nanoTime(); this.sendRate.increment(start); } return new AggregatingChannelMetricsContext(this.start, count + 1); }
Source:
<code>private Analysis analyzeStatement(Statement statement, Session session, Metadata metadata, AccessControl accessControl, List<Expression> parameters) { <START> Analyzer analyzer = new Analyzer(session, metadata, sqlParser, accessControl, Optional.empty(), parameters, BlackholeWarningSink.getInstance()); <END> return analyzer.analyze(statement); }</code><technical_language>Do a follow plan support warnings runtime? This useful some operators produce warnings in runtime depending data, e.g: cast('abc ' varchar(3)) produce warning - string data, right truncation</technical_language>

Target:
private Analysis analyzeStatement(Statement statement, Session session, Metadata metadata, AccessControl accessControl, List<Expression> parameters) { Analyzer analyzer = new Analyzer(session, metadata, sqlParser, accessControl, Optional.empty(), parameters, BlackholeWarningCollector.getInstance()); return analyzer.analyze(statement); }
Source:
<code>private static Photo toPhoto(Feature feature) { LngLatAlt coordinates = ((Point)feature.getGeometry()).getCoordinates(); GeoPoint geoPoint = new GeoPoint(coordinates.getLatitude(), coordinates.getLongitude()); return new Photo(propertyOrDefault(feature, "id", -1), propertyOrDefault(feature, "categoryId", "Not known"), propertyOrDefault(feature, "metacategoryId", "Not known"), (String)feature.getProperty("caption"), <START> propertyOrDefault(feature, "datetime",-1), <END> (String)feature.getProperty("shortlink"), (String)feature.getProperty("thumbnailUrl"), geoPoint, toVideos(propertyOrDefault(feature, "videoFormats", Collections.<String, Object>emptyMap()))); }</code><technical_language>indentation of this line is character</technical_language>

Target:
private static Photo toPhoto(Feature feature) { LngLatAlt coordinates = ((Point)feature.getGeometry()).getCoordinates(); GeoPoint geoPoint = new GeoPoint(coordinates.getLatitude(), coordinates.getLongitude()); return new Photo(propertyOrDefault(feature, "id", -1), propertyOrDefault(feature, "categoryId", "Not known"), propertyOrDefault(feature, "metacategoryId", "Not known"), feature.getProperty("caption"), propertyOrDefault(feature, "datetime",-1), feature.getProperty("shortlink"), feature.getProperty("thumbnailUrl"), geoPoint, toVideos(propertyOrDefault(feature, "videoFormats", Collections.<String, Object>emptyMap()))); }
Source:
<code>public void testGenerateOnlyBreakingCompatibility() throws Exception { final List<String> errors = MainProcess.run( createNotes(createAllNotes(), null, null, null, null), createBaseCliOptions() .setGenerateAll(true).build()); Assert.assertEquals("no errors", 0, errors.size()); assertFile("xdocBreakingCompatibility.txt", MainProcess.XDOC_FILENAME); <START> assertFile("twitterGplusBreakingCompatibility.txt", MainProcess.TWITTER_FILENAME); <END> assertFile("rssMlistBreakingCompatibility.txt", MainProcess.RSS_FILENAME); assertFile("rssMlistBreakingCompatibility.txt", MainProcess.MLIST_FILENAME); }</code><technical_language>remove google file name</technical_language>

Target:
public void testGenerateOnlyBreakingCompatibility() throws Exception { final List<String> errors = MainProcess.run( createNotes(createAllNotes(), null, null, null, null), createBaseCliOptions() .setGenerateAll(true).build()); Assert.assertEquals("no errors", 0, errors.size()); assertFile("xdocBreakingCompatibility.txt", MainProcess.XDOC_FILENAME); assertFile("twitterBreakingCompatibility.txt", MainProcess.TWITTER_FILENAME); assertFile("rssMlistBreakingCompatibility.txt", MainProcess.RSS_FILENAME); assertFile("rssMlistBreakingCompatibility.txt", MainProcess.MLIST_FILENAME); }
Source:
<code>public static void main(String... args) throws CheckstyleException, ParseException { final CommandLine commandLine = parseCli(args); if (commandLine.getArgList().size() == 1) { try { writePropertiesFile(commandLine.getArgList().get(0), commandLine.getOptionValue(OPTION_DEST_FILE)); } catch (IOException ex) { <START> throw new CheckstyleException("Failed to write properties file", ex); <END> } } else { printUsage(); } }</code><technical_language>do print in exception message context information, is sign of improper place process exception</technical_language>

Target:
public static void main(String... args) throws CheckstyleException, ParseException { final CommandLine commandLine = parseCli(args); if (commandLine.getArgList().size() == 1) { final File inputFile = new File(commandLine.getArgList().get(0)); final File outputFile = new File(commandLine.getOptionValue(OPTION_DEST_FILE)); writePropertiesFile(inputFile, outputFile); } else { printUsage(); } }
Source:
<code>public static Sla getSLA(Cluster cluster, Process process) { final Sla clusterSla = cluster.getSla(); if (clusterSla != null) { return clusterSla; } final Sla processSla = process.getSla(); <START> return processSla == null ? null : processSla; <END> }</code><technical_language>additional null check unnecessary. return process.getSla()</technical_language>

Target:
public static Sla getSLA(Cluster cluster, Process process) { final Sla clusterSla = cluster.getSla(); if (clusterSla != null) { return clusterSla; } return process.getSla(); }
Source:
<code>public void addVertexHopCriteria(SearchResult searchResult, GraphContainer container) { LOG.debug("SearchProvider->addVertexHopCriteria: called with search result: '{}'", searchResult); <START> VertexHopCriteria criterion = LinkdHopCriteria.createCriteria(container.getMetaTopologyId(),searchResult.getId(), searchResult.getLabel()); <END> container.addCriteria(criterion); LOG.debug("SearchProvider->addVertexHop: adding hop criteria {}.", criterion); logCriteriaInContainer(container); }</code><technical_language>suggestion VertexHopCriteria criterion = LinkdHopCriteria.createCriteria(container.getMetaTopologyId(), searchResult.getId(), searchResult.getLabel());</technical_language>

Target:
public void addVertexHopCriteria(SearchResult searchResult, GraphContainer container) { LOG.debug("SearchProvider->addVertexHopCriteria: called with search result: '{}'", searchResult); VertexHopCriteria criterion = LinkdHopCriteria.createCriteria(searchResult.getNamespace(), searchResult.getId(), searchResult.getLabel()); container.addCriteria(criterion); LOG.debug("SearchProvider->addVertexHop: adding hop criteria {}.", criterion); logCriteriaInContainer(container); }
Source:
<code>public Optional<Object> apply( final Object... args ) { Integer minInt = Integer.MAX_VALUE; Double minDouble = Double.MAX_VALUE; if(args.length == 0) { return Optional.empty(); } for(Object arg: args) { <START> if(arg instanceof Integer) { <END> minInt = java.lang.Math.min( minInt, (Integer) arg ); } else if(arg instanceof Double) { minDouble = java.lang.Math.min( minDouble, (Double) arg ); } } if(minInt == Integer.MAX_VALUE && minDouble == Double.MAX_VALUE) { return Optional.<Object>of( Double.NaN ); } if ( minInt.doubleValue() <= minDouble ) { return Optional.<Object>of(minInt); } else { return Optional.<Object>of(minDouble); } }</code><technical_language>deal need handle Longs</technical_language>

Target:
public Optional<Object> apply( final Object... args ) { Integer minInt = Integer.MAX_VALUE; Double minDouble = Double.MAX_VALUE; Long minLong = Long.MAX_VALUE; if(args.length == 0) { return Optional.empty(); } for(Object arg: args) { if(arg instanceof Integer) { minInt = java.lang.Math.min( minInt, (Integer) arg ); } else if(arg instanceof Double) { minDouble = java.lang.Math.min( minDouble, (Double) arg ); } else if(arg instanceof Long) { minLong = java.lang.Math.min( minLong, (Long) arg ); } } if(minInt == Integer.MAX_VALUE && minDouble == Double.MAX_VALUE) { return Optional.empty(); } if(minInt.longValue() <= minDouble.longValue() && minInt.longValue() <= minLong) { return Optional.<Object>of(minInt); } else if(minLong <= minDouble.longValue() && minLong <= minInt.longValue()) { return Optional.<Object>of(minLong); } else { return Optional.<Object>of(minDouble); } }
Source:
<code>public void waitNavigationBar() { <START> new WebDriverWait(seleniumWebDriver, LOAD_PAGE_TIMEOUT_SEC).until(visibilityOf(navigationBar)); <END> }</code><technical_language>Please, "SeleniumWebDriverHelper#waitVisibility" method: seleniumWebDriverHelper.waitVisibility(navigationBar, LOAD_PAGE_TIMEOUT_SEC);</technical_language>

Target:
public void waitNavigationBar() { seleniumWebDriverHelper.waitVisibility(navigationBar, LOAD_PAGE_TIMEOUT_SEC); }
Source:
<code>public HashMap<String, String> toMap() { ObjectMapper objectMapper = new ObjectMapper(); HashMap<String, String> map = new HashMap<>(); ObjectNode node = objectMapper.convertValue(this, ObjectNode.class); node.fieldNames().forEachRemaining(fieldName -> { map.put(fieldName, node.get(fieldName).asText()); }); <START> return map; <END> }</code><technical_language>This a inefficient convert a json node iterate map. I guess alternative is manually constructing map, tradeoff of more duplicate code</technical_language>

Target:
public Map<String, String> toMap() { return objectMapper.convertValue(this, new TypeReference<Map<String, String>>() { }); }
Source:
<code>public CompletableFuture<String> generateMap(String version, byte[] optionArray) { ByteBuffer seedBuffer = ByteBuffer.allocate(8); seedBuffer.putLong(seedGenerator.nextLong()); String seedString = Base64.getEncoder().encodeToString(seedBuffer.array()); String optionString = Base64.getEncoder().encodeToString(optionArray); return generateMap(version,seedString+'_'+optionString); <START> } <END></code><technical_language>sue this is called a Spring Proxy</technical_language>

Target:
public CompletableFuture<String> generateMap(String version, byte[] optionArray) { return generateMap(new ComparableVersion(version), optionArray); }
Source:
<code>public boolean taskFailed(int siteId, long taskId, String lockId, AgentId agentId, Config error) { boolean changed = sm.lockTaskIfExists(taskId, (store, task) -> taskFailed(new TaskControl(store, task), error) ).or(false); if (changed) { try { dispatcher.taskFinished(siteId, lockId, agentId); } catch (TaskNotFoundException ex) { <START> logger.debug("Ignoring missing task entry error", ex); <END> } catch (TaskConflictException ex) { logger.warn("Ignoring preempted task entry error", ex); } } return changed; }</code><technical_language>is log level TaskConflictException</technical_language>

Target:
public boolean taskFailed(int siteId, long taskId, String lockId, AgentId agentId, Config error) { boolean changed = sm.lockTaskIfExists(taskId, (store, task) -> taskFailed(new TaskControl(store, task), error) ).or(false); if (changed) { try { dispatcher.taskFinished(siteId, lockId, agentId); } catch (TaskNotFoundException ex) { logger.warn("Ignoring missing task entry error", ex); } catch (TaskConflictException ex) { logger.warn("Ignoring preempted task entry error", ex); } } return changed; }
Source:
<code>public void setDriverClassName(String driverClassName) { Class<?> driverClass = null; try { driverClass = this.getClass().getClassLoader().loadClass(driverClassName); <START> LOGGER.info("Driver class found in the Hikari classes classloader {}", this.getClass().getClassLoader()); <END> } catch (ClassNotFoundException e) { if (Thread.currentThread().getContextClassLoader() != this.getClass().getClassLoader()) { try { driverClass = Thread.currentThread().getContextClassLoader().loadClass(driverClassName); LOGGER.info("Driver class found in Thread context class loader {}", Thread.currentThread().getContextClassLoader()); } catch (ClassNotFoundException e1) { LOGGER.error("Failed to load class of driverClassName in either of HikariConfig class loader or Thread context classloader {}", driverClassName, this.getClass().getClassLoader(), Thread.currentThread().getContextClassLoader()); } } else { LOGGER.error("Failed to load class of driverClassName in HikariConfig class loader {}", driverClassName, this.getClass().getClassLoader()); } } if (driverClass == null) { throw new RuntimeException("Failed to load class of driverClassName [" + driverClassName + "] in either of HikariConfig class loader or Thread context classloader"); } try { driverClass.newInstance(); this.driverClassName = driverClassName; } catch (Exception e) { throw new RuntimeException("Failed to instantiate class " + driverClassName, e); } }</code><technical_language>Log debug</technical_language>

Target:
public void setDriverClassName(String driverClassName) { Class<?> driverClass = null; try { driverClass = this.getClass().getClassLoader().loadClass(driverClassName); LOGGER.debug("Driver class found in the HikariConfig class classloader {}", this.getClass().getClassLoader()); } catch (ClassNotFoundException e) { ClassLoader threadContextClassLoader = Thread.currentThread().getContextClassLoader(); if (threadContextClassLoader != null && threadContextClassLoader != this.getClass().getClassLoader()) { try { driverClass = threadContextClassLoader.loadClass(driverClassName); LOGGER.debug("Driver class found in Thread context class loader {}", threadContextClassLoader); } catch (ClassNotFoundException e1) { LOGGER.error("Failed to load class of driverClassName in either of HikariConfig class classloader or Thread context classloader {}", driverClassName, this.getClass().getClassLoader(), threadContextClassLoader); } } else { LOGGER.error("Failed to load class of driverClassName in HikariConfig class classloader {}", driverClassName, this.getClass().getClassLoader()); } } if (driverClass == null) { throw new RuntimeException("Failed to load class of driverClassName [" + driverClassName + "] in either of HikariConfig class loader or Thread context classloader"); } try { driverClass.newInstance(); this.driverClassName = driverClassName; } catch (Exception e) { throw new RuntimeException("Failed to instantiate class " + driverClassName, e); } }
Source:
<code><START> public void compile(final ThemeArchive.ThemeModifier modifier) { <END> try { final LessCompiler lessCompiler = new LessCompiler(); lessCompiler.setEncoding("UTF-8"); File file = modifier.resolve(input); if (!Files.exists(file.toPath())) { LOGGER.warning(format("Trying to compile <%s> but it does not exist.", file)); return; } modifier.add(output, lessCompiler.compile(file).getBytes("UTF-8")); } catch (final LessException | IOException e) { throw new LessCompilationException("Failed to compile " + input, e); } }</code><technical_language>error web-sp build : bonita-web-sp/server-sp/src/main/java/com/bonitasoft/web/rest/server/datastore/ theme/PortalThemeInstaller.java:[80,84] error: incompatible types</technical_language>

Target:
public byte[] compile(final ThemeArchive.ThemeModifier modifier) { final LessCompiler lessCompiler = new LessCompiler(); lessCompiler.setEncoding("UTF-8"); File file = modifier.resolve(input); if (!Files.exists(file.toPath())) { LOGGER.warning(format("Theme compilation failure. File <%s> not found", file)); return new byte[0]; } try { final byte[] compilation = lessCompiler.compile(file).getBytes("UTF-8"); modifier.add(output, compilation); return compilation; } catch (final LessException | IOException e) { throw new LessCompilationException("Failed to compile " + input, e); } }
Source:
<code>protected final void ensureUniqueId(String type, TransactionContext context) { final Timer idGenerationTimer = context.service(Metrics.class).timer("idGeneration"); try { idGenerationTimer.start(); if (getIdGenerationStrategy() instanceof RegisteringIdStrategy) { final String componentId = getIdGenerationStrategy().generate(context); try { checkComponentExists(context, componentId); throw new AlreadyExistsException(type, componentId); } catch (ComponentNotFoundException e) { setIdGenerationStrategy(new ConstantIdStrategy(componentId)); return; } } else if (getIdGenerationStrategy() instanceof ReservingIdStrategy) { String componentId = null; for (int i = 0; i < ID_GENERATION_ATTEMPTS; i++) { componentId = getIdGenerationStrategy().generate(context); try { checkComponentExists(context, componentId); } catch (ComponentNotFoundException e) { setIdGenerationStrategy(new RegisteringIdStrategy(componentId)); return; } } throw new BadRequestException("Couldn't generate unique identifier for %s after %d attempts.", type, ID_GENERATION_ATTEMPTS); } else if (getIdGenerationStrategy() instanceof ConstantIdStrategy) { String componentId = getIdGenerationStrategy().generate(context); try { <START> checkComponentExists(context, componentId); <END> throw new AlreadyExistsException(type, componentId); } catch (ComponentNotFoundException e) { return; } } } finally { idGenerationTimer.stop(); } }</code><technical_language>Checking component IDs item next performance bottleneck. a chat this</technical_language>

Target:
protected final void ensureUniqueId(String type, TransactionContext context) { final Timer idGenerationTimer = context.service(Metrics.class).timer("idGeneration"); try { idGenerationTimer.start(); if (getIdGenerationStrategy() instanceof RegisteringIdStrategy) { final String componentId = getIdGenerationStrategy().generate(context); try { checkComponentExists(context, componentId); throw new AlreadyExistsException(type, componentId); } catch (ComponentNotFoundException e) { setIdGenerationStrategy(new ConstantIdStrategy(componentId)); return; } } else if (getIdGenerationStrategy() instanceof ReservingIdStrategy) { String componentId = null; for (int i = 0; i < IdRequest.ID_GENERATION_ATTEMPTS; i++) { componentId = getIdGenerationStrategy().generate(context); try { checkComponentExists(context, componentId); } catch (ComponentNotFoundException e) { setIdGenerationStrategy(new RegisteringIdStrategy(componentId)); return; } } throw new BadRequestException("Couldn't generate unique identifier for %s after %d attempts.", type, IdRequest.ID_GENERATION_ATTEMPTS); } else if (getIdGenerationStrategy() instanceof ConstantIdStrategy) { String componentId = getIdGenerationStrategy().generate(context); try { checkComponentExists(context, componentId); throw new AlreadyExistsException(type, componentId); } catch (ComponentNotFoundException e) { return; } } } finally { idGenerationTimer.stop(); } }
Source:
<code>public void setSystemProperty(CoreSession session, List<String> ids, Boolean value) { List<DocumentRef> updatedRefs = new ArrayList<>(ids.size()); String query = String.format(SYSPROP_QUERY_TEMPLATE, value ? "0" : "1", String.join("', '", ids)); try (IterableQueryResult res = session.queryAndFetch(query, NXQL)) { for (Map<String, Serializable> map : res) { DocumentRef ref = new IdRef((String) map.get(ECM_UUID)); try { session.setDocumentSystemProp(ref, "isTrashed", value); String docName = (String) map.get(ECM_NAME); <START> TrashService trashService = Framework.getService(TrashService.class); <END> if (!value && trashService.isMangledName(docName)) { DocumentRef parentRef = new IdRef((String) map.get(ECM_PARENTID)); session.move(ref, parentRef, trashService.unmangleName(session, parentRef, docName)); } updatedRefs.add(ref); } catch (NuxeoException e) { log.warn("Cannot set system property: isTrashed on: " + ref.toString(), e); } } } try { session.save(); if (!updatedRefs.isEmpty()) { fireEvent(session, value ? DOCUMENT_TRASHED : DOCUMENT_UNTRASHED, updatedRefs); } } catch (PropertyException e) { log.warn("Cannot save session", e); } }</code><technical_language>extract a variable for loop avoid calling time service</technical_language>

Target:
public void setSystemProperty(CoreSession session, List<String> ids, Boolean value) { List<DocumentRef> updatedRefs = new ArrayList<>(ids.size()); String query = String.format(SYSPROP_QUERY_TEMPLATE, value ? "0" : "1", String.join("', '", ids)); try (IterableQueryResult res = session.queryAndFetch(query, NXQL)) { TrashService trashService = Framework.getService(TrashService.class); for (Map<String, Serializable> map : res) { DocumentRef ref = new IdRef((String) map.get(ECM_UUID)); try { session.setDocumentSystemProp(ref, "isTrashed", value); String docName = (String) map.get(ECM_NAME); if (!value && trashService.isMangledName(docName)) { DocumentRef parentRef = new IdRef((String) map.get(ECM_PARENTID)); session.move(ref, parentRef, trashService.unmangleName(session, parentRef, docName)); } updatedRefs.add(ref); } catch (NuxeoException e) { log.warn("Cannot set system property: isTrashed on: " + ref.toString(), e); } } } try { session.save(); if (!updatedRefs.isEmpty()) { fireEvent(session, value ? DOCUMENT_TRASHED : DOCUMENT_UNTRASHED, updatedRefs); } } catch (PropertyException e) { log.warn("Cannot save session", e); } }
Source:
<code>public void onUpdate(IItemRelocator relocator, int side) { ++tick; if (tick == 4) { tick = 0; emitRedstoneSignal = false; <START> markRedstoneUpdate(relocator.getTileEntity()); <END> } }</code><technical_language>This update 4 ticks items passing! want that. set tick 4 in passesFilter do tick-- tick > 0, do redstone signal emit changes tick 0</technical_language>

Target:
public void onUpdate(IItemRelocator relocator, int side) { if (tick >= 0) { --tick; if (tick == 0) { emitRedstoneSignal = false; markRedstoneUpdate(relocator.getTileEntity()); } } }