auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try { HttpSession httpSession = ((HttpServletRequest) request).getSession(false); if (httpSession != null) { String engineSession = (String) httpSession.getAttribute(FiltersHelper.Constants.ENGINE_SESSION_ID_KEY); InitialContext ctx = null; if (engineSession != null) { ctx = new InitialContext(); try { VdcQueryParametersBase parameters = new VdcQueryParametersBase(); parameters.setSessionId(engineSession); httpSession.setAttribute( FiltersHelper.Constants.AUTHENTICATED_KEY, FiltersHelper.getBackend(ctx) .runPublicQuery(VdcQueryType.ValidateSession, parameters) .getSucceeded() ); } finally { FiltersHelper.closeContext(ctx); } } } <START> chain.doFilter(request, response); <END> } catch (Exception ex) { String msg = String.format("An error has occurred while session validation. Message is %1$s", ex.getMessage()); log.error(msg); if (log.isDebugEnabled()) { log.debug("", ex); } ((HttpServletResponse) response).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } }</code><technical_language>this moved out of try/catch filters</technical_language>

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try { HttpSession httpSession = ((HttpServletRequest) request).getSession(false); if (httpSession != null) { String engineSession = (String) httpSession.getAttribute(FiltersHelper.Constants.SESSION_ENGINE_SESSION_ID_KEY); InitialContext ctx = null; if (engineSession != null) { ctx = new InitialContext(); try { VdcQueryParametersBase parameters = new VdcQueryParametersBase(); parameters.setSessionId(engineSession); VdcQueryReturnValue returnValue = FiltersHelper.getBackend(ctx) .runPublicQuery(VdcQueryType.ValidateSession, parameters); if (!returnValue.getSucceeded()) { httpSession.removeAttribute(FiltersHelper.Constants.SESSION_ENGINE_SESSION_ID_KEY); } else { httpSession.setAttribute(FiltersHelper.Constants.SESSSION_USER_KEY, returnValue.getReturnValue()); } } finally { ctx.close(); } } } chain.doFilter(request, response); } catch (Exception ex) { String msg = String.format("An error has occurred while session validation. Message is %1$s", ex.getMessage()); log.error(msg); if (log.isDebugEnabled()) { log.debug("", ex); } ((HttpServletResponse) response).sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } }
Source:
<code>public RowExpressionService getRowExpressionService() { return new RowExpressionService() { @Override public DomainTranslator getDomainTranslator() { return domainTranslator; } @Override public ExpressionOptimizer getExpressionOptimizer() { return new RowExpressionOptimizer(metadata); } @Override public PredicateCompiler getPredicateCompiler() { return predicateCompiler; } @Override public DeterminismEvaluator getDeterminismEvaluator() { return determinismEvaluator; } @Override public String formatRowExpression(ConnectorSession session, RowExpression expression) { return new RowExpressionFormatter(functionManager).formatRowExpression(session, expression); } @Override public Object optimizeRowExpression(ConnectorSession session, RowExpression expression, Function<VariableReferenceExpression, Object> variableResolver, ExpressionOptimizer.Level optimizationLevel) { <START> return new RowExpressionInterpreter(expression, metadata, session, optimizationLevel).optimize(variableResolver::apply); <END> } }; }</code><technical_language>I wondering if ExpressionOptimizer returned RowExpressionService do optimization? RowExpressionOptimizer similar (creating RowExpressionInterpreter) call optimize: <LINK_0> For this case, need a variable resolver. I wondering if adding another optimize method RowExpressionOptimizer takes customized variable resolver well? cc @highker</technical_language>

Target:
public RowExpressionService getRowExpressionService() { return new RowExpressionService() { @Override public DomainTranslator getDomainTranslator() { return domainTranslator; } @Override public ExpressionOptimizer getExpressionOptimizer() { return new RowExpressionOptimizer(metadata); } @Override public PredicateCompiler getPredicateCompiler() { return predicateCompiler; } @Override public DeterminismEvaluator getDeterminismEvaluator() { return determinismEvaluator; } @Override public String formatRowExpression(ConnectorSession session, RowExpression expression) { return new RowExpressionFormatter(functionManager).formatRowExpression(session, expression); } }; }
Source:
<code>public void tearDown() throws Exception { super.tearDown(); <START> if (editor != null) <END> { editor.close(false); editor = null; } }</code><technical_language>editor null</technical_language>

Target:
public void tearDown() throws Exception { super.tearDown(); editor.close(false); editor= null; }
Source:
<code>private RuleApplication applyRule() { SymbolAllocator symbolAllocator = new SymbolAllocator(symbols); Memo memo = new Memo(idAllocator, plan); Lookup lookup = Lookup.from(memo::resolve); Optional<PlanNode> result = inTransaction(session -> rule.apply(memo.getNode(memo.getRootGroup()), lookup, idAllocator, symbolAllocator, session)); <START> return new RuleApplication( <END> memo, lookup, symbolAllocator.getTypes(), result); }</code><technical_language>arguments line</technical_language>

Target:
private RuleApplication applyRule() { SymbolAllocator symbolAllocator = new SymbolAllocator(symbols); Memo memo = new Memo(idAllocator, plan); Lookup lookup = Lookup.from(memo::resolve); Optional<PlanNode> result = inTransaction(session -> rule.apply(memo.getNode(memo.getRootGroup()), lookup, idAllocator, symbolAllocator, session)); return new RuleApplication(lookup, symbolAllocator.getTypes(), result); }
Source:
<code>public void downloadBlob(String container, String name, File destination, ExecutorService executor) { ListeningExecutorService listeningExecutor = MoreExecutors.listeningDecorator(executor); RandomAccessFile raf = null; File tempFile = new File(destination.getName() + "." + UUID.randomUUID()); try { long contentLength = api .getObjectApi(regionId, container) .getWithoutBody(name) .getPayload() .getContentMetadata() .getContentLength(); raf = new RandomAccessFile(tempFile, "rw"); raf.seek(contentLength - 1); raf.write(0); long partSize = getMinimumMultipartPartSize(); long from; long to; List<ListenableFuture<Void>> results = new ArrayList<ListenableFuture<Void>>(); for (from = 0; from < contentLength; from = from + partSize) { to = (from + partSize >= contentLength) ? contentLength - 1 : from + partSize - 1; BlobDownloader b = new BlobDownloader(regionId, container, name, raf, from, to); results.add(listeningExecutor.submit(b)); } Futures.getUnchecked(Futures.allAsList(results)); raf.getChannel().force(true); raf.getChannel().close(); raf.close(); if ( destination.exists() ) destination.delete(); <START> if ( !tempFile.renameTo(destination) ) { <END> throw new RuntimeException("Could not move temporary downloaded file to destination " + destination); } tempFile = null; } catch (IOException e) { throw new RuntimeException(e); } finally { Closeables2.closeQuietly(raf); if (tempFile != null) { tempFile.delete(); } } }</code><technical_language>Please remove extra whitespace</technical_language>

