auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private Collection<Unit> getUnprotectedUnits(final BattleState.Side side) { final Collection<Unit> unitsToKill; unitsToKill = CollectionUtils.getMatches( battleState.getUnits(EnumSet.of(side)), getActiveUnits().and(Matches.unitIsNotInfrastructure())); <START> return unitsToKill; <END> }</code><technical_language>Ditto direct return, avoid intermediate variable</technical_language>

Target:
private Collection<Unit> getUnprotectedUnits(final BattleState.Side side) { return CollectionUtils.getMatches( battleState.getUnits(side), Matches.unitIsActiveInTerritory(battleState.getBattleSite()) .and(Matches.unitIsNotInfrastructure())); }
Source:
<code>public <T> T data(LightblueRequest lightblueRequest, Class<T> type) throws IOException { LightblueResponse response = data(lightblueRequest); JsonNode responseJson = response.getJson(); JsonNode objectType = responseJson.get("objectType"); if (objectType != null && "error".equalsIgnoreCase(objectType.textValue())) { throw new RuntimeException("Error in lightblue response: " + responseJson.toString()); } JsonNode responseNode = responseJson.path("processed"); if (responseNode instanceof MissingNode || (responseNode instanceof ArrayNode && responseNode.size() == 0 && !type.isArray())) { return null; } try { return mapper.readValue(responseNode.traverse(), type); } catch (JsonMappingException e) { LOGGER.error("Error parsing lightblue response: " + responseJson.toString(), e); throw new RuntimeException("Error parsing lightblue response: " + responseJson.toString()); <START> } <END> }</code><technical_language>This change in data(LightblueRequest, Class<T>) reverts changes new LightblueResponse#parseProceseed method. Why</technical_language>

Target:
public <T> T data(LightblueRequest lightblueRequest, Class<T> type) throws IOException { LightblueResponse response = data(lightblueRequest); try { return response.parseProcessed(type); } catch (RuntimeException | LightblueResponseParseException e) { throw new LightblueHttpClientException("Error sending lightblue request: " + lightblueRequest.getBody(), e); } }
Source:
<code>public void runTask() { JobConfig jobConfig = new JobConfig(this.config); <START> String taskName = new TaskConfig(config).getTaskClass().get(); <END> if (taskName == null) { throw new SamzaException("Neither APP nor task.class are defined defined"); } LOG.info("LocalApplicationRunner will run " + taskName); LocalStreamProcessorLifeCycleListener listener = new LocalStreamProcessorLifeCycleListener(); StreamProcessor processor = createStreamProcessor(jobConfig, null, listener); listener.setProcessor(processor); processor.start(); }</code><technical_language>get() throw if taskClass is defined, instead of returning null. I do a scala option.exists() orElse()</technical_language>

Target:
public void runTask() { JobConfig jobConfig = new JobConfig(this.config); String taskName = new TaskConfig(config).getTaskClass().getOrElse(null); if (taskName == null) { throw new SamzaException("Neither APP nor task.class are defined defined"); } LOG.info("LocalApplicationRunner will run " + taskName); LocalStreamProcessorLifeCycleListener listener = new LocalStreamProcessorLifeCycleListener(); StreamProcessor processor = createStreamProcessor(jobConfig, null, listener); numProcessorsToStart.set(1); listener.setProcessor(processor); processor.start(); }
Source:
<code>public void testValidationChecksumBuilderChecksumEmptyCollection() { final Log log = mock(Log.class); final Builder builder = new ValidationChecksum.Builder(log, checksumdirectory); final ValidationChecksum checksum = builder.checksum(emptyList()); <START> assertNotNull(checksum); <END> assertFalse(checksum.checkValidation()); }</code><technical_language>please assert4j - assertThat ...</technical_language>

Target:
public void testValidationChecksumBuilderChecksumEmptyCollection() { final Builder builder = new ValidationChecksum.Builder().destination(checksumdirectory); final ValidationChecksum checksum = builder.artifacts(emptyList()).build(); assertThat(checksum).isNotNull(); assertThat(checksum.checkValidation()).isFalse(); }
Source:
<code>private SegmentNameGenerator getSegmentNameGenerator(TableConfig tableConfig, Schema schema, SegmentConfig segmentConfig) { String rawTableName = TableNameBuilder.extractRawTableName(tableConfig.getTableName()); String segmentNameGeneratorType = segmentConfig.getSegmentNameGeneratorType(); if (segmentNameGeneratorType == null) { segmentNameGeneratorType = SIMPLE_SEGMENT_NAME_GENERATOR; } switch (segmentNameGeneratorType) { case SIMPLE_SEGMENT_NAME_GENERATOR: return new SimpleSegmentNameGenerator(rawTableName, segmentConfig.getSegmentPostfix()); case NORMALIZED_DATE_SEGMENT_NAME_GENERATOR: Preconditions.checkState(tableConfig != null, <START> "In order to use NormalizedDateSegmentNameGenerator, table config must be provided"); <END> SegmentsValidationAndRetentionConfig validationConfig = tableConfig.getValidationConfig(); DateTimeFormatSpec dateTimeFormatSpec = null; String timeColumnName = tableConfig.getValidationConfig().getTimeColumnName(); if (timeColumnName != null) { DateTimeFieldSpec dateTimeFieldSpec = schema.getSpecForTimeColumn(timeColumnName); if (dateTimeFieldSpec != null) { dateTimeFormatSpec = new DateTimeFormatSpec(dateTimeFieldSpec.getFormat()); } } return new NormalizedDateSegmentNameGenerator(rawTableName, segmentConfig.getSegmentPrefix(), segmentConfig.getExcludeSequenceId(), validationConfig.getSegmentPushType(), validationConfig.getSegmentPushFrequency(), dateTimeFormatSpec, segmentConfig.getSegmentPostfix()); default: throw new UnsupportedOperationException("Unsupported segment name generator type: " + segmentNameGeneratorType); } }</code><technical_language>Nit: rephrased "Table config required NormalizedDate..."</technical_language>

