auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static SegmentGeneratorConfig generateSegmentGeneratorConfig(TableConfig tableConfig, BatchConfig batchConfig, Schema schema, File inputFile, File outputSegmentDir) throws ClassNotFoundException, IOException { SegmentGeneratorConfig segmentGeneratorConfig = new SegmentGeneratorConfig(tableConfig, schema); segmentGeneratorConfig.setTableName(tableConfig.getTableName()); segmentGeneratorConfig.setOutDir(outputSegmentDir.getAbsolutePath()); segmentGeneratorConfig.setInputFilePath(inputFile.getAbsolutePath()); FileFormat fileFormat = batchConfig.getInputFormat(); segmentGeneratorConfig.setFormat(fileFormat); segmentGeneratorConfig.setRecordReaderPath(RecordReaderFactory.getRecordReaderClassName(fileFormat.toString())); String readerConfigClassName = RecordReaderFactory.getRecordReaderConfigClassName(fileFormat.toString()); <START> if (readerConfigClassName != null) { <END> Map<String, String> configs = batchConfig.getRecordReaderProps(); if (configs == null) { configs = Collections.emptyMap(); } JsonNode jsonNode = new ObjectMapper().valueToTree(IngestionConfigUtils.getRecordReaderProps(configs)); Class<?> clazz = PluginManager.get().loadClass(readerConfigClassName); RecordReaderConfig recordReaderConfig = (RecordReaderConfig) JsonUtils.jsonNodeToObject(jsonNode, clazz); segmentGeneratorConfig.setReaderConfig(recordReaderConfig); } segmentGeneratorConfig.setSegmentNameGenerator( new SimpleSegmentNameGenerator(tableConfig.getTableName(), String.valueOf(System.currentTimeMillis()))); return segmentGeneratorConfig; }</code><technical_language>extract this a common class RecordReaderFactory.getRecordReaderConfig(...)</technical_language>

Target:
public static SegmentGeneratorConfig generateSegmentGeneratorConfig(TableConfig tableConfig, BatchConfig batchConfig, Schema schema, File inputFile, File outputSegmentDir) throws ClassNotFoundException, IOException { SegmentGeneratorConfig segmentGeneratorConfig = new SegmentGeneratorConfig(tableConfig, schema); segmentGeneratorConfig.setTableName(tableConfig.getTableName()); segmentGeneratorConfig.setOutDir(outputSegmentDir.getAbsolutePath()); segmentGeneratorConfig.setInputFilePath(inputFile.getAbsolutePath()); FileFormat fileFormat = batchConfig.getInputFormat(); segmentGeneratorConfig.setFormat(fileFormat); segmentGeneratorConfig.setRecordReaderPath(RecordReaderFactory.getRecordReaderClassName(fileFormat.toString())); Map<String, String> configs = batchConfig.getRecordReaderProps(); segmentGeneratorConfig.setReaderConfig( RecordReaderFactory.getRecordReaderConfig(fileFormat, IngestionConfigUtils.getRecordReaderProps(configs))); segmentGeneratorConfig.setSegmentNameGenerator( new SimpleSegmentNameGenerator(tableConfig.getTableName(), String.valueOf(System.currentTimeMillis()))); return segmentGeneratorConfig; }
Source:
<code>public static boolean equalsLowerCase(CharSequence l, int lLo, int lHi, CharSequence r, int rLo, int rHi) { if (l == r) { return true; } int ll = lHi - lLo; if (ll != rHi - rLo) { return false; } for (int i = 0; i < ll; i++) { <START> if (Character.toLowerCase(l.charAt(i + lLo)) != r.charAt(i + rLo)) { <END> return false; } } return true; }</code><technical_language>toLowerCase sides</technical_language>

Target:
public static boolean equalsLowerCase(CharSequence l, int lLo, int lHi, CharSequence r, int rLo, int rHi) { if (l == r) { return true; } int ll = lHi - lLo; if (ll != rHi - rLo) { return false; } for (int i = 0; i < ll; i++) { if (Character.toLowerCase(l.charAt(i + lLo)) != Character.toLowerCase(r.charAt(i + rLo))) { return false; } } return true; }
Source:
<code><START> public void getSchedulePlansIncludeDeleted() { <END> dao.getSchedulePlans(ClientInfo.UNKNOWN_CLIENT, TestConstants.TEST_STUDY, false); verify(mapper).queryPage(eq(DynamoSchedulePlan.class), queryCaptor.capture()); Condition condition = new Condition().withComparisonOperator(ComparisonOperator.NE) .withAttributeValueList(new AttributeValue().withN("1")); assertEquals(condition, queryCaptor.getValue().getQueryFilter().get("deleted")); }</code><technical_language>Nitpick: This test next test names reversed</technical_language>