Target:
public void downloadBlob(String container, String name, File destination, ExecutorService executor) { ListeningExecutorService listeningExecutor = MoreExecutors.listeningDecorator(executor); RandomAccessFile raf = null; File tempFile = new File(destination.getName() + "." + UUID.randomUUID()); try { long contentLength = api .getObjectApi(regionId, container) .getWithoutBody(name) .getPayload() .getContentMetadata() .getContentLength(); raf = new RandomAccessFile(tempFile, "rw"); raf.seek(contentLength - 1); raf.write(0); long partSize = getMinimumMultipartPartSize(); long from; long to; List<ListenableFuture<Void>> results = new ArrayList<ListenableFuture<Void>>(); for (from = 0; from < contentLength; from = from + partSize) { to = (from + partSize >= contentLength) ? contentLength - 1 : from + partSize - 1; BlobDownloader b = new BlobDownloader(regionId, container, name, raf, from, to); results.add(listeningExecutor.submit(b)); } Futures.getUnchecked(Futures.allAsList(results)); raf.getChannel().force(true); raf.getChannel().close(); raf.close(); if (destination.exists()) { destination.delete(); } if (!tempFile.renameTo(destination)) { throw new RuntimeException("Could not move temporary downloaded file to destination " + destination); } tempFile = null; } catch (IOException e) { throw new RuntimeException(e); } finally { Closeables2.closeQuietly(raf); if (tempFile != null) { tempFile.delete(); } } }
Source:
<code>public FunctionStatus getFunctionStatus(final String name) throws CatalogException { if (isClosed) { throw new CatalogException("Catalog is closed."); } try { return queue .execute( new SQLiteJob<FunctionStatus>() { @Override protected FunctionStatus job(final SQLiteConnection sqliteConnection) throws CatalogException, SQLiteException { try { SQLiteStatement statement = sqliteConnection.prepare( "SELECT function_name, function_description, function_outputType, function_isMultivalued, function_lang FROM registered_functions WHERE function_name=?"); statement.bind(1, name); if (!statement.step()) { return null; } String name = statement.columnString(0); String descrip = statement.columnString(1); String outputSchema = statement.columnString(2); Boolean isMultivalued = ((statement.columnInt(3) == 0) ? false : true); int lang = statement.columnInt(4); statement.dispose(); return new FunctionStatus( name, descrip, outputSchema, isMultivalued, MyriaConstants.FunctionLanguage.values()[lang], null); <START> <END> } catch (final SQLiteException e) { throw new CatalogException(e); } } }) .get(); } catch (InterruptedException | ExecutionException e) { throw new CatalogException(e); } }</code><technical_language>lang is a FunctionLanguage number do need check for MyriaConstants.FunctionLanguage.values()[lang],null)</technical_language>

Target:
public FunctionStatus getFunctionStatus(final String name) throws CatalogException { if (isClosed) { throw new CatalogException("Catalog is closed."); } try { return queue .execute( new SQLiteJob<FunctionStatus>() { @Override protected FunctionStatus job(final SQLiteConnection sqliteConnection) throws CatalogException, SQLiteException { try { SQLiteStatement statement = sqliteConnection.prepare( "SELECT function_name, function_description, function_outputType, function_isMultiValued, function_lang FROM registered_functions WHERE function_name=?"); statement.bind(1, name); if (!statement.step()) { return null; } String name = statement.columnString(0); String descrip = statement.columnString(1); String outputType = statement.columnString(2); Boolean isMultiValued = ((statement.columnInt(3) == 0) ? false : true); int lang = statement.columnInt(4); statement.dispose(); return new FunctionStatus( name, descrip, outputType, isMultiValued, FunctionLanguage.values()[lang], null); } catch (final SQLiteException e) { throw new CatalogException(e); } } }) .get(); } catch (InterruptedException | ExecutionException e) { throw new CatalogException(e); } }
Source:
<code>public AbstractJackson2MessageConverter(ObjectMapper objectMapper, MimeType contentType, String... trustedPackages) { <START> Assert.notNull(objectMapper, "'objectMapper' must not be null"); <END> this.objectMapper = objectMapper; this.contentType = contentType; ((DefaultJackson2JavaTypeMapper) this.javaTypeMapper).setTrustedPackages(trustedPackages); }</code><technical_language>need Assert.notNull() for contentType well</technical_language>

Target:
protected AbstractJackson2MessageConverter(ObjectMapper objectMapper, MimeType contentType, String... trustedPackages) { Assert.notNull(objectMapper, "'objectMapper' must not be null"); Assert.notNull(contentType, "'contentType' must not be null"); this.objectMapper = objectMapper; this.contentType = contentType; ((DefaultJackson2JavaTypeMapper) this.javaTypeMapper).setTrustedPackages(trustedPackages); }
Source:
<code>public void testPrepareFailure() { failureInterceptor.enable(); try { <START> Exceptions.expectException(CacheException.class, () -> cache("LON", 0).put("k", "v")); <END> } finally { failureInterceptor.disable(); } assertNull(cache("LON",0).get("k")); assertNull(cache("LON",1).get("k")); assertNull(backup("LON").get("k")); assertEquals(0, txTable(cache("LON", 0)).getLocalTransactions().size()); assertEquals(0, txTable(cache("LON", 1)).getLocalTransactions().size()); assertEquals(0, txTable(backup("LON")).getLocalTransactions().size()); }</code><technical_language>Exceptions.expectException(CacheException.class, RollbackException.class, () -> cache("LON", 0).put("k", "v")); I noticed XAException is a suppressed exception RollbackException, exploring exception hierarchy overkill</technical_language>