Target:
private SegmentNameGenerator getSegmentNameGenerator(TableConfig tableConfig, Schema schema, SegmentConfig segmentConfig) { String rawTableName = TableNameBuilder.extractRawTableName(tableConfig.getTableName()); String segmentNameGeneratorType = segmentConfig.getSegmentNameGeneratorType(); if (segmentNameGeneratorType == null) { segmentNameGeneratorType = SIMPLE_SEGMENT_NAME_GENERATOR; } switch (segmentNameGeneratorType) { case SIMPLE_SEGMENT_NAME_GENERATOR: return new SimpleSegmentNameGenerator(rawTableName, segmentConfig.getSegmentPostfix()); case NORMALIZED_DATE_SEGMENT_NAME_GENERATOR: SegmentsValidationAndRetentionConfig validationConfig = tableConfig.getValidationConfig(); DateTimeFormatSpec dateTimeFormatSpec = null; String timeColumnName = tableConfig.getValidationConfig().getTimeColumnName(); if (timeColumnName != null) { DateTimeFieldSpec dateTimeFieldSpec = schema.getSpecForTimeColumn(timeColumnName); if (dateTimeFieldSpec != null) { dateTimeFormatSpec = new DateTimeFormatSpec(dateTimeFieldSpec.getFormat()); } } return new NormalizedDateSegmentNameGenerator(rawTableName, segmentConfig.getSegmentPrefix(), segmentConfig.getExcludeSequenceId(), validationConfig.getSegmentPushType(), validationConfig.getSegmentPushFrequency(), dateTimeFormatSpec, segmentConfig.getSegmentPostfix()); default: throw new UnsupportedOperationException("Unsupported segment name generator type: " + segmentNameGeneratorType); } }
Source:
<code>public void extractSingle() { assertEquals(foo, <START> new Or<String>( <END> new And<String>(foo, bar), foo ).simplify()); }</code><technical_language>diamond operator, too, for Or<> And<> operators</technical_language>

Target:
public void extractSingle() { assertEquals(foo, new Or<>( new And<>(foo, bar), foo ).simplify()); }
Source:
<code>public TransactionAndImmutableTsLock setupRunTaskWithConditionThrowOnConflict(PreCommitCondition condition) { StartTransactionWithWatchesResponse responseWithWatches = timelockService <START> .startTransactionWithWatches(OptionalLong.empty()); <END> StartIdentifiedAtlasDbTransactionResponse transactionResponse = responseWithWatches.response(); try { LockToken immutableTsLock = transactionResponse.immutableTimestamp().getLock(); long immutableTs = transactionResponse.immutableTimestamp().getImmutableTimestamp(); recordImmutableTimestamp(immutableTs); cleaner.punch(transactionResponse.startTimestampAndPartition().timestamp()); Supplier<Long> startTimestampSupplier = Suppliers.ofInstance( transactionResponse.startTimestampAndPartition().timestamp()); Transaction transaction = createTransaction( immutableTs, startTimestampSupplier, immutableTsLock, condition); return TransactionAndImmutableTsLock.of(transaction, immutableTsLock); } catch (Throwable e) { timelockService.tryUnlock(ImmutableSet.of(transactionResponse.immutableTimestamp().getLock())); throw Throwables.rewrapAndThrowUncheckedException(e); } }</code><technical_language>I TimelockService gain a method related lock watches - maintaining this state some part of hierarchy _below_ timelock service</technical_language>

Target:
public TransactionAndImmutableTsLock setupRunTaskWithConditionThrowOnConflict(PreCommitCondition condition) { StartIdentifiedAtlasDbTransactionResponse transactionResponse = timelockService.startIdentifiedAtlasDbTransaction(); try { LockToken immutableTsLock = transactionResponse.immutableTimestamp().getLock(); long immutableTs = transactionResponse.immutableTimestamp().getImmutableTimestamp(); recordImmutableTimestamp(immutableTs); cleaner.punch(transactionResponse.startTimestampAndPartition().timestamp()); Supplier<Long> startTimestampSupplier = Suppliers.ofInstance( transactionResponse.startTimestampAndPartition().timestamp()); Transaction transaction = createTransaction( immutableTs, startTimestampSupplier, immutableTsLock, condition); return TransactionAndImmutableTsLock.of(transaction, immutableTsLock); } catch (Throwable e) { timelockService.tryUnlock(ImmutableSet.of(transactionResponse.immutableTimestamp().getLock())); throw Throwables.rewrapAndThrowUncheckedException(e); } }
Source:
<code>public void testQueueConsumerPriority() throws JMSException, InterruptedException { connection.start(); Session consumerLowPriority = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Session consumerHighPriority = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); assertNotNull(consumerHighPriority); Session senderSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); String queueName = "QUEUE.A"; ActiveMQQueue low = new ActiveMQQueue(queueName + "?consumer.priority=1"); MessageConsumer lowConsumer = consumerLowPriority.createConsumer(low); ActiveMQQueue high = new ActiveMQQueue(queueName + "?consumer.priority=2"); MessageConsumer highConsumer = consumerLowPriority.createConsumer(high); ActiveMQQueue senderQueue = new ActiveMQQueue(queueName); MessageProducer producer = senderSession.createProducer(senderQueue); Message msg = senderSession.createTextMessage("test"); for (int i = 0; i < 1000; i++) { producer.send(msg); assertNotNull("null on iteration: " + i, highConsumer.receive(1000)); } <START> assertNull(lowConsumer.receive(2000)); <END> }</code><technical_language>a receiveNoWait (either in loop) other tests nicer burning 2 seconds? Slow tests is a key reason eventually wants runs tests :)</technical_language>

Target:
public void testQueueConsumerPriority() throws JMSException, InterruptedException { connection.start(); Session consumerLowPriority = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Session consumerHighPriority = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); assertNotNull(consumerHighPriority); Session senderSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); String queueName = "QUEUE.A"; ActiveMQQueue low = new ActiveMQQueue(queueName + "?consumer.priority=1"); MessageConsumer lowConsumer = consumerLowPriority.createConsumer(low); ActiveMQQueue high = new ActiveMQQueue(queueName + "?consumer.priority=2"); MessageConsumer highConsumer = consumerLowPriority.createConsumer(high); ActiveMQQueue senderQueue = new ActiveMQQueue(queueName); MessageProducer producer = senderSession.createProducer(senderQueue); Message msg = senderSession.createTextMessage("test"); for (int i = 0; i < 1000; i++) { producer.send(msg); assertNotNull("null on iteration: " + i, highConsumer.receive(1000)); } assertNull(lowConsumer.receive(250)); }
Source:
<code>private String getUriExceptionText(Configuration conf) { final String URI_EXCEPTION_TEXT = "Ozone file system URL " + "should be one of the following formats: " + "o3fs://bucket.volume/key OR " + "o3fs://bucket.volume.om-host.example.com/key OR " + "o3fs://bucket.volume.om-host.example.com:" + <START> OmUtils.getOmRpcPort(conf) + "/key"; <END> return URI_EXCEPTION_TEXT; }</code><technical_language>This work here, configuration object instance of OzoneConfiguration, ozone-site.xml ozone-default.xml added resources. check is done BasicOzoneClientAdapterImpl.java <LINK_0></technical_language>