Target:
public void getSchedulePlansIncludeDeleted() { dao.getSchedulePlans(ClientInfo.UNKNOWN_CLIENT, TestConstants.TEST_STUDY, true); verify(mapper).queryPage(eq(DynamoSchedulePlan.class), queryCaptor.capture()); assertNull(queryCaptor.getValue().getQueryFilter()); }
Source:
<code>public <T extends TopLevelItem> T create(Class<T> type, String name) { visit("newJob"); fillIn("name", name); findCaption(type, getFinder()).click(); try { executeScript( "var obj = document.getElementById('name');" + "var ev = document.createEvent('MouseEvents');" + "ev.initEvent('blur', true, false);" + "obj.dispatchEvent(ev);" + "return true;"); <START> } catch(Exception e) { <END> } clickButton("OK"); waitFor(by.name("config"), 10); final T j = get(type, name); waitFor().withTimeout(3, TimeUnit.SECONDS) .until(new Callable<Object>() { @Override public Object call() throws Exception { try { j.getJson(); return true; } catch (Exception e) { return false; } } }); return j; }</code><technical_language>catch (Exception e) {</technical_language>

Target:
public <T extends TopLevelItem> T create(Class<T> type, String name) { visit("newJob"); fillIn("name", name); findCaption(type, getFinder()).click(); try { blur(find(By.name("name"))); } catch (Exception e) { } clickButton("OK"); waitFor(by.name("config"), 10); final T j = get(type, name); waitFor().withTimeout(3, TimeUnit.SECONDS) .until(new Callable<Object>() { @Override public Object call() throws Exception { try { j.getJson(); return true; } catch (Exception e) { return false; } } }); return j; }
Source:
<code>public void testCanBeSatisfiedBy() { final NetworkRequest request = new NetworkRequest.Builder() .setCapabilities(TEST_CAPABILITIES) .build(); assertFalse(request.canBeSatisfiedBy(null)); assertFalse(request.canBeSatisfiedBy(new NetworkCapabilities())); <START> assertTrue(request.canBeSatisfiedBy(TEST_CAPABILITIES.addCapability(NET_CAPABILITY_MMS))); <END> assertEquals(request.canBeSatisfiedBy(TEST_CAPABILITIES), TEST_CAPABILITIES.satisfiedByNetworkCapabilities(TEST_CAPABILITIES)); }</code><technical_language>please try capabilities object ? try combinations of transport, test network specifier</technical_language>

Target:
public void testCanBeSatisfiedBy() { final WifiNetworkSpecifier specifier1 = new WifiNetworkSpecifier.Builder() .setSsidPattern(new PatternMatcher(TEST_SSID, PatternMatcher.PATTERN_LITERAL)) .setBssidPattern(ARBITRARY_ADDRESS, ARBITRARY_ADDRESS) .build(); final WifiNetworkSpecifier specifier2 = new WifiNetworkSpecifier.Builder() .setSsidPattern(new PatternMatcher(OTHER_SSID, PatternMatcher.PATTERN_LITERAL)) .setBssidPattern(ARBITRARY_ADDRESS, ARBITRARY_ADDRESS) .build(); final NetworkCapabilities cap = new NetworkCapabilities() .addTransportType(TRANSPORT_WIFI) .addCapability(NET_CAPABILITY_INTERNET); final NetworkCapabilities capWithSp = new NetworkCapabilities(cap).setNetworkSpecifier(specifier1); final NetworkCapabilities cellCap = new NetworkCapabilities() .addTransportType(TRANSPORT_CELLULAR) .addCapability(NET_CAPABILITY_MMS) .addCapability(NET_CAPABILITY_INTERNET); final NetworkRequest request = new NetworkRequest.Builder() .addTransportType(TRANSPORT_WIFI) .addCapability(NET_CAPABILITY_INTERNET) .setNetworkSpecifier(specifier1) .build(); assertFalse(request.canBeSatisfiedBy(null)); assertFalse(request.canBeSatisfiedBy(new NetworkCapabilities())); assertTrue(request.canBeSatisfiedBy(cap)); assertTrue(request.canBeSatisfiedBy( new NetworkCapabilities(cap).addTransportType(TRANSPORT_VPN))); assertTrue(request.canBeSatisfiedBy(capWithSp)); assertFalse(request.canBeSatisfiedBy( new NetworkCapabilities(cap).setNetworkSpecifier(specifier2))); assertFalse(request.canBeSatisfiedBy(cellCap)); assertEquals(request.canBeSatisfiedBy(capWithSp), new NetworkCapabilities(capWithSp).satisfiedByNetworkCapabilities(capWithSp)); }
Source:
<code>public void start() { this.waitStrategy = new HostPortWaitStrategy() <START> .withStartupTimeout(Duration.of(300, SECONDS)); <END> this.withCreateContainerCmdModifier(createContainerCmd -> { createContainerCmd.withHostName(hostname); createContainerCmd.withName(getContainerName()); }); super.start(); log.info("Started bookie at cluster {}", hostname, clusterName); }</code><technical_language>this change is needed anymore</technical_language>

Target:
public void start() { if (Strings.isNullOrEmpty(extraServerComponents)) { this.waitStrategy = new HttpWaitStrategy() .forPath("/heartbeat") .forStatusCode(200) .forPort(BOOKIE_HTTP_PORT) .withStartupTimeout(Duration.of(60, SECONDS)); } else { this.waitStrategy = new HostPortWaitStrategy() .withStartupTimeout(Duration.of(300, SECONDS)); } this.withCreateContainerCmdModifier(createContainerCmd -> { createContainerCmd.withHostName(hostname); createContainerCmd.withName(getContainerName()); }); super.start(); log.info("Started bookie at cluster {}", hostname, clusterName); }
Source:
<code>public GoogleBuilder() { super(GoogleAuthProvider.PROVIDER_ID); if (getApplicationContext().getString(R.string.default_web_client_id) .equals(UNCONFIGURED_CONFIG_VALUE)) { <START> throw new RuntimeException("Check your google-services plugin configuration," + <END> " the client id string wasn't populated."); } }</code><technical_language>extracting hardcoded string values this strings.xml</technical_language>

Target:
public GoogleBuilder() { super(GoogleAuthProvider.PROVIDER_ID); Preconditions.checkConfigured(getApplicationContext(), "Check your google-services plugin configuration, the" + " default_web_client_id string wasn't populated.", R.string.default_web_client_id); }
Source:
<code>public void sendEventAsync(String jsonEvent) { ExecutorService executorService = executor.get(); if (executorService == null) { final int maxSize = Integer.getInteger(getClass().getName() + ".max", this.maxSize); executorService = new ThreadPoolExecutor( Math.min(Integer.getInteger(getClass().getName() + ".core", coreSize), maxSize), maxSize, Integer.getInteger(getClass().getName() + ".keepAliveMs", keepAliveMs), MILLISECONDS, <START> new LinkedBlockingQueue<>(), END> new ThreadFactory() { private final AtomicInteger counter = new AtomicInteger(); @Override public Thread newThread(final Runnable worker) { final Thread thread = new Thread(worker, HttpEventSender.class.getName() + "-thread-" + counter.incrementAndGet()); thread.setPriority(Thread.NORM_PRIORITY); thread.setDaemon(false); return thread; } }); if (!executor.compareAndSet(null, executorService)) { executorService.shutdownNow(); executorService = executor.get(); } } executorService.execute(new LogSender(jsonEvent)); }</code><technical_language>Create a queue size property (with a default value)</technical_language>

Target:
public void sendEventAsync(String jsonEvent) { ExecutorService executorService = executor.get(); if (executorService == null) { executorService = new ThreadPoolExecutor(Math.min(coreSize, maxSize), maxSize, keepAliveMs, MILLISECONDS, queueSize < 0 ? new LinkedBlockingQueue<>() : (queueSize == 0 ? new SynchronousQueue<>() : new ArrayBlockingQueue<>(queueSize)), new ThreadFactory() { private final AtomicInteger counter = new AtomicInteger(); @Override public Thread newThread(final Runnable worker) { final Thread thread = new Thread(worker, HttpEventSender.class.getName() + "-thread-" + counter.incrementAndGet()); thread.setPriority(Thread.NORM_PRIORITY); thread.setDaemon(false); return thread; } }); if (!executor.compareAndSet(null, executorService)) { executorService.shutdownNow(); executorService = executor.get(); } } executorService.execute(new LogSender(jsonEvent)); }
Source:
<code>public String getValue(final String parm, final String parsedParm, final Event event, final EventUtil eventUtil) { if (event.getNodeid() != null) { try { return eventUtil.getPrimaryInterface(event.getNodeid()); } catch (SQLException ex) { <START> LoggerFactory.getLogger(getClass()).info("primary interface ipaddr unavailable for node with id:", event.getNodeid(), ex); <END> } } return null; }</code><technical_language>suggestion LOG.info("primary interface ipaddr unavailable for node id: {}", event.getNodeid(), ex); Missing placeholder. a good opportunity refactor existing LoggerFactory.getLogger(getClass()) statements a static logger instead</technical_language>

Target:
public String getValue(final String parm, final String parsedParm, final Event event, final EventUtil eventUtil) { if (event.getNodeid() != null) { try { return eventUtil.getPrimaryInterface(event.getNodeid()); } catch (SQLException ex) { LOG.info("primary interface ipaddr unavailable for node with id: {}", event.getNodeid(), ex); } } return null; }
Source:
<code><START> public static ArrayPool<byte[]> getByteArrayPool() <END> { synchronized (Caches.class) { if (byteArrayPool == null) { byteArrayPool = new ArrayPool(1024, 8 * 1024 * 1024, 2028 * 1024 * 1024, new ByteArrayAllocator()); } } return byteArrayPool; }</code><technical_language>initialize startup? Is lazy initialization extra locking needed</technical_language>

Target:
public static ArrayPool<byte[]> getByteArrayPool() { synchronized (Caches.class) { if (byteArrayPool == null) { byteArrayPool = new ArrayPool(BYTE_SMALLEST_ARRAY_SIZE, BYTE_LARGEST_ARRAY_SIZE, BYTE_POOL_CAPACITY, new ByteArrayAllocator()); } } return byteArrayPool; }
Source:
<code>private void doPostProjectUsersUpdate(final Project project, final User... users) { final URI usersUri = getUsersUri(project); <START> final ProjectUsersUpdateResult projectUsersUpdateResult = restTemplate.postForObject(usersUri, new Users(users), ProjectUsersUpdateResult.class); <END> if (!projectUsersUpdateResult.getFailed().isEmpty()) { throw new ProjectUsersUpdateException("Unable to update users: " + projectUsersUpdateResult.getFailed()); } }</code><technical_language>catch rest exception</technical_language>

Target:
private void doPostProjectUsersUpdate(final Project project, final User... users) { final URI usersUri = getUsersUri(project); try { final ProjectUsersUpdateResult projectUsersUpdateResult = restTemplate.postForObject(usersUri, new Users(users), ProjectUsersUpdateResult.class); if (!projectUsersUpdateResult.getFailed().isEmpty()) { throw new ProjectUsersUpdateException("Unable to update users: " + projectUsersUpdateResult.getFailed()); } } catch (RestClientException e) { throw new GoodDataException("Unable to update users in project", e); } }
Source:
<code>private Map<Archive, Resource> parseSingle(Archive archive, File single) throws Exception { ResourceBuilder rb = new ResourceBuilder(); boolean hasIdentity = rb.addFile(single, single.toURI()); String name = archive.getWithoutVersion(); MavenVersion version = archive.revision.version; <START> BridgeRepository.addInformationCapability(rb, name, version.getOSGiVersion(), repo.toString(), <END> !hasIdentity ? Constants.NOT_A_BUNDLE_S : null, archive.revision.group, archive.revision.artifact, version.toString(), archive.extension, archive.classifier); Resource resource = rb.build(); return Collections.singletonMap(archive, resource); }</code><technical_language>this is wise. check for places assume presence of a bnd.info cap means artifacts is a bundle? changed a resource a osgi.identity a bnd.info resource a bnd.info</technical_language>

Target:
private Map<Archive, Resource> parseSingle(Archive archive, File single) throws Exception { ResourceBuilder rb = new ResourceBuilder(); boolean hasIdentity = rb.addFile(single, single.toURI()); if (!hasIdentity) { String name = archive.getWithoutVersion(); MavenVersion version = archive.revision.version; BridgeRepository.addInformationCapability(rb, name, version.getOSGiVersion(), repo.toString(), Constants.NOT_A_BUNDLE_S); } MavenCapability.addMavenCapability(rb, archive.revision.group, archive.revision.artifact, archive.revision.version, archive.classifier, repo.toString()); Resource resource = rb.build(); return Collections.singletonMap(archive, resource); }
Source:
<code>public int execute(ExecutionContext context) throws IOException, InterruptedException { ImmutableList.Builder<String> command = createCommandList(); ProcessBuilder processBuilder = new ProcessBuilder(command.build()); Map<String, String> env = processBuilder.environment(); env.clear(); env.putAll(context.getEnvironment()); env.put("BUCK_INVOKING_RULE", invokingRule.toString()); env.put("BUCK_TARGET", invokingRule.toString()); <START> env.put("BUCK_DIRECTORY_ROOT", filesystem.getRootPath().toAbsolutePath().toString()); <END> processBuilder.directory(filesystem.getRootPath().toAbsolutePath().toFile()); int exitCode = -1; try { exitCode = context.getProcessExecutor().execute(processBuilder.start()).getExitCode(); } catch (IOException e) { e.printStackTrace(context.getStdErr()); return exitCode; } return exitCode; }</code><technical_language>environment variables necessary, remove them</technical_language>

Target:
public int execute(ExecutionContext context) throws IOException, InterruptedException { ProcessBuilder processBuilder = new ProcessBuilder(createCommand()); Map<String, String> env = processBuilder.environment(); env.clear(); env.putAll(context.getEnvironment()); processBuilder.directory(filesystem.getRootPath().toAbsolutePath().toFile()); int exitCode = -1; try { exitCode = context.getProcessExecutor().execute(processBuilder.start()).getExitCode(); } catch (IOException e) { e.printStackTrace(context.getStdErr()); return exitCode; } return exitCode; }
Source:
<code>protected static Ds3Request makeRequiredParam( final Ds3Request ds3Request, final String nameSpacing, final String optionalParamName, final int responseCode, final String responseType, <START> final String responseComponentType) { <END> return new Ds3Request( nameSpaceSplitRequest(ds3Request.getName(), nameSpacing), ds3Request.getHttpVerb(), ds3Request.getClassification(), ds3Request.getBucketRequirement(), ds3Request.getObjectRequirement(), ds3Request.getAction(), ds3Request.getResource(), ds3Request.getResourceType(), ds3Request.getOperation(), modifyResponseCode( ds3Request.getDs3ResponseCodes(), responseCode, responseType, responseComponentType), removeDs3Param( ds3Request.getOptionalQueryParams(), optionalParamName), addDs3Param( ds3Request.getRequiredQueryParams(), getDs3Param(ds3Request.getOptionalQueryParams(), optionalParamName)) ); }</code><technical_language>Is this null? I this param in split functions</technical_language>

Target:
protected static Ds3Request makeRequiredParam( final Ds3Request ds3Request, final String nameSpacing, final String optionalParamName, final int responseCode, final String responseType, final String responseComponentType) throws ResponseTypeNotFoundException { return new Ds3Request( nameSpaceSplitRequest(ds3Request.getName(), nameSpacing), ds3Request.getHttpVerb(), ds3Request.getClassification(), ds3Request.getBucketRequirement(), ds3Request.getObjectRequirement(), ds3Request.getAction(), ds3Request.getResource(), ds3Request.getResourceType(), ds3Request.getOperation(), modifyResponseCode( ds3Request.getDs3ResponseCodes(), responseCode, responseType, responseComponentType), removeDs3Param( ds3Request.getOptionalQueryParams(), optionalParamName), addDs3Param( ds3Request.getRequiredQueryParams(), getDs3Param(ds3Request.getOptionalQueryParams(), optionalParamName)) ); }
Source:
<code>private Optional<Object> buildExportStatements(String nodeId, Alien4CloudApplication toscaApplication, Operation op, String computeName, String script) { Map<String, PaaSNodeTemplate> builtPaaSNodeTemplates = getAllNodes(toscaApplication); PaaSNodeTemplate paasNodeTemplate = builtPaaSNodeTemplates.get(computeName); Map<String, IValue> inputParameters = op.getInputParameters(); if (inputParameters == null) { return Optional.absent(); } Object testvalue = null; List<Object> dsls = Lists.newArrayList(); for (Map.Entry<String, IValue> entry : inputParameters.entrySet()) { Optional<Object> value = resolve(inputParameters, entry.getKey(), paasNodeTemplate, builtPaaSNodeTemplates, toscaApplication.getKeywordMap(nodeId)); if (value.isPresent()) { dsls.add(BrooklynDslCommon.formatString("export %s=\"%s\"", entry.getKey(), value.get())); if (!DslUtils.resolved(value.get())) { <START> testvalue = value.get(); <END> } } } dsls.add(script); return Optional.of(BrooklynDslCommon.formatString(Strings.repeat("%s\n", dsls.size()), dsls.toArray())); }</code><technical_language>is testValue for</technical_language>

Target:
private Optional<Object> buildExportStatements(String nodeId, Alien4CloudApplication toscaApplication, Operation op, String computeName, String script) { Map<String, PaaSNodeTemplate> builtPaaSNodeTemplates = getAllNodes(toscaApplication); PaaSNodeTemplate paasNodeTemplate = builtPaaSNodeTemplates.get(computeName); Map<String, IValue> inputParameters = op.getInputParameters(); if (inputParameters == null) { return Optional.absent(); } List<Object> dsls = Lists.newArrayList(); for (Map.Entry<String, IValue> entry : inputParameters.entrySet()) { Optional<Object> value = resolve(inputParameters, entry.getKey(), paasNodeTemplate, builtPaaSNodeTemplates, toscaApplication.getKeywordMap(nodeId)); if (value.isPresent() && !Strings.isBlank(entry.toString())) { dsls.add(BrooklynDslCommon.formatString("export %s=\"%s\"", entry.getKey(), value.get())); } } dsls.add(script); return Optional.of(BrooklynDslCommon.formatString(Strings.repeat("%s\n", dsls.size()), dsls.toArray())); }
Source:
<code>private void validateLotAndScale(final TransactionDto transactionDto) { final LotsSearchDto lotsSearchDto = new LotsSearchDto(); lotsSearchDto.setLotIds(Lists.newArrayList(transactionDto.getLot().getLotId())); final List<ExtendedLotDto> result = this.lotService.searchLots(lotsSearchDto, null); <START> if (result.size() == 1) { <END> final Integer scaleId = result.get(0).getScaleId(); this.inventoryScaleValidator.validateNotNullInventoryScaleId(this.errors, scaleId); } else { this.errors.rejectValue("transaction.wrong.lot", ""); } }</code><technical_language>@vmaletta Please validate lot is open</technical_language>

Target:
private void validateLotAndScale(final TransactionDto transactionDto) { final LotsSearchDto lotsSearchDto = new LotsSearchDto(); lotsSearchDto.setLotIds(Lists.newArrayList(transactionDto.getLot().getLotId())); final List<ExtendedLotDto> result = this.lotService.searchLots(lotsSearchDto, null); if (result.size() == 1) { final ExtendedLotDto lot = result.get(0); final Integer scaleId = lot.getScaleId(); this.inventoryScaleValidator.validateNotNullInventoryScaleId(this.errors, scaleId); if (lot.getStatus().equalsIgnoreCase(LotStatus.CLOSED.name())) { this.errors.reject("transaction.closed.lot", ""); } } else { this.errors.reject("transaction.wrong.lot", ""); } }
Source:
<code>static FeignException errorReading(Request request, Response ignored, IOException cause) { return new FeignException( <START> format("%s reading %s %s", cause.getMessage(), request.httpMethod().name(), request.url()), <END> cause); }</code><technical_language>format able deal Enums fine. need call name()</technical_language>

Target:
static FeignException errorReading(Request request, Response ignored, IOException cause) { return new FeignException( format("%s reading %s %s", cause.getMessage(), request.httpMethod(), request.url()), cause); }
Source:
<code>public void testBumpTransactionalEpochOnRecoverableAddPartitionRequestError() { final long producerId = 13131L; final short initialEpoch = 1; <START> final short bumpedEpoch = 2; <END> doInitTransactions(producerId, initialEpoch); transactionManager.beginTransaction(); transactionManager.failIfNotReadyForSend(); transactionManager.maybeAddPartitionToTransaction(tp0); prepareAddPartitionsToTxnResponse(Errors.INVALID_PRODUCER_ID_MAPPING, tp0, initialEpoch, producerId); sender.runOnce(); assertTrue(transactionManager.hasAbortableError()); TransactionalRequestResult abortResult = transactionManager.beginAbort(); prepareInitPidResponse(Errors.NONE, false, producerId, bumpedEpoch); sender.runOnce(); assertEquals(bumpedEpoch, transactionManager.producerIdAndEpoch().epoch); assertTrue(abortResult.isCompleted()); assertTrue(abortResult.isSuccessful()); assertTrue(transactionManager.isReady()); }</code><technical_language>nit: bumpedEpoch = initialEpoch + 1;</technical_language>

Target:
public void testBumpTransactionalEpochOnRecoverableAddPartitionRequestError() { final long producerId = 13131L; final short initialEpoch = 1; final short bumpedEpoch = 2; doInitTransactions(producerId, initialEpoch); transactionManager.beginTransaction(); transactionManager.failIfNotReadyForSend(); transactionManager.maybeAddPartitionToTransaction(tp0); prepareAddPartitionsToTxnResponse(Errors.INVALID_PRODUCER_ID_MAPPING, tp0, initialEpoch, producerId); runUntil(transactionManager::hasAbortableError); TransactionalRequestResult abortResult = transactionManager.beginAbort(); prepareInitPidResponse(Errors.NONE, false, producerId, bumpedEpoch); runUntil(abortResult::isCompleted); assertEquals(bumpedEpoch, transactionManager.producerIdAndEpoch().epoch); assertTrue(abortResult.isSuccessful()); assertTrue(transactionManager.isReady()); }
Source:
<code>private boolean isEmulatedMachineChanged() { <START> return !StringUtils.equals( <END> getParameters().getVm().getCustomEmulatedMachine(), getVm().getCustomEmulatedMachine()); }</code><technical_language>minor, Objects#equals instead? is provided Java.</technical_language>

Target:
private boolean isEmulatedMachineChanged() { return !Objects.equals( getParameters().getVm().getCustomEmulatedMachine(), getVm().getCustomEmulatedMachine()); }
Source:
<code>public String getPropertiesPath() { <START> if (propsPath == null) { <END> URL propLocation = SiteConfiguration.getAccumuloPropsLocation(); propsPath = propLocation.getFile(); } return propsPath; }</code><technical_language>sync this method</technical_language>

Target:
public synchronized String getPropertiesPath() { if (propsPath == null) { propsPath = SiteConfiguration.getAccumuloPropsLocation().getFile(); } return propsPath; }
Source:
<code>private static void calculateIntStreamPartitions(JobGraph jobGraph, Config config) { int partitions = config.getInt(JobConfig.JOB_INTERMEDIATE_STREAM_PARTITIONS(), StreamEdge.PARTITIONS_UNKNOWN); if (partitions < 0) { int maxInPartitions = maxPartition(jobGraph.getSources()); int maxOutPartitions = maxPartition(jobGraph.getSinks()); partitions = Math.max(maxInPartitions, maxOutPartitions); if (partitions > MAX_INFERRED_PARTITIONS) { partitions = MAX_INFERRED_PARTITIONS; log.warn(String.format("Inferred intermediate stream partition count %d is greater than the max %d. Using the max.", partitions, MAX_INFERRED_PARTITIONS)); } } for (StreamEdge edge : jobGraph.getIntermediateStreamEdges()) { if (edge.getPartitionCount() <= 0) { <START> log.info("Initialize the partition count for edge to {}.", edge.getName(), partitions); <END> edge.setPartitionCount(partitions); } } }</code><technical_language>another place set default partition count for edges infer. add logging too</technical_language>

Target:
private static void calculateIntStreamPartitions(JobGraph jobGraph, Config config) { int partitions = config.getInt(JobConfig.JOB_INTERMEDIATE_STREAM_PARTITIONS(), StreamEdge.PARTITIONS_UNKNOWN); if (partitions < 0) { int maxInPartitions = maxPartition(jobGraph.getSources()); int maxOutPartitions = maxPartition(jobGraph.getSinks()); partitions = Math.max(maxInPartitions, maxOutPartitions); if (partitions > MAX_INFERRED_PARTITIONS) { partitions = MAX_INFERRED_PARTITIONS; log.warn(String.format("Inferred intermediate stream partition count %d is greater than the max %d. Using the max.", partitions, MAX_INFERRED_PARTITIONS)); } } for (StreamEdge edge : jobGraph.getIntermediateStreamEdges()) { if (edge.getPartitionCount() <= 0) { log.info("Set the partition count for intermediate stream to {}.", edge.getName(), partitions); edge.setPartitionCount(partitions); } } }
Source:
<code>protected View.OnClickListener validateAndSubmit(){ return new View.OnClickListener() { @Override public void onClick(View view) { List<String> errorStrings = new ArrayList<String>(); <START> if (mTitleField.getText().toString().length() == 0) errorStrings.add("Title"); <END> if (mDescriptionField.getText().toString().length() == 0) errorStrings.add("Description"); if (mAddressField.getText().toString().length() == 0) errorStrings.add("Address"); if (errorStrings.size() > 0) Utility.setEmpty(mParentActivity, errorStrings); else { submitListener(); SiteViewPagerFragment returnFragment = SiteViewPagerFragment.newInstance(); mParentActivity.replaceFragment(returnFragment); } } }; }</code><technical_language>this brackets</technical_language>

Target:
protected View.OnClickListener validateAndSubmit(){ return new View.OnClickListener() { @Override public void onClick(View view) { List<String> errorStrings = new ArrayList<String>(); if (mTitleField.getText().toString().length() == 0) { errorStrings.add("Title"); } if (mDescriptionField.getText().toString().length() == 0) { errorStrings.add("Description"); } if (mAddressField.getText().toString().length() == 0) { errorStrings.add("Address"); } if (errorStrings.size() > 0) { Utility.setEmpty(mParentActivity, errorStrings); } else { submitListener(); SiteViewPagerFragment returnFragment = SiteViewPagerFragment.newInstance(); mParentActivity.replaceFragment(returnFragment); } } }; }
Source:
<code>protected static boolean skipFile(@SuppressWarnings("unused") @NotNull Path path, @NotNull Long modificationTime, Long lastModificationTime) throws IOException { <START> if(lastModificationTime == null) { <END> return false; } return (!(lastModificationTime == null || modificationTime > lastModificationTime)); }</code><technical_language>checkstyle violation here. space opening parenthesis</technical_language>

Target:
protected static boolean skipFile(@SuppressWarnings("unused") @NotNull Path path, @NotNull Long modificationTime, Long lastModificationTime) throws IOException { return (!(lastModificationTime == null || modificationTime > lastModificationTime)); }
Source:
<code>public RegionCoprocessorHost(final HRegion region, final RegionServerServices rsServices, final Configuration conf) { super(rsServices); this.conf = conf; this.rsServices = rsServices; this.region = region; this.pathPrefix = Integer.toString(this.region.getRegionInfo().hashCode()); loadSystemCoprocessors(conf, REGION_COPROCESSOR_CONF_KEY); if (!region.getRegionInfo().getTable().isSystemTable()) { loadSystemCoprocessors(conf, USER_REGION_COPROCESSOR_CONF_KEY); } loadTableCoprocessors(conf); boolean hasCustomPostScannerFilterRow = false; out: for (RegionCoprocessorEnvironment env: coprocEnvironments) { if (env.getInstance() instanceof RegionObserver) { Class<?> clazz = env.getInstance().getClass(); for(;;) { if (clazz == null) { hasCustomPostScannerFilterRow = true; break out; } try { clazz.getDeclaredMethod("postScannerFilterRow", ObserverContext.class, InternalScanner.class, Cell.class, boolean.class); hasCustomPostScannerFilterRow = true; break out; } catch (NoSuchMethodException ignore) { } try { clazz.getDeclaredMethod("postScannerFilterRow", ObserverContext.class, InternalScanner.class, byte[].class, int.class, short.class, boolean.class); hasCustomPostScannerFilterRow = true; break out; } catch (NoSuchMethodException ignore) { } clazz = clazz.getSuperclass(); <START> <END> if (clazz == Object.class) { break out; } } } } this.hasCustomPostScannerFilterRow = hasCustomPostScannerFilterRow; }</code><technical_language>change of this loop if (clazz == null) { // implemented RegionObserver hasCustomPostScannerFilterRow = true; break out; } In 1.x interface def impl. consider hasCustomPostScannerFilterRow = true then. in 2.x Interface default impl. safe change hasCustomPostScannerFilterRow = false only. In fact check urs if (clazz == Object.class) { break out; }</technical_language>

Target:
public RegionCoprocessorHost(final HRegion region, final RegionServerServices rsServices, final Configuration conf) { super(rsServices); this.conf = conf; this.rsServices = rsServices; this.region = region; this.pathPrefix = Integer.toString(this.region.getRegionInfo().hashCode()); loadSystemCoprocessors(conf, REGION_COPROCESSOR_CONF_KEY); if (!region.getRegionInfo().getTable().isSystemTable()) { loadSystemCoprocessors(conf, USER_REGION_COPROCESSOR_CONF_KEY); } loadTableCoprocessors(conf); boolean hasCustomPostScannerFilterRow = false; out: for (RegionCoprocessorEnvironment env: coprocEnvironments) { if (env.getInstance() instanceof RegionObserver) { Class<?> clazz = env.getInstance().getClass(); for (;;) { if (clazz == Object.class) { break; } try { clazz.getDeclaredMethod("postScannerFilterRow", ObserverContext.class, InternalScanner.class, Cell.class, boolean.class); hasCustomPostScannerFilterRow = true; break out; } catch (NoSuchMethodException ignore) { } try { clazz.getDeclaredMethod("postScannerFilterRow", ObserverContext.class, InternalScanner.class, byte[].class, int.class, short.class, boolean.class); hasCustomPostScannerFilterRow = true; break out; } catch (NoSuchMethodException ignore) { } clazz = clazz.getSuperclass(); } } } this.hasCustomPostScannerFilterRow = hasCustomPostScannerFilterRow; }
Source:
<code>public void testWaitForStartAndCancelBeforeStart() throws Exception { final OneShotEvent ev = new OneShotEvent(); FreeStyleProject p = createFreeStyleProject(); QueueTaskFuture<FreeStyleBuild> f = p.scheduleBuild2(10); final Queue.Item item = Queue.getInstance().getItem(p); assertNotNull(item); final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1); executor.schedule(new Runnable() { @Override public void run() { try { Queue.getInstance().doCancelItem(item.id); } catch (IOException e) { e.printStackTrace(); } catch (ServletException e) { e.printStackTrace(); } } }, 2, TimeUnit.SECONDS); try { f.waitForStart(); <START> assertTrue(f.isCancelled()); <END> } catch (CancellationException e) }</code><technical_language>I I follow logic here. completes normally? IMO outcome in case of item cancellation CancellationException</technical_language>

Target:
public void testWaitForStartAndCancelBeforeStart() throws Exception { final OneShotEvent ev = new OneShotEvent(); FreeStyleProject p = createFreeStyleProject(); QueueTaskFuture<FreeStyleBuild> f = p.scheduleBuild2(10); final Queue.Item item = Queue.getInstance().getItem(p); assertNotNull(item); final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1); executor.schedule(new Runnable() { @Override public void run() { try { Queue.getInstance().doCancelItem(item.id); } catch (IOException e) { e.printStackTrace(); } catch (ServletException e) { e.printStackTrace(); } } }, 2, TimeUnit.SECONDS); try { f.waitForStart(); fail("Expected an CancellationException to be thrown"); } catch (CancellationException e) }
Source:
<code>public void addEvent(IResourceChangeEvent event) { <START> synchronized (pendingJobs) { <END> if (!noMoreEvents) { events.add(event); } else { throw new IllegalStateException("This job is underway, no new events can be added"); } } }</code><technical_language>avoid synchronizing addEvent is called synchronized pendingJobs. This methods public: default access is safer</technical_language>