Target:
public void testPrepareFailure() { failureInterceptor.enable(); try { Exceptions.expectException(CacheException.class, RollbackException.class, () -> cache("LON", 0).put("k", "v")); } finally { failureInterceptor.disable(); } assertNull(cache("LON",0).get("k")); assertNull(cache("LON",1).get("k")); assertNull(backup("LON").get("k")); assertEquals(0, txTable(cache("LON", 0)).getLocalTransactions().size()); assertEquals(0, txTable(cache("LON", 1)).getLocalTransactions().size()); assertEquals(0, txTable(backup("LON")).getLocalTransactions().size()); }
Source:
<code>public int hashCode() { int result = inv.hashCode(); <START> result = 31 * result + (side == null ? 0 : side.hashCode()); <END> return result; }</code><technical_language>null-safe hashCode java.util.Objects here: suggestion result = 31 * result + Objects.hashCode(side);</technical_language>

Target:
public int hashCode() { int result = inv.hashCode(); result = 31 * result + Objects.hashCode(side); return result; }
Source:
<code>public boolean isInternal() { <START> return isInternal(this.name); <END> }</code><technical_language>This a boolean field internal, is set protocol layer, protocol specific bits in core models</technical_language>

Target:
public boolean isInternal() { return this.internal; }
Source:
<code>public void setup(Method method) throws Exception { logger.info("test name: " + method.getName()); <START> KerberosHelper.loginFromKeytab(MerlinConstants.CURRENT_USER_NAME); <END> bundles[0] = Util.readELBundles()[0][0]; bundles[0] = new Bundle(bundles[0], cluster.getEnvFileName(), cluster.getPrefix()); bundles[0].generateUniqueBundle(); bundles[0].setProcessWorkflow(aggregateWorkflowDir); }</code><technical_language>This redundant logging in current user in base class</technical_language>

Target:
public void setup(Method method) throws Exception { logger.info("test name: " + method.getName()); bundles[0] = Util.readELBundles()[0][0]; bundles[0] = new Bundle(bundles[0], cluster.getEnvFileName(), cluster.getPrefix()); bundles[0].generateUniqueBundle(); bundles[0].setProcessWorkflow(aggregateWorkflowDir); }
Source:
<code>private boolean isRequestEnabled(RequestOrResponseType requestType, PartitionId id) { Set<PartitionId> requestDisableInfo = requestsDisableInfo.get(requestType); if (requestDisableInfo != null && requestDisableInfo.contains(id)) { return false; } if (serverConfig.serverValidateRequestBasedOnStoreState) { Store store = storeManager.getStore(id); if (requestType == RequestOrResponseType.PutRequest && !POST_ALLOWED_STORE_STATES.contains( store.getCurrentState())) { <START> logger.error("{} is not allowed because current state of store is {}", requestType, id, <END> store.getCurrentState()); return false; } if (UPDATE_REQUEST_TYPES.contains(requestType) && !UPDATE_ALLOWED_STORE_STATES.contains( store.getCurrentState())) { logger.error("{} is not allowed because current state of store is {}", requestType, id, store.getCurrentState()); return false; } } return true; }</code><technical_language>Is error correct log level for this? this occur normal operation</technical_language>

Target:
private boolean isRequestEnabled(RequestOrResponseType requestType, PartitionId id) { Set<PartitionId> requestDisableInfo = requestsDisableInfo.get(requestType); if (requestDisableInfo != null && requestDisableInfo.contains(id)) { return false; } if (serverConfig.serverValidateRequestBasedOnStoreState) { Store store = storeManager.getStore(id); if (requestType == RequestOrResponseType.PutRequest && !PUT_ALLOWED_STORE_STATES.contains( store.getCurrentState())) { logger.warn("{} is not allowed because current state of store is {}", requestType, id, store.getCurrentState()); return false; } if (UPDATE_REQUEST_TYPES.contains(requestType) && !UPDATE_ALLOWED_STORE_STATES.contains( store.getCurrentState())) { logger.warn("{} is not allowed because current state of store is {}", requestType, id, store.getCurrentState()); return false; } } return true; }
Source:
<code>private void placeBreadcrumbFile( String folderPath, boolean success ) { String ext = ERROR; if ( success ) { ext = OK; } String breadcrumbFilename = folderPath + WI_STATUS + ext; <START> File breadcrumb = new File( breadcrumbFilename ); <END> try { if ( !breadcrumb.createNewFile() ) { logger.error( Messages.getInstance().getErrorString( "ActionInvokerSystemListener.ERROR_0004_COULD_NOT_WRITE_STATUS" ) ); } } catch ( IOException e ) { logger.error( Messages.getInstance().getErrorString( "ActionInvokerSystemListener.ERROR_0004_COULD_NOT_WRITE_STATUS" ) ); } }</code><technical_language>File object construct breadcrumb file: new File( folderPath, WI_STATUS + etx);</technical_language>

Target:
private void placeBreadcrumbFile( String folderPath, boolean success ) { String ext = ERROR; if ( success ) { ext = OK; } File breadcrumb = new File( folderPath, WI_STATUS + ext ); try { if ( !breadcrumb.createNewFile() ) { logger.error( Messages.getInstance().getErrorString( "ActionInvokerSystemListener.ERROR_0004_COULD_NOT_WRITE_STATUS" ) ); } } catch ( IOException e ) { logger.error( Messages.getInstance().getErrorString( "ActionInvokerSystemListener.ERROR_0004_COULD_NOT_WRITE_STATUS" ) ); } }
Source:
<code><START> public BitmapObjectFilter(BitmapBuilder <END> bitmap) { this.bitmap = bitmap; }</code><technical_language>default, need public</technical_language>