Target:
private String getUriExceptionText(Configuration conf) { return "Ozone file system URL should be one of the following formats: " + "o3fs://bucket.volume/key OR " + "o3fs://bucket.volume.om-host.example.com/key OR " + "o3fs://bucket.volume.om-host.example.com:" + OmUtils.getOmRpcPort(getOzoneConf(conf)) + "/key"; }
Source:
<code>public void removeDeploymentGroup(final String name) throws DeploymentGroupDoesNotExistException { log.info("removing deployment-group: name={}", name); final ZooKeeperClient client = provider.get("removeDeploymentGroup"); try { client.ensurePath(Paths.configDeploymentGroups()); client.ensurePath(Paths.statusDeploymentGroups()); final List<ZooKeeperOperation> operations = Lists.newArrayList(); operations.add(delete(Paths.configDeploymentGroup(name))); operations.add(delete(Paths.statusDeploymentGroupHosts(name))); <START> operations.add(delete(Paths.statusDeploymentGroupRollingOps(name))); <END> operations.add(delete(Paths.statusDeploymentGroup(name))); client.transaction(operations); } catch (final NoNodeException e) { throw new DeploymentGroupDoesNotExistException(name); } catch (final KeeperException e) { throw new HeliosRuntimeException("removing deployment-group " + name + " failed", e); } }</code><technical_language>Is intentional remove /config/rolling-operations/<uuid>, /status/rolling-operations/<uuid>, /status/rolling-operations-tasks/<uuid></technical_language>

Target:
public void removeDeploymentGroup(final String name) throws DeploymentGroupDoesNotExistException { log.info("removing deployment-group: name={}", name); final ZooKeeperClient client = provider.get("removeDeploymentGroup"); try { client.ensurePath(Paths.configDeploymentGroups()); client.ensurePath(Paths.statusDeploymentGroups()); final List<ZooKeeperOperation> operations = Lists.newArrayList(); for (final String id : getRollingOperationIds(client, name)) { removeRollingOperation(client, operations, id); } operations.add(delete(Paths.configDeploymentGroup(name))); operations.add(delete(Paths.statusDeploymentGroupHosts(name))); operations.add(delete(Paths.statusDeploymentGroupRollingOps(name))); operations.add(delete(Paths.statusDeploymentGroup(name))); client.transaction(operations); } catch (final NoNodeException e) { throw new DeploymentGroupDoesNotExistException(name); } catch (final KeeperException e) { throw new HeliosRuntimeException("removing deployment-group " + name + " failed", e); } }
Source:
<code>public void initBiomeGensRTG(WorldTypeEvent.InitBiomeGens event) { if (!(event.worldType instanceof WorldTypeRTG)) { <START> return; <END> } if (event.newBiomeGens[0].getClass().getName().contains("GenLayerEB")) { return; } try { event.newBiomeGens = new RiverRemover().riverLess(event.originalBiomeGens); } catch (ClassCastException ex) { } }</code><technical_language>@whichonespink44 registering of event handlers pre-init, registered this point if creating a world is a RTG WorldType. returning prevents river remover initialised, need unregister other event handlers interfere in a non-RTG world. java if (!(event.worldType instanceof WorldTypeRTG)) { unRegisterEventHandlers(); return; }</technical_language>

Target:
public void initBiomeGensRTG(WorldTypeEvent.InitBiomeGens event) { if (!(event.worldType instanceof WorldTypeRTG)) { unRegisterEventHandlers(); return; } if (event.newBiomeGens[0].getClass().getName().contains("GenLayerEB")) { return; } try { event.newBiomeGens = new RiverRemover().riverLess(event.originalBiomeGens); } catch (ClassCastException ex) { } }
Source:
<code>public void start() throws Exception { Router router = Router.router(vertx); router.route().handler(BodyHandler.create()); router.route("/").handler(routingContext -> { routingContext.response().putHeader("content-type", "text/html").end( "<form action=\"/form\" method=\"post\">\n" + " <div>\n" + " <label for=\"name\">Enter your name:</label>\n" + " <input type=\"text\" id=\"name\" name=\"name\" />\n" + " </div>\n" + " <div class=\"button\">\n" + " <button type=\"submit\">Send</button>\n" + " </div>" + "</form>" ); }); router.post("/form").handler(ctx -> { ctx.response().putHeader(HttpHeaders.CONTENT_TYPE, "text/plain"); <START> ctx.response().end("Hello " + ctx.request().getFormAttribute("name") + "!"); <END> }); vertx.createHttpServer().requestHandler(router::accept).listen(8080); }</code><technical_language>params() default put in params :)</technical_language>

Target:
public void start() throws Exception { Router router = Router.router(vertx); router.route().handler(BodyHandler.create()); router.route("/").handler(routingContext -> { routingContext.response().putHeader("content-type", "text/html").end( "<form action=\"/form\" method=\"post\">\n" + " <div>\n" + " <label for=\"name\">Enter your name:</label>\n" + " <input type=\"text\" id=\"name\" name=\"name\" />\n" + " </div>\n" + " <div class=\"button\">\n" + " <button type=\"submit\">Send</button>\n" + " </div>" + "</form>" ); }); router.post("/form").handler(ctx -> { ctx.response().putHeader(HttpHeaders.CONTENT_TYPE, "text/plain"); ctx.response().end("Hello " + ctx.request().getParam("name") + "!"); }); vertx.createHttpServer().requestHandler(router::accept).listen(8080); }
Source:
<code>public long run (String start, String end) { voltQueueSQL(selAcct, EXPECT_NON_EMPTY, start, end); voltQueueSQL(selActv, start, end); <START> VoltTable results[] = voltExecuteSQL(true); <END> return 1; }</code><technical_language>here? run selects do nothing</technical_language>