Target:
void addEvent(IResourceChangeEvent event) { synchronized (pendingJobs) { if (!noMoreEvents) { events.add(event); } else { throw new IllegalStateException("This job is underway, no new events can be added"); } } }
Source:
<code>public void testSsModule() { ITmfStateSystem ss = fModule.getStateSystem(); assertNull(ss); fModule.schedule(); if (fModule.waitForCompletion()) { ss = fModule.getStateSystem(); assertNotNull(ss); try { int quark = ss.getQuarkAbsolute(TestExperimentAnalysis.TRACE_QUARK_NAME); ITmfStateInterval interval = ss.querySingleState(ss.getCurrentEndTime(), quark); <START> System.out.println("Exp ss value at " + ss.getCurrentEndTime() + ": " + interval); <END> assertEquals(2, interval.getStateValue().unboxInt()); } catch (AttributeNotFoundException e) { fail("The quark for number of traces does not exist"); } catch (StateSystemDisposedException e) { fail("Error: state system disposed"); } } else { fail("Module did not complete properly"); } }</code><technical_language>this</technical_language>

Target:
public void testSsModule() { ITmfStateSystem ss = fModule.getStateSystem(); assertNull(ss); fModule.schedule(); if (fModule.waitForCompletion()) { ss = fModule.getStateSystem(); assertNotNull(ss); try { int quark = ss.getQuarkAbsolute(TestExperimentAnalysis.TRACE_QUARK_NAME); ITmfStateInterval interval = ss.querySingleState(ss.getCurrentEndTime(), quark); assertEquals(2, interval.getStateValue().unboxInt()); } catch (AttributeNotFoundException e) { fail("The quark for number of traces does not exist"); } catch (StateSystemDisposedException e) { fail("Error: state system disposed"); } } else { fail("Module did not complete properly"); } }
Source:
<code>File getTempFile(ParseFile.State state) { if (state.url() == null) { return null; } <START> return new File(cachePath, ParseDigestUtils.md5(state.url())); <END> }</code><technical_language>If end keeping this, clashing temporary file name. want unique UUID.randomUUID()</technical_language>