Target:
BitmapObjectFilter(BitmapBuilder bitmap) { this.bitmap = bitmap; }
Source:
<code>private void registerServiceBean(BeanDefinitionHolder beanDefinitionHolder, BeanDefinitionRegistry registry, DubboClassPathBeanDefinitionScanner scanner) { Class<?> beanClass = resolveClass(beanDefinitionHolder); Service service = findAnnotation(beanClass, Service.class); Class<?> interfaceClass = resolveServiceInterfaceClass(beanClass, service); String annotatedServiceBeanName = beanDefinitionHolder.getBeanName(); AbstractBeanDefinition serviceBeanDefinition = buildServiceBeanDefinition(service, interfaceClass, annotatedServiceBeanName); String beanName = generateServiceBeanName(service, interfaceClass, annotatedServiceBeanName); if (scanner.checkCandidate(beanName, serviceBeanDefinition)) { registry.registerBeanDefinition(beanName, serviceBeanDefinition); <START> if (logger.isInfoEnabled()) { <END> logger.warn("The BeanDefinition[" + serviceBeanDefinition + "] of ServiceBean has been registered with name : " + beanName); } } else { if (logger.isWarnEnabled()) { logger.warn("The Duplicated BeanDefinition[" + serviceBeanDefinition + "] of ServiceBean[ bean name : " + beanName + "] was be found , Did @DubboComponentScan scan to same package in many times?"); } } }</code><technical_language>consistence logger.warn</technical_language>

Target:
private void registerServiceBean(BeanDefinitionHolder beanDefinitionHolder, BeanDefinitionRegistry registry, DubboClassPathBeanDefinitionScanner scanner) { Class<?> beanClass = resolveClass(beanDefinitionHolder); Service service = findAnnotation(beanClass, Service.class); Class<?> interfaceClass = resolveServiceInterfaceClass(beanClass, service); String annotatedServiceBeanName = beanDefinitionHolder.getBeanName(); AbstractBeanDefinition serviceBeanDefinition = buildServiceBeanDefinition(service, interfaceClass, annotatedServiceBeanName); String beanName = generateServiceBeanName(service, interfaceClass, annotatedServiceBeanName); if (scanner.checkCandidate(beanName, serviceBeanDefinition)) { registry.registerBeanDefinition(beanName, serviceBeanDefinition); if (logger.isInfoEnabled()) { logger.info("The BeanDefinition[" + serviceBeanDefinition + "] of ServiceBean has been registered with name : " + beanName); } } else { if (logger.isWarnEnabled()) { logger.warn("The Duplicated BeanDefinition[" + serviceBeanDefinition + "] of ServiceBean[ bean name : " + beanName + "] was be found , Did @DubboComponentScan scan to same package in many times?"); } } }
Source:
<code>public Clamp() { BooleanOutput leftClamp = Igneous.makeSolenoid(0); BooleanOutput rightClamp = Igneous.makeSolenoid(1); openControl = BooleanMixing.combine(leftClamp, rightClamp); heightControl = new FloatStatus(); min = new FloatStatus(0.0f); <START> max = new FloatStatus(1.0f); <END> FloatInputPoll encoder = Igneous.makeEncoder(0, 0, Igneous.MOTOR_FORWARD); FloatOutput speedControl = Igneous.makeTalonMotor(2, Igneous.MOTOR_FORWARD, 1.0f); BooleanInputPoll inputLimitTop = Igneous.makeDigitalInput(0); BooleanInputPoll inputLimitBottom = Igneous.makeDigitalInput(1); EventInput limitTop = EventMixing.filterEvent(inputLimitTop, true, Igneous.constantPeriodic); EventInput limitBottom = EventMixing.filterEvent(inputLimitBottom, true, Igneous.constantPeriodic); FloatMixing.pumpWhen(limitTop, encoder, max); FloatMixing.pumpWhen(limitBottom, encoder, min); PIDControl pid = new PIDControl(FloatMixing.normalizeFloat(encoder, min, max), (FloatStatus)heightControl, FloatMixing.always(1.0f), FloatMixing.always(0.0f), FloatMixing.always(0.0f)); Igneous.constantPeriodic.send(pid); pid.send(speedControl); }</code><technical_language>Consider putting initializations instance variable declarations, for more concise code</technical_language>

Target:
public Clamp() { FloatStatus height = new FloatStatus(); heightControl = height; FloatInputPoll encoder = Igneous.makeEncoder(0, 1, false); FloatOutput speedControl = Igneous.makeTalonMotor(2, Igneous.MOTOR_REVERSE, 0.1f); EventInput limitTop = EventMixing.filterEvent(Igneous.makeDigitalInput(2), true, Igneous.constantPeriodic); EventInput limitBottom = EventMixing.filterEvent(Igneous.makeDigitalInput(3), true, Igneous.constantPeriodic); TuningContext context = new TuningContext("Clamp").publishSavingEvent(); FloatStatus min = context.getFloat("clamp-min", 0.0f); FloatStatus max = context.getFloat("clamp-max", 1.0f); FloatMixing.pumpWhen(limitTop, encoder, max); FloatMixing.pumpWhen(limitBottom, encoder, min); FloatStatus p = context.getFloat("clamp-p", 1.0f); FloatStatus i = context.getFloat("clamp-i", 0.0f); FloatStatus d = context.getFloat("clamp-d", 0.0f); PIDControl pid = new PIDControl(FloatMixing.normalizeFloat(encoder, min, max), height, p, i, d); Igneous.constantPeriodic.send(pid); pid.send(speedControl); }
Source:
<code><START> private void setSegmentStatesAndEndOffsets() <END> throws IOException { LogSegment firstSegment = log.getSegmentIterator().next().getValue(); firstSegment.setEndOffset(index.getCurrentEndOffset()); log.setActiveSegment(firstSegment.getName()); }</code><technical_language>for understanding - in a multi-segment scenario, this do? Set end offset of segment based end offset in index</technical_language>

Target:
private void setSegmentStatesAndEndOffsets() throws IOException { LogSegment firstSegment = log.getFirstSegment(); firstSegment.setEndOffset(index.getCurrentEndOffset()); log.setActiveSegment(firstSegment.getName()); }
Source:
<code><START> public static ParsingOptions createParsingOptions(Session session) <END> { return new ParsingOptions(isParseDecimalLiteralsAsDouble(session)); }</code><technical_language>this a method of SqlParser. need for a separate class</technical_language>