Target:
public long run (String start, String end) { int startPan = Integer.parseInt(start); int endPan = Integer.parseInt(end); double totalBalance = 0; double totalTransfer = 0; voltQueueSQL(selAcct, EXPECT_NON_EMPTY, start, end); voltQueueSQL(selActv, start, end); VoltTable results[] = voltExecuteSQL(true); VoltTable tb1 = results[0]; while (tb1.advanceRow()) { totalBalance += tb1.getDouble(3); } VoltTable tb2 = results[1]; while (tb2.advanceRow()) { totalTransfer += tb2.getDouble(4); } return totalTransfer > totalBalance ? 1 : 0; }
Source:
<code>public void makeString(Token t, int quotes, Str strToFill) { String s = t.image; char quoteChar = s.charAt(0); int start = 0; boolean ustring = false; boolean bstring = false; boolean fstring = false; if (quoteChar == 'u' || quoteChar == 'U') { ustring = true; start++; } else if (quoteChar == 'b' || quoteChar == 'B') { bstring = true; start++; } else if (quoteChar == 'f' || quoteChar == 'F') { fstring = true; start++; } quoteChar = s.charAt(start); if (quoteChar == 'r' || quoteChar == 'R') { if (start == 0) { char quoteCharAux = s.charAt(1); if (quoteCharAux == 'f' || quoteCharAux == 'F') { fstring = true; start++; } else if (quoteCharAux == 'b' || quoteCharAux == 'B') { bstring = true; start++; } } String str; if (bstring) { <START> str = 'b' + s.substring(quotes + start, s.length() - quotes + 1); <END> } else { str = s.substring(quotes + start + 1, s.length() - quotes); } strToFill.type = getType(s.charAt(start + 1), quotes); strToFill.s = str; strToFill.unicode = ustring; strToFill.raw = true; strToFill.binary = bstring; strToFill.fstring = fstring; } else { int n = s.length() - quotes; int i = quotes + start; String str = s.substring(i, n); strToFill.type = getType(s.charAt(start), quotes); strToFill.s = str; strToFill.unicode = ustring; strToFill.raw = false; strToFill.binary = bstring; strToFill.fstring = fstring; } }</code><technical_language>Humm, is this done here? I need special treatment for str here..</technical_language>

Target:
public void makeString(Token t, int quotes, Str strToFill) { String s = t.image; char quoteChar = s.charAt(0); int start = 0; boolean ustring = false; boolean bstring = false; boolean fstring = false; if (quoteChar == 'u' || quoteChar == 'U') { ustring = true; start++; } else if (quoteChar == 'b' || quoteChar == 'B') { bstring = true; start++; } else if (quoteChar == 'f' || quoteChar == 'F') { fstring = true; start++; } quoteChar = s.charAt(start); if (quoteChar == 'r' || quoteChar == 'R') { if (start == 0) { char quoteCharAux = s.charAt(1); if (quoteCharAux == 'f' || quoteCharAux == 'F') { fstring = true; start++; } else if (quoteCharAux == 'b' || quoteCharAux == 'B') { bstring = true; start++; } } String str = s.substring(quotes + start + 1, s.length() - quotes); strToFill.type = getType(s.charAt(start + 1), quotes); strToFill.s = str; strToFill.unicode = ustring; strToFill.raw = true; strToFill.binary = bstring; strToFill.fstring = fstring; } else { int n = s.length() - quotes; int i = quotes + start; String str = s.substring(i, n); strToFill.type = getType(s.charAt(start), quotes); strToFill.s = str; strToFill.unicode = ustring; strToFill.raw = false; strToFill.binary = bstring; strToFill.fstring = fstring; } }
Source:
<code>protected void setUp() throws Exception { super.setUp(); if(!hasWifi()) { return; } mWifiManager = (WifiManager) mContext .getSystemService(Context.WIFI_SERVICE); assertNotNull(mWifiManager); SystemUtil.runShellCommand("svc wifi enable"); Thread.sleep(ENABLE_DELAY); <START> if (hasWifi()) { <END> assertTrue(mWifiManager.isWifiEnabled()); } }</code><technical_language>Wifi omit function, this if removed</technical_language>

Target:
protected void setUp() throws Exception { super.setUp(); if(!hasWifi()) { return; } mWifiManager = (WifiManager) mContext .getSystemService(Context.WIFI_SERVICE); assertNotNull(mWifiManager); SystemUtil.runShellCommand("svc wifi enable"); Thread.sleep(ENABLE_DELAY); assertTrue(mWifiManager.isWifiEnabled()); }
Source:
<code><START> public Message getMessage() { <END> return message; }</code><technical_language>Message<?></technical_language>

Target:
public Message<?> getMessage() { return message; }
Source:
<code>public String toString() { StringBuilder sb = new StringBuilder(); appendModifier(sb, dynamicEMFMode, DYNAMIC_EMF_MODE_DEFAULT, "dynamicEMF"); appendModifier(sb, wildcardMode, WILDCARD_MODE_DEFAULT, "wildcard"); appendModifier(sb, traverseOnlyWellBehavingDerivedFeatures, TRAVERS_ONLY_WELLBEHAVING_DERIVED_FEATURES_DEFAULT, "wellBehavingOnly"); appendModifier(sb, notifierFilterConfiguration, null, "notifierFilter="); appendModifier(sb, resourceFilterConfiguration, null, "resourceFilter="); appendModifier(sb, featureFilterConfiguration, null, "featureFilterConfiguration="); <START> appendModifier(sb, strictNotificationMode, STRICT_NOTIFICATION_MODE_DEFAULT, "strictNotificationMode"); <END> final String result = sb.toString(); return result.isEmpty() ? "defaults" : result; }</code><technical_language>Move a lines, Boolean switches parametric modifiers</technical_language>

Target:
public String toString() { StringBuilder sb = new StringBuilder(); appendModifier(sb, dynamicEMFMode, DYNAMIC_EMF_MODE_DEFAULT, "dynamicEMF"); appendModifier(sb, wildcardMode, WILDCARD_MODE_DEFAULT, "wildcard"); appendModifier(sb, traverseOnlyWellBehavingDerivedFeatures, TRAVERS_ONLY_WELLBEHAVING_DERIVED_FEATURES_DEFAULT, "wellBehavingOnly"); appendModifier(sb, strictNotificationMode, STRICT_NOTIFICATION_MODE_DEFAULT, "strictNotificationMode"); appendModifier(sb, notifierFilterConfiguration, null, "notifierFilter="); appendModifier(sb, resourceFilterConfiguration, null, "resourceFilter="); appendModifier(sb, featureFilterConfiguration, null, "featureFilterConfiguration="); final String result = sb.toString(); return result.isEmpty() ? "defaults" : result; }
Source:
<code>public void handleRequest(final HttpServerExchange exchange) throws Exception { boolean decodeDone = exchange.getConnection().getUndertowOptions().get(UndertowOptions.DECODE_URL, true); <START> if (!decodeDone) { <END> final StringBuilder sb = getStringBuilderForDecoding(exchange); decodePath(exchange, charset, sb); decodeQueryString(exchange, charset, sb); decodePathTemplateMatch(exchange, charset, sb); } next.handleRequest(exchange); }</code><technical_language>I attachment key ok, existing check (i.e. adding attachment key exchanges encoding handled listener)</technical_language>