Target:
File getTempFile(ParseFile.State state) { if (state.url() == null) { return null; } return new File(cachePath, state.url() + ".tmp"); }
Source:
<code>public void delete() throws IOException { <START> root.retrieve().method("POST").withPreview(INERTIA).method("DELETE").withUrlPath(getApiRoute()).to(); <END> }</code><technical_language>Multiple method(*) methods</technical_language>

Target:
public void delete() throws IOException { root.createRequest().withPreview(INERTIA).method("DELETE").withUrlPath(getApiRoute()).send(); }
Source:
<code>public void start(ComponentContext context) { init(); ConfigurationService configuration = Framework.getService(ConfigurationService.class); <START> storeState = Boolean.parseBoolean(configuration.getProperty(STORESTATE_KEY)); <END> stateTTL = Long.parseLong(configuration.getProperty(STATETTL_KEY, STATETTL_DEFAULT_VALUE)); }</code><technical_language>storeState = configuration.isBooleanPropertyTrue(STORESTATE_KEY)</technical_language>

Target:
public void start(ComponentContext context) { init(); ConfigurationService configuration = Framework.getService(ConfigurationService.class); storeState = configuration.isBooleanPropertyTrue(STORESTATE_KEY); stateTTL = Long.parseLong(configuration.getProperty(STATETTL_KEY, STATETTL_DEFAULT_VALUE)); }
Source:
<code>public io.confluent.connect.storage.format.RecordWriter getRecordWriter( final HdfsSinkConnectorConfig conf, final String filename ) { return new io.confluent.connect.storage.format.RecordWriter() { FSDataOutputStream out; final DataFileWriter<Object> writer = new DataFileWriter<>(new GenericDatumWriter<>()); final Path path = new Path(filename); Schema schema = null; @Override public void write(SinkRecord record) { if (schema == null) { schema = record.valueSchema(); try { log.info("Opening record writer for: {}", filename); out = FileSystem.newInstance(path.toUri(), <START> conf.getHadoopConfiguration()) <END> .create(path); org.apache.avro.Schema avroSchema = avroData.fromConnectSchema(schema); writer.setCodec(CodecFactory.fromString(conf.getAvroCodec())); writer.create(avroSchema, out); } catch (IOException e) { throw new ConnectException(e); } } log.trace("Sink record: {}", record); Object value = avroData.fromConnectData(schema, record.value()); try { if (value instanceof NonRecordContainer) { writer.append(((NonRecordContainer) value).getValue()); } else { writer.append(value); } } catch (IOException e) { throw new DataException(e); } } @Override public void close() { try { writer.close(); out.close(); } catch (IOException e) { throw new DataException(e); } } @Override public void commit() }; }</code><technical_language>need hold result of FileSystem.newInstance(path.toUri(), conf.getHadoopConfiguration()), is a closeable FileSystem object, close in close()? need hold close FSDataOutputStream instance, if is closed in DataFileWriter instance</technical_language>