Target:
public static ParsingOptions createParsingOptions(Session session) { return new ParsingOptions(isParseDecimalLiteralsAsDouble(session) ? AS_DOUBLE : AS_DECIMAL); }
Source:
<code>private Boolean checkErrorLogMessage(SWTBotView logViewBot) { logViewBot.show(); SWTBotTree treeError = logViewBot.bot().tree(); <START> String errorMessage = "Compilation error for expression \"service:monServiceQuiNexistePas\" : Cannot find method monServiceQuiNexistePas"; <END> for (SWTBotTreeItem treeItem : treeError.getAllItems()) { if (errorMessage.equals(treeItem.getText())) { return true; } } return false; }</code><technical_language>monServiceQuiNexistePas => in english</technical_language>

Target:
private Boolean checkErrorLogMessage(SWTBotView logViewBot) { logViewBot.show(); SWTBotTree treeError = logViewBot.bot().tree(); String errorMessage = "Compilation error for expression \"service:myImaginaryService\" : Cannot find method myImaginaryService"; for (SWTBotTreeItem treeItem : treeError.getAllItems()) { if (errorMessage.equals(treeItem.getText())) { return true; } } return false; }
Source:
<code>private void parseCommandLine() { try { String[] args = Platform.getCommandLineArgs(); String ip = EnvironmentUtils.getArgValue(args, EnvConstants.CLIENTIP_KEY); if (StringUtils.isNotEmpty(ip)) { System.setProperty(EnvConstants.CLIENTIP_KEY, ip); } String port = EnvironmentUtils.getArgValue(args, EnvConstants.CLIENTPORT_KEY); if (StringUtils.isNotEmpty(port)) { System.setProperty(EnvConstants.CLIENTPORT_KEY, port); } } catch (Throwable e) { <START> System.out.println(e.getLocalizedMessage()); e.printStackTrace(System.out); <END> } }</code><technical_language>this lost if start in windows, logger</technical_language>

Target:
private void parseCommandLine() { String[] args = Platform.getCommandLineArgs(); String ip = EnvironmentUtils.getArgValue(args, EnvConstants.CLIENTIP_KEY); if (StringUtils.isNotEmpty(ip)) { System.setProperty(EnvConstants.CLIENTIP_KEY, ip); } String port = EnvironmentUtils.getArgValue(args, EnvConstants.CLIENTPORT_KEY); if (StringUtils.isNotEmpty(port)) { System.setProperty(EnvConstants.CLIENTPORT_KEY, port); } }
Source:
<code>private void optionsChanged() { <START> if ((inMemStats == null) == this.getStatsParam().isInMemoryEnabled()) { <END> if (inMemStats == null) { logger.info("Start recording in memory stats"); inMemStats = new InMemoryStats(); Stats.addListener(inMemStats); } else { logger.info("Stop recording in memory stats"); Stats.removeListener(inMemStats); inMemStats = null; } } if ((statsd == null) == this.getStatsParam().isStatsdEnabled()) { if (statsd == null) { logger.info("Start sending stats to statsd server"); try { statsd = new Statsd( this.getStatsParam().getStatsdHost(), this.getStatsParam().getStatsdPort(), this.getStatsParam().getStatsdPrefix()); Stats.addListener(statsd); } catch (Exception e) { logger.error(e.getMessage(), e); } } else { logger.info("Stop sending stats to statsd server"); Stats.removeListener(statsd); statsd = null; } } else if (statsd != null) { statsd.setPrefix(this.getStatsParam().getStatsdPrefix()); } }</code><technical_language>check inMemStats == null extracted a variable (it reused in if statement code easier read)</technical_language>

Target:
private void optionsChanged() { boolean inMemStatsInit = inMemStats != null; if (inMemStatsInit != this.getStatsParam().isInMemoryEnabled()) { if (!inMemStatsInit) { LOG.info("Start recording in memory stats"); inMemStats = new InMemoryStats(); Stats.addListener(inMemStats); } else { LOG.info("Stop recording in memory stats"); Stats.removeListener(inMemStats); inMemStats.allCleared(); inMemStats = null; } } boolean statsdInit = statsd != null; if (statsdInit != this.getStatsParam().isStatsdEnabled()) { if (! statsdInit) { LOG.info("Start sending stats to statsd server"); try { statsd = newStatsD(this.getStatsParam()); Stats.addListener(statsd); } catch (Exception e) { LOG.error(e.getMessage(), e); } } else { LOG.info("Stop sending stats to statsd server"); Stats.removeListener(statsd); statsd = null; } } else if (statsdInit) { if (! StringUtils.equals(this.getStatsParam().getStatsdHost(), statsd.getHost()) || this.getStatsParam().getStatsdPort() != statsd.getPort()) { LOG.info("Restart sending stats to statsd server"); try { Stats.removeListener(statsd); statsd = newStatsD(this.getStatsParam()); Stats.addListener(statsd); } catch (Exception e) { LOG.error(e.getMessage(), e); } } else if (! StringUtils.equals(this.getStatsParam().getStatsdPrefix(), statsd.getPrefix())) { statsd.setPrefix(this.getStatsParam().getStatsdPrefix()); } } }
Source:
<code>private Function<PollingContext<DeletedCertificate>, Mono<PollResponse<DeletedCertificate>>> createDeletePollOperation(String keyName) { return pollingContext -> withContext(context -> service.getDeletedCertificatePoller(vaultUrl, keyName, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) .flatMap(deletedKeyResponse -> { if (deletedKeyResponse.getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { return Mono.defer(() -> Mono.just(new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, pollingContext.getLatestResponse().getValue()))); } return Mono.defer(() -> Mono.just(new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, deletedKeyResponse.getValue()))); })) <START> .onErrorReturn(new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, pollingContext.getLatestResponse().getValue())); <END> }</code><technical_language>Is right return a successful poller response error here? consuming activationOperation response if successfully completed. throw a Mono.error indicating operation supported failure activationOperation</technical_language>