Target:
public void handleRequest(final HttpServerExchange exchange) throws Exception { if (shouldDecode(exchange)) { final StringBuilder sb = getStringBuilderForDecoding(exchange); decodePath(exchange, charset, sb); decodeQueryString(exchange, charset, sb); decodePathTemplateMatch(exchange, charset, sb); } next.handleRequest(exchange); }
Source:
<code>public static ITextWrapper get(final TextWrapperStrategy strategy, final Text text) { switch (strategy) { case BOUNDS_AND_LINE_BREAKS: return new TextBoundsAndLineBreaksWrap(text); case LINE_BREAK: return new TextLineBreakWrap(text); case NO_WRAP: return new TextNoWrap(text); case TRUNCATE: return new TextTruncateWrapper(text, new BoundingBox(0, 0, 1, 1)); default: <START> case BOUNDS: <END> return new TextBoundsWrap(text); } }</code><technical_language>worth case for default</technical_language>

Target:
public static ITextWrapper get(final TextWrapperStrategy strategy, final Text text) { switch (strategy) { case BOUNDS_AND_LINE_BREAKS: return new TextBoundsAndLineBreaksWrap(text); case LINE_BREAK: return new TextLineBreakWrap(text); case NO_WRAP: return new TextNoWrap(text); case TRUNCATE: return new TextTruncateWrapper(text, new BoundingBox(0, 0, 1, 1)); default: return new TextBoundsWrap(text); } }
Source:
<code>public void testGetAllEmptyRequestWithLoader() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.<String, String>emptyMap()); this.store = spy(fakeStore); final FakeCacheLoaderWriter fakeLoaderWriter = new FakeCacheLoaderWriter(TEST_ENTRIES); this.loaderWriter = spy(fakeLoaderWriter); final Ehcache<String, String> ehcache = this.getEhcache(this.loaderWriter); final Map<String, String> actual = ehcache.getAll(Collections.<String>emptySet()); final Map<String, String> expected = Collections.emptyMap(); assertThat(actual, equalTo(expected)); verify(this.store, never()).bulkComputeIfAbsent(eq(Collections.<String>emptySet()), getAnyIterableFunction()); verify(this.spiedResilienceStrategy, never()) <START> .getAllFailure(eq(Collections.<String>emptySet()), any(CacheAccessException.class)); <END> verifyZeroInteractions(this.store, this.spiedResilienceStrategy, this.loaderWriter); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.GetOutcome.class)); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.CacheLoadingOutcome.class)); }</code><technical_language>deal: verifications redundant</technical_language>

Target:
public void testGetAllEmptyRequestWithLoader() throws Exception { final FakeStore fakeStore = new FakeStore(Collections.<String, String>emptyMap()); this.store = spy(fakeStore); final FakeCacheLoaderWriter fakeLoaderWriter = new FakeCacheLoaderWriter(TEST_ENTRIES); this.loaderWriter = spy(fakeLoaderWriter); final Ehcache<String, String> ehcache = this.getEhcache(this.loaderWriter); final Map<String, String> actual = ehcache.getAll(Collections.<String>emptySet()); final Map<String, String> expected = Collections.emptyMap(); assertThat(actual, equalTo(expected)); verify(this.store, never()).bulkComputeIfAbsent(eq(Collections.<String>emptySet()), getAnyIterableFunction()); verify(this.spiedResilienceStrategy, never()).getAllFailure(eq(Collections.<String>emptySet()), any(CacheAccessException.class)); verify(this.loaderWriter, never()).loadAll(eq(Collections.<String>emptySet())); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.GetOutcome.class)); validateStats(ehcache, EnumSet.noneOf(CacheOperationOutcomes.CacheLoadingOutcome.class)); }
Source:
<code>public CorfuTable(IndexRegistry<K, V> indices, Supplier<StreamingMap<K, V>> streamingMapSupplier) { this.indexSpec = new HashSet<>(); this.secondaryIndexes = new HashMap<>(); this.mainMap = streamingMapSupplier.get(); <START> this.optimisticTable = new CorfuTable<>(this.mainMap.getOptimisticMap(), this.indexSpec, <END> this.secondaryIndexes, null); indices.forEach(index -> { secondaryIndexes.put(index.getName().get(), new HashMap<>()); indexSpec.add(index); }); log.info("CorfuTable: creating CorfuTable with the following indexes: {}", secondaryIndexes.keySet()); }</code><technical_language>optimisitcTable breaks abstraction of SMR. optimstic updates assume initial table is empty. This is correct for CorfuTable keys orthogonal, is true for general SMR</technical_language>

Target:
public CorfuTable(IndexRegistry<K, V> indices, Supplier<StreamingMap<K, V>> streamingMapSupplier) { this(indices, streamingMapSupplier, ICorfuVersionPolicy.DEFAULT); }
Source:
<code>private CircuitBreakerMetrics(String prefix, Iterable<CircuitBreaker> circuitBreakers) { requireNonNull(prefix); requireNonNull(circuitBreakers); circuitBreakers.forEach(circuitBreaker -> { String name = circuitBreaker.getName(); CircuitBreaker.Metrics metrics = circuitBreaker.getMetrics(); <START> metricRegistry.register(name(prefix, name, STATE), <END> (Gauge<Integer>)()-> circuitBreaker.getState().ordinal()); metricRegistry.register(name(prefix, name, SUCCESSFUL), (Gauge<Integer>) metrics::getNumberOfSuccessfulCalls); metricRegistry.register(name(prefix, name, FAILED), (Gauge<Integer>) metrics::getNumberOfFailedCalls); metricRegistry.register(name(prefix, name, NOT_PERMITTED), (Gauge<Long>) metrics::getNumberOfNotPermittedCalls); metricRegistry.register(name(prefix, name, BUFFERED), (Gauge<Integer>) metrics::getNumberOfBufferedCalls); metricRegistry.register(name(prefix, name, BUFFERED_MAX), (Gauge<Integer>) metrics::getMaxNumberOfBufferedCalls); } ); }</code><technical_language>@eleduardo, prefer add explicit final int field CircuitBreaker.State, enum elements reordering affect of users</technical_language>