Target:
public io.confluent.connect.storage.format.RecordWriter getRecordWriter( final HdfsSinkConnectorConfig conf, final String filename ) { return new io.confluent.connect.storage.format.RecordWriter() { FileSystem fs; final DataFileWriter<Object> writer = new DataFileWriter<>(new GenericDatumWriter<>()); final Path path = new Path(filename); Schema schema = null; @Override public void write(SinkRecord record) { if (schema == null) { schema = record.valueSchema(); try { log.info("Opening record writer for: {}", filename); fs = FileSystem.newInstance(path.toUri(), conf.getHadoopConfiguration()); FSDataOutputStream out = fs.create(path); org.apache.avro.Schema avroSchema = avroData.fromConnectSchema(schema); writer.setCodec(CodecFactory.fromString(conf.getAvroCodec())); writer.create(avroSchema, out); } catch (IOException e) { throw new ConnectException(e); } } log.trace("Sink record: {}", record); Object value = avroData.fromConnectData(schema, record.value()); try { if (value instanceof NonRecordContainer) { writer.append(((NonRecordContainer) value).getValue()); } else { writer.append(value); } } catch (IOException e) { throw new DataException(e); } } @Override public void close() { IOException error = null; try { writer.close(); } catch (IOException e) { error = e; throw new DataException(e); } finally { if (fs != null) { try { fs.close(); } catch (IOException e) { if (error == null) { throw new DataException(e); } } } } } @Override public void commit() }; }
Source:
<code>public Builder addOptions(String... keyValuePairs) { Preconditions.checkArgument(keyValuePairs.length % 2 == 0 && keyValuePairs.length > 0, "Require an even, positive number of arguments, got %s", keyValuePairs.length); for (int i = 0; i < keyValuePairs.length; i += 2) { <START> addOption(keyValuePairs[i], keyValuePairs[i + 1]); END> } return this; }</code><technical_language>instead add a bounds check ensure 2. explicit check throw is relying incidental error. I Preconditions a convenience method for bounds checking, throws a reasonable RTE type, a message</technical_language>