Target:
private Function<PollingContext<DeletedCertificate>, Mono<PollResponse<DeletedCertificate>>> createDeletePollOperation(String keyName) { return pollingContext -> withContext(context -> service.getDeletedCertificatePoller(vaultUrl, keyName, API_VERSION, ACCEPT_LANGUAGE, CONTENT_TYPE_HEADER_VALUE, context) .flatMap(deletedCertificateResponse -> { if (deletedCertificateResponse.getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND) { return Mono.defer(() -> Mono.just(new PollResponse<>(LongRunningOperationStatus.IN_PROGRESS, pollingContext.getLatestResponse().getValue()))); } return Mono.defer(() -> Mono.just(new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, deletedCertificateResponse.getValue()))); })) .onErrorReturn(new PollResponse<>(LongRunningOperationStatus.SUCCESSFULLY_COMPLETED, pollingContext.getLatestResponse().getValue())); }
Source:
<code>public void setBranchName(String branchName) { this.branchName = branchName; <START> if (nameText != null) <END> nameText.setText(branchName); }</code><technical_language>Missing braces</technical_language>

Target:
public void setBranchName(String branchName) { this.branchName = branchName; if (nameText != null) { nameText.setText(branchName); } }
Source:
<code>protected void run() throws Exception { StoredConfig dbconfig = db.getConfig(); RemoteConfig remoteConfig = new RemoteConfig(dbconfig, remote); PubSubConfig pubsubConfig = SubscribeDaemon.getConfig(); List<URIish> uris = remoteConfig.getURIs(); if (uris.isEmpty()) { <START> out.println(MessageFormat.format( <END> CLIText.get().noRemoteUriUnsubscribe, remote)); return; } String uriRoot = PubSubConfig.getUriRoot(uris.get(0)); String dir = db.getDirectory().getAbsolutePath(); Publisher p = pubsubConfig.getPublisher(uriRoot); if (p == null || !p.removeSubscriber(remote, dir)) { out.println(MessageFormat.format( CLIText.get().subscriptionDoesNotExist, remote)); return; } if (p.getSubscribers().size() == 0) pubsubConfig.removePublisher(p); try { SubscribeDaemon.updateConfig(pubsubConfig); } catch (IOException e) { out.println(MessageFormat.format(CLIText.get().cannotWrite, SubscribeDaemon.getConfigFile())); return; } out.println(MessageFormat.format( CLIText.get().didUnsubscribe, remote, uriRoot)); }</code><technical_language>throw die(msg, e) instead</technical_language>

Target:
protected void run() throws Exception { StoredConfig dbconfig = db.getConfig(); RemoteConfig remoteConfig = new RemoteConfig(dbconfig, remote); PubSubConfig pubsubConfig = SubscribeDaemon.getConfig(); List<URIish> uris = remoteConfig.getURIs(); if (uris.isEmpty()) throw die(MessageFormat.format( CLIText.get().noRemoteUriUnsubscribe, remote)); String uriRoot = PubSubConfig.getUriRoot(uris.get(0)); String dir = db.getDirectory().getAbsolutePath(); Publisher p = pubsubConfig.getPublisher(uriRoot); if (p == null || !p.removeSubscriber(remote, dir)) throw die(MessageFormat.format( CLIText.get().subscriptionDoesNotExist, remote)); if (p.getSubscribers().size() == 0) pubsubConfig.removePublisher(p); try { SubscribeDaemon.updateConfig(pubsubConfig); } catch (IOException e) { throw die(MessageFormat.format(CLIText.get().cannotWrite, SubscribeDaemon.getConfigFile())); } out.println(MessageFormat.format( CLIText.get().didUnsubscribe, remote, uriRoot)); }
Source:
<code>public List<String> subscribeChildChanges(String path, IZkChildListener listener) { <START> if (!checkIfPathBelongsToZkRealm(path)) { throw new IllegalArgumentException( "The given path does not map to the ZK realm for this DedicatedZkClient! Path: " + path + " ZK realm sharding key: " + _zkRealmShardingKey); } <END> return _innerSharedZkClient.subscribeChildChanges(path, listener); }</code><technical_language>This check is necessary here, is a this simpler refactoring block throws exception check() function. This done in PR: <LINK_0> please review this PR changes cut duplicate code/logic? Thank you</technical_language>

Target:
public List<String> subscribeChildChanges(String path, IZkChildListener listener) { checkIfPathContainsShardingKey(path); return _innerSharedZkClient.subscribeChildChanges(path, listener); }
Source:
<code>protected Directory newFSDirectory(Path location, LockFactory lockFactory) throws IOException { final String storeType = indexSettings.getSettings() .get(IndexModule.INDEX_STORE_TYPE_SETTING.getKey(), IndexModule.Type.FS.getSettingsKey()); IndexModule.Type type; if (IndexModule.Type.FS.match(storeType)) { type = IndexModule.defaultStoreType( <START> IndexModule.NODE_STORE_ALLOW_MMAP.get(indexSettings.getNodeSettings(), Settings.EMPTY)); <END> } else { type = IndexModule.Type.fromSettingsKey(storeType); } switch (type) { case HYBRIDFS: final FSDirectory primaryDirectory = FSDirectory.open(location, lockFactory); if (primaryDirectory instanceof MMapDirectory) { return new HybridDirectory(location, lockFactory, primaryDirectory); } else { return primaryDirectory; } case MMAPFS: return new MMapDirectory(location, lockFactory); case SIMPLEFS: return new SimpleFSDirectory(location, lockFactory); case NIOFS: return new NIOFSDirectory(location, lockFactory); default: throw new AssertionError("unexpected built-in store type [" + type + "]"); } }</code><technical_language>here, Settings.EMPTY fallback</technical_language>