Target:
private CircuitBreakerMetrics(String prefix, Iterable<CircuitBreaker> circuitBreakers) { requireNonNull(prefix); requireNonNull(circuitBreakers); circuitBreakers.forEach(circuitBreaker -> { String name = circuitBreaker.getName(); CircuitBreaker.Metrics metrics = circuitBreaker.getMetrics(); metricRegistry.register(name(prefix, name, STATE), (Gauge<Integer>)()-> circuitBreaker.getState().getOrder()); metricRegistry.register(name(prefix, name, SUCCESSFUL), (Gauge<Integer>) metrics::getNumberOfSuccessfulCalls); metricRegistry.register(name(prefix, name, FAILED), (Gauge<Integer>) metrics::getNumberOfFailedCalls); metricRegistry.register(name(prefix, name, NOT_PERMITTED), (Gauge<Long>) metrics::getNumberOfNotPermittedCalls); metricRegistry.register(name(prefix, name, BUFFERED), (Gauge<Integer>) metrics::getNumberOfBufferedCalls); metricRegistry.register(name(prefix, name, BUFFERED_MAX), (Gauge<Integer>) metrics::getMaxNumberOfBufferedCalls); } ); }
Source:
<code>public List<VDS> filter(SchedulingContext context, List<VDS> hosts, VM vm, PerHostMessages messages) { List<String> vmMDevs = getMDevsFromCustomProperties(vm); if (vmMDevs.isEmpty()) { return hosts; } List<VDS> list = new ArrayList<>(); for (VDS host : hosts) { List<MDevType> hostMDevs = getMDevsForHost(host, vmMDevs); List<String> missingMDevs = getMissingMDevsForHost(hostMDevs, vmMDevs); if (!missingMDevs.isEmpty()) { messages.addMessage(host.getId(), String.format("$missingMDevs %1$s", StringUtils.join(missingMDevs, ","))); messages.addMessage(host.getId(), EngineMessage.VAR__DETAIL__HOST_MDEV_DEVICE_MISSING.toString()); <START> log.info("Host <END> '{}' is missing required mDev devices ({}))", host.getName(), StringUtils.join(missingMDevs, ", ")); continue; } List<String> unavailableMDevs = getUnavailableMDevsForHost(hostMDevs, vmMDevs); if (!unavailableMDevs.isEmpty()) { messages.addMessage(host.getId(), String.format("$unavailableMDevs %1$s", StringUtils.join(unavailableMDevs, ","))); messages.addMessage(host.getId(), EngineMessage.VAR__DETAIL__HOST_MDEV_DEVICE_UNAVAILABLE.toString()); log.info("Host '{}' has required mDev devices with no available instances ({}))", host.getName(), StringUtils.join(missingMDevs, ", ")); continue; } list.add(host); } return list; }</code><technical_language>policy unit called often, 'info' level pollute logs. Please change 'debug', surround a condition if(log.isDebugEnabled()), parameters evaluated if needed</technical_language>

Target:
public List<VDS> filter(SchedulingContext context, List<VDS> hosts, VM vm, PerHostMessages messages) { List<String> vmMDevs = getMDevsFromCustomProperties(vm); if (vmMDevs.isEmpty()) { return hosts; } List<VDS> list = new ArrayList<>(); for (VDS host : hosts) { List<MDevType> hostMDevs = getMDevsForHost(host, vmMDevs); List<String> missingMDevs = getMissingMDevsForHost(hostMDevs, vmMDevs); if (!missingMDevs.isEmpty()) { messages.addMessage(host.getId(), String.format("$missingMDevs %1$s", StringUtils.join(missingMDevs, ","))); messages.addMessage(host.getId(), EngineMessage.VAR__DETAIL__HOST_MDEV_DEVICE_MISSING.toString()); log.debug("Host '{}' is missing required mDev devices ({}))", host.getName(), StringUtils.join(missingMDevs, ", ")); continue; } List<String> unavailableMDevs = getUnavailableMDevsForHost(hostMDevs, vmMDevs); if (!unavailableMDevs.isEmpty()) { messages.addMessage(host.getId(), String.format("$unavailableMDevs %1$s", StringUtils.join(unavailableMDevs, ","))); messages.addMessage(host.getId(), EngineMessage.VAR__DETAIL__HOST_MDEV_DEVICE_UNAVAILABLE.toString()); log.debug("Host '{}' has required mDev devices with no available instances ({}))", host.getName(), StringUtils.join(missingMDevs, ", ")); continue; } list.add(host); } return list; }
Source:
<code>private void collectPaths(Object o, List<IPath> result) { if (o instanceof Iterable<?>) { ((Iterable<?>) o).forEach(child -> collectPaths(child, result)); } else if (o instanceof StagingFolderEntry) { collectPaths(Arrays.asList(((StagingFolderEntry) <START> o).getChildren()), <END> result); } else if (o instanceof StagingEntry) { result.add(AdapterUtils.adapt(o, IPath.class)); } }</code><technical_language>another problem relating filters. This applies action files, filtered out ones. Stage/unstage applies visible nodes. consistent. I mean: a test project a folder foo files A.txt B.txt. Modify both. Enter "foo/A" in filter box in staging view's toolbar Compact Tree View enabled. foo/A.txt visible in unstaged viewer. choose "Untrack". Staged viewer shows deletion of foo/A.txt. clear filter text in toolbar. Oops, foo/B.txt removed index. stage(), I contentProvider.getStagingEntriesFiltered() get children of a StagingFolderEntry. I done here, too. (I stage() a funny "if StagingEntry else if StagingFolderEntry else {}" structure. I else-branch good for... a leftover code. AFAIK StagingEntry StagingFolderEntry elements in tree. unstage() a else part either. some more clean-up duplicate code unification needed here; in a commit.)</technical_language>

Target:
private void collectPaths(Object o, List<IPath> result) { if (o instanceof Iterable<?>) { ((Iterable<?>) o).forEach(child -> collectPaths(child, result)); } else if (o instanceof StagingFolderEntry) { StagingViewContentProvider contentProvider = getContentProvider(unstagedViewer); List<StagingEntry> entries = contentProvider .getStagingEntriesFiltered((StagingFolderEntry) o); collectPaths(entries, result); } else if (o instanceof StagingEntry) { result.add(AdapterUtils.adapt(o, IPath.class)); } }
Source:
<code>private void startListenForPhoneState() { if (!mListening) { int subId = SubscriptionManager.getDefaultSubscriptionId(); if (SubscriptionManager.isValidSubscriptionId(subId)) { mPhoneStateListener = new HeadsetPhoneStateListener(subId, mHeadsetService.getStateMachinesThreadLooper()); mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_SERVICE_STATE | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS); mTelephonyManager.setRadioIndicationUpdateMode( <START> TelephonyManager.INDICATION_FILTER_FULL_NETWORK_STATE <END> | TelephonyManager.INDICATION_FILTER_SIGNAL_STRENGTH, TelephonyManager.INDICATION_UPDATE_MODE_IGNORE_SCREEN_OFF); mListening = true; } else { Log.w(TAG, "startListenForPhoneState, invalid subscription ID " + subId); } } }</code><technical_language>I need this. This is for turning insignificant network updates (e.g. cell tower info) screen is off</technical_language>