Target:
public Builder addOptions(String... keyValuePairs) { Preconditions.checkArgument(keyValuePairs.length % 2 == 0 && keyValuePairs.length > 0, "Require an even, positive number of arguments, got %s", keyValuePairs.length); for (int i = 1; i < keyValuePairs.length; i += 2) { addOption(keyValuePairs[i - 1], keyValuePairs[i]); } return this; }
Source:
<code>public SegmentArchiveReader open(String archiveName) throws IOException { <START> AwsContext directoryContext = awsContext.withDirectory(archiveName); <END> if (!directoryContext.doesObjectExist("closed")) { throw new IOException("The archive " + archiveName + " hasn't been closed correctly."); } return new AwsSegmentArchiveReader(directoryContext, archiveName, ioMonitor); }</code><technical_language>AwsContext responsibilities: providing context for AWS operations more granular context relative archive/directory in S3.. I a bit misleading some random parts of code harder read</technical_language>

Target:
public SegmentArchiveReader open(String archiveName) throws IOException { S3Directory archiveDirectory = directory.withDirectory(archiveName); if (!archiveDirectory.doesObjectExist("closed")) { throw new IOException("The archive " + archiveName + " hasn't been closed correctly."); } return new AwsSegmentArchiveReader(archiveDirectory, archiveName, ioMonitor); }
Source:
<code>private void finalizeResolving() { if (!shutdownInProgress.get()) { shutdownPools(); } if (diagnostic.getSeverity() >= Diagnostic.ERROR) { dependencyGraph.clear(); } resolvedResources = null; diagnostic = null; notResolving.signal(); <START> lock.unlock(); <END> }</code><technical_language>left in "finally" blocks, lock-related information is visible a glance hidden here</technical_language>