Target:
protected Directory newFSDirectory(Path location, LockFactory lockFactory) throws IOException { final String storeType = indexSettings.getSettings() .get(IndexModule.INDEX_STORE_TYPE_SETTING.getKey(), IndexModule.Type.FS.getSettingsKey()); IndexModule.Type type; if (IndexModule.Type.FS.match(storeType)) { type = IndexModule.defaultStoreType( IndexModule.NODE_STORE_ALLOW_MMAP.getWithFallback(indexSettings.getNodeSettings())); } else { type = IndexModule.Type.fromSettingsKey(storeType); } switch (type) { case HYBRIDFS: final FSDirectory primaryDirectory = FSDirectory.open(location, lockFactory); if (primaryDirectory instanceof MMapDirectory) { return new HybridDirectory(location, lockFactory, primaryDirectory); } else { return primaryDirectory; } case MMAPFS: return new MMapDirectory(location, lockFactory); case SIMPLEFS: return new SimpleFSDirectory(location, lockFactory); case NIOFS: return new NIOFSDirectory(location, lockFactory); default: throw new AssertionError("unexpected built-in store type [" + type + "]"); } }
Source:
<code>protected Protocol configureRendererProtocol() { Protocol protocol = new BasicProtocol(81); protocol.registerNetworkAction(RenderJoinEvent.class, RenderJoinEvent::new); protocol.registerNetworkAction(GameWaitingEvent.class, GameWaitingEvent::new); protocol.registerNetworkAction(GameAboutToStartEvent.class, GameAboutToStartEvent::new); protocol.registerNetworkAction(GameStartedEvent.class, GameStartedEvent::new); protocol.registerNetworkAction(GameFinishedEvent.class, GameFinishedEvent::new); protocol.registerNetworkAction(GameStoppedEvent.class, GameStoppedEvent::new); protocol.registerNetworkAction(PlayerAddedEvent.class, PlayerAddedEvent::new); protocol.registerNetworkAction(PlayerJumpedEvent.class, PlayerJumpedEvent::new); <START> <END> return protocol; }</code><technical_language>a method register multiple events handler</technical_language>

Target:
protected Protocol configureRendererProtocol() { Protocol protocol = new BasicProtocol(RENDER_PORT_NUMBER); protocol.registerNetworkAction(RenderJoinEvent.class, RenderJoinEvent::new); protocol.registerNetworkAction(GameWaitingEvent.class, GameWaitingEvent::new); protocol.registerNetworkAction(GameAboutToStartEvent.class, GameAboutToStartEvent::new); protocol.registerNetworkAction(GameStartedEvent.class, GameStartedEvent::new); protocol.registerNetworkAction(GameFinishedEvent.class, GameFinishedEvent::new); protocol.registerNetworkAction(GameStoppedEvent.class, GameStoppedEvent::new); protocol.registerNetworkAction(PlayerAddedEvent.class, PlayerAddedEvent::new); protocol.registerNetworkAction(PlayerJumpedEvent.class, PlayerJumpedEvent::new); return protocol; }
Source:
<code>public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = LayoutInflater.from(mContext); View userView = inflater.inflate(R.layout.add_user_layout, parent, false); TextView textViewUserName = (TextView) userView.findViewById(R.id.textViewUserName); ImageView imageUser = (ImageView) userView.findViewById(R.id.imageUser); CheckBox checkBox = (CheckBox) userView.findViewById(R.id.checkboxUser); User user = mUsers.get(position).getUser(); textViewUserName.setText(user.getName()); Bitmap userImage = user.getImg(); if (userImage == null){ imageUser.setImageBitmap(YieldsApplication.getDefaultUserImage()); } else { imageUser.setImageBitmap(userImage); } boolean b = mUsers.get(position).getBoolean(); checkBox.setChecked(b); final int pos = position; checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { mUsers.get(pos).setBoolean(isChecked); if (mRemoveWhenUnchecked && !isChecked && pos!=0){ mUsers.remove(pos); ListAdapterUsersCheckBox.this.notifyDataSetChanged(); <START> } <END> if (mRemoveWhenUnchecked && pos==0){ buttonView.setChecked(!isChecked); } } }); return userView; }</code><technical_language>explain .this.</technical_language>

Target:
public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = LayoutInflater.from(mContext); View userView = inflater.inflate(R.layout.add_user_layout, parent, false); TextView textViewUserName = (TextView) userView.findViewById(R.id.textViewUserName); ImageView imageUser = (ImageView) userView.findViewById(R.id.imageUser); CheckBox checkBox = (CheckBox) userView.findViewById(R.id.checkboxUser); User user = mUsers.get(position).getKey(); textViewUserName.setText(user.getName()); Bitmap userImage = user.getImg(); if (userImage == null){ imageUser.setImageBitmap(YieldsApplication.getDefaultUserImage()); } else { imageUser.setImageBitmap(userImage); } boolean b = mUsers.get(position).getValue(); checkBox.setChecked(b); final int pos = position; checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { mUsers.get(pos).setValue(isChecked); if (mRemoveWhenUnchecked && !isChecked && pos!=0){ mUsers.remove(pos); ListAdapterUsersCheckBox.this.notifyDataSetChanged(); } if (mRemoveWhenUnchecked && pos==0){ buttonView.setChecked(!isChecked); } } }); return userView; }
Source:
<code>public void onPause() { super.onPause(); if ( !isInViewPager ) { <START> if (player != null) isPaused = player.isPaused(); <END> handleOnPause(); } }</code><technical_language>I freezing instead of pausing player automatically save playing state</technical_language>

Target:
public void onPause() { super.onPause(); if ( !isInViewPager ) { handleOnPause(); } }
Source:
<code>private static String getHomeCommunityID(BusinessEntity entity) { <START> if (entity.getIdentifierBag() != null && CollectionUtils.isNotEmpty(entity.getIdentifierBag(). <END> getKeyedReference())) { for (KeyedReference key : entity.getIdentifierBag().getKeyedReference()) { if (key.getTModelKey().equals(UDDI_HOME_COMMUNITY_ID_KEY)) { return key.getKeyValue(); } } } return null; }</code><technical_language>need check for null if Collectionutils.isnotempty</technical_language>

Target:
private static String getHomeCommunityID(BusinessEntity entity) { if (entity.getIdentifierBag() != null && CollectionUtils.isNotEmpty(entity.getIdentifierBag(). getKeyedReference())) { for (KeyedReference key : entity.getIdentifierBag().getKeyedReference()) { if (UDDIConstants.UDDI_HOME_COMMUNITY_ID_KEY.equalsIgnoreCase(key.getTModelKey())) { return key.getKeyValue(); } } } return null; }
Source:
<code>private BuildCommand cmdClone(String workDir, int cloneDepth) { ArrayList<String> cloneArgs = new ArrayList<>(); cloneArgs.add("clone"); cloneArgs.add("--no-checkout"); cloneArgs.add(format("--branch=%s", material.branchWithDefault())); if (material.isShallowClone()) { cloneArgs.add(format("--depth=%s", String.valueOf(cloneDepth))); } <START> cloneArgs.add(material.getUrlArgument().rawUrl()); <END> cloneArgs.add(workDir); return exec("git", cloneArgs.toArray(new String[cloneArgs.size()])) .setTest(isNotRepository(workDir)); }</code><technical_language>This changed forCommandline()</technical_language>