Target:
private void startListenForPhoneState() { if (!mListening) { int subId = SubscriptionManager.getDefaultSubscriptionId(); if (SubscriptionManager.isValidSubscriptionId(subId)) { mPhoneStateListener = new HeadsetPhoneStateListener(subId, mHeadsetService.getStateMachinesThreadLooper()); mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_SERVICE_STATE | PhoneStateListener.LISTEN_SIGNAL_STRENGTHS); mTelephonyManager.setRadioIndicationUpdateMode( TelephonyManager.INDICATION_FILTER_SIGNAL_STRENGTH, TelephonyManager.INDICATION_UPDATE_MODE_IGNORE_SCREEN_OFF); mListening = true; } else { Log.w(TAG, "startListenForPhoneState, invalid subscription ID " + subId); } } }
Source:
<code>public List<String> unwrap(final ExpressionResolver context, final ModelNode model) throws OperationFailedException { <START> return unwrapValue(context, model.get(getName())); <END> }</code><technical_language>This mutate 'model' if model.has(...) return false. a big deal, more robust to</technical_language>

Target:
public List<String> unwrap(final ExpressionResolver context, final ModelNode model) throws OperationFailedException { if (!model.hasDefined(getName())){ return Collections.emptyList(); } return unwrapValue(context, model.get(getName())); }
Source:
<code>public int read(long position, byte[] buffer, int offset, int length) throws IOException { checkStream(); <START> if (in instanceof PositionedReadable) { <END> final int n = ((PositionedReadable) in).read(position, buffer, offset, length); if (n > 0) { decrypt(position, buffer, offset, n); } return n; } else { throw new UnsupportedOperationException("This stream does not support " + "positioned read."); } }</code><technical_language>nit: do mind negating this check un-indent rest of method? ("early return" style)</technical_language>

Target:
public int read(long position, byte[] buffer, int offset, int length) throws IOException { checkStream(); if (!(in instanceof PositionedReadable)) { throw new UnsupportedOperationException("This stream does not support " + "positioned read."); } final int n = ((PositionedReadable) in).read(position, buffer, offset, length); if (n > 0) { decrypt(position, buffer, offset, n); } return n; }
Source:
<code>private void loadPolicyExtensions(Properties properties, String extensionType) { int count = 1; String className = null; int size = 0; Enumeration<String> keyValues = (Enumeration<String>) properties.propertyNames(); while (keyValues.hasMoreElements()) { String currentProp = keyValues.nextElement(); if (currentProp.contains(extensionType)) { size++; } } while (size > 0) { className = properties.getProperty(extensionType + "." + count); if (className == null) { count++; <START> size--; <END> continue; } try { Class clazz = Thread.currentThread().getContextClassLoader().loadClass(className); PolicyEnforcer policy = (PolicyEnforcer) clazz.newInstance(); policy.init(getParameters(properties, extensionType, count)); this.policyRegistry.addPolicy((PolicyEnforcer) policy); count++; size--; } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | SecurityException e) { log.error("Error while loading password policies " + className, e); } } }</code><technical_language>is a requirement for password policies work for example order of extensions [1], Password.policy.extensions.1 Password.policy.extensions.4 Password.policy.extensions.6 In case decrementing size satisfy this scenario. [1]. <LINK_0></technical_language>

Target:
private void loadPolicyExtensions(Properties properties, String extensionType) { Set<Integer> count = new HashSet(); Iterator<String> keyValues = properties.stringPropertyNames().iterator(); while (keyValues.hasNext()) { String currentProp = keyValues.next(); if (currentProp.startsWith(extensionType)) { String extensionNumber = currentProp.replaceFirst(extensionType + ".", ""); if (StringUtils.isNumeric(extensionNumber)) { count.add(Integer.parseInt(extensionNumber)); } } } Iterator<Integer> countIterator = count.iterator(); while (countIterator.hasNext()) { Integer extensionIndex = countIterator.next(); String className = properties.getProperty(extensionType + "." + extensionIndex); if (className == null) { continue; } try { Class clazz = Thread.currentThread().getContextClassLoader().loadClass(className); PolicyEnforcer policy = (PolicyEnforcer) clazz.newInstance(); policy.init(getParameters(properties, extensionType, extensionIndex)); this.policyRegistry.addPolicy(policy); } catch (ClassNotFoundException | IllegalAccessException | InstantiationException | SecurityException e) { log.error("Error while loading password policies " + className, e); } } }
Source:
<code>private void testFunctionIndex() throws SQLException { stat.execute("CREATE ALIAS TEST_INDEX FOR \"" + TestIndex.class.getName() + ".testFunctionIndexFunction\""); try (ResultSet rs = stat.executeQuery("SELECT * FROM TEST_INDEX() WHERE ID = 1 OR ID = 3")) { <START> assertTrue(rs.next()); <END> assertEquals(1, rs.getInt(1)); assertEquals(10, rs.getInt(2)); assertTrue(rs.next()); assertEquals(3, rs.getInt(1)); assertEquals(30, rs.getInt(2)); assertFalse(rs.next()); } finally { stat.execute("DROP ALIAS TEST_INDEX"); } }</code><technical_language>this test is verifying call testFunctionIndexFunction once? original bug</technical_language>

Target:
private void testFunctionIndex() throws SQLException { testFunctionIndexCounter = 0; stat.execute("CREATE ALIAS TEST_INDEX FOR \"" + TestIndex.class.getName() + ".testFunctionIndexFunction\""); try (ResultSet rs = stat.executeQuery("SELECT * FROM TEST_INDEX() WHERE ID = 1 OR ID = 3")) { assertTrue(rs.next()); assertEquals(1, rs.getInt(1)); assertEquals(10, rs.getInt(2)); assertTrue(rs.next()); assertEquals(3, rs.getInt(1)); assertEquals(30, rs.getInt(2)); assertFalse(rs.next()); } finally { stat.execute("DROP ALIAS TEST_INDEX"); } assertEquals(1, testFunctionIndexCounter); }
Source:
<code>public static void Init() { Class<?>[] inspectedClassNames = new Class<?>[] { <START> VmBase.class, <END> VM.class, VmStatic.class, VmDynamic.class }; mUpdateVmsStatic = new ObjectIdentityChecker(VmHandler.class, Arrays.asList(inspectedClassNames), VMStatus.class); for (Pair<EditableField,String> pair : BaseHandler.extractyAnnotatedFields(EditableField.class, (inspectedClassNames))) { mUpdateVmsStatic.AddPermittedFields(pair.getSecond()); } for (Pair<EditableOnVmStatusField, String> pair : BaseHandler.extractyAnnotatedFields(EditableOnVmStatusField.class, inspectedClassNames)) { mUpdateVmsStatic.AddField(Arrays.asList(pair.getFirst().statuses()), pair.getSecond()); } }</code><technical_language>adding VmBase</technical_language>