Target:
private void finalizeResolving() { if (!shutdownInProgress.get()) { shutdownPools(); } if (diagnostic.getSeverity() >= Diagnostic.ERROR) { dependencyGraph.clear(); } resolvedResources = null; diagnostic = null; }
Source:
<code>public List<DBNote> searchNotes(long accountId, @Nullable CharSequence query, @Nullable String category, @Nullable Boolean favorite) { validateAccountId(accountId); List<String> where = new ArrayList<>(); List<String> args = new ArrayList<>(); where.add(key_status + " != ?"); args.add(DBStatus.LOCAL_DELETED.getTitle()); where.add(key_account_id + " = ?"); args.add("" + accountId); if (query != null) { where.add(key_status + " != ?"); args.add(DBStatus.LOCAL_DELETED.getTitle()); where.add("(" + key_title + " LIKE ? OR " + key_content + " LIKE ? OR " + key_category + " LIKE ?" + ")"); <START> args.add("%" + query + "%"); args.add("%" + query + "%"); args.add("%" + query + "%"); } if (category != null) { List<Integer> ids = getCategoryIdsByTitle(accountId, category); if (ids.size() == 0) { return new ArrayList<DBNote>(); } StringBuffer tmpSQL = new StringBuffer(); String tmp = String.format(" %s = ? ", key_category); for (int i = 0; i < ids.size(); i++) { tmpSQL.append(tmp); if (i != ids.size() - 1) { tmpSQL.append(" or "); } } where.add(String.format("( %s )", tmpSQL.toString())); for (int i = 0; i < ids.size(); i++) { args.add(String.valueOf(ids.get(i))); } <END> } if (favorite != null) { where.add(key_favorite + "=?"); args.add(favorite ? "1" : "0"); } String order = category == null ? default_order : key_category + ", " + key_title; return getNotesCustom(accountId, TextUtils.join(" AND ", where), args.toArray(new String[]{}), order, true); }</code><technical_language>I suggest SQL subquery here. This code more easier. like: where.add("CATEGORY IN (SELECT ID CATEGORIES TITLE=? TITLE ?)"); args.add(category); args.add(category + "/%"); remove method getCategoryIdsByTitle(...), then</technical_language>