Target:
private BuildCommand cmdClone(String workDir, int cloneDepth) { ArrayList<String> cloneArgs = new ArrayList<>(); cloneArgs.add("clone"); cloneArgs.add("--no-checkout"); cloneArgs.add(format("--branch=%s", material.branchWithDefault())); if (material.isShallowClone()) { cloneArgs.add(format("--depth=%s", String.valueOf(cloneDepth))); } cloneArgs.add(material.getUrlArgument().forCommandLine()); cloneArgs.add(workDir); return exec("git", cloneArgs.toArray(new String[cloneArgs.size()])) .setTest(isNotRepository(workDir)); }
Source:
<code>private static void addHook(Object[] tagsExpressionsAndBody, boolean before) { long timeout = DEFAULT_TIMEOUT; int order = DEFAULT_ORDER; Closure body = null; List<String> tagExpressions = new ArrayList<String>(); boolean isDefaultTimeout = true; boolean isDefaultOrder = true; for (Object o : tagsExpressionsAndBody) { if (o instanceof String) { tagExpressions.add((String) o); <START> } else if (o instanceof Number && isDefaultTimeout) { <END> timeout = ((Number) o).longValue(); isDefaultTimeout = false; } else if (o instanceof Number && isDefaultOrder) { order = ((Number) o).intValue(); isDefaultOrder = false; } else if (o instanceof Closure) { body = (Closure) o; } } TagExpression tagExpression = new TagExpression(tagExpressions); if (before) { GroovyBackend.getInstance().addBeforeHook(tagExpression, timeout, order, body); } else { GroovyBackend.getInstance().addAfterHook(tagExpression, timeout, order, body); } }</code><technical_language>I if instanceof Long instanceof Integer detect timeout order, respectively. In other words - Long means timeout - Integer means order</technical_language>

Target:
private static void addHook(Object[] tagsExpressionsAndBody, boolean before) { long timeoutMillis = DEFAULT_TIMEOUT; int order = DEFAULT_ORDER; Closure body = null; List<String> tagExpressions = new ArrayList<String>(); for (Object o : tagsExpressionsAndBody) { if (o instanceof String) { tagExpressions.add((String) o); } else if (o instanceof Long) { timeoutMillis = (Long) o; } else if (o instanceof Integer) { order = (Integer) o; } else if (o instanceof Closure) { body = (Closure) o; } } TagExpression tagExpression = new TagExpression(tagExpressions); if (before) { GroovyBackend.getInstance().addBeforeHook(tagExpression, timeoutMillis, order, body); } else { GroovyBackend.getInstance().addAfterHook(tagExpression, timeoutMillis, order, body); } }
Source:
<code>public PrimaryKey getPrimaryKey(List<String> primaryKeyColumns) { <START> Object[] fields = new Object[primaryKeyColumns.size()]; <END> for (int i = 0; i < primaryKeyColumns.size(); i++) { fields[i] = getValue(primaryKeyColumns.get(i)); } return new PrimaryKey(fields); }</code><technical_language>Cache primaryKeyColumns.size() a local variable</technical_language>

Target:
public PrimaryKey getPrimaryKey(List<String> primaryKeyColumns) { int numPrimaryKeyColumns = primaryKeyColumns.size(); Object[] values = new Object[numPrimaryKeyColumns]; for (int i = 0; i < numPrimaryKeyColumns; i++) { values[i] = getValue(primaryKeyColumns.get(i)); } return new PrimaryKey(values); }
Source:
<code>protected CompletableFuture<JarRunResponseBody> handleRequest( @Nonnull final HandlerRequest<JarRunRequestBody, JarRunMessageParameters> request, @Nonnull final DispatcherGateway gateway) throws RestHandlerException { configuration.set(DeploymentOptions.ATTACHED, false); configuration.set(DeploymentOptions.TARGET, EmbeddedExecutor.NAME); final JarHandlerContext context = JarHandlerContext.fromRequest(request, jarDir, log); context.applyOnConfiguration(configuration); SavepointRestoreSettings.toConfiguration(getSavepointRestoreSettings(request), configuration); final PackagedProgram program = context.toPackagedProgram(configuration); return CompletableFuture .supplyAsync(() -> applicationRunner.run(gateway, program, configuration), executor) .thenApply(jobIds -> { if (jobIds.isEmpty()) { throw new CompletionException(new ProgramInvocationException("No jobs submitted.")); } return new JarRunResponseBody(jobIds.get(0)); <START> }); <END> }</code><technical_language>is kind of subtle possibly multiple job executed return id of one. mention this manner somewhere</technical_language>

Target:
protected CompletableFuture<JarRunResponseBody> handleRequest( @Nonnull final HandlerRequest<JarRunRequestBody, JarRunMessageParameters> request, @Nonnull final DispatcherGateway gateway) throws RestHandlerException { final Configuration effectiveConfiguration = new Configuration(configuration); effectiveConfiguration.set(DeploymentOptions.ATTACHED, false); effectiveConfiguration.set(DeploymentOptions.TARGET, EmbeddedExecutor.NAME); final JarHandlerContext context = JarHandlerContext.fromRequest(request, jarDir, log); context.applyToConfiguration(effectiveConfiguration); SavepointRestoreSettings.toConfiguration(getSavepointRestoreSettings(request), effectiveConfiguration); final PackagedProgram program = context.toPackagedProgram(effectiveConfiguration); return CompletableFuture .supplyAsync(() -> applicationRunner.run(gateway, program, effectiveConfiguration), executor) .thenApply(jobIds -> { if (jobIds.isEmpty()) { throw new CompletionException(new ProgramInvocationException("No jobs submitted.")); } return new JarRunResponseBody(jobIds.get(0)); }); }