auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void validatePositionOfPortOnContainer(String containerName, String portName, boolean pinBorderedNodes) { SWTBotGefEditPart swtbotContainerEditPart = editor.getEditPart(containerName); assertNotNull("No container edit part found with this name", swtbotContainerEditPart); EditPart containerSquareEP = swtbotContainerEditPart.part(); assertTrue("The parent edit part of the container label is not a AbstractBorderedShapeEditPart", containerSquareEP.getParent() instanceof AbstractBorderedShapeEditPart); final AbstractBorderedShapeEditPart containerEP = (AbstractBorderedShapeEditPart) containerSquareEP.getParent(); final AbstractDiagramBorderNodeEditPart portEP = findPortInContainer(containerEP, portName); assertNotNull("No port edit part found with this name", portEP); if (pinBorderedNodes) { pinDiagramElement((DDiagramElement) ((Node) portEP.getModel()).getElement()); } boolean edgeFromPortCrossParentContainer = validateEdgeFromPortCrossParentContainer(containerEP, portEP); assertFalse("The port " + portName + " has an edge that cross the parent container " + containerName, edgeFromPortCrossParentContainer); boolean <START> validateEdgeFromPortHaveBendpointsReseted = <END> validateEdgeFromPortHaveBendpointsReseted(containerEP, portEP); assertTrue("The port " + portName + " has an edge that don't have its bendpoints reseted " + containerName, validateEdgeFromPortHaveBendpointsReseted); }</code><technical_language>validateEdgeFromPortHaveBendpointsReset</technical_language>

Target:
private void validatePositionOfPortOnContainer(String containerName, String portName, boolean pinBorderedNodes) { SWTBotGefEditPart swtbotContainerEditPart = editor.getEditPart(containerName); assertNotNull("No container edit part found with this name", swtbotContainerEditPart); EditPart containerSquareEP = swtbotContainerEditPart.part(); assertTrue("The parent edit part of the container label is not a AbstractBorderedShapeEditPart", containerSquareEP.getParent() instanceof AbstractBorderedShapeEditPart); final AbstractBorderedShapeEditPart containerEP = (AbstractBorderedShapeEditPart) containerSquareEP.getParent(); final AbstractDiagramBorderNodeEditPart portEP = findPortInContainer(containerEP, portName); assertNotNull("No port edit part found with this name", portEP); if (pinBorderedNodes) { pinDiagramElement((DDiagramElement) ((Node) portEP.getModel()).getElement()); } boolean edgeFromPortCrossParentContainer = validateEdgeFromPortCrossParentContainer(containerEP, portEP); assertFalse("The port " + portName + " has an edge that cross the parent container " + containerName, edgeFromPortCrossParentContainer); boolean validateEdgeFromPortHaveBendpointsReset = validateEdgeFromPortHaveBendpointsReset(containerEP, portEP); assertTrue("The port " + portName + " has an edge that don't have its bendpoints reset " + containerName, validateEdgeFromPortHaveBendpointsReset); }
Source:
<code>@Test void testAggregateRelMdColumnOrigins() { final RelBuilder relBuilder = RelBuilder.create(config().build()); final LogicalProject project = (LogicalProject) relBuilder.scan("EMP") .project(relBuilder.field("EMPNO"), relBuilder.field("ENAME"), relBuilder.field("JOB"), relBuilder.field("SAL"), relBuilder.field("DEPTNO")).build(); final LogicalAggregate aggregate = (LogicalAggregate) relBuilder.push(project) .aggregate( relBuilder.groupKey(relBuilder.field(1, 0, "DEPTNO")), relBuilder.count(relBuilder.field(1, 0, "SAL"))) .build(); RelMetadataQuery mq = aggregate.getCluster().getMetadataQuery(); final RelColumnOrigin nameColumn = mq.getColumnOrigin(aggregate, 0); <START> assertThat(nameColumn.getOriginTable().getRowType(). getFieldNames().get(7).equals("DEPTNO"), is(true)); assertThat(nameColumn.getOriginColumnOrdinal() == 7, is(true)); <END> }</code><technical_language>Please, avoid assertThat(..., is(true)) pattern results in hard understand test failures (... expected true false). test failure message understandable source code and/or JIRA</technical_language>

Target:
@Test void testAggregateRelMdColumnOrigins() { final RelBuilder relBuilder = RelBuilder.create(config().build()); final LogicalProject project = (LogicalProject) relBuilder.scan("EMP") .project(relBuilder.field("EMPNO"), relBuilder.field("ENAME"), relBuilder.field("JOB"), relBuilder.field("SAL"), relBuilder.field("DEPTNO")).build(); final LogicalAggregate aggregate = (LogicalAggregate) relBuilder.push(project) .aggregate( relBuilder.groupKey(relBuilder.field(1, 0, "DEPTNO")), relBuilder.count(relBuilder.field(1, 0, "SAL"))) .build(); RelMetadataQuery mq = aggregate.getCluster().getMetadataQuery(); final RelColumnOrigin nameColumn = mq.getColumnOrigin(aggregate, 0); assertEquals(nameColumn.getOriginTable().getRowType(). getFieldNames().get(7), "DEPTNO"); assertEquals(nameColumn.getOriginColumnOrdinal(), 7); }
Source:
<code><START> public InternationalFixedDate plusMonths(final long months) { <END> if (months == 0) { return this; } int day = isYearDay() ? InternationalFixedChronology.DAYS_IN_MONTH : getCalculatedDayOfMonth(); int newMonth = (int) Math.addExact(getCalculatedProlepticMonth(), months); int year = newMonth / InternationalFixedChronology.MONTHS_IN_YEAR; newMonth = 1 + (newMonth % InternationalFixedChronology.MONTHS_IN_YEAR); return create(year, newMonth, day); }</code><technical_language>This method allow get leap-day year-day. 2012 Year-Day + 4 years -> exception (calculated day-of-month is out of range!). 2012 leap-day + 4 years -> 2016 Sol 1, leap-day again</technical_language>

Target:
public InternationalFixedDate plusMonths(final long months) { if (months == 0) { return this; } if (months % MONTHS_IN_YEAR == 0) { return plusYears(months / MONTHS_IN_YEAR); } int newMonth = (int) Math.addExact(getProlepticMonth(), months); int newYear = newMonth / MONTHS_IN_YEAR; newMonth = 1 + (newMonth % MONTHS_IN_YEAR); return resolvePreviousValid(newYear, newMonth, this.day); }
Source:
<code>private void bindCard(SquareButtonViewHolder squareButtonViewHolder, int i, List<Object> payload) { HomeCardDisplayData cardDisplayData = getItem(i); String notificationText = null; if (payload != null) { notificationText = getLastPayloadString(payload); } <START> cardDisplayData.textSetter.update(cardDisplayData, <END> squareButtonViewHolder, context, notificationText); setupViewHolder(context, cardDisplayData, squareButtonViewHolder); }</code><technical_language>minor, reason code for setting view holder's text part of setupViewHolder() method? logically a part of that</technical_language>

Target:
private void bindCard(SquareButtonViewHolder squareButtonViewHolder, int i, List<Object> payload) { HomeCardDisplayData cardDisplayData = getItem(i); String notificationText = null; if (payload != null) { notificationText = getFirstPayloadString(payload); } cardDisplayData.textSetter.update(cardDisplayData, squareButtonViewHolder, context, notificationText); setupViewHolder(context, cardDisplayData, squareButtonViewHolder); }
Source:
<code>public void setHeight(String height) { this.getElement().getStyle().setProperty("height", height); final String lineHeightStyle = "line-height: " + height + ";"; boolean isVisible = optionsPanel.isVisible(); currentItemLabel.setAttribute("style", lineHeightStyle); <START> optionsPanel.getElement().setAttribute("style", lineHeightStyle + ";max-height:calc(6*" + height + ");"); <END> optionsPanel.setVisible(isVisible); }</code><technical_language>Don'n solutions. Element style, work it</technical_language>

Target:
public void setHeight(String height) { this.getElement().getStyle().setProperty("height", height); currentItemLabel.getStyle().setProperty("lineHeight", height); optionsPanel.getElement().getStyle().setProperty("lineHeight", height); optionsPanel.getElement().getStyle().setProperty("maxHeight", "calc(" + dropDownSize + "*" + height + ")"); }
Source:
<code><START> public static long getRandomLong(long n) { <END> if (n<=0) { throw new IllegalArgumentException("Cannot generate random long in range [0,n) for n<=0."); } return (long)(new Random().nextDouble()*n); }</code><technical_language>implementation is tested widely instead of stack overflow. I suggest implementation is widely - /** \* Get a pseudo-random long uniformly 0 n-1. Stolen \* {@link java.util.Random#nextInt()}. * \* @param n bound \* @return a select randomly range {@code [0..n)}. */ private static long nextLong(long n) { long bits, val; do { bits = ThreadLocalRandom.current().nextLong() & (~(1L << BITS_PER_LONG)); val = bits % n; } while (bits - val + (n - 1) < 0L); return val; }</technical_language>

Target:
public static long getRandomLong(long n) { if (n<=0) { throw new IllegalArgumentException("Cannot generate random long in range [0,n) for n<=0."); } final int BITS_PER_LONG = 63; long bits, val; do { bits = new Random().nextLong() & (~(1L << BITS_PER_LONG)); val = bits % n; } while (bits - val + (n - 1) < 0L); return val; }
Source:
<code>private void initEvaluator() throws DbException { ExpressionOperator op = getExpression().getRootExpressionOperator(); String pyFunc = ((PyUDFExpression) op).getName(); try { String pyCodeString = pyFunction.getFunction(pyFunc); if (pyCodeString == null) { LOGGER.info("no python UDF with name registered.", pyFunc); throw new DbException("No Python UDf with given name registered."); } else { LOGGER.info("tuple size is: " + tupleSize); <START> pyWorker.sendCodePickle(pyCodeString, tupleSize, outputType, isFlatmap); <END> } } catch (Exception e) { throw new DbException(e); } }</code><technical_language>get rid of Logger</technical_language>

Target:
private void initEvaluator() throws DbException { ExpressionOperator op = getExpression().getRootExpressionOperator(); String pyFunctionName = ((PyUDFExpression) op).getName(); try { if (pyFuncRegistrar != null) { FunctionStatus fs = pyFuncRegistrar.getFunctionStatus(pyFunctionName); if (fs == null) { throw new DbException("No Python UDf with given name registered."); } isMultiValued = fs.getIsMultivalued(); pyWorker.sendCodePickle(fs.getBinary(), numColumns, outputType, isMultiValued); List<ExpressionOperator> childops = op.getChildren(); if (childops != null) { for (int i = 0; i < childops.size(); i++) { if (childops.get(i).getClass().equals(StateExpression.class)) { isStateColumn[i] = true; columnIdxs[i] = ((StateExpression) childops.get(i)).getColumnIdx(); } else if (childops.get(i).getClass().equals(VariableExpression.class)) { columnIdxs[i] = ((VariableExpression) childops.get(i)).getColumnIdx(); } else { throw new DbException( "Python expression can only have State or Variable expression as child expressions."); } } } } else { throw new DbException("PythonRegistrar should not be null in PythonUDFEvaluator."); } } catch (Exception e) { throw new DbException(e); } }
Source:
<code>public void setValue(Double value, boolean fireEvents) { <START> if (this.getValue().equals(value)) { <END> view.setValue(value.toString()); if (fireEvents) { notifyValueChange(value.toString()); } } }</code><technical_language>@hasys good point! idea is checking new is setting it, do like: if (this.getValue() == null || !this.getValue().equals(value))</technical_language>

Target:
public void setValue(Double value, boolean fireEvents) { if (value == null && this.getValue() == null) { return; } if (this.getValue() == null || !this.getValue().equals(value)) { view.setValue(Objects.toString(value, null)); if (fireEvents) { notifyValueChange(Objects.toString(value, null)); } } }
Source:
<code>public void runAction(final VdcActionType actionType, final VdcActionParametersBase parameters, final IFrontendActionAsyncCallback callback, final Object state, final boolean showErrorDialog) { VdcOperation<VdcActionType, VdcActionParametersBase> operation = new VdcOperation<VdcActionType, VdcActionParametersBase>(actionType, parameters, new VdcOperationCallback<VdcOperation<VdcActionType, VdcActionParametersBase>, VdcReturnValueBase>() { @Override public void onSuccess(final VdcOperation<VdcActionType, VdcActionParametersBase> operation, final VdcReturnValueBase result) { <START> logger.finer("Frontend: sucessfully executed RunAction, determining result!"); END> handleActionResult(actionType, parameters, result, callback != null ? callback : NULLABLE_ASYNC_CALLBACK, state, showErrorDialog); } @Override public void onFailure(final VdcOperation<VdcActionType, VdcActionParametersBase> operation, final Throwable caught) { if (ignoreFailure(caught)) { return; } logger.log(Level.SEVERE, "Failed to execute RunAction: " + caught, caught); failureEventHandler(caught); FrontendActionAsyncResult f = new FrontendActionAsyncResult(actionType, parameters, null, state); if (callback != null) { callback.executed(f); } } }); getInstance().getOperationManager().addOperation(operation); }</code><technical_language>runAction</technical_language>

Target:
public void runAction(final VdcActionType actionType, final VdcActionParametersBase parameters, final IFrontendActionAsyncCallback callback, final Object state, final boolean showErrorDialog) { VdcOperation<VdcActionType, VdcActionParametersBase> operation = new VdcOperation<VdcActionType, VdcActionParametersBase>(actionType, parameters, new VdcOperationCallback<VdcOperation<VdcActionType, VdcActionParametersBase>, VdcReturnValueBase>() { @Override public void onSuccess(final VdcOperation<VdcActionType, VdcActionParametersBase> operation, final VdcReturnValueBase result) { logger.finer("Frontend: sucessfully executed runAction, determining result!"); handleActionResult(actionType, parameters, result, callback != null ? callback : NULLABLE_ASYNC_CALLBACK, state, showErrorDialog); } @Override public void onFailure(final VdcOperation<VdcActionType, VdcActionParametersBase> operation, final Throwable caught) { if (ignoreFailure(caught)) { return; } logger.log(Level.SEVERE, "Failed to execute runAction: " + caught, caught); failureEventHandler(caught); FrontendActionAsyncResult f = new FrontendActionAsyncResult(actionType, parameters, null, state); if (callback != null) { callback.executed(f); } } }); getInstance().getOperationManager().addOperation(operation); }
Source:
<code><START> private RevCommit <END> parseCommit(AnyObjectId id) throws IncorrectObjectTypeException, IOException, MissingObjectException { if (id instanceof RevCommit) { return (RevCommit) id; } try (RevWalk walk = new RevWalk(this)) { return walk.parseCommit(id); } }</code><technical_language>public</technical_language>

Target:
public RevCommit parseCommit(AnyObjectId id) throws IncorrectObjectTypeException, IOException, MissingObjectException { if (id instanceof RevCommit) { return (RevCommit) id; } try (RevWalk walk = new RevWalk(this)) { return walk.parseCommit(id); } }
Source:
<code>public void assertInvalidFunction(String projection, StandardErrorCode errorCode, String messagePattern) { try { evaluateInvalid(projection); fail("Expected to throw a PrestoException with message matching " + messagePattern); } catch (PrestoException e) { try { assertEquals(e.getErrorCode(), errorCode.toErrorCode()); <START> assertTrue(e.getMessage().equals(messagePattern) || e.getMessage().matches(messagePattern), format("Exception message[%s] should either equals or matches messagePattern[%s]", e.getMessage(), messagePattern)); <END> } catch (Throwable failure) { failure.addSuppressed(e); throw failure; } } }</code><technical_language>match L329, update Error message [%s] match [%s]</technical_language>

Target:
public void assertInvalidFunction(String projection, StandardErrorCode errorCode, String messagePattern) { try { evaluateInvalid(projection); fail("Expected to throw a PrestoException with message matching " + messagePattern); } catch (PrestoException e) { try { assertEquals(e.getErrorCode(), errorCode.toErrorCode()); assertTrue(e.getMessage().equals(messagePattern) || e.getMessage().matches(messagePattern), format("Error message [%s] doesn't match [%s]", e.getMessage(), messagePattern)); } catch (Throwable failure) { failure.addSuppressed(e); throw failure; } } }
Source:
<code>protected Node visitShowPartitions(ShowPartitions showPartitions, Void context) { QualifiedObjectName table = createQualifiedObjectName(session, showPartitions, showPartitions.getTable()); <START> metadata.getTableHandle(session, table) <END> .orElseThrow(() -> new SemanticException(MISSING_TABLE, showPartitions, "Table '%s' does not exist", table)); QualifiedObjectName partitionsTable = new QualifiedObjectName(table.getCatalogName(), table.getSchemaName(), table.getObjectName() + "$partitions"); metadata.getTableHandle(session, partitionsTable) .orElseThrow(() -> new SemanticException(NOT_SUPPORTED, showPartitions, "Table '%s' is not partitioned ", table)); return simpleQuery( selectList(new AllColumns()), new Table(QualifiedName.of(partitionsTable.getCatalogName(), partitionsTable.getSchemaName(), partitionsTable.getObjectName())), showPartitions.getWhere(), Optional.empty(), Optional.empty(), orderBy(showPartitions.getOrderBy()), showPartitions.getLimit()); }</code><technical_language>orElseThrow assignment a bit surprising.. if (!metadata.getTableHandle(session, table).isPresent()) { throw ... }</technical_language>

Target:
protected Node visitShowPartitions(ShowPartitions showPartitions, Void context) { QualifiedObjectName table = createQualifiedObjectName(session, showPartitions, showPartitions.getTable()); if (!metadata.getTableHandle(session, table).isPresent()) { throw new SemanticException(MISSING_TABLE, showPartitions, "Table '%s' does not exist", table); } QualifiedObjectName partitionsTable = new QualifiedObjectName(table.getCatalogName(), table.getSchemaName(), table.getObjectName() + "$partitions"); if (!metadata.getTableHandle(session, partitionsTable).isPresent()) { throw new SemanticException(NOT_SUPPORTED, showPartitions, "Table does not have partition columns: %s", table); } return simpleQuery( selectList(new AllColumns()), new Table(createQualifiedName(partitionsTable)), showPartitions.getWhere(), Optional.empty(), Optional.empty(), orderBy(showPartitions.getOrderBy()), showPartitions.getLimit()); }
Source:
<code>public void testInjection() throws Exception { final Injector injector = Guice.createInjector( new AzkabanCommonModule(props), new AzkabanWebServerModule() ); SERVICE_PROVIDER.unsetInjector(); SERVICE_PROVIDER.setInjector(injector); final ExecutorLoader executorLoader = injector.getInstance(ExecutorLoader.class); assertNotNull(executorLoader); final Executor executor = executorLoader.addExecutor("localhost", 60000); executor.setActive(true); executorLoader.updateExecutor(executor); assertNotNull(injector.getInstance(ExecutionFlowDao.class)); assertNotNull(injector.getInstance(DatabaseOperator.class)); assertSingleton(ExecutorLoader.class, injector); assertSingleton(ExecutorManager.class, injector); assertSingleton(ProjectLoader.class, injector); assertSingleton(ProjectManager.class, injector); assertSingleton(Storage.class, injector); assertSingleton(TriggerLoader.class, injector); assertSingleton(TriggerManager.class, injector); assertSingleton(AlerterHolder.class, injector); assertSingleton(Emailer.class, injector); assertSingleton(ExecutionFlowDao.class, injector); assertSingleton(ExecutorDao.class, injector); assertSingleton(ExecutionJobDao.class, injector); assertSingleton(ExecutionLogsDao.class, injector); assertSingleton(ExecutorEventsDao.class, injector); assertSingleton(ActiveExecutingFlowsDao.class, injector); assertSingleton(FetchActiveFlowDao.class, injector); <START> assertSingleton(H2FileDataSource.class, injector); <END> SERVICE_PROVIDER.unsetInjector(); }</code><technical_language>mysql datasource</technical_language>

Target:
public void testInjection() throws Exception { final Injector injector = Guice.createInjector( new AzkabanCommonModule(props), new AzkabanWebServerModule() ); SERVICE_PROVIDER.unsetInjector(); SERVICE_PROVIDER.setInjector(injector); final ExecutorLoader executorLoader = injector.getInstance(ExecutorLoader.class); assertNotNull(executorLoader); final Executor executor = executorLoader.addExecutor("localhost", 60000); executor.setActive(true); executorLoader.updateExecutor(executor); assertNotNull(injector.getInstance(ExecutionFlowDao.class)); assertNotNull(injector.getInstance(DatabaseOperator.class)); assertSingleton(ExecutorLoader.class, injector); assertSingleton(ExecutorManager.class, injector); assertSingleton(ProjectLoader.class, injector); assertSingleton(ProjectManager.class, injector); assertSingleton(Storage.class, injector); assertSingleton(TriggerLoader.class, injector); assertSingleton(TriggerManager.class, injector); assertSingleton(AlerterHolder.class, injector); assertSingleton(Emailer.class, injector); assertSingleton(ExecutionFlowDao.class, injector); assertSingleton(ExecutorDao.class, injector); assertSingleton(ExecutionJobDao.class, injector); assertSingleton(ExecutionLogsDao.class, injector); assertSingleton(ExecutorEventsDao.class, injector); assertSingleton(ActiveExecutingFlowsDao.class, injector); assertSingleton(FetchActiveFlowDao.class, injector); assertSingleton(AzkabanWebServer.class, injector); assertSingleton(H2FileDataSource.class, injector); SERVICE_PROVIDER.unsetInjector(); }
Source:
<code>public String instantiateProcess(final Map<String, Serializable> inputs) throws ProcessDefinitionNotFoundException, ProcessActivationException, ProcessExecutionException, FileNotFoundException { final String userId = getRequestParameter(USER_PARAM); final long processDefinitionId = getProcessDefinitionIdParameter(); try { final ContractDefinition processContract = processAPI.getProcessContract(processDefinitionId); final long tenantId = apiSession.getTenantId(); final long maxSizeForTenant = PropertiesFactory.getConsoleProperties(tenantId).getMaxSize(); final Map<String, Serializable> processedInputs = typeConverterUtil.getProcessedInput(processContract, inputs, maxSizeForTenant, tenantId); <START> long processInstanceId; <END> if (userId == null) { processInstanceId = processAPI.startProcessWithInputs(processDefinitionId, processedInputs).getId(); } else { processInstanceId = processAPI.startProcessWithInputs(Long.parseLong(userId), processDefinitionId, processedInputs).getId(); } final JsonNodeFactory factory = JsonNodeFactory.instance; final ObjectNode returnedObject = factory.objectNode(); returnedObject.put("processInstanceId", processInstanceId); return returnedObject.toString(); } catch (final ContractViolationException e) { manageContractViolationException(e, "Cannot instantiate process task."); return null; } catch (final Exception e) { e.printStackTrace(); throw e; } }</code><technical_language>caseId instead of processInstanceId antyhing web side,</technical_language>

Target:
public String instantiateProcess(final Map<String, Serializable> inputs) throws ProcessDefinitionNotFoundException, ProcessActivationException, ProcessExecutionException, FileNotFoundException { final String userId = getRequestParameter(USER_PARAM); final long processDefinitionId = getProcessDefinitionIdParameter(); try { final ContractDefinition processContract = processAPI.getProcessContract(processDefinitionId); final long tenantId = apiSession.getTenantId(); final long maxSizeForTenant = PropertiesFactory.getConsoleProperties(tenantId).getMaxSize(); final Map<String, Serializable> processedInputs = typeConverterUtil.getProcessedInput(processContract, inputs, maxSizeForTenant, tenantId); long processInstanceId; if (userId == null) { processInstanceId = processAPI.startProcessWithInputs(processDefinitionId, processedInputs).getId(); } else { processInstanceId = processAPI.startProcessWithInputs(Long.parseLong(userId), processDefinitionId, processedInputs).getId(); } final JsonNodeFactory factory = JsonNodeFactory.instance; final ObjectNode returnedObject = factory.objectNode(); returnedObject.put(CASE_ID_ATTRIBUTE, processInstanceId); return returnedObject.toString(); } catch (final ContractViolationException e) { manageContractViolationException(e, "Cannot instantiate process task."); return null; } catch (final Exception e) { e.printStackTrace(); throw e; } }
Source:
<code><START> private MVCCEntry wrapMvccEntryForPut(InvocationContext ctx, Object key, CacheEntry cacheEntry, Metadata providedMetadata, boolean skipRead) { <END> if (cacheEntry instanceof MVCCEntry) { MVCCEntry mvccEntry = (MVCCEntry) cacheEntry; updateMetadata(mvccEntry, providedMetadata); return mvccEntry; } return wrapInternalCacheEntryForPut(ctx, key, (InternalCacheEntry) cacheEntry, providedMetadata, true); }</code><technical_language>skipRead parameter used</technical_language>

Target:
private MVCCEntry wrapMvccEntryForPut(InvocationContext ctx, Object key, CacheEntry cacheEntry, Metadata providedMetadata, boolean skipRead) { if (cacheEntry instanceof MVCCEntry) { MVCCEntry mvccEntry = (MVCCEntry) cacheEntry; updateMetadata(mvccEntry, providedMetadata); return mvccEntry; } return wrapInternalCacheEntryForPut(ctx, key, (InternalCacheEntry) cacheEntry, providedMetadata, skipRead); }
Source:
<code>public static int getRemoteVersion(Project project) { if (!project.isRemote()) { return -1; } <START> return Integer.valueOf(ProjectUtilities.getVersion(project.getPrimaryProject()).getName()); <END> }</code><technical_language>want migrate</technical_language>

Target:
public static long getRemoteVersion(Project project) { if (!project.isRemote()) { return -1; } return Long.valueOf(ProjectUtilities.getVersion(project.getPrimaryProject()).getName()); }
Source:
<code>private DataSet<ExecRow> getTableDataSet(DataSetProcessor dsp, long conglomerateId, List<DDLMessage.TentativeIndex> tentativeIndexList) throws StandardException { SpliceConglomerate conglomerate = (SpliceConglomerate) ((SpliceTransactionManager) activation.getTransactionController()).findConglomerate(conglomerateId); int[] formatIds = conglomerate.getFormat_ids(); int[] columnOrdering = conglomerate.getColumnOrdering(); int[] baseColumnMap = getBaseColumnMap(tentativeIndexList); FormatableBitSet accessedKeyColumns = new FormatableBitSet(columnOrdering.length); ExecRow templateRow = getTemplateRow(baseColumnMap, formatIds); this.leadingIndexColumnInfoMap = getIndexColumnMap(tentativeIndexList, baseColumnMap); DataSet<ExecRow> scanSet = dsp.<TableScanOperation,ExecRow>newScanSet(null, Long.toString(conglomerateId)) .activation(activation) .tableDisplayName(tableName) .transaction(txn) .scan(createScan(txn)) .tableVersion(tableVersion) .template(templateRow) .keyColumnEncodingOrder(columnOrdering) .keyColumnTypes(ScanOperation.getKeyFormatIds(columnOrdering, formatIds)) .accessedKeyColumns(accessedKeyColumns) .keyDecodingMap(ScanOperation.getKeyDecodingMap(accessedKeyColumns, columnOrdering, baseColumnMap)) .rowDecodingMap(ScanOperation.getRowDecodingMap(accessedKeyColumns, columnOrdering, baseColumnMap)) .baseColumnMap(baseColumnMap) .buildDataSet(); <START> <END> return scanSet; }</code><technical_language>I need set defaultRow TableScanOperation, base table columns added default values physically populated</technical_language>

Target:
private DataSet<ExecRow> getTableDataSet(DataSetProcessor dsp, long conglomerateId, List<DDLMessage.TentativeIndex> tentativeIndexList) throws StandardException { SpliceConglomerate conglomerate = (SpliceConglomerate) ((SpliceTransactionManager) activation.getTransactionController()).findConglomerate(conglomerateId); int[] formatIds = conglomerate.getFormat_ids(); int[] columnOrdering = conglomerate.getColumnOrdering(); int[] baseColumnMap = getBaseColumnMap(tentativeIndexList); FormatableBitSet accessedKeyColumns = getAccessedKeyColumns(columnOrdering, baseColumnMap); ExecRow templateRow = getTemplateRow(baseColumnMap, formatIds); ExecRow defaultValueRow = getDefaultValueRow(baseColumnMap, templateRow); FormatableBitSet defaultValueMap = getDefaultValueMap(defaultValueRow); this.leadingIndexColumnInfoMap = getIndexColumnMap(tentativeIndexList, baseColumnMap); DataSet<ExecRow> scanSet = dsp.<TableScanOperation,ExecRow>newScanSet(null, Long.toString(conglomerateId)) .activation(activation) .tableDisplayName(tableName) .transaction(txn) .scan(createScan(txn)) .tableVersion(tableVersion) .template(templateRow) .keyColumnEncodingOrder(columnOrdering) .keyColumnTypes(ScanOperation.getKeyFormatIds(columnOrdering, formatIds)) .accessedKeyColumns(accessedKeyColumns) .keyDecodingMap(ScanOperation.getKeyDecodingMap(accessedKeyColumns, columnOrdering, baseColumnMap)) .rowDecodingMap(ScanOperation.getRowDecodingMap(accessedKeyColumns, columnOrdering, baseColumnMap)) .baseColumnMap(baseColumnMap) .defaultRow(defaultValueRow, defaultValueMap) .buildDataSet(); return scanSet; }
Source:
<code>private boolean resolveOptionalConstraints(ResolverBundle bundle) { BundleConstraint[] requires = bundle.getRequires(); List<ResolverBundle> cycle = new ArrayList<>(); boolean resolvedOptional = false; for (BundleConstraint require : requires) { if (require.isOptional() && require.getSelectedSupplier() == null) { cycle.clear(); resolveRequire(require, cycle); if (require.getSelectedSupplier() != null) { resolvedOptional = true; } } } ResolverImport[] imports = bundle.getImportPackages(); for (ResolverImport <START> import1 : <END> imports) { if (import1.isOptional() && import1.getSelectedSupplier() == null) { cycle.clear(); resolveImport(import1, cycle); if (import1.getSelectedSupplier() != null) { resolvedOptional = true; } } } return resolvedOptional; }</code><technical_language>rename resolverImport</technical_language>

Target:
private boolean resolveOptionalConstraints(ResolverBundle bundle) { BundleConstraint[] requires = bundle.getRequires(); List<ResolverBundle> cycle = new ArrayList<>(); boolean resolvedOptional = false; for (BundleConstraint require : requires) { if (require.isOptional() && require.getSelectedSupplier() == null) { cycle.clear(); resolveRequire(require, cycle); if (require.getSelectedSupplier() != null) { resolvedOptional = true; } } } ResolverImport[] imports = bundle.getImportPackages(); for (ResolverImport resolverImport : imports) { if (resolverImport.isOptional() && resolverImport.getSelectedSupplier() == null) { cycle.clear(); resolveImport(resolverImport, cycle); if (resolverImport.getSelectedSupplier() != null) { resolvedOptional = true; } } } return resolvedOptional; }
Source:
<code>public ExpressionEvaluator getOrCreate(FactMappingValue factMappingValue) { if (Type.DMN.equals(type)) { return getOrCreateDMNExpressionEvaluator(); } Object rawValue = factMappingValue.getRawValue(); <START> if (rawValue instanceof String && ((String) rawValue).startsWith("#")) { <END> return getOrCreateMVELExpressionEvaluator(); } else { return getOrCreateBaseExpressionEvaluator(); } }</code><technical_language>@danielezonca I suggest a static variable refer "#" char, in place is used, in order easily update in case of change request</technical_language>

Target:
public ExpressionEvaluator getOrCreate(FactMappingValue factMappingValue) { if (Type.DMN.equals(type)) { return getOrCreateDMNExpressionEvaluator(); } Object rawValue = factMappingValue.getRawValue(); if (rawValue instanceof String && ((String) rawValue).trim().startsWith(MVEL_ESCAPE_SYMBOL)) { return getOrCreateMVELExpressionEvaluator(); } else { return getOrCreateBaseExpressionEvaluator(); } }
Source:
<code><START> default void onExecutionStart() { <END> throw new UnsupportedOperationException("Method is not implemented"); }</code><technical_language>here. I dont throwing exceptions.We instead empty implementations</technical_language>

Target:
default void onExecutionStart() { }
Source:
<code>private void createNameForm(Composite composite) { Group group = createGroup(composite, Messages.SelectDiagramKindPage_diagram_name_group); nameText = new Text(group, SWT.BORDER); nameText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); nameText.setText(Messages.SelectDiagramKindPage_default_diagram_name); ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection(); if (selection instanceof IStructuredSelection && ((IStructuredSelection) selection).size() > 0) { IStructuredSelection sSelection = (IStructuredSelection) selection; Object selectedObject = sSelection.getFirstElement(); if (selectedObject instanceof IAdaptable) { IFile selectedIFile = ((IAdaptable) selectedObject).getAdapter(IFile.class); if (selectedIFile != null) { try { ResourceSet resourceSet = new ResourceSetImpl(); Resource resource = resourceSet.getResource(URI.createURI(selectedIFile.getLocationURI().toString()), true); EObject sEObject = resource.getContents().get(0); if (sEObject != null && sEObject instanceof org.eclipse.uml2.uml.Package) { org.eclipse.uml2.uml.Package sPackage = (org.eclipse.uml2.uml.Package) sEObject; nameText.setText(sPackage.getName()); } } catch (Exception e) { <START> Activator.log.error(e); <END> } } } } nameText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { validatePage(); } }); }</code><technical_language>exception displayed Wizard, user wrong</technical_language>

Target:
private void createNameForm(Composite composite) { Group group = createGroup(composite, Messages.SelectDiagramKindPage_diagram_name_group); nameText = new Text(group, SWT.BORDER); nameText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); nameText.setText(Messages.SelectDiagramKindPage_default_diagram_name); ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection(); if (selection instanceof IStructuredSelection && ((IStructuredSelection) selection).size() > 0) { IStructuredSelection sSelection = (IStructuredSelection) selection; Object selectedObject = sSelection.getFirstElement(); if (selectedObject instanceof IAdaptable) { IFile selectedIFile = ((IAdaptable) selectedObject).getAdapter(IFile.class); if (selectedIFile != null) { try { ResourceSet resourceSet = new ResourceSetImpl(); Resource resource = resourceSet.getResource(URI.createURI(selectedIFile.getLocationURI().toString()), true); if (resource.getContents().size() > 0) { EObject sEObject = resource.getContents().get(0); if (sEObject != null && sEObject instanceof org.eclipse.uml2.uml.Package) { org.eclipse.uml2.uml.Package sPackage = (org.eclipse.uml2.uml.Package) sEObject; nameText.setText(sPackage.getName()); } } } catch (Exception e) { this.setErrorMessage(Messages.SelectDiagramKindPage_Set_Root_Name_Error); Activator.log.error(e); } } } } nameText.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { validatePage(); } }); }
Source:
<code>protected static String buildCredential(String key, String secret) { <START> StringBuilder strBuilder = new StringBuilder(); strBuilder.append(key); strBuilder.append(':'); strBuilder.append(secret); <END> return Base64.getEncoder().encodeToString(strBuilder.toString().getBytes(DEFAULT_CHARSET)); }</code><technical_language>This replaced shorter string concatenation need of string builder: key + ':' + secret</technical_language>