Target:
public List<DBNote> searchNotes(long accountId, @Nullable CharSequence query, @Nullable String category, @Nullable Boolean favorite) { validateAccountId(accountId); List<String> where = new ArrayList<>(); List<String> args = new ArrayList<>(); where.add(key_status + " != ?"); args.add(DBStatus.LOCAL_DELETED.getTitle()); where.add(key_account_id + " = ?"); args.add("" + accountId); if (query != null) { where.add(key_status + " != ?"); args.add(DBStatus.LOCAL_DELETED.getTitle()); where.add("(" + key_title + " LIKE ? OR " + key_content + " LIKE ? OR " + key_category + " LIKE ?" + ")"); args.add("%" + query + "%"); args.add("%" + query + "%"); args.add("%" + query + "%"); } if (category != null) { where.add(key_category + " IN (SELECT " + key_category_id + " FROM " + table_category + " WHERE " + key_category_title + " =? OR " + key_category_title + " LIKE ?)"); args.add(category); args.add(category + "/%"); } if (favorite != null) { where.add(key_favorite + "=?"); args.add(favorite ? "1" : "0"); } String order = category == null ? default_order : key_category + ", " + key_title; return getNotesCustom(accountId, TextUtils.join(" AND ", where), args.toArray(new String[]{}), order, true); }
Source:
<code>public static <T> T get(String key) { ensureKeyIsValid(key); String fullText = storage.get(key); try { return encoder.decode(fullText); } catch (Exception e) { Logger.d(e.getMessage()); } <START> return null; <END> }</code><technical_language>is for being</technical_language>

Target:
public static <T> T get(String key) { if (key == null) { throw new NullPointerException("Key cannot be null"); } String fullText = storage.get(key); try { return encoder.decode(fullText); } catch (Exception e) { Logger.d(e.getMessage()); } return null; }
Source:
<code>protected void preConsumerPollHook() { while (!_taskUpdates.isEmpty()) { TaskUpdateType updateType = _taskUpdates.remove(); <START> if (updateType == null) { <END> continue; } else if (updateType == TaskUpdateType.PAUSE_RESUME_PARTITIONS) { pausePartitions(); } } }</code><technical_language>nit: if updateType is null if (updateType != null) { switch (updateType) { case... } }</technical_language>

Target:
protected void preConsumerPollHook() { while (!_taskUpdates.isEmpty()) { DatastreamConstants.UpdateType updateType = _taskUpdates.remove(); if (updateType != null) { switch (updateType) { case PAUSE_RESUME_PARTITIONS: pausePartitions(); break; default: String msg = String.format("Unknown update type for task {}.", updateType, _taskName); _logger.error(msg); throw new DatastreamRuntimeException(msg); } } } }