Target:
public static void Init() { Class<?>[] inspectedClassNames = new Class<?>[] { VmBase.class, VM.class, VmStatic.class, VmDynamic.class }; mUpdateVmsStatic = new ObjectIdentityChecker(VmHandler.class, Arrays.asList(inspectedClassNames), VMStatus.class); for (Pair<EditableField,String> pair : BaseHandler.extractAnnotatedFields(EditableField.class, (inspectedClassNames))) { mUpdateVmsStatic.AddPermittedField(pair.getSecond()); } for (Pair<EditableOnVmStatusField, String> pair : BaseHandler.extractAnnotatedFields(EditableOnVmStatusField.class, inspectedClassNames)) { mUpdateVmsStatic.AddField(Arrays.asList(pair.getFirst().statuses()), pair.getSecond()); } }
Source:
<code>public KafkaSupervisor( final TaskStorage taskStorage, final TaskMaster taskMaster, final IndexerMetadataStorageCoordinator indexerMetadataStorageCoordinator, final KafkaIndexTaskClientFactory taskClientFactory, final ObjectMapper mapper, final KafkaSupervisorSpec spec, final RowIngestionMetersFactory rowIngestionMetersFactory ) { super( StringUtils.format("KafkaSupervisor-%s", spec.getDataSchema().getDataSource()), taskStorage, taskMaster, indexerMetadataStorageCoordinator, taskClientFactory, mapper, spec, rowIngestionMetersFactory, <START> NOT_SET, <END> Long.MAX_VALUE, false, true ); this.spec = spec; this.emitter = spec.getEmitter(); this.monitorSchedulerConfig = spec.getMonitorSchedulerConfig(); }</code><technical_language>do abstract getter for this instead of passing in constructor? feels.. weird do this way. for end of partition</technical_language>

Target:
public KafkaSupervisor( final TaskStorage taskStorage, final TaskMaster taskMaster, final IndexerMetadataStorageCoordinator indexerMetadataStorageCoordinator, final KafkaIndexTaskClientFactory taskClientFactory, final ObjectMapper mapper, final KafkaSupervisorSpec spec, final RowIngestionMetersFactory rowIngestionMetersFactory ) { super( StringUtils.format("KafkaSupervisor-%s", spec.getDataSchema().getDataSource()), taskStorage, taskMaster, indexerMetadataStorageCoordinator, taskClientFactory, mapper, spec, rowIngestionMetersFactory, false ); this.spec = spec; this.emitter = spec.getEmitter(); this.monitorSchedulerConfig = spec.getMonitorSchedulerConfig(); }
Source:
<code>protected synchronized void activate(final ComponentContext componentContext, final Map<String, Object> properties) { logger.debug(message.activatingWireService()); try { this.extractProperties(properties); this.trackerCustomizer = new WireComponentTrackerCustomizer(componentContext.getBundleContext(), this); this.serviceTracker = new ServiceTracker<>(componentContext.getBundleContext(), WireComponent.class, this.trackerCustomizer); this.serviceTracker.open(); this.createWires(); } catch (final Exception exception) { <START> logger.error(ThrowableUtil.stackTraceAsString(exception)); <END> } logger.debug(message.activatingWireServiceDone()); }</code><technical_language>passed arguments exceptions. logger handle stack traces is need pre-render this</technical_language>

Target:
protected synchronized void activate(final ComponentContext componentContext, final Map<String, Object> properties) { logger.debug(message.activatingWireService()); try { this.extractProperties(properties); this.trackerCustomizer = new WireComponentTrackerCustomizer(componentContext.getBundleContext(), this); this.serviceTracker = new ServiceTracker<>(componentContext.getBundleContext(), WireComponent.class, this.trackerCustomizer); this.serviceTracker.open(); this.createWires(); } catch (final Exception e) { logger.error(e.getMessage(), e); } logger.debug(message.activatingWireServiceDone()); }
Source:
<code>public void setUp() throws Exception { <START> hostPort = HOST + PortAssignment.unique(); <END> port = Integer.parseInt(hostPort.split(":")[1]); tmpDir = ClientBase.createTmpDir(); ClientBase.setupTestEnv(); zks = new ZooKeeperServer(tmpDir, tmpDir, 3000); SyncRequestProcessor.setSnapCount(100); serverCnxnFactory = ServerCnxnFactory.createFactory(port, -1); serverCnxnFactory.startup(zks); Assert.assertTrue("waiting for server being up ", ClientBase.waitForServerUp(hostPort,CONNECTION_TIMEOUT)); zk = ClientBase.createZKClient(hostPort); }</code><technical_language>While in fix this? this ClientBase. Is a reason convert this class subclass ClientBase</technical_language>

Target:
public void setUp() throws Exception { SyncRequestProcessor.setSnapCount(50); super.setUp(); }
Source:
<code>public void vuapDefaultStateShouldStartPlayingAdvertisementAutomatically(Page page, String slot, String videoIframeSelector) { <START> openPageWithVideoInLocalStorage(page, VuapVideos.PORVATA_VAST, VuapVideos.VAST_VIDEO); <END> final AutoplayVuap vuap = new AutoplayVuap(driver, slot, videoIframeSelector); VuapAssertions.verifyVideoPlay(vuap); }</code><technical_language>I pass parameters a lot VuapVideos.PORVATA_VAST, VuapVideos.VAST_VIDEO. extract method hardcode parameters</technical_language>

Target:
public void vuapDefaultStateShouldStartPlayingAdvertisementAutomatically(Page page, String slot, String videoIframeSelector) { openPageWithVideoInLocalStorage(page); final AutoplayVuap vuap = new AutoplayVuap(driver, slot, videoIframeSelector); VuapAssertions.verifyVideoPlay(vuap); }