auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public IFigure getToolTip() { if (toolTip == null) { Figure composite = new Figure(); GridLayout fl = new GridLayout(2, false); fl.horizontalSpacing = 1; fl.verticalSpacing = 1; composite.setLayoutManager(fl); for (DecorationDescriptor decoDescriptor : decoDescriptors) { <START> composite.add(getDecorationFigureForTooltip(decoDescriptor)); <END> IFigure decorationTooltip = getDecorationTooltip(decoDescriptor); if (decorationTooltip != null) { composite.add(getDecorationTooltip(decoDescriptor)); } else { composite.add(new Figure()); } } toolTip = composite; } return toolTip; }</code><technical_language>In absolute, this method return null. No</technical_language>

Target:
public IFigure getToolTip() { if (toolTip == null) { Figure composite = new Figure(); GridLayout fl = new GridLayout(2, false); fl.horizontalSpacing = 1; fl.verticalSpacing = 1; composite.setLayoutManager(fl); for (DecorationDescriptor decoDescriptor : decoDescriptors) { IFigure decorationFigureForTooltip = getDecorationFigureForTooltip(decoDescriptor); if (decorationFigureForTooltip != null) { composite.add(decorationFigureForTooltip); IFigure decorationTooltip = getDecorationTooltip(decoDescriptor); if (decorationTooltip != null) { composite.add(getDecorationTooltip(decoDescriptor)); } else { composite.add(new Figure()); } } } toolTip = composite; } return toolTip; }
Source:
<code>public boolean syncWait() { try { <START> lock.await(2000, TimeUnit.MILLISECONDS); <END> } catch (InterruptedException e) { return false; } return lock.getCount() == 0; }</code><technical_language>Hm, hardcoded time is pretty dangerous, if emulator slow -> test fail :( loop waits set max loop time, if changes arrive faster -> break loop, tests faster</technical_language>

Target:
public boolean syncWait() { try { lock.await(15, SECONDS); } catch (InterruptedException e) { throw new RuntimeException(e); } return lock.getCount() == 0; }
Source:
<code>@Override public void implement(Implementor implementor) { implementor.visitChild(0, getInput()); List<String> inputFields = fieldNames(getInput().getRowType()); <START> if (groupSet.cardinality() == 1) { <END> final String groupByFieldName = inputFields.get(groupSet.nth(0)); implementor.addGroupBy(groupByFieldName); } else { for (int group : groupSet) { implementor.addGroupBy(inputFields.get(group)); } } for (AggregateCall aggCall : aggCalls) { List<String> names = new ArrayList<>(); for (int i : aggCall.getArgList()) { names.add(inputFields.get(i)); } final String name = names.isEmpty() ? ElasticsearchConstants.ID : names.get(0); String op = String.format(Locale.ROOT, "\"%s\":{\"field\": \"%s\"}", toElasticAggregate(aggCall), name); implementor.addAggregation(aggCall.getName(), op); } }</code><technical_language>do need this for single group, performance? L114~L116 do work</technical_language>

Target:
@Override public void implement(Implementor implementor) { implementor.visitChild(0, getInput()); List<String> inputFields = fieldNames(getInput().getRowType()); for (int group : groupSet) { implementor.addGroupBy(inputFields.get(group)); } for (AggregateCall aggCall : aggCalls) { List<String> names = new ArrayList<>(); for (int i : aggCall.getArgList()) { names.add(inputFields.get(i)); } final String name = names.isEmpty() ? ElasticsearchConstants.ID : names.get(0); String op = String.format(Locale.ROOT, "\"%s\":{\"field\": \"%s\"}", toElasticAggregate(aggCall), name); implementor.addAggregation(aggCall.getName(), op); } }
Source:
<code>public void testUDPLargePacket() throws Exception { Subject<byte[], byte[]> sub = PublishSubject.create(); SimpleChan simpleadapter = new SimpleChan(sub); TestAwaitableObserver<byte[]> monitor = new TestAwaitableObserver<>(); sub.subscribe(monitor); int port; ServerFrontEnd udpSrv = null; <START> int chances = RETRIES; boolean ready = false; do { chances --; port = rand.nextInt(100) + 8000; try { udpSrv = ServerFrontEnd.udp(simpleadapter, port, 65535); udpSrv.startAsync().awaitRunning(); ready = true; } catch (IllegalStateException e) { if (chances <= 0) throw e; } } while (!ready); <END> byte[] msg = new byte[65535 - 28]; rand.nextBytes(msg); sendMSG(msg, port); monitor.awaitOnNext(1, TIMEOUT); assertThat("msg was received", monitor.getOnNextEvents().get(0), equalTo(msg)); udpSrv.stopAsync().awaitTerminated(); }</code><technical_language>place this in a method</technical_language>

Target:
public void testUDPLargePacket() throws Exception { Subject<byte[], byte[]> sub = PublishSubject.create(); SimpleChan simpleadapter = new SimpleChan(sub); TestAwaitableObserver<byte[]> monitor = new TestAwaitableObserver<>(); sub.subscribe(monitor); Pair<ServerFrontEnd, Integer> cnxn = connect(simpleadapter, 65535); ServerFrontEnd udpSrv = cnxn.getLeft(); int port = cnxn.getRight(); byte[] msg = new byte[65535 - 28]; rand.nextBytes(msg); sendMSG(msg, port); monitor.awaitOnNext(1, TIMEOUT); assertThat("msg was received", monitor.getOnNextEvents().get(0), equalTo(msg)); udpSrv.stopAsync().awaitTerminated(); }
Source:
<code>public void set(String mode) { AccessType world = null, trusted = null; try { String[] modes = StringUtils.split(mode, ','); world = AccessType.valueOf(modes[0].trim()); trusted = AccessType.valueOf(modes[1].trim()); } catch (RuntimeException e) { <START> LOGGER.error("RuntimeException ", e); <END> } if (world != null && trusted != null) { set(world, trusted); } }</code><technical_language>LOGGER.error(e.getMessage(), e) ? exception class RuntimeException</technical_language>

Target:
public void set(String mode) { AccessType world = null, trusted = null; try { String[] modes = StringUtils.split(mode, ','); world = AccessType.valueOf(modes[0].trim()); trusted = AccessType.valueOf(modes[1].trim()); } catch (RuntimeException e) { LOGGER.error(e.getMessage(), e); } if (world != null && trusted != null) { set(world, trusted); } }
Source:
<code>public void name() throws Exception { <START> assertThat(faker.pokemon().name(), matchesRegularExpression("([\\w'\\./ ]+ ?)+")); <END> }</code><technical_language>testing pokemon service, rockband one</technical_language>

Target:
public void name() throws Exception { assertThat(faker.rockBand().name(), matchesRegularExpression("([\\w'/.,&]+ ?)+")); }
Source:
<code>public CompletableFuture<Boolean> matchMCConfig(Member member, String eTag) { checkNotNull(member); checkNotNull(eTag); ClientInvocation invocation = new ClientInvocation( client, MCMatchMCConfigCodec.encodeRequest(eTag), null, member.getAddress() ); return new ClientDelegatingFuture<>( invocation.invoke(), serializationService, clientMessage -> { MCMatchMCConfigCodec.ResponseParameters response = MCMatchMCConfigCodec.decodeResponse(clientMessage); return response.response; }, <START> true <END> ); }</code><technical_language>need deserializeResponse response is data</technical_language>

Target:
public CompletableFuture<Boolean> matchMCConfig(Member member, String eTag) { checkNotNull(member); checkNotNull(eTag); ClientInvocation invocation = new ClientInvocation( client, MCMatchMCConfigCodec.encodeRequest(eTag), null, member.getAddress() ); return new ClientDelegatingFuture<>( invocation.invoke(), serializationService, clientMessage -> { MCMatchMCConfigCodec.ResponseParameters response = MCMatchMCConfigCodec.decodeResponse(clientMessage); return response.response; }, false ); }
Source:
<code>public TriggerResult onElement(T element, long timestamp, W window, TriggerContext ctx) throws Exception { TriggerResult triggerResult = this.nestedTrigger.onElement(element, timestamp, window, ctx); if (triggerResult.isFire()) { this.clear(window, ctx); return triggerResult; } ValueState<Long> timeoutState = ctx.getPartitionedState(this.timeoutStateDesc); long nextFireTimestamp = ctx.getCurrentProcessingTime() + this.interval; if (timeoutState.value() != null && continualInterval) { ctx.deleteProcessingTimeTimer(timeoutState.value()); timeoutState.clear(); } <START> if (timeoutState.value() == null) { <END> timeoutState.update(nextFireTimestamp); ctx.registerProcessingTimeTimer(nextFireTimestamp); } return triggerResult; }</code><technical_language>timeoutState.value() called in this method. access is potentially costly out RocksDB for state access if RocksDB state backend is used</technical_language>

Target:
public TriggerResult onElement(T element, long timestamp, W window, TriggerContext ctx) throws Exception { TriggerResult triggerResult = this.nestedTrigger.onElement(element, timestamp, window, ctx); if (triggerResult.isFire()) { this.clear(window, ctx); return triggerResult; } ValueState<Long> timeoutState = ctx.getPartitionedState(this.timeoutStateDesc); long nextFireTimestamp = ctx.getCurrentProcessingTime() + this.interval; Long timeoutTimestamp = timeoutState.value(); if (timeoutTimestamp != null && resetTimerOnNewRecord) { ctx.deleteProcessingTimeTimer(timeoutTimestamp); timeoutState.clear(); timeoutTimestamp = null; } if (timeoutTimestamp == null) { timeoutState.update(nextFireTimestamp); ctx.registerProcessingTimeTimer(nextFireTimestamp); } return triggerResult; }
Source:
<code>public ExecutionResult executeCLI(Arguments arguments) { prepare(); try { if(!silent) { log.info("Execute {}", name, arguments); } context.setIOAgent(tracker.agent()); final String[] args = getArgumentStrings(arguments); if(strategy != null) { context.invokeStrategyCLI(strategy, name, args); } else { context.invokeStrategyCLI(strategyName, name, args); } return new ExecutionResult(true, tracker.stdout(), tracker.stderr()); } catch(StrategoExit e) { if(e.getValue() == 0) { return new ExecutionResult(true, tracker.stdout(), tracker.stderr()); } if(!silent) { log.error("Executing failed: {}", name, e); } return new ExecutionResult(false, tracker.stdout(), tracker.stderr()); } finally { <START> SSLLibrary op = (SSLLibrary) context.getOperatorRegistry(SSLLibrary.REGISTRY_NAME); <END> op.getDynamicRuleTable().clear(); op.getTableTable().clear(); } }</code><technical_language>skip clearing tables when, for reason, is SSLLibrary in context (right throw a ClassCastException). like: final @Nullable OperatorRegistry op = context.getOperatorRegistry(SSLLibrary.REGISTRY_NAME); if(op != null) { final SSLLibrary sslLibrary = (SSLLibrary) op; sslLibrary.getDynamicRuleTable().clear(); sslLibrary.getTableTable().clear(); }</technical_language>

Target:
public ExecutionResult executeCLI(Arguments arguments) { prepare(); try { if(!silent) { log.info("Execute {}", name, arguments); } context.setIOAgent(tracker.agent()); final String[] args = getArgumentStrings(arguments); if(strategy != null) { context.invokeStrategyCLI(strategy, name, args); } else { context.invokeStrategyCLI(strategyName, name, args); } return new ExecutionResult(true, tracker.stdout(), tracker.stderr()); } catch(StrategoExit e) { if(e.getValue() == 0) { return new ExecutionResult(true, tracker.stdout(), tracker.stderr()); } if(!silent) { log.error("Executing failed: {}", name, e); } return new ExecutionResult(false, tracker.stdout(), tracker.stderr()); } finally { final @Nullable IOperatorRegistry registry = context.getOperatorRegistry(SSLLibrary.REGISTRY_NAME); if(registry != null) { final SSLLibrary sslLibrary = (SSLLibrary) registry; sslLibrary.getDynamicRuleTable().clear(); sslLibrary.getTableTable().clear(); } } }
Source:
<code>public static MysqlSavedSchema restore( ConnectionPool pool, Long serverID, CaseSensitivity caseSensitivity, <START> Position targetPosition <END> ) throws SQLException, InvalidSchemaError { try (Connection conn = pool.getConnection()) { Long schemaID = findSchema(conn, targetPosition, serverID); if (schemaID == null) { return null; } MysqlSavedSchema savedSchema = new MysqlSavedSchema(serverID, caseSensitivity); savedSchema.restoreFromSchemaID(conn, schemaID); savedSchema.handleVersionUpgrades(conn); return savedSchema; } }</code><technical_language>is this..</technical_language>

Target:
public static MysqlSavedSchema restore( ConnectionPool pool, Long serverID, CaseSensitivity caseSensitivity, Position targetPosition ) throws SQLException, InvalidSchemaError { try ( Connection conn = pool.getConnection() ) { Long schemaID = findSchema(conn, targetPosition, serverID); if (schemaID == null) return null; MysqlSavedSchema savedSchema = new MysqlSavedSchema(serverID, caseSensitivity); savedSchema.restoreFromSchemaID(conn, schemaID); savedSchema.handleVersionUpgrades(conn); return savedSchema; } }
Source:
<code>public void onBackPressed() { super.onBackPressed(); <START> goToMap() <END> }</code><technical_language>Missing ;(semi colon). Syntax Error</technical_language>

Target:
public void onBackPressed() { finish(); super.onBackPressed(); }
Source:
<code>public void start() { if (started.compareAndSet(false, true)) { refreshExecutor.scheduleWithFixedDelay(this::refreshAndStartQueries, 1, 1, TimeUnit.MILLISECONDS); <START> resourceGroupRefreshExecutor.scheduleWithFixedDelay(this::refreshInternalResourceGroups, 1, 1, TimeUnit.SECONDS); <END> } }</code><technical_language>reasoning periodically refresh refresh actual change is detected? file based resource groups, changed. this running unnecessary</technical_language>

Target:
public void start() { if (started.compareAndSet(false, true)) { refreshExecutor.scheduleWithFixedDelay(() -> { try { refreshAndStartQueries(); lastSchedulingCycleRunTimeMs.getAndSet(currentTimeMillis()); } catch (Throwable t) { log.error(t, "Error while executing refreshAndStartQueries"); throw t; } }, 1, 1, MILLISECONDS); } }
Source:
<code>public Page getNextPage() { try { Page dataPage = delegate.getNextPage(); if (dataPage == null) { return null; } if (bucketAdapter.isPresent()) { IntArrayList ids = bucketAdapter.get().computeEligibleRowIds(dataPage); Block[] adaptedBlocks = new Block[dataPage.getChannelCount()]; for (int i = 0; i < adaptedBlocks.length; i++) { adaptedBlocks[i] = new LazyBlock(ids.size(), new RowFilterLazyBlockLoader(dataPage.getBlock(i), ids)); <START> } <END> dataPage = new Page(ids.size(), adaptedBlocks); } int batchSize = dataPage.getPositionCount(); List<Block> blocks = new ArrayList<>(); for (int fieldId = 0; fieldId < columnMappings.size(); fieldId++) { ColumnMapping columnMapping = columnMappings.get(fieldId); switch (columnMapping.getKind()) { case PREFILLED: blocks.add(RunLengthEncodedBlock.create(types[fieldId], prefilledValues[fieldId], batchSize)); break; case REGULAR: Block block = dataPage.getBlock(columnMapping.getIndex()); if (coercers[fieldId] != null) { block = new LazyBlock(batchSize, new CoercionLazyBlockLoader(block, coercers[fieldId])); } blocks.add(block); break; case INTERIM: break; default: throw new UnsupportedOperationException(); } } return new Page(batchSize, blocks.toArray(new Block[0])); } catch (PrestoException e) { closeWithSuppression(e); throw e; } catch (RuntimeException e) { closeWithSuppression(e); throw new PrestoException(HIVE_CURSOR_ERROR, e); } }</code><technical_language>if block is lazy loaded, need wrapper a lazy block, instead mask</technical_language>

Target:
public Page getNextPage() { try { Page dataPage = delegate.getNextPage(); if (dataPage == null) { return null; } if (bucketAdapter.isPresent()) { IntArrayList rowsToKeep = bucketAdapter.get().computeEligibleRowIds(dataPage); Block[] adaptedBlocks = new Block[dataPage.getChannelCount()]; for (int i = 0; i < adaptedBlocks.length; i++) { Block block = dataPage.getBlock(i); if (block instanceof LazyBlock && !((LazyBlock) block).isLoaded()) { adaptedBlocks[i] = new LazyBlock(rowsToKeep.size(), new RowFilterLazyBlockLoader(dataPage.getBlock(i), rowsToKeep)); } else { adaptedBlocks[i] = block.getPositions(rowsToKeep.elements(), 0, rowsToKeep.size()); } } dataPage = new Page(rowsToKeep.size(), adaptedBlocks); } int batchSize = dataPage.getPositionCount(); List<Block> blocks = new ArrayList<>(); for (int fieldId = 0; fieldId < columnMappings.size(); fieldId++) { ColumnMapping columnMapping = columnMappings.get(fieldId); switch (columnMapping.getKind()) { case PREFILLED: blocks.add(RunLengthEncodedBlock.create(types[fieldId], prefilledValues[fieldId], batchSize)); break; case REGULAR: Block block = dataPage.getBlock(columnMapping.getIndex()); if (coercers[fieldId] != null) { block = new LazyBlock(batchSize, new CoercionLazyBlockLoader(block, coercers[fieldId])); } blocks.add(block); break; case INTERIM: break; default: throw new UnsupportedOperationException(); } } return new Page(batchSize, blocks.toArray(new Block[0])); } catch (PrestoException e) { closeWithSuppression(e); throw e; } catch (RuntimeException e) { closeWithSuppression(e); throw new PrestoException(HIVE_CURSOR_ERROR, e); } }
Source:
<code>public ASTValue eval(WordsEnvironment environment) throws WordsRuntimeException { ASTValue className = this.children.get(0).eval(environment); ASTValue parentClassName = this.children.get(1).eval(environment); WordsClass wordsClass = environment.createClass(className.stringValue, parentClassName.stringValue); INodeClassStatementList statementList = (INodeClassStatementList) this.children.get(2); if (statementList != null) { for (Object child : statementList.children) { if (child instanceof INodeDefineProperty) { ASTValue propertyName = ((INodeDefineProperty) child).id.eval(environment); if (((INodeDefineProperty) child).literal == null) { wordsClass.setProperty(propertyName.stringValue, new WordsProperty(WordsProperty.PropertyType.NOTHING)); } else { <START> ASTValue propertyValue = ((INodeDefineProperty) child).literal.eval(environment); <END> WordsProperty wordsProp = null; switch (propertyValue.type) { case STRING: wordsProp = new WordsProperty(propertyValue.stringValue); break; case NUM: wordsProp = new WordsProperty(propertyValue.numValue); break; default: throw new AssertionError("literal wasn't number or string"); } wordsClass.setProperty(propertyName.stringValue, wordsProp); } } } } return null; }</code><technical_language>implemented a method simplifies this. queue-prop-assign-branch in #87. I good if merged branch this refactor. (Sorry a separate branch itself, practice part.)</technical_language>

Target:
public ASTValue eval(WordsEnvironment environment) throws WordsRuntimeException { ASTValue className = this.children.get(0).eval(environment); ASTValue parentClassName = this.children.get(1).eval(environment); WordsClass wordsClass = environment.createClass(className.stringValue, parentClassName.stringValue); INodeClassStatementList statementList = (INodeClassStatementList) this.children.get(2); if (statementList != null) { statementList.eval(environment, wordsClass); } return null; }
Source:
<code>public VdcReturnValueBase ExecuteAction() { <START> adjustExecutionReason(); <END> _actionState = CommandActionState.EXECUTE; String tempVar = getDescription(); getReturnValue().setDescription((tempVar != null) ? tempVar : getReturnValue().getDescription()); setActionMessageParameters(); boolean actionAllowed = false; Step validatingStep = ExecutionHandler.addStep(getExecutionContext(), StepEnum.VALIDATING, null); try { actionAllowed = acquireLock() && (getReturnValue().getCanDoAction() || InternalCanDoAction()); ExecutionHandler.endStep(getExecutionContext(), validatingStep, actionAllowed); if (actionAllowed) { getReturnValue().setCanDoAction(true); getReturnValue().setIsSyncronious(true); getParameters().setTaskStartTime(System.currentTimeMillis()); Execute(); } else { getReturnValue().setCanDoAction(false); } } finally { freeLock(); } return getReturnValue(); }</code><technical_language>"determine" is a more suitable verb</technical_language>

Target:
public VdcReturnValueBase ExecuteAction() { determineExecutionReason(); _actionState = CommandActionState.EXECUTE; String tempVar = getDescription(); getReturnValue().setDescription((tempVar != null) ? tempVar : getReturnValue().getDescription()); setActionMessageParameters(); boolean actionAllowed = false; Step validatingStep = ExecutionHandler.addStep(getExecutionContext(), StepEnum.VALIDATING, null); try { actionAllowed = acquireLock() && (getReturnValue().getCanDoAction() || InternalCanDoAction()); ExecutionHandler.endStep(getExecutionContext(), validatingStep, actionAllowed); if (actionAllowed) { getReturnValue().setCanDoAction(true); getReturnValue().setIsSyncronious(true); getParameters().setTaskStartTime(System.currentTimeMillis()); Execute(); } else { getReturnValue().setCanDoAction(false); } } finally { freeLock(); } return getReturnValue(); }
Source:
<code>protected BuildResult perform(Run<?, ?> run, FilePath workspace, PluginLogger logger) throws InterruptedException, IOException{ if (isOverridden(HealthAwarePublisher.class, getClass(), <START> "perform", AbstractBuild.class, PluginLogger.class) && run instanceof AbstractBuild) { <END> return perform((AbstractBuild) run, logger); } else { throw new AbstractMethodError("you must override the new overload of perform(Run, FilePath, Launcher, PluginLogger)"); } }</code><technical_language>NIT: cost checks i.e. in this case run instanceof AbstractBuild</technical_language>

Target:
protected BuildResult perform(Run<?, ?> run, FilePath workspace, PluginLogger logger) throws InterruptedException, IOException{ if (run instanceof AbstractBuild && Compatibility.isOverridden(HealthAwarePublisher.class, getClass(), "perform", AbstractBuild.class, PluginLogger.class)) { return perform((AbstractBuild) run, logger); } else { throw new AbstractMethodError("you must override the new overload of perform(Run, FilePath, Launcher, PluginLogger)"); } }
Source:
<code>public OpenDocumentDialogPanel(String aId, AnnotatorState aBModel, ModalWindow aModalWindow, IModel<List<DecoratedObject<Project>>> aProjects) { super(aId); modalWindow = aModalWindow; state = aBModel; currentUser = userRepository.getCurrentUser(); selectedUser = currentUser; projects = aProjects; List<DecoratedObject<Project>> allowedProjects = projects.getObject(); if (!allowedProjects.isEmpty()) { selectedProject = allowedProjects.get(0).get(); } projectSelectionForm = new ProjectSelectionForm("projectSelectionForm"); if (aBModel.isProjectLocked()) { selectedProject = aBModel.getProject(); projectSelectionForm.getModelObject().projectSelection = aBModel.getProject(); projectSelectionForm.setVisible(false); } <START> isAdmin = userRepository.isAdministrator(currentUser); <END> userSelectionForm = new UserSelectionForm("userSelectionForm", aModalWindow); documentSelectionForm = new DocumentSelectionForm("documentSelectionForm", aModalWindow); userSelectionForm.add(visibleWhen(() -> isAdmin)); buttonsForm = new ButtonsForm("buttonsForm", aModalWindow); add(buttonsForm); add(userSelectionForm); add(projectSelectionForm); add(documentSelectionForm); }</code><technical_language>Do cache - fetch necessary. Also, ProjectService.isManager(Project, User) instead of userRepository.isAdministrator(currentUser)</technical_language>

Target:
public OpenDocumentDialogPanel(String aId, AnnotatorState aBModel, ModalWindow aModalWindow, IModel<List<DecoratedObject<Project>>> aProjects) { super(aId); modalWindow = aModalWindow; state = aBModel; projects = aProjects; projectListChoice = createProjectListChoice(aBModel); userListChoice = createUserListChoice(); docListChoice = createDocListChoice(); buttonsForm = new ButtonsForm("buttonsForm", aModalWindow); add(buttonsForm); add(projectListChoice); add(docListChoice); add(userListChoice); }
Source:
<code>public void UpdateDynamicData(VdsDynamic dynamicData) { <START> log.debug("Updated VDS dynamic without checking if update is needed"); <END> DbFacade.getInstance().getVdsDynamicDao().update(dynamicData); }</code><technical_language>I a cache update here. pls fix java doc</technical_language>

Target:
public void UpdateDynamicData(VdsDynamic dynamicData) { DbFacade.getInstance().getVdsDynamicDao().update(dynamicData); }
Source:
<code>private String getSequenceNumberInternal(StreamPartition<String> partition, ShardIteratorType iteratorEnum) { String shardIterator; try { shardIterator = kinesis.getShardIterator( partition.getStream(), partition.getPartitionId(), iteratorEnum.toString() ).getShardIterator(); } catch (LimitExceededException | ProvisionedThroughputExceededException | ResourceInUseException e) { throw new TransientStreamException(e); } catch (ResourceNotFoundException e) { throw new PossiblyTransientStreamException(e); } catch (AmazonKinesisException e) { throw new NonTransientStreamException(e); } <START> return getSequenceNumberInternal(partition, shardIterator); <END> }</code><technical_language>this put in try block exceptions throws wrapped</technical_language>

Target:
private String getSequenceNumberInternal(StreamPartition<String> partition, ShardIteratorType iteratorEnum) { return wrapExceptions(() -> getSequenceNumberInternal( partition, kinesis.getShardIterator(partition.getStream(), partition.getPartitionId(), iteratorEnum.toString()) .getShardIterator() )); }
Source:
<code>private static int getFullModifiers(ClassStub data, AsmReferenceResolver resolver) { int result = data.accessModifiers; String className = data.className; <START> int idx = className.lastIndexOf('$'); <END> if (idx > 0) { ClassNode outerClass = resolver.resolveClassNullable(className.substring(0, idx)); if (outerClass instanceof DecompiledClassNode) { Integer outerModifiers = ((DecompiledClassNode) outerClass).classData.innerClassModifiers.get(className.substring(idx + 1)); if (outerModifiers != null) { result |= outerModifiers; } } } return result; }</code><technical_language>$ in custom class names, $ is a valid identifier for a classname I believe. Generally people $ in class names, caught if did</technical_language>

Target:
private static int getFullModifiers(ClassStub data, AsmReferenceResolver resolver) { String className = data.className; int bound = className.length(); while (bound > 0) { int idx = className.lastIndexOf('$', bound); if (idx > 0) { ClassNode outerClass = resolver.resolveClassNullable(className.substring(0, idx)); if (outerClass instanceof DecompiledClassNode) { Integer outerModifiers = ((DecompiledClassNode) outerClass).classData.innerClassModifiers.get(className.substring(idx + 1)); if (outerModifiers != null) { return data.accessModifiers | outerModifiers; } } } bound = idx - 1; } return data.accessModifiers; }
Source:
<code><START> public boolean isMultitenant() { <END> return delegate.isMultitenant(); }</code><technical_language>this method final? If not, in cases a delegate kind of tenancy</technical_language>

Target:
public final boolean isMultitenant() { return delegate.isMultitenant(); }
Source:
<code>public void testAddQueryParam() { Map<String, String> mock = mock(Map.class); request.setQueryParams(mock); expect(mock.put(same(DEFAULT_KEY), eq(DEFAULT_VALUE))).andReturn(null); replay(mock); this.request.addQueryParam(DEFAULT_KEY, DEFAULT_VALUE); <START> } <END></code><technical_language>for this file</technical_language>

Target:
public void testAddQueryParam() { Map<String, String> mock = mock(Map.class); request.setQueryParams(mock); expect(mock.put(same(DEFAULT_KEY), eq(DEFAULT_VALUE))).andReturn(null); replay(mock); this.request.addQueryParam(DEFAULT_KEY, DEFAULT_VALUE); verify(mock); }
Source:
<code>private Map<String, List<Pair<EtlKey, ExceptionWritable>>> readErrors(final FileSystem fs, final Path newExecutionOutput) throws IOException { final int maxErrorsFromFile = Integer.parseInt(props.getProperty(ETL_MAX_ERRORS_TO_PRINT_FROM_FILE, ETL_MAX_ERRORS_TO_PRINT_FROM_FILE_DEFAULT)); final Map<String, List<Pair<EtlKey, ExceptionWritable>>> errors = Maps.newHashMap(); for (final FileStatus f : fs.listStatus(newExecutionOutput, new PrefixFilter(EtlMultiOutputFormat.ERRORS_PREFIX))) { int errorCounter = 0; final Path filePath = f.getPath(); final SequenceFile.Reader reader = new SequenceFile.Reader(fs, filePath, fs.getConf()); EtlKey key = new EtlKey(); ExceptionWritable value = new ExceptionWritable(); while (reader.next(key, value) && errorCounter < maxErrorsFromFile) { errorCounter++; final List<Pair<EtlKey, ExceptionWritable>> errorsFromFile = errors.containsKey(filePath.toString()) ? errors.get(filePath.toString()) : Lists.<Pair<EtlKey, ExceptionWritable>>newArrayList(); if (errorCounter >= maxErrorsFromFile) { errorsFromFile.add( new Pair<EtlKey, ExceptionWritable>(new EtlKey(key), <START> new ExceptionWritable("... Too many errors to show. Skipping..."))); <END> } else { errorsFromFile.add( new Pair<EtlKey, ExceptionWritable>(new EtlKey(key), new ExceptionWritable(value.toString()))); } errors.put(filePath.toString(), errorsFromFile); } reader.close(); } return errors; }</code><technical_language>include number of errors skipped</technical_language>

Target:
private Map<String, List<Pair<EtlKey, ExceptionWritable>>> readErrors(final FileSystem fs, final Path newExecutionOutput) throws IOException { final int maxErrorsFromFile = Integer.parseInt(props.getProperty(ETL_MAX_ERRORS_TO_PRINT_FROM_FILE, ETL_MAX_ERRORS_TO_PRINT_FROM_FILE_DEFAULT)); final Map<String, List<Pair<EtlKey, ExceptionWritable>>> errors = Maps.newHashMap(); for (final FileStatus f : fs.listStatus(newExecutionOutput, new PrefixFilter(EtlMultiOutputFormat.ERRORS_PREFIX))) { int errorCounter = 0; final Path filePath = f.getPath(); final SequenceFile.Reader reader = new SequenceFile.Reader(fs, filePath, fs.getConf()); EtlKey key = new EtlKey(); ExceptionWritable value = new ExceptionWritable(); final List<Pair<EtlKey, ExceptionWritable>> errorsFromFile = Lists.<Pair<EtlKey, ExceptionWritable>>newArrayList(); while (reader.next(key, value)) { errorCounter++; if (errorCounter <= maxErrorsFromFile) { errorsFromFile.add( new Pair<EtlKey, ExceptionWritable>(new EtlKey(key), new ExceptionWritable(value.toString()))); } } if (errorCounter > 0) { if (errorCounter > maxErrorsFromFile) { errorsFromFile.add( new Pair<EtlKey, ExceptionWritable>( new EtlKey(key), new ExceptionWritable("... Too many errors to show. " + "Skipped " + (errorCounter - maxErrorsFromFile) + " ..."))); } errors.put(filePath.toString(), errorsFromFile); } reader.close(); } return errors; }
Source:
<code>Map<String, String> getFieldAliases() { Map<String, String> outputFieldMappings = new HashMap<String, String>(); if (fieldAliases != null) { for (String field : Splitter.on(',').trimResults().split(fieldAliases)) { String[] value = field.split(":"); if (value.length == 2) { outputFieldMappings.put(value[0], value[1]); <START> } <END> } } return outputFieldMappings; }</code><technical_language>else throw exception a descriptive message whats wrong</technical_language>

Target:
Map<String, String> getFieldAliases() { Map<String, String> outputFieldMappings = new HashMap<String, String>(); if (StringUtils.isNotEmpty(fieldAliases)) { for (String field : Splitter.on(',').trimResults().split(fieldAliases)) { String[] value = field.split(":"); if (value.length == 2) { outputFieldMappings.put(value[0], value[1]); } else { throw new IllegalArgumentException( String.format("Either key or value is missing for 'Output fields to rename'. Please make sure that " + "both key and value are present.")); } } } return outputFieldMappings; }
Source:
<code>public Mono<AmqpTransaction> createTransaction() { return createTransactionCoordinator() <START> .cast(ReactorSender.class) <END> .flatMap(coordinator -> { return coordinator.createTransaction(); }); }</code><technical_language>wary of casting this ReactorSender. TransactionCoordinator a ReactorSender? current implementation adds more responsibility ReactorSender. handles sending messages, transactions. a separation of concerns a TransactionCoordinator class contains a AmqpSendLink verifies send operations of "transaction" message. java class TransactionCoordinator { private final AmqpSendLink sendLink; TransactionCoordinator(AmqpSendLink link) { // This reactor sender underneath. this.sendLink = link; } }</technical_language>

Target:
public Mono<AmqpTransaction> createTransaction() { return createTransactionCoordinator() .flatMap(coordinator -> coordinator.createTransaction()); }
Source:
<code>private boolean deleteAllFromRecycleBin(XWikiContext context) throws XWikiException { RefactoringScriptService refactoring = (RefactoringScriptService) Utils.getComponent(ScriptService.class, "refactoring"); <START> PermanentlyDeleteRequest deleteRequest = refactoring.createPermanentlyDeleteRequest(Collections.emptyList()); <END> deleteRequest.setInteractive(isAsync(context.getRequest())); try { JobExecutor jobExecutor = Utils.getComponent(JobExecutor.class); Job job = jobExecutor.execute(RefactoringJobs.PERMANENTLY_DELETE, deleteRequest); if (isAsync(context.getRequest())) { List<String> jobId = job.getRequest().getId(); sendRedirect(context.getResponse(), Utils.getRedirect("view", "xpage=delete&jobId=" + serializeJobId(jobId), context)); return true; } try { job.join(); } catch (InterruptedException e) { throw new XWikiException("Failed to delete all from the recycle bin", e); } return false; } catch (JobException e) { throw new XWikiException("Failed to schedule the delete all from recycle bin job", e); } }</code><technical_language>I this work for a subwiki wiki for want empty trash bin (and I doubt goal is empty trash bin of wiki, job is doing)</technical_language>

Target:
private boolean deleteAllFromRecycleBin(XWikiContext context) throws XWikiException { RefactoringScriptService refactoring = (RefactoringScriptService) Utils.getComponent(ScriptService.class, "refactoring"); PermanentlyDeleteRequest deleteRequest = refactoring.createPermanentlyDeleteRequest(Collections.emptyList()); deleteRequest.setInteractive(isAsync(context.getRequest())); deleteRequest.setCheckAuthorRights(false); try { JobExecutor jobExecutor = Utils.getComponent(JobExecutor.class); Job job = jobExecutor.execute(RefactoringJobs.PERMANENTLY_DELETE, deleteRequest); if (isAsync(context.getRequest())) { List<String> jobId = job.getRequest().getId(); sendRedirect(context.getResponse(), Utils.getRedirect("view", "xpage=delete&jobId=" + serializeJobId(jobId), context)); return true; } try { job.join(); } catch (InterruptedException e) { throw new XWikiException("Failed to delete all from the recycle bin", e); } return false; } catch (JobException e) { throw new XWikiException("Failed to schedule the delete all from recycle bin job", e); } }
Source:
<code>public MicroProfileClientFactoryBean(MicroProfileClientConfigurableImpl<RestClientBuilder> configuration, String baseUri, Class<?> aClass, ExecutorService executorService, TLSConfiguration secConfig) { super(new MicroProfileServiceFactoryBean()); this.configuration = configuration.getConfiguration(); this.comparator = MicroProfileClientProviderFactory.createComparator(this); <START> this.executorService = (executorService == null) ? defaultExecutorService() : executorService; <END> this.secConfig = secConfig; super.setAddress(baseUri); super.setServiceClass(aClass); super.setProviderComparator(comparator); super.setProperties(this.configuration.getProperties()); registeredProviders = new ArrayList<>(); registeredProviders.addAll(processProviders()); if (!configuration.isDefaultExceptionMapperDisabled()) { registeredProviders.add(new ProviderInfo<>(new DefaultResponseExceptionMapper(), getBus(), false)); } registeredProviders.add(new ProviderInfo<>(new JsrJsonpProvider(), getBus(), false)); super.setProviders(registeredProviders); }</code><technical_language>lazy create (forkjoin common pool) if app client for lifecycle</technical_language>

Target:
public MicroProfileClientFactoryBean(MicroProfileClientConfigurableImpl<RestClientBuilder> configuration, String baseUri, Class<?> aClass, ExecutorService executorService, TLSConfiguration secConfig) { super(new MicroProfileServiceFactoryBean()); this.configuration = configuration.getConfiguration(); this.comparator = MicroProfileClientProviderFactory.createComparator(this); this.executorService = (executorService == null) ? Utils.defaultExecutorService() : executorService; this.secConfig = secConfig; super.setAddress(baseUri); super.setServiceClass(aClass); super.setProviderComparator(comparator); super.setProperties(this.configuration.getProperties()); registeredProviders = new ArrayList<>(); registeredProviders.addAll(processProviders()); if (!configuration.isDefaultExceptionMapperDisabled()) { registeredProviders.add(new ProviderInfo<>(new DefaultResponseExceptionMapper(), getBus(), false)); } registeredProviders.add(new ProviderInfo<>(new JsrJsonpProvider(), getBus(), false)); super.setProviders(registeredProviders); }
Source:
<code>public static ISaveablePart getSaveable(Object o) { <START> if (o instanceof ISaveablePart) { <END> return (ISaveablePart) o; } return Adapters.getAdapter(o, ISaveablePart.class, true); }</code><technical_language>I this instanceof check deleted, is done getAdapter</technical_language>

Target:
public static ISaveablePart getSaveable(Object o) { return Adapters.getAdapter(o, ISaveablePart.class, true); }
Source:
<code><START> public Matrix muli(final Matrix matrix) { <END> if (matrix.isDense()) { ((NumericOps) breezeMatrix).$colon$times$eq(((DenseMatrix) matrix).breezeMatrix, MatrixOps.EMULI_DD); return this; } else { throw new UnsupportedOperationException(); } }</code><technical_language>UnsupportedOperationException thrown this method</technical_language>

Target:
public Matrix muli(final Matrix matrix) { if (matrix.isDense()) { ((NumericOps) breezeMatrix).$colon$times$eq(((DenseMatrix) matrix).breezeMatrix, MatrixOps.EMULI_DD); } else { ((NumericOps) breezeMatrix).$colon$times$eq(((CSCMatrix) matrix).getBreezeMatrix(), MatrixOps.EMULI_MM); } return this; }
Source:
<code>public InternalThreadExecutor() { <START> super(0, Config.<Integer> GetValue(ConfigValues.DefaultMaxThreadPoolSize), <END> 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>()); }</code><technical_language>initial pool size is set 0, doc idle thread core number of threads terminated time-out. I core threads 0 trash system creating terminating threads time. configurable before, set a number reasonable constant number of threads started (100 for example - tested of course)</technical_language>

Target:
public InternalThreadExecutor() { super(Config.<Integer> GetValue(ConfigValues.DefaultMinThreadPoolSize), Config.<Integer> GetValue(ConfigValues.DefaultMaxThreadPoolSize), 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>()); }
Source:
<code>private boolean perform(Run<?, ?> run, TaskListener listener, boolean disableInProgress) { StashBuildState state; PrintStream logger = listener.getLogger(); Result buildResult = run.getResult(); if (buildResult == null && disableInProgress) { return true; } else if (buildResult == null) { state = StashBuildState.INPROGRESS; } else if (buildResult == Result.SUCCESS || <START> (buildResult == Result.UNSTABLE && considerUnstableAsSuccess)) { <END> state = StashBuildState.SUCCESSFUL; } else if (buildResult == Result.ABORTED && disableAbortAsFailures) { return true; } else if (buildResult.equals(Result.NOT_BUILT)) { logger.println("NOT BUILT"); return true; } else { state = StashBuildState.FAILED; } return processJenkinsEvent(run, listener, state); }</code><technical_language>additional else if branch? easier read</technical_language>

Target:
private boolean perform(Run<?, ?> run, TaskListener listener, boolean disableInProgress) { StashBuildState state; PrintStream logger = listener.getLogger(); Result buildResult = run.getResult(); if (buildResult == null && disableInProgress) { return true; } else if (buildResult == null) { state = StashBuildState.INPROGRESS; } else if (buildResult == Result.SUCCESS) { state = StashBuildState.SUCCESSFUL; } else if (buildResult == Result.UNSTABLE && considerUnstableAsSuccess) { logger.println("UNSTABLE reported to stash as SUCCESSFUL"); state = StashBuildState.SUCCESSFUL; } else if (buildResult == Result.ABORTED && disableInProgress) { logger.println("ABORTED"); return true; } else if (buildResult.equals(Result.NOT_BUILT)) { logger.println("NOT BUILT"); return true; } else { state = StashBuildState.FAILED; } return processJenkinsEvent(run, listener, state); }
Source:
<code>public String buildCollectorFile(ConcurStandardAccountingExtractFile saeFileContents) { <START> ConcurStandardAccountingExtractCollectorBatchBuilder builder = createBatchBuilder(); <END> int sequenceNumber = calculateBatchSequenceNumber(); CollectorBatch collectorBatch = builder.buildCollectorBatchFromStandardAccountingExtract(sequenceNumber, saeFileContents); if (collectorBatch == null) { LOG.error("There was a problem preparing the data for the Collector file; will not create a file. See earlier logs for details."); return null; } String collectorFilePath = buildCollectorFilePath(saeFileContents.getOriginalFileName()); boolean fileCreatedSuccessfully = collectorFlatFileSerializerService.serializeToFlatFile(collectorFilePath, collectorBatch); if (!fileCreatedSuccessfully) { LOG.error("An error occurred while writing the data to the Collector file; see earlier logs for details."); collectorFilePath = null; } return collectorFilePath; }</code><technical_language>This method is multiple things.It broken smaller methods</technical_language>

Target:
public String buildCollectorFile(ConcurStandardAccountingExtractFile saeFileContents) { CollectorBatch collectorBatch = buildCollectorBatch(saeFileContents); if (collectorBatch == null) { LOG.error("There was a problem preparing the data for the Collector file; will not create a file. See earlier logs for details."); return StringUtils.EMPTY; } return writeToCollectorFile(saeFileContents.getOriginalFileName(), collectorBatch); }
Source:
<code>private TreeWalk createFileWalker(Repository db, List<FilterPath> paths) { final TreeWalk fileWalker = new TreeWalk(db); fileWalker.setRecursive(true); if (paths.size() > 0) { pathFilters = paths; List<String> stringPaths = new ArrayList<String>(paths.size()); <START> for (FilterPath p : paths) { <END> stringPaths.add(p.getPath()); } currentWalk.setTreeFilter(AndTreeFilter.create(PathFilterGroup .createFromStrings(stringPaths), TreeFilter.ANY_DIFF)); fileWalker.setFilter(currentWalk.getTreeFilter().clone()); } else { pathFilters = null; currentWalk.setTreeFilter(TreeFilter.ALL); fileWalker.setFilter(TreeFilter.ANY_DIFF); } return fileWalker; }</code><technical_language>Style-nit: extra curly braces</technical_language>

Target:
private TreeWalk createFileWalker(Repository db, List<FilterPath> paths) { final TreeWalk fileWalker = new TreeWalk(db); fileWalker.setRecursive(true); if (paths.size() > 0) { pathFilters = paths; List<String> stringPaths = new ArrayList<String>(paths.size()); for (FilterPath p : paths) stringPaths.add(p.getPath()); currentWalk.setTreeFilter(AndTreeFilter.create(PathFilterGroup .createFromStrings(stringPaths), TreeFilter.ANY_DIFF)); fileWalker.setFilter(currentWalk.getTreeFilter().clone()); } else { pathFilters = null; currentWalk.setTreeFilter(TreeFilter.ALL); fileWalker.setFilter(TreeFilter.ANY_DIFF); } return fileWalker; }
Source:
<code>public void testGetBaseParameters() throws UnsupportedEncodingException { exportEventProcessor.context = context; exportEventProcessor.request = request; exportEventProcessor.configurationService = configurationService; exportEventProcessor.trackerUrlVersion = "Z39.88-2004"; when(exportEventProcessor.getCurrentDateString()).thenReturn("2020-01-24T13:24:33Z"); when(request.getRemoteAddr()).thenReturn("test-client-ip"); when(request.getHeader("USER-AGENT")).thenReturn("test-user-agent"); when(request.getHeader("referer")).thenReturn("test-referer"); when(configurationService.getBooleanProperty("useProxies", false)).thenReturn(false); <START> when(configurationService.getProperty("dspace.hostname")).thenReturn("localhost"); <END> when(item.getHandle()).thenReturn("123456/1"); when(exportEventProcessor.getBaseParameters(item)).thenCallRealMethod(); String result = exportEventProcessor.getBaseParameters(item); String expected = "url_ver=Z39.88-2004&req_id=test-client-ip&req_dat=test-user-agent&rft.artnum=" + "oai%3Alocalhost%3A123456%2F1&rfr_dat=test-referer&rfr_id=localhost&url_tim=2020-01-24T13%3A24%3A33Z"; assertThat(result, is(expected)); }</code><technical_language>dspace.hostname is valid. here, need mock configurations. set values need</technical_language>

Target:
public void testGetBaseParameters() throws UnsupportedEncodingException { exportEventProcessor.context = context; exportEventProcessor.request = request; exportEventProcessor.configurationService = configurationService; exportEventProcessor.trackerUrlVersion = "Z39.88-2004"; when(exportEventProcessor.getCurrentDateString()).thenReturn("2020-01-24T13:24:33Z"); when(request.getRemoteAddr()).thenReturn("test-client-ip"); when(request.getHeader("USER-AGENT")).thenReturn("test-user-agent"); when(request.getHeader("referer")).thenReturn("test-referer"); when(item.getHandle()).thenReturn("123456/1"); when(exportEventProcessor.getBaseParameters(item)).thenCallRealMethod(); String result = exportEventProcessor.getBaseParameters(item); String expected = "url_ver=Z39.88-2004&req_id=test-client-ip&req_dat=test-user-agent&rft.artnum=" + "oai%3Alocalhost%3A123456%2F1&rfr_dat=test-referer&rfr_id=localhost&url_tim=2020-01-24T13%3A24%3A33Z"; assertThat(result, is(expected)); }
Source:
<code><START> static List<Expression> fromInternal(Class<?> targetType, List<Expression> expressions) { <END> final List<Expression> list = new ArrayList<>(); for (int i = 0; i < expressions.size(); i++) { list.add(fromInternal(expressions.get(i), targetType)); } return list; }</code><technical_language>need package private? private</technical_language>

Target:
private static List<Expression> fromInternal(Class<?> targetType, List<Expression> expressions) { final List<Expression> list = new ArrayList<>(); for (int i = 0; i < expressions.size(); i++) { list.add(fromInternal(expressions.get(i), targetType)); } return list; }
Source:
<code>protected Integer getUnspecifiedLocationId() { <START> final List<Location> locations = locationDataManager.getLocationsByName("Unspecified Location", Operation.EQUAL); <END> if (!locations.isEmpty()) { return locations.get(0).getLocid(); } return 0; }</code><technical_language>"Unspecified Location" constant in Middleware</technical_language>

Target:
protected Integer getUnspecifiedLocationId() { final List<Location> locations = locationDataManager.getLocationsByName(Location.UNSPECIFIED_LOCATION, Operation.EQUAL); if (!locations.isEmpty()) { return locations.get(0).getLocid(); } return 0; }
Source:
<code>protected void tearDown() throws Exception { Log.i(TAG, "Tearing down"); if (mExecutorService != null) { mExecutorService.shutdownNow(); } closeQuietly(getServerListeningSocket()); closeQuietly(getServerSocket()); closeQuietly(getClientSocket()); closeQuietly(getMitmListeningSocket()); closeQuietly(getMitmServerSocket()); closeQuietly(getMitmClientSocket()); <START> super.tearDown(); <END> Log.i(TAG, "Tear down completed"); }</code><technical_language>Traditionally, super.tearDown() is called follows: protected void tearDown() throws Exception { try { Log.i(TAG, "Tearing down"); ... } finally { super.tearDown(); } } This prevents exception thrown tearDown method inhibiting super.tearDown()</technical_language>

Target:
protected void tearDown() throws Exception { Log.i(TAG, "Tearing down"); try { if (mExecutorService != null) { mExecutorService.shutdownNow(); } OpenSSLHeartbleedTest.closeQuietly(getServerListeningSocket()); OpenSSLHeartbleedTest.closeQuietly(getServerSocket()); OpenSSLHeartbleedTest.closeQuietly(getClientSocket()); OpenSSLHeartbleedTest.closeQuietly(getMitmListeningSocket()); OpenSSLHeartbleedTest.closeQuietly(getMitmServerSocket()); OpenSSLHeartbleedTest.closeQuietly(getMitmClientSocket()); } finally { super.tearDown(); Log.i(TAG, "Tear down completed"); } }