Target:
protected static String buildCredential(String key, String secret) { return Base64.getEncoder().encodeToString((key + ':' + secret).getBytes(DEFAULT_CHARSET)); }
Source:
<code>public static InstanceType map(org.ovirt.engine.core.common.businessentities.InstanceType entity, InstanceType incoming) { InstanceType model = incoming != null ? incoming : new InstanceType(); mapCommonEntityToModel(model, (VmTemplate) entity); model.setDisplay(DisplayMapper.map(entity, null)); if (entity.getDefaultBootSequence() != null) { <START> OperatingSystem os = new OperatingSystem(); <END> if (entity.getDefaultBootSequence() != null) { for (Boot boot : VmMapper.map(entity.getDefaultBootSequence(), null)) { os.getBoot().add(boot); } } model.setOs(os); } return model; }</code><technical_language>Note "os" property populated, partially, this is replacing completely. In general is safer do this: OperatingSystem os = model.getOs(); if (os == null) { os = new OperatingSystem(); model.setOs(os); }</technical_language>

Target:
public static InstanceType map(org.ovirt.engine.core.common.businessentities.InstanceType entity, InstanceType incoming) { InstanceType model = incoming != null ? incoming : new InstanceType(); mapCommonEntityToModel(model, (VmTemplate) entity); model.setDisplay(DisplayMapper.map(entity, null)); if (entity.getDefaultBootSequence() != null) { OperatingSystem os = model.getOs(); if (os == null) { os = new OperatingSystem(); } if (entity.getDefaultBootSequence() != null) { for (Boot boot : VmMapper.map(entity.getDefaultBootSequence(), null)) { os.getBoot().add(boot); } } model.setOs(os); } return model; }
Source:
<code>public void visitReturnStatement(ReturnStatementTree tree) { Tree parent = tree.parent(); while (!parent.is(Tree.Kind.METHOD)) { parent = parent.parent(); if (parent == null) { return; } } MethodTree methodTree = (MethodTree) parent; String nonNullAnnotation = nonNullAnnotation((JavaSymbol) methodTree.symbol()); if (nonNullAnnotation != null) { SymbolicValue returnedValue = programState.peekValue(); Constraint constraint = programState.getConstraint(returnedValue); if (constraint == null) { <START> reportIssue(tree, "This method''s return value is marked \"{0}\" but null may be returned.", nonNullAnnotation); <END> } else if (constraint.isNull()) { reportIssue(tree, "This method''s return value is marked \"{0}\" but null is returned.", nonNullAnnotation); } } }</code><technical_language>reporting issue. case; field is final set in constructor: class MyOtherClass { private final Object myObject; public MyOtherClass() { myObject = new Object(); } @Nonnull public Object getMyObject() { return myObject; // raise a FP } }</technical_language>

Target:
public void visitReturnStatement(ReturnStatementTree tree) { Tree parent = tree.parent(); while (!parent.is(Tree.Kind.METHOD)) { parent = parent.parent(); if (parent == null) { return; } } MethodTree mTree = (MethodTree) parent; String nonNullAnnotation = nonNullAnnotation(mTree.symbol()); if (nonNullAnnotation != null && isLocalExpression(tree.expression())) { checkReturnedValue(tree, nonNullAnnotation); } }
Source:
<code>public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AvroReplacementDescriptor other = (AvroReplacementDescriptor) obj; if (forbidden == null) { if (other.forbidden != null) { <START> return false; <END> } } else if (!forbidden.equals(other.forbidden)) { return false; } return true; }</code><technical_language>test equality ? Objects#equals, concise</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } AvroReplacementDescriptor other = (AvroReplacementDescriptor) obj; return Objects.equals(forbidden, other.forbidden); }
Source:
<code>public String getDataLoadingPolicy() { if (StringUtils.isBlank(dataLoadingPolicy)) { return NEVER_LOAD; } <START> String dlp = dataLoadingPolicy.toLowerCase(); <END> if (!DATA_LOADING_POLICIES.contains(dlp)) { throw new DirectoryException("Invalid dataLoadingPolicy: " + dataLoadingPolicy + ", it should be one of: " + DATA_LOADING_POLICIES); } return dlp; }</code><technical_language>please</technical_language>

Target:
public String getDataLoadingPolicy() { if (StringUtils.isBlank(dataLoadingPolicy)) { return DATA_LOADING_POLICY_LEGACY; } String dlp = dataLoadingPolicy.toLowerCase(Locale.ENGLISH); checkDataLoadingPolicy(dlp); return dlp; }
Source:
<code>private static void assertValue(int priority) { if (priority < 0 || priority > 10) { <START> throw new TaskAssigningRuntimeException(String.format("Task priority %s is out of range. " + <END> "A valid priority value must be between 0 (inclusive) " + " and 10 (inclusive)", priority)); } }</code><technical_language>Standard exception preferred of time, especially for unchecked exceptions. For purpose if input validation, IllegalArgumentException is typically used</technical_language>

Target:
private static void assertValue(int priority) { if (priority < 0 || priority > 10) { throw new IllegalArgumentException(String.format("Task priority %s is out of range. " + "A valid priority value must be between 0 (inclusive) " + " and 10 (inclusive)", priority)); } }
Source:
<code>public PageTitle(final String namespace, final String text) { this.namespace = namespace; <START> this.text = text.replaceAll("\\s+", "_"); <END> }</code><technical_language>\s include zero-width non-joiner stuff? Oh, languages, fun. :D</technical_language>

Target:
public PageTitle(final String namespace, final String text) { this.namespace = namespace; this.text = text; }
Source:
<code>public boolean removeAttributeWithoutCheck(PerunSession sess, Host host, AttributeDefinition attribute) throws InternalErrorException, WrongAttributeAssignmentException { getAttributesManagerImpl().checkNamespace(sess, attribute, AttributesManager.NS_HOST_ATTR); if (getAttributesManagerImpl().isCoreAttribute(sess, attribute)) throw new WrongAttributeAssignmentException(attribute); boolean changed = getAttributesManagerImpl().removeAttribute(sess, host, attribute); if (changed) { try { getAttributesManagerImpl().changedAttributeHook(sess, host, new Attribute(attribute)); } catch (WrongAttributeValueException | WrongReferenceAttributeValueException ex) { throw new InternalErrorException(ex); } <START> log.info("{} removed this attribute from host {}", sess.getLogId(), attribute.getName(), host.getId()); <END> getPerunBl().getAuditer().log(sess, "{} removed for {}.", new AttributeDefinition(attribute), host); } return changed; }</code><technical_language>I remove unnecessary "this" message (and other similar messages). is double space "host" word</technical_language>

Target:
public boolean removeAttributeWithoutCheck(PerunSession sess, Host host, AttributeDefinition attribute) throws InternalErrorException, WrongAttributeAssignmentException { getAttributesManagerImpl().checkNamespace(sess, attribute, AttributesManager.NS_HOST_ATTR); if (getAttributesManagerImpl().isCoreAttribute(sess, attribute)) throw new WrongAttributeAssignmentException(attribute); boolean changed = getAttributesManagerImpl().removeAttribute(sess, host, attribute); if (changed) { try { getAttributesManagerImpl().changedAttributeHook(sess, host, new Attribute(attribute)); } catch (WrongAttributeValueException | WrongReferenceAttributeValueException ex) { throw new InternalErrorException(ex); } log.info("{} removed attribute from host {}.", sess.getLogId(), attribute.getName(), host.getId()); getPerunBl().getAuditer().log(sess, "{} removed for {}", new AttributeDefinition(attribute), host); } return changed; }
Source:
<code>private boolean isDeletionAllowed(ContainerData containerData, ContainerDeletionChoosingPolicy deletionPolicy) { if (!deletionPolicy .isValidContainerType(containerData.getContainerType())) { return false; } else if (!containerData.isClosed()) { return false; } else { if (ozoneContainer.getWriteChannel() instanceof XceiverServerRatis) { try { XceiverServerRatis ratisServer = (XceiverServerRatis) ozoneContainer.getWriteChannel(); long minReplicatedIndex = ratisServer.getMinReplicatedIndex(PipelineID <START> .valueOf(UUID.fromString(containerData.getOriginPipelineId()))); <END> long containerBCSID = containerData.getBlockCommitSequenceId(); if (minReplicatedIndex >= 0 && minReplicatedIndex < containerBCSID) { LOG.warn("Close Container log Index is not replicated across all" + "the servers in the pipeline as the min replicated " + "index is {}. Deletion is not allowed in this container " + "yet.", containerBCSID, containerData.getOriginPipelineId(), minReplicatedIndex); return false; } else { return true; } } catch (IOException ioe) { LOG.info(ioe.getMessage()); return false; } } return true; } }</code><technical_language>If pipeline exist, throw GroupMismatchException here. check exception is thrown once. In case need return true</technical_language>

Target:
private boolean isDeletionAllowed(ContainerData containerData, ContainerDeletionChoosingPolicy deletionPolicy) { if (!deletionPolicy .isValidContainerType(containerData.getContainerType())) { return false; } else if (!containerData.isClosed()) { return false; } else { if (ozoneContainer.getWriteChannel() instanceof XceiverServerRatis) { XceiverServerRatis ratisServer = (XceiverServerRatis) ozoneContainer.getWriteChannel(); PipelineID pipelineID = PipelineID .valueOf(UUID.fromString(containerData.getOriginPipelineId())); if (!ratisServer.isExist(pipelineID.getProtobuf())) { return true; } try { long minReplicatedIndex = ratisServer.getMinReplicatedIndex(pipelineID); long containerBCSID = containerData.getBlockCommitSequenceId(); if (minReplicatedIndex >= 0 && minReplicatedIndex < containerBCSID) { LOG.warn("Close Container log Index is not replicated across all" + "the servers in the pipeline as the min replicated " + "index is {}. Deletion is not allowed in this container " + "yet.", containerBCSID, containerData.getOriginPipelineId(), minReplicatedIndex); return false; } else { return true; } } catch (IOException ioe) { if (!ratisServer.isExist(pipelineID.getProtobuf())) { return true; } else { LOG.info(ioe.getMessage()); return false; } } } return true; } }
Source:
<code>protected List<? extends EObject> getTargets(IterateCondition condition, EObject domainModel) { try { return databindings.getObservableList(condition.getItemReference(), domainModel); } catch (final DatabindingFailedException e) { <START> Activator.log(e); <END> return Collections.emptyList(); } }</code><technical_language>Please ask Eugen log</technical_language>

Target:
protected List<? extends EObject> getTargets(IterateCondition condition, EObject domainModel) { try { return databindings.getObservableList(condition.getItemReference(), domainModel); } catch (final DatabindingFailedException e) { reportService.report(new DatabindingFailedReport(e)); return Collections.emptyList(); } }
Source:
<code>private CommcareMetadataInfo populateReportsMetadata(CommcareMetadataJson metadataJson) { CommcareMetadataInfo metadataInfo = new CommcareMetadataInfo(); <START> metadataInfo.setLimit(metadataJson.getLimit()); <END> metadataInfo.setNextPageQueryString(metadataJson.getNextPageQueryString()); metadataInfo.setOffset(metadataJson.getOffset()); metadataInfo.setPreviousPageQueryString(metadataJson.getPreviousPageQueryString()); metadataInfo.setTotalCount(metadataJson.getTotalCount()); return metadataInfo; }</code><technical_language>constructor</technical_language>

Target:
private CommcareMetadataInfo populateReportsMetadata(CommcareMetadataJson metadataJson) { return new CommcareMetadataInfo(metadataJson.getLimit(), metadataJson.getNextPageQueryString(), metadataJson.getOffset(), metadataJson.getPreviousPageQueryString(), metadataJson.getTotalCount()); }