auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static DocVector createDocVector(String content, int ngram) { LuceneTokenizer tokenizer; if(ngram > 1){ LOG.info("Using Ngram Cosine Model, user specified ngram value : {}", ngram); tokenizer = new LuceneTokenizer(content, TokenizerType.STANDARD, StemFilterType.PORTERSTEM_FILTER, ngram); } else if(stopWords!=null) { tokenizer = new LuceneTokenizer(content, TokenizerType.STANDARD, stopWords, true, StemFilterType.PORTERSTEM_FILTER); } else { tokenizer = new LuceneTokenizer(content, TokenizerType.STANDARD, true, StemFilterType.PORTERSTEM_FILTER); } TokenStream tStream = tokenizer.getTokenStream(); HashMap<String, Integer> termVector = new HashMap<>(); try { CharTermAttribute charTermAttribute = tStream.addAttribute(CharTermAttribute.class); tStream.reset(); while(tStream.incrementToken()) { String term = charTermAttribute.toString(); <START> LOG.info(term); <END> if(termVector.containsKey(term)) { int count = termVector.get(term); count++; termVector.put(term, count); } else { termVector.put(term, 1); } } DocVector docVector = new DocVector(); docVector.setTermFreqVector(termVector); return docVector; } catch (IOException e) { LOG.error("Error creating DocVector : {}",StringUtils.stringifyException(e)); } return null; }</code><technical_language>This for debugging, please change LOG.debug(). helps keeping log clean. Thanks</technical_language>

Target:
public static DocVector createDocVector(String content, int ngram) { LuceneTokenizer tokenizer; if(ngram > 1){ LOG.info("Using Ngram Cosine Model, user specified ngram value : {}", ngram); tokenizer = new LuceneTokenizer(content, TokenizerType.STANDARD, StemFilterType.PORTERSTEM_FILTER, ngram); } else if(stopWords!=null) { tokenizer = new LuceneTokenizer(content, TokenizerType.STANDARD, stopWords, true, StemFilterType.PORTERSTEM_FILTER); } else { tokenizer = new LuceneTokenizer(content, TokenizerType.STANDARD, true, StemFilterType.PORTERSTEM_FILTER); } TokenStream tStream = tokenizer.getTokenStream(); HashMap<String, Integer> termVector = new HashMap<>(); try { CharTermAttribute charTermAttribute = tStream.addAttribute(CharTermAttribute.class); tStream.reset(); while(tStream.incrementToken()) { String term = charTermAttribute.toString(); LOG.debug(term); if(termVector.containsKey(term)) { int count = termVector.get(term); count++; termVector.put(term, count); } else { termVector.put(term, 1); } } DocVector docVector = new DocVector(); docVector.setTermFreqVector(termVector); return docVector; } catch (IOException e) { LOG.error("Error creating DocVector : {}",StringUtils.stringifyException(e)); } return null; }
Source:
<code><START> public void testSingleChildOfSpanWithOtherFollowsFromRefs() { <END> TestTraceReporter reporter = new TestTraceReporter(); Tracer tracer = new APMTracer(reporter); Span refdSpan1 = tracer.buildSpan("ref1") .start(); refdSpan1.finish(); Span refdSpan2 = tracer.buildSpan("ref2") .start(); refdSpan2.finish(); Span parentSpan = tracer.buildSpan("parentSpan") .start(); Span span = tracer.buildSpan("SingleChildOfSpan") .addReference(References.FOLLOWS_FROM, refdSpan1.context()) .asChildOf(parentSpan) .addReference(References.FOLLOWS_FROM, refdSpan2.context()) .start(); span.finish(); parentSpan.finish(); assertEquals(3, reporter.getTraces().size()); Trace trace1 = reporter.getTraces().get(0); Trace trace2 = reporter.getTraces().get(1); Trace trace3 = reporter.getTraces().get(2); assertEquals(1, trace3.getNodes().size()); assertEquals(Component.class, trace3.getNodes().get(0).getClass()); Component parentComponent = (Component) trace3.getNodes().get(0); assertEquals(1, parentComponent.getNodes().size()); assertEquals(Component.class, parentComponent.getNodes().get(0).getClass()); Component childComponent = (Component) parentComponent.getNodes().get(0); assertTrue(childComponent.getCorrelationIds().contains( new CorrelationIdentifier(Scope.CausedBy, trace1.getFragmentId() + ":0"))); assertTrue(childComponent.getCorrelationIds().contains( new CorrelationIdentifier(Scope.CausedBy, trace2.getFragmentId() + ":0"))); assertEquals(0, childComponent.getNodes().size()); }</code><technical_language>update this test spans trace</technical_language>

Target:
public void testSingleChildOfSpanWithOtherFollowsFromRefs() { TestTraceReporter reporter = new TestTraceReporter(); Tracer tracer = new APMTracer(reporter); Span rootSpan = tracer.buildSpan("root") .start(); Span childSpan1 = tracer.buildSpan("child1") .asChildOf(rootSpan) .start(); childSpan1.finish(); Span childSpan2 = tracer.buildSpan("child2") .asChildOf(rootSpan) .start(); Span referencingSpan = tracer.buildSpan("referencingSpan") .addReference(References.FOLLOWS_FROM, childSpan1.context()) .asChildOf(childSpan2) .start(); childSpan2.finish(); rootSpan.finish(); referencingSpan.finish(); assertEquals(1, reporter.getTraces().size()); Trace trace = reporter.getTraces().get(0); assertEquals(1, trace.getNodes().size()); assertEquals(Component.class, trace.getNodes().get(0).getClass()); Component rootComponent = (Component) trace.getNodes().get(0); assertEquals(2, rootComponent.getNodes().size()); assertEquals(Component.class, rootComponent.getNodes().get(0).getClass()); assertEquals(Component.class, rootComponent.getNodes().get(1).getClass()); Component child1Component = (Component) rootComponent.getNodes().get(0); Component child2Component = (Component) rootComponent.getNodes().get(1); assertEquals(0, child1Component.getNodes().size()); assertEquals(1, child2Component.getNodes().size()); assertEquals(Component.class, child2Component.getNodes().get(0).getClass()); Component referencingComponent = (Component) child2Component.getNodes().get(0); assertTrue(referencingComponent.getCorrelationIds().contains( new CorrelationIdentifier(Scope.CausedBy, trace.getFragmentId() + ":0:0"))); }
Source:
<code>final void removeFirst() { Node head = get(); Node next = head.get(); size--; Node newHead = new Node(null); Node newNext = next.get(); <START> newHead.set(newNext); <END> setFirst(newHead); if (newNext == null) { tail = newHead; } }</code><technical_language>This lazySet</technical_language>

Target:
final void removeFirst() { Node head = get(); Node next = head.get(); size--; setFirst(next); }
Source:
<code>public ItemStack getResultForClick() { <START> if(!getWorld().isRemote) { <END> ItemStack result = getOutput(true); if (result.isEmpty()) { result = getOutput(false); } if (result.isEmpty()) { return ItemStack.EMPTY; } result.setCount(inv.addCompressed(result, false)); if (result.getCount() > 0) { return result; } return ItemStack.EMPTY; } return ItemStack.EMPTY; }</code><technical_language>Please method MainProxy check this</technical_language>

Target:
public ItemStack getResultForClick() { if(MainProxy.isServer(getWorld())) { ItemStack result = getOutput(true); if (result.isEmpty()) { result = getOutput(false); } if (result.isEmpty()) { return ItemStack.EMPTY; } result.setCount(inv.addCompressed(result, false)); if (result.getCount() > 0) { return result; } return ItemStack.EMPTY; } return ItemStack.EMPTY; }
Source:
<code>private static QueryRunner createQueryRunner() throws Exception { DistributedQueryRunner queryRunner = HiveQueryRunner.createQueryRunner(getTables(), ImmutableMap.of(), "sql-standard", ImmutableMap.of("hive.pushdown-filter-enabled", "true"), Optional.empty()); queryRunner.execute(noPushdownFilter(queryRunner.getDefaultSession()), <START> "CREATE TABLE lineitem_ex (linenumber, orderkey, ship_by_air, is_returned, byte_col1, byte_col2) AS " + <END> "SELECT linenumber, " + " orderkey, " + " IF (linenumber % 7 = 0, null, shipmode = 'AIR') AS ship_by_air, " + " IF (linenumber % 5 = 0, null, returnflag = 'R') AS is_returned, " + " IF (linenumber % 8 = 0, null, cast((linenumber) as TINYINT)) AS byte_col1, " + " IF (linenumber % 9 = 0, null, cast((-linenumber) as TINYINT)) AS byte_col2 " + "FROM lineitem"); return queryRunner; }</code><technical_language>feel more descriptive column names? For example, day(shipdate) ship_day month(shipdate) ship_month? 2 give values TINYINT range meaningful names easy understand</technical_language>

Target:
private static QueryRunner createQueryRunner() throws Exception { DistributedQueryRunner queryRunner = HiveQueryRunner.createQueryRunner(getTables(), ImmutableMap.of(), "sql-standard", ImmutableMap.of("hive.pushdown-filter-enabled", "true"), Optional.empty()); queryRunner.execute(noPushdownFilter(queryRunner.getDefaultSession()), "CREATE TABLE lineitem_ex (linenumber, orderkey, ship_by_air, is_returned, ship_day, ship_month) AS " + "SELECT linenumber, " + " orderkey, " + " IF (linenumber % 7 = 0, null, shipmode = 'AIR') AS ship_by_air, " + " IF (linenumber % 5 = 0, null, returnflag = 'R') AS is_returned, " + " IF (linenumber % 4 = 0, null, CAST(day(shipdate) AS TINYINT)) AS ship_day, " + " IF (linenumber % 6 = 0, null, CAST(month(shipdate) AS TINYINT)) AS ship_month " + "FROM lineitem"); return queryRunner; }
Source:
<code>public boolean append(ByteBuffer source, int targetChannel, DataType dataType) throws IOException { checkState(!isFinished, "Sort buffer is already finished."); checkState(!isReleased, "Sort buffer is already released."); int totalBytes = source.remaining(); <START> if (totalBytes == 0) { <END> return true; } if (!allocateBuffersForRecord(totalBytes)) { return false; } writeIndex(targetChannel, totalBytes, dataType); writeRecord(source); ++numTotalRecords; numTotalBytes += totalBytes; return true; }</code><technical_language>Is empty record ? I if is write index for it, throw exceptions for illegal state, reasonable ignore silently</technical_language>

Target:
public boolean append(ByteBuffer source, int targetChannel, DataType dataType) throws IOException { checkArgument(source.hasRemaining(), "Cannot append empty data."); checkState(!isFinished, "Sort buffer is already finished."); checkState(!isReleased, "Sort buffer is already released."); int totalBytes = source.remaining(); if (!allocateBuffersForRecord(totalBytes)) { return false; } writeIndex(targetChannel, totalBytes, dataType); writeRecord(source); ++numTotalRecords; numTotalBytes += totalBytes; return true; }
Source:
<code>public static Locale getLocale(String localeName) { Locale locale; String[] languageAndRegion = localeName.split("_", 2); if (languageAndRegion.length > 1) { locale = new Locale(languageAndRegion[0], languageAndRegion[1]); } else { locale = new Locale(localeName); <START> } <END> return locale; }</code><technical_language>a constructor a parameter - variation. if widely though</technical_language>

Target:
public static Locale getLocale(String localeName) { Locale locale; String[] languageAndRegion = localeName.split("-", 2); if (languageAndRegion.length > 1) { locale = new Locale(languageAndRegion[0], languageAndRegion[1]); } else { locale = new Locale(localeName); } return locale; }
Source:
<code>public NettyPipelineBuilder create( Channel channel, Log log ) throws Exception { ChannelPipeline pipeline = channel.pipeline(); NettyPipelineBuilder builder = NettyPipelineBuilder.with( pipeline, log ); int i = 0; for ( ChannelHandler handler : wrapper.handlersFor( channel ) ) { <START> builder.add( String.format( "%s_%d", wrapper.name(), i ), handler ); <END> } return builder; }</code><technical_language>i equals 0</technical_language>

Target:
public NettyPipelineBuilder create( Channel channel, Log log ) throws Exception { ChannelPipeline pipeline = channel.pipeline(); NettyPipelineBuilder builder = NettyPipelineBuilder.with( pipeline, log ); int i = 0; for ( ChannelHandler handler : wrapper.handlersFor( channel ) ) { builder.add( String.format( "%s_%d", wrapper.name(), i ), handler ); i++; } return builder; }
Source:
<code>public void readFromNBT(NBTTagCompound par1nbtTagCompound) { super.readFromNBT(par1nbtTagCompound); inv.readFromNBT(par1nbtTagCompound, "inv"); matrix.readFromNBT(par1nbtTagCompound, "matrix"); placedBy = par1nbtTagCompound.getString("placedBy"); NBTTagList lst = par1nbtTagCompound.getTagList("fuzzyFlags"); <START> if(lst != null) { <END> for(int i = 0; i < 9; i++) { NBTTagCompound comp = (NBTTagCompound) lst.tagAt(i); fuzzyFlags[i].ignore_dmg = comp.getBoolean("ignore_dmg"); fuzzyFlags[i].ignore_nbt = comp.getBoolean("ignore_nbt"); fuzzyFlags[i].use_od = comp.getBoolean("use_od"); fuzzyFlags[i].use_category = comp.getBoolean("use_category"); } } cacheRecipe(); }</code><technical_language>Checking for null work becuase empty list is returned tag is found. hasKey NBTCompund</technical_language>

Target:
public void readFromNBT(NBTTagCompound par1nbtTagCompound) { super.readFromNBT(par1nbtTagCompound); inv.readFromNBT(par1nbtTagCompound, "inv"); matrix.readFromNBT(par1nbtTagCompound, "matrix"); placedBy = par1nbtTagCompound.getString("placedBy"); if(par1nbtTagCompound.hasKey("fuzzyFlags")) { NBTTagList lst = par1nbtTagCompound.getTagList("fuzzyFlags"); for(int i = 0; i < 9; i++) { NBTTagCompound comp = (NBTTagCompound) lst.tagAt(i); fuzzyFlags[i].ignore_dmg = comp.getBoolean("ignore_dmg"); fuzzyFlags[i].ignore_nbt = comp.getBoolean("ignore_nbt"); fuzzyFlags[i].use_od = comp.getBoolean("use_od"); fuzzyFlags[i].use_category = comp.getBoolean("use_category"); } } cacheRecipe(); }
Source:
<code>public String getString( final Object key ) { <START> return String.valueOf(getDynamicProperties().get( key )); <END> }</code><technical_language>cast a string call toString shortened return (String) get( key );</technical_language>

Target:
public String getString( final Object key ) { return (String) getDynamicProperties().get( key ); }
Source:
<code>public void setCurve(final Currency ccy, final YieldAndDiscountCurve curve) { ArgumentChecker.notNull(ccy, "currency"); ArgumentChecker.notNull(curve, "curve"); if (!_discountingCurves.containsKey(ccy)) { _discountingCurves.put(ccy, curve); setAllCurves(); } else { boolean curvesEqual = _discountingCurves.get(ccy).equals(curve); s_logger.debug("Two discounting curves for {}: {}", curvesEqual ? "equal" : "unequal", ccy.getCode(), curve, _discountingCurves.get(ccy)); if (!curvesEqual) { <START> throw new IllegalArgumentException("Currency discounting curve already set: " + ccy.toString()); <END> } } }</code><technical_language>I need output curves in exception well. If a difficult reproduce issue, want turn debug in hope of isolating</technical_language>

Target:
public void setCurve(final Currency ccy, final YieldAndDiscountCurve curve) { ArgumentChecker.notNull(ccy, "currency"); ArgumentChecker.notNull(curve, "curve"); if (!_discountingCurves.containsKey(ccy)) { _discountingCurves.put(ccy, curve); setAllCurves(); } else { boolean curvesEqual = _discountingCurves.get(ccy).equals(curve); s_logger.debug("Two discounting curves for {}: {}", curvesEqual ? "equal" : "unequal", ccy.getCode(), curve, _discountingCurves.get(ccy)); if (!curvesEqual) { throw new IllegalArgumentException("Attempting to replace " + ccy.getCode() + " discounting curve with " + "different curve. existing: " + _discountingCurves.get(ccy) + ", new: " + curve); } } }
Source:
<code>public String getModulesPath() throws IOException, ConfigInvalidException { lazyLoadModulesConfig(); return modulesConfig.getString(ConfigConstants.CONFIG_SUBMODULE_SECTION, <START> (pathToName.get(path) <END> != null) ? pathToName.get(path) : path, ConfigConstants.CONFIG_KEY_PATH); }</code><technical_language>do need null check places down? sense ensure null before</technical_language>

Target:
public String getModulesPath() throws IOException, ConfigInvalidException { lazyLoadModulesConfig(); return modulesConfig.getString(ConfigConstants.CONFIG_SUBMODULE_SECTION, getModuleName(path), ConfigConstants.CONFIG_KEY_PATH); }
Source:
<code>public ChargeEntity transitionChargeState( ChargeEntity charge, ChargeStatus targetChargeState, ZonedDateTime gatewayEventTime ) { ChargeStatus fromChargeState = ChargeStatus.fromString(charge.getStatus()); charge.setStatus(targetChargeState); ChargeEventEntity chargeEventEntity = chargeEventDao.persistChargeEventOf(charge, gatewayEventTime); PaymentGatewayStateTransitions.getInstance() .getEventForTransition(fromChargeState, targetChargeState) .ifPresent(eventType -> { if (shouldEmitPaymentStateTransitionEvents) { PaymentStateTransition transition = new PaymentStateTransition(chargeEventEntity.getId(), eventType); stateTransitionQueue.offer(transition); <START> logger.info("Offered payment state transition to emitter queue [from={}] [to={}] [chargeId={}]", fromChargeState, targetChargeState, chargeEventEntity.getId()); <END> } }); return charge; }</code><technical_language>This ID is chargeId suggestion logger.info("Offered payment state transition emitter queue [from={}] [to={}] [chargeEventId={}] [chargeId={}]", fromChargeState, targetChargeState, chargeEventEntity.getId(), charge.getExternalId());</technical_language>

Target:
public ChargeEntity transitionChargeState( ChargeEntity charge, ChargeStatus targetChargeState, ZonedDateTime gatewayEventTime ) { ChargeStatus fromChargeState = ChargeStatus.fromString(charge.getStatus()); charge.setStatus(targetChargeState); ChargeEventEntity chargeEventEntity = chargeEventDao.persistChargeEventOf(charge, gatewayEventTime); PaymentGatewayStateTransitions.getInstance() .getEventForTransition(fromChargeState, targetChargeState) .ifPresent(eventType -> { if (shouldEmitPaymentStateTransitionEvents) { PaymentStateTransition transition = new PaymentStateTransition(chargeEventEntity.getId(), eventType); stateTransitionQueue.offer(transition); logger.info("Offered payment state transition to emitter queue [from={}] [to={}] [chargeEventId={}] [chargeId={}]", fromChargeState, targetChargeState, chargeEventEntity.getId(), charge.getExternalId()); } }); return charge; }
Source:
<code>protected boolean scheduleExecutor( ExecutorDetails exec, TopologyDetails td, Collection<ExecutorDetails> scheduledTasks, Iterable<String> sortedNodes) { WorkerSlot targetSlot = findWorkerForExec(exec, td, sortedNodes); if (targetSlot != null) { RasNode targetNode = idToNode(targetSlot.getNodeId()); targetNode.assignSingleExecutor(targetSlot, exec, td); scheduledTasks.add(exec); LOG.debug( "TASK assigned to Node: avail [ mem: cpu: ] total [ mem: cpu: ] on " + "slot: on Rack: {}", exec, targetNode.getHostname(), targetNode.getAvailableMemoryResources(), targetNode.getAvailableCpuResources(), targetNode.getTotalMemoryResources(), targetNode.getTotalCpuResources(), targetSlot, nodeToRack(targetNode)); return true; } else { String comp = td.getExecutorToComponent().get(exec); NormalizedResourceRequest requestedResources = td.getTotalResources(exec); schedulingFailText = "Not Enough Resources to schedule Task " + exec + " - " + comp + " " + requestedResources; <START> LOG.error(schedulingFailText); <END> return false; } }</code><technical_language>this a warn message? bothered this reports ERROR. error in code flow, cluster enough resources</technical_language>

Target:
protected boolean scheduleExecutor( ExecutorDetails exec, TopologyDetails td, Collection<ExecutorDetails> scheduledTasks, Iterable<String> sortedNodes) { WorkerSlot targetSlot = findWorkerForExec(exec, td, sortedNodes); if (targetSlot != null) { RasNode targetNode = idToNode(targetSlot.getNodeId()); targetNode.assignSingleExecutor(targetSlot, exec, td); scheduledTasks.add(exec); LOG.debug( "TASK assigned to Node: avail [ mem: cpu: ] total [ mem: cpu: ] on " + "slot: on Rack: {}", exec, targetNode.getHostname(), targetNode.getAvailableMemoryResources(), targetNode.getAvailableCpuResources(), targetNode.getTotalMemoryResources(), targetNode.getTotalCpuResources(), targetSlot, nodeToRack(targetNode)); return true; } else { String comp = td.getExecutorToComponent().get(exec); NormalizedResourceRequest requestedResources = td.getTotalResources(exec); LOG.warn("Not Enough Resources to schedule Task - {}", exec, comp, requestedResources); return false; } }
Source:
<code>public void whenExceedMaxConsumersNumThen429() throws IOException, InterruptedException, ExecutionException, TimeoutException { final String etName = NakadiTestUtils.createEventType().getName(); final List<CompletableFuture<HttpURLConnection>> connectionFutures = range(0, 8) .mapToObj(x -> createConsumingConnection(etName)) .collect(Collectors.toList()); assertThat("first 5 connections should be accepted", countStatusCode(connectionFutures, HttpStatus.OK.value()), equalTo(5)); assertThat("last 3 connections should be rejected", countStatusCode(connectionFutures, HttpStatus.TOO_MANY_REQUESTS.value()), equalTo(3)); for (final CompletableFuture<HttpURLConnection> conn : connectionFutures) { if (conn.get().getResponseCode() == HttpStatus.OK.value()) { conn.get().disconnect(); break; } } <START> range(0, 15).forEach(value -> NakadiTestUtils.publishEvent(etName, "{\"foo\": \"please, close connection\"}")); <END> Thread.sleep(1000); final List<CompletableFuture<HttpURLConnection>> moreConnectionFutures = range(0, 3) .mapToObj(x -> createConsumingConnection(etName)) .collect(Collectors.toList()); assertThat("one more connection should be accepted", countStatusCode(moreConnectionFutures, HttpStatus.OK.value()), equalTo(1)); assertThat("other 2 connections should be rejected as we had only one new free slot", countStatusCode(moreConnectionFutures, HttpStatus.TOO_MANY_REQUESTS.value()), equalTo(2)); }</code><technical_language>@adyach</technical_language>

Target:
public void whenExceedMaxConsumersNumThen429() throws IOException, InterruptedException, ExecutionException, TimeoutException { final String etName = NakadiTestUtils.createEventType().getName(); final List<CompletableFuture<HttpURLConnection>> connectionFutures = range(0, 8) .mapToObj(x -> createConsumingConnection(etName)) .collect(Collectors.toList()); assertThat("first 5 connections should be accepted", countStatusCode(connectionFutures, HttpStatus.OK.value()), equalTo(5)); assertThat("last 3 connections should be rejected", countStatusCode(connectionFutures, HttpStatus.TOO_MANY_REQUESTS.value()), equalTo(3)); for (final CompletableFuture<HttpURLConnection> conn : connectionFutures) { if (conn.get().getResponseCode() == HttpStatus.OK.value()) { conn.get().disconnect(); break; } } range(0, 15).forEach(value -> NakadiTestUtils.publishEvent(etName, "{\"foo\": \"bar\"}")); Thread.sleep(1000); final List<CompletableFuture<HttpURLConnection>> moreConnectionFutures = range(0, 3) .mapToObj(x -> createConsumingConnection(etName)) .collect(Collectors.toList()); assertThat("one more connection should be accepted", countStatusCode(moreConnectionFutures, HttpStatus.OK.value()), equalTo(1)); assertThat("other 2 connections should be rejected as we had only one new free slot", countStatusCode(moreConnectionFutures, HttpStatus.TOO_MANY_REQUESTS.value()), equalTo(2)); }
Source:
<code>public ListCoercer(TypeManager typeManager, HiveType fromHiveType, HiveType toHiveType, BridgingRecordCursor bridgingRecordCursor) { requireNonNull(typeManager, "typeManage is null"); requireNonNull(fromHiveType, "fromHiveType is null"); requireNonNull(toHiveType, "toHiveType is null"); this.bridgingRecordCursor = requireNonNull(bridgingRecordCursor, "bridgingRecordCursor is null"); this.fromElementHiveType = HiveType.valueOf(((ListTypeInfo) fromHiveType.getTypeInfo()).getListElementTypeInfo().getTypeName()); <START> this.toElementHiveType = HiveType.valueOf(((ListTypeInfo) toHiveType.getTypeInfo()).getListElementTypeInfo().getTypeName()); <END> this.fromElementType = fromElementHiveType.getType(typeManager); this.toElementType = toElementHiveType.getType(typeManager); this.elementCoercer = fromElementHiveType.equals(toElementHiveType) ? null : createCoercer(typeManager, fromElementHiveType, toElementHiveType, bridgingRecordCursor); this.pageBuilder = elementCoercer == null ? null : new PageBuilder(ImmutableList.of(toHiveType.getType(typeManager))); }</code><technical_language>fromElementHiveType toElementHiveType in this constructor. local variables</technical_language>

Target:
public ListCoercer(TypeManager typeManager, HiveType fromHiveType, HiveType toHiveType, BridgingRecordCursor bridgingRecordCursor) { requireNonNull(typeManager, "typeManage is null"); requireNonNull(fromHiveType, "fromHiveType is null"); requireNonNull(toHiveType, "toHiveType is null"); this.bridgingRecordCursor = requireNonNull(bridgingRecordCursor, "bridgingRecordCursor is null"); HiveType fromElementHiveType = HiveType.valueOf(((ListTypeInfo) fromHiveType.getTypeInfo()).getListElementTypeInfo().getTypeName()); HiveType toElementHiveType = HiveType.valueOf(((ListTypeInfo) toHiveType.getTypeInfo()).getListElementTypeInfo().getTypeName()); this.fromElementType = fromElementHiveType.getType(typeManager); this.toType = toHiveType.getType(typeManager); this.toElementType = toElementHiveType.getType(typeManager); this.elementCoercer = fromElementHiveType.equals(toElementHiveType) ? null : createCoercer(typeManager, fromElementHiveType, toElementHiveType, bridgingRecordCursor); this.pageBuilder = elementCoercer == null ? null : new PageBuilder(ImmutableList.of(toType)); }
Source:
<code>public void makeSortable() { makeSortable(new Comparator<T>() { <START> private LexoNumericComparator lexoNumeric = new LexoNumericComparator(); <END> @Override public int compare(T o1, T o2) { String text1 = getValue(o1); String text2 = getValue(o2); if (text1.equals(text2)) { return 0; } else if (RxTxRateRenderer.NO_VALUE.equals(text1) || RxTxRateRenderer.NO_VALUE.equals(text2)) { return RxTxRateRenderer.NO_VALUE.equals(text1) ? -1 : 1; } else if (RxTxRateRenderer.ZERO_VALUE.equals(text1) || RxTxRateRenderer.ZERO_VALUE.equals(text2)) { return RxTxRateRenderer.ZERO_VALUE.equals(text1) ? -1 : 1; } else if (RxTxRateRenderer.SMALL_VALUE.equals(text1) || RxTxRateRenderer.SMALL_VALUE.equals(text2)) { return RxTxRateRenderer.SMALL_VALUE.equals(text1) ? -1 : 1; } else { return lexoNumeric.compare(text1, text2); } } }); }</code><technical_language>Here, override TextColumnWithTooltip.makeSortable() works LexoNumericComparator. If TextColumnWithTooltip exposed LexoNumericComparator this: public abstract class TextColumnWithTooltip<T> ... { private final LexoNumericComparator lexoNumeric = new LexoNumericComparator(); ... public void makeSortable() { // anonymous-class-specific comparator, lexoNumeric declared } protected LexoNumericComparator getDefaultComparator() { return lexoNumeric; } } remove "lexoNumeric" (RxTxRateColumn) instead of this: return lexoNumeric.compare(text1, text2); do this: return getDefaultComparator().compare(text1, text2);</technical_language>

Target:
public void makeSortable() { makeSortable(new Comparator<T>() { private LexoNumericComparator lexoNumeric = new LexoNumericComparator(); @Override public int compare(T o1, T o2) { String text1 = getValue(o1); String text2 = getValue(o2); if (text1.equals(text2)) { return 0; } else if (RxTxRateRenderer.isEmpty(text1) || RxTxRateRenderer.isEmpty(text2)) { return RxTxRateRenderer.isEmpty(text1) ? -1 : 1; } else if (RxTxRateRenderer.isZero(text1) || RxTxRateRenderer.isZero(text2)) { return RxTxRateRenderer.isZero(text1) ? -1 : 1; } else if (RxTxRateRenderer.isSmall(text1) || RxTxRateRenderer.isSmall(text2)) { return RxTxRateRenderer.isSmall(text1) ? -1 : 1; } else { return lexoNumeric.compare(text1, text2); } } }); }
Source:
<code>protected void serviceStart() throws Exception { super.serviceStart(); if (UserGroupInformation.isSecurityEnabled()) { delegationTokenManager.startThreads(); } InetSocketAddress connectAddress = NetUtils.getConnectAddress(this.heartbeatListener.getAddress()); URI connectUri = RecoverableRpcProxy.toConnectURI(connectAddress); FSRecoveryHandler recoveryHandler = new FSRecoveryHandler(dag.assertAppPath(), getConfig()); recoveryHandler.writeConnectUri(connectUri.toString()); try { org.mortbay.log.Log.setLog(null); } catch (Throwable throwable) { } try { Configuration config = getConfig(); if (SecurityUtils.isStramWebSecurityEnabled()) { config = new Configuration(config); config.set("hadoop.http.filter.initializers", StramWSFilterInitializer.class.getCanonicalName()); } else { String authType = config.get(SecurityUtils.HADOOP_HTTP_AUTH_PROP); <START> if (!SecurityUtils.HADOOP_HTTP_AUTH_VALUE_SIMPLE.equals(authType)) { <END> LOG.warn("Found but authentication was disabled in Apex.", SecurityUtils.HADOOP_HTTP_AUTH_PROP, authType); config = new Configuration(config); config.set(SecurityUtils.HADOOP_HTTP_AUTH_PROP, SecurityUtils.HADOOP_HTTP_AUTH_VALUE_SIMPLE); config.setBoolean(SecurityUtils.HADOOP_HTTP_AUTH_SIMPLE_ANONYMOUS_ALLOWED_PROP, true); } } addSSLConfigResource(config); WebApp webApp = WebApps.$for("stram", StramAppContext.class, appContext, "ws").with(config).start(new StramWebApp(this.dnmgr)); LOG.info("Started web service at port: " + webApp.port()); appMasterTrackingUrl = NetUtils.getConnectAddress(webApp.getListenerAddress()).getHostName() + ":" + webApp.port(); if (ConfigUtils.isSSLEnabled(config)) { appMasterTrackingUrl = "https://" + appMasterTrackingUrl; } LOG.info("Setting tracking URL to: " + appMasterTrackingUrl); } catch (Exception e) { LOG.error("Webapps failed to start. Ignoring for now:", e); } }</code><technical_language>else if (SecurityUtils.isHadoopWebSecurityEnabled())</technical_language>

Target:
protected void serviceStart() throws Exception { super.serviceStart(); if (UserGroupInformation.isSecurityEnabled()) { delegationTokenManager.startThreads(); } InetSocketAddress connectAddress = NetUtils.getConnectAddress(this.heartbeatListener.getAddress()); URI connectUri = RecoverableRpcProxy.toConnectURI(connectAddress); FSRecoveryHandler recoveryHandler = new FSRecoveryHandler(dag.assertAppPath(), getConfig()); recoveryHandler.writeConnectUri(connectUri.toString()); try { org.mortbay.log.Log.setLog(null); } catch (Throwable throwable) { } try { Configuration config = SecurityUtils.configureWebAppSecurity(getConfig(), dag.getValue(Context.DAGContext.SSL_CONFIG)); WebApp webApp = WebApps.$for("stram", StramAppContext.class, appContext, "ws").with(config).start(new StramWebApp(this.dnmgr)); LOG.info("Started web service at port: " + webApp.port()); appMasterTrackingUrl = NetUtils.getConnectAddress(webApp.getListenerAddress()).getHostName() + ":" + webApp.port(); if (ConfigUtils.isSSLEnabled(config)) { appMasterTrackingUrl = "https://" + appMasterTrackingUrl; } LOG.info("Setting tracking URL to: " + appMasterTrackingUrl); } catch (Exception e) { LOG.error("Webapps failed to start. Ignoring for now:", e); } }
Source:
<code>public String toString() { <START> try { <END> JSONObject object = new JSONObject(); object.put("isHealthy", isHealthy.get()); object.put("isBootstrapping", isBootstrapping.get()); object.put("nodeState", nodeState); object.put("bootstrapTime", DateUtil.formatyyyyMMddHHmm(bootstrapTime)); object.put("isCassandraProcessAlive", isCassandraProcessAlive.get()); object.put("isGossipActive", isGossipActive.get()); object.put("isThriftActive", isThriftActive.get()); object.put("isNativeTransportActive", isNativeTransportActive.get()); object.put("isRequiredDirectoriesExist", isRequiredDirectoriesExist.get()); object.put("isYamlWritten", isYmlWritten.get()); if (backupMetadata != null) object.put("backupStatus", backupMetadata.getJSON()); else object.put("backupStatus", backupMetadata); object.put("restoreStatus", restoreStatus.getJSON()); return object.toString(); }catch (JSONException ex) { logger.error("JSONException during toString representation of InstanceState.", ex); } return null; }</code><technical_language>default serializations instead of this</technical_language>

Target:
public String toString() { return GsonJsonSerializer.getGson().toJson(this); }
Source:
<code>public static Pill create(DeviceAccountPair pillAccountPair, Optional<DeviceStatus> pillStatusOptional, final Optional<Color> pillColorOptional) { final Color color = pillColorOptional.isPresent() ? pillColorOptional.get() : DEFAULT_COLOR; if (!pillStatusOptional.isPresent()) { <START> return new Pill(pillAccountPair.internalDeviceId, pillAccountPair.externalDeviceId, null, null, null, State.UNKNOWN, color); <END> } final DeviceStatus pillStatus = pillStatusOptional.get(); final State state = pillStatus.batteryLevel < MIN_IDEAL_BATTERY_LEVEL ? State.LOW_BATTERY : State.NORMAL; return new Pill(pillAccountPair.internalDeviceId, pillAccountPair.externalDeviceId, pillStatus.firmwareVersion, pillStatus.batteryLevel, pillStatus.lastSeen, state, color); }</code><technical_language>null,null,null inspire confidence</technical_language>

Target:
public static Pill create(DeviceAccountPair pillAccountPair, Optional<DeviceStatus> pillStatusOptional, final Optional<Color> pillColorOptional) { final Color color = pillColorOptional.isPresent() ? pillColorOptional.get() : DEFAULT_COLOR; if (!pillStatusOptional.isPresent()) { return new Pill(pillAccountPair.internalDeviceId, pillAccountPair.externalDeviceId, Optional.<String>absent(), Optional.<Integer>absent(), Optional.<DateTime>absent(), State.UNKNOWN, color); } final DeviceStatus pillStatus = pillStatusOptional.get(); final State state = pillStatus.batteryLevel < MIN_IDEAL_BATTERY_LEVEL ? State.LOW_BATTERY : State.NORMAL; return new Pill(pillAccountPair.internalDeviceId, pillAccountPair.externalDeviceId, Optional.of(pillStatus.firmwareVersion), Optional.of(pillStatus.batteryLevel), Optional.of(pillStatus.lastSeen), state, color); }
Source:
<code>protected void handleObjectPut(Object object) throws Exception { FeatureTypeInfo featureTypeUpdate = (FeatureTypeInfo) object; String workspace = getAttribute("workspace"); String datastore = getAttribute("datastore"); String featuretype = getAttribute("featuretype"); DataStoreInfo ds = catalog.getDataStoreByName(workspace, datastore); FeatureTypeInfo featureTypeInfo = catalog.getFeatureTypeByDataStore( ds, featuretype ); Map<String, Serializable> parametersCheck = featureTypeInfo.getStore().getConnectionParameters(); CatalogBuilder helper = new CatalogBuilder(catalog); helper.updateFeatureType(featureTypeInfo,featureTypeUpdate); calculateOptionalFields(featureTypeUpdate, featureTypeInfo); catalog.save( featureTypeInfo ); catalog.getResourcePool().clear(featureTypeInfo); Map<String, Serializable> parameters = featureTypeInfo.getStore().getConnectionParameters(); if( parameters.equals(parametersCheck)){ LOGGER.info( "PUT FeatureType" + datastore + "," + featuretype + " updated metadata only"); } else { LOGGER.info( "PUT featureType" + datastore + "," + featuretype + " updated metadata and data access" ); <START> catalog.getResourcePool().clear(featureTypeInfo.getStore()); <END> } }</code><technical_language>This break sql views, definition is hosted in metadata map. Also, I changing a feature type alter of store connection parameters</technical_language>

Target:
protected void handleObjectPut(Object object) throws Exception { FeatureTypeInfo featureTypeUpdate = (FeatureTypeInfo) object; String workspace = getAttribute("workspace"); String datastore = getAttribute("datastore"); String featuretype = getAttribute("featuretype"); DataStoreInfo ds = catalog.getDataStoreByName(workspace, datastore); FeatureTypeInfo featureTypeInfo = catalog.getFeatureTypeByDataStore( ds, featuretype ); Map<String, Serializable> parametersCheck = featureTypeInfo.getStore().getConnectionParameters(); CatalogBuilder helper = new CatalogBuilder(catalog); helper.updateFeatureType(featureTypeInfo,featureTypeUpdate); calculateOptionalFields(featureTypeUpdate, featureTypeInfo); catalog.save( featureTypeInfo ); catalog.getResourcePool().clear(featureTypeInfo); Map<String, Serializable> parameters = featureTypeInfo.getStore().getConnectionParameters(); MetadataMap mdm = featureTypeInfo.getMetadata(); boolean virtual = mdm != null && mdm.containsKey(FeatureTypeInfo.JDBC_VIRTUAL_TABLE); if( !virtual && parameters.equals(parametersCheck)){ LOGGER.info( "PUT FeatureType" + datastore + "," + featuretype + " updated metadata only"); } else { LOGGER.info( "PUT featureType" + datastore + "," + featuretype + " updated metadata and data access" ); catalog.getResourcePool().clear(featureTypeInfo.getStore()); } }
Source:
<code>public Building(double x, double y, int team, int localTeam) { super(x, y, team, localTeam); setStartHealth(20); disableMobHealthRegen(true); <START> disableBuildingHealthRegen(false); <END> freezeTime = 10; spawnTime = TurnSynchronizer.synchedRandom.nextInt(SPAWN_INTERVAL); }</code><technical_language>a simple setter instead of twisting head double negation. setBuildingHealthRegen(true) for mobs</technical_language>

Target:
public Building(double x, double y, int team, int localTeam) { super(x, y, team, localTeam); setStartHealth(20); healthRegen = false; healthRegenB = true; freezeTime = 10; spawnTime = TurnSynchronizer.synchedRandom.nextInt(SPAWN_INTERVAL); }
Source:
<code>public void testCollectorFailureDoesNotResultInTwoErrorEmissions() { try { final List<Throwable> list = new CopyOnWriteArrayList<Throwable>(); RxJavaPlugins.setErrorHandler(new Consumer<Throwable>() { @Override public void accept(Throwable t) { list.add(t); } }); final RuntimeException e1 = new RuntimeException(); final RuntimeException e2 = new RuntimeException(); TestSubscriber<List<Integer>> ts = TestSubscriber.create(); <START> new Flowable<Integer>() { <END> @Override protected void subscribeActual(final Subscriber<? super Integer> s) { s.onSubscribe(new Subscription() { @Override public void request(long n) { if (n > 0) { s.onNext(1); s.onError(e2); } } @Override public void cancel() { } }); } }.collect( new Callable<List<Integer>>() { @Override public List<Integer> call() { return new ArrayList<Integer>(); } }, new BiConsumer<List<Integer>, Integer>() { @Override public void accept(List<Integer> t1, Integer t2) { throw e1; } }) .subscribe(ts); ts.assertError(e1); ts.assertNotComplete(); assertEquals(Arrays.asList(e2), list); } finally { RxJavaPlugins.reset(); } }</code><technical_language>just().concatWith(Flowable.error()); of troubles porting 1.x tests custom Observables need rearchitected. of written standard API composition</technical_language>

Target:
public void testCollectorFailureDoesNotResultInTwoErrorEmissions() { try { final List<Throwable> list = new CopyOnWriteArrayList<Throwable>(); RxJavaPlugins.setErrorHandler(addToList(list)); final RuntimeException e1 = new RuntimeException(); final RuntimeException e2 = new RuntimeException(); Burst.items(1).error(e2) .collect(callableListCreator(), biConsumerThrows(e1)) .test() .assertError(e1) .assertNotComplete(); assertEquals(Arrays.asList(e2), list); } finally { RxJavaPlugins.reset(); } }
Source:
<code>void serializeMessageInfoList(ByteBuffer outputBuffer) { outputBuffer.putInt(messageInfoList == null ? 0 : messageInfoList.size()); if (messageInfoList != null) { for (MessageInfo messageInfo : messageInfoList) { outputBuffer.put(messageInfo.getStoreKey().toBytes()); outputBuffer.putLong(messageInfo.getSize()); outputBuffer.putLong(messageInfo.getExpirationTimeInMs()); outputBuffer.put(messageInfo.isDeleted() ? DELETED : (byte) ~DELETED); switch (version) { case VERSION_1: break; case VERSION_2: <START> Long crc = messageInfo.getCrc(); <END> if (crc != null) { outputBuffer.put(CRC_PRESENT); outputBuffer.putLong(crc); } else { outputBuffer.put((byte) ~CRC_PRESENT); } break; case VERSION_3: crc = messageInfo.getCrc(); if (crc != null) { outputBuffer.put(CRC_PRESENT); outputBuffer.putLong(crc); } else { outputBuffer.put((byte) ~CRC_PRESENT); } outputBuffer.putShort(messageInfo.getAccountId()); outputBuffer.putShort(messageInfo.getContainerId()); outputBuffer.putLong(messageInfo.getOperationTimeMs()); break; default: throw new IllegalArgumentException("Unknown version in MessageInfoList " + version); } } } }</code><technical_language>minor move declaration Long crc; of switch do assignments of switch</technical_language>

Target:
void serializeMessageInfoList(ByteBuffer outputBuffer) { outputBuffer.putInt(messageInfoList == null ? 0 : messageInfoList.size()); if (messageInfoList != null) { for (MessageInfo messageInfo : messageInfoList) { outputBuffer.put(messageInfo.getStoreKey().toBytes()); outputBuffer.putLong(messageInfo.getSize()); outputBuffer.putLong(messageInfo.getExpirationTimeInMs()); outputBuffer.put(messageInfo.isDeleted() ? DELETED : (byte) ~DELETED); switch (version) { case VERSION_1: break; case VERSION_2: { Long crc = messageInfo.getCrc(); if (crc != null) { outputBuffer.put(CRC_PRESENT); outputBuffer.putLong(crc); } else { outputBuffer.put((byte) ~CRC_PRESENT); } } break; case VERSION_3: { Long crc = messageInfo.getCrc(); if (crc != null) { outputBuffer.put(CRC_PRESENT); outputBuffer.putLong(crc); } else { outputBuffer.put((byte) ~CRC_PRESENT); } outputBuffer.putShort(messageInfo.getAccountId()); outputBuffer.putShort(messageInfo.getContainerId()); outputBuffer.putLong(messageInfo.getOperationTimeMs()); } break; default: throw new IllegalArgumentException("Unknown version in MessageInfoList " + version); } } } }
Source:
<code>public ApplicationStatus status(StreamApplication app) { try { boolean finished = false; boolean unsuccessfulFinish = false; ExecutionPlan plan = getExecutionPlan(app); for (JobConfig jobConfig : plan.getJobConfigs()) { JobRunner runner = new JobRunner(jobConfig); JobStatus status = runner.status(); log.debug("Status is for job {}", new Object[]{status, jobConfig.getName()}); switch (status) { case Running: return ApplicationStatus.running(); case UnsuccessfulFinish: unsuccessfulFinish = true; case SuccessfulFinish: finished = true; break; default: } } if (unsuccessfulFinish) { <START> return ApplicationStatus.unsuccessfulFinish(null); END> } else if (finished) { return ApplicationStatus.successfulFinish(); } return ApplicationStatus.new_(); } catch (Throwable t) { throw new SamzaException("Failed to get status for application", t); } }</code><technical_language>Feels this is a gap. Ideally, report exception for remote case too. Maybe, for example YarnJob smarts determine application failed Diagnostic Info</technical_language>

Target:
public ApplicationStatus status(StreamApplication app) { try { boolean hasNewJobs = false; boolean hasRunningJobs = false; ApplicationStatus unsuccessfulFinishStatus = null; ExecutionPlan plan = getExecutionPlan(app); for (JobConfig jobConfig : plan.getJobConfigs()) { JobRunner runner = new JobRunner(jobConfig); ApplicationStatus status = runner.status(); log.debug("Status is for job {}", new Object[]{status, jobConfig.getName()}); switch (status.getStatusCode()) { case New: hasNewJobs = true; break; case Running: hasRunningJobs = true; break; case UnsuccessfulFinish: unsuccessfulFinishStatus = status; break; case SuccessfulFinish: break; default: } } if (hasNewJobs) { return ApplicationStatus.New; } else if (hasRunningJobs) { return ApplicationStatus.Running; } else if (unsuccessfulFinishStatus != null) { return unsuccessfulFinishStatus; } else { return ApplicationStatus.SuccessfulFinish; } } catch (Throwable t) { throw new SamzaException("Failed to get status for application", t); } }
Source:
<code>protected void executeQueryCommand() { Set<GlusterVolumeEntity> eligibleVolumes = new HashSet<GlusterVolumeEntity>(); Guid masterVolumeId = getParameters().getId(); GlusterVolumeEntity masterVolume = getGlusterVolumeDao().getById(masterVolumeId); List<GlusterVolumeEntity> allGlusterVolumesWithMasterCompatibleVersion = getAllGlusterVolumesWithMasterCompatibleVersion(masterVolumeId); CheckEligibilityOfVolumesForGeoRepSessionCreationQuery<CheckGlusterVolumeGeoRepEligibilityParameters> eligibilityQuery = new CheckEligibilityOfVolumesForGeoRepSessionCreationQuery<CheckGlusterVolumeGeoRepEligibilityParameters>(new CheckGlusterVolumeGeoRepEligibilityParameters(masterVolumeId, null)); List<Guid> sessionSlavesIds = eligibilityQuery.prepareSessionMap(getGeoRepDao().getAllSessions()); for(GlusterVolumeEntity currentVolume : allGlusterVolumesWithMasterCompatibleVersion) { <START> List<GEO_REP_NON_ELIGIBILITY_REASON> nonEligibilityResons = eligibilityQuery.processVolumesInCurrentCluster(masterVolume, currentVolume, sessionSlavesIds); <END> if(nonEligibilityResons == null || nonEligibilityResons.size() == 0) { eligibleVolumes.add(currentVolume); } } getQueryReturnValue().setReturnValue(eligibleVolumes); }</code><technical_language>move processVolumes method a GlusterGeoRepUtils call that, instead of instantiating query class here</technical_language>

Target:
protected void executeQueryCommand() { Set<GlusterVolumeEntity> eligibleVolumes = new HashSet<GlusterVolumeEntity>(); Guid masterVolumeId = getParameters().getId(); GlusterVolumeEntity masterVolume = getGlusterVolumeDao().getById(masterVolumeId); List<GlusterVolumeEntity> allGlusterVolumesWithMasterCompatibleVersion = getAllGlusterVolumesWithMasterCompatibleVersion(masterVolumeId); for(GlusterVolumeEntity currentVolume : allGlusterVolumesWithMasterCompatibleVersion) { List<GlusterGeoRepNonEligibilityReason> nonEligibilityResons = getGeoRepUtilInstance().getNonEligibilityReasons(masterVolume, currentVolume); if(nonEligibilityResons == null || nonEligibilityResons.size() == 0) { eligibleVolumes.add(currentVolume); } } getQueryReturnValue().setReturnValue(eligibleVolumes); }
Source:
<code>private void validateConfigOptions(ReadableConfig config) { String jdbcUrl = config.get(URL); final Optional<JdbcDialect> dialect = JdbcDialects.get(jdbcUrl); checkState(dialect.isPresent(), "Cannot handle such jdbc url: " + jdbcUrl); checkAllOrNone(config, new ConfigOption[]{ USERNAME, PASSWORD }); checkAllOrNone(config, new ConfigOption[]{ SCAN_PARTITION_COLUMN, SCAN_PARTITION_NUM, SCAN_PARTITION_LOWER_BOUND, SCAN_PARTITION_UPPER_BOUND }); if (config.getOptional(SCAN_PARTITION_LOWER_BOUND).isPresent() && config.getOptional(SCAN_PARTITION_UPPER_BOUND).isPresent()) { long lowerBound = config.get(SCAN_PARTITION_LOWER_BOUND); long upperBound = config.get(SCAN_PARTITION_UPPER_BOUND); if (lowerBound > upperBound) { throw new IllegalArgumentException(String.format( "'%s'='%s' must not be larger than '%s'='%s'.", SCAN_PARTITION_LOWER_BOUND.key(), lowerBound, SCAN_PARTITION_UPPER_BOUND.key(), upperBound)); } } checkAllOrNone(config, new ConfigOption[]{ LOOKUP_CACHE_MAX_ROWS, LOOKUP_CACHE_TTL }); if (config.get(LOOKUP_MAX_RETRIES) <= 0) { <START> throw new IllegalArgumentException("The 'lookup.max-retries' should be greater than 0."); <END> } if (config.get(SINK_MAX_RETRIES) <= 0) { throw new IllegalArgumentException("The 'sink.max-retries' should be greater than 0."); } }</code><technical_language>java throw new IllegalArgumentException(String.format( "The of '%s' option negative, is %s.", LOOKUP_MAX_RETRIES.key(), config.get(LOOKUP_MAX_RETRIES)));</technical_language>

Target:
private void validateConfigOptions(ReadableConfig config) { String jdbcUrl = config.get(URL); final Optional<JdbcDialect> dialect = JdbcDialects.get(jdbcUrl); checkState(dialect.isPresent(), "Cannot handle such jdbc url: " + jdbcUrl); checkAllOrNone(config, new ConfigOption[]{ USERNAME, PASSWORD }); checkAllOrNone(config, new ConfigOption[]{ SCAN_PARTITION_COLUMN, SCAN_PARTITION_NUM, SCAN_PARTITION_LOWER_BOUND, SCAN_PARTITION_UPPER_BOUND }); if (config.getOptional(SCAN_PARTITION_LOWER_BOUND).isPresent() && config.getOptional(SCAN_PARTITION_UPPER_BOUND).isPresent()) { long lowerBound = config.get(SCAN_PARTITION_LOWER_BOUND); long upperBound = config.get(SCAN_PARTITION_UPPER_BOUND); if (lowerBound > upperBound) { throw new IllegalArgumentException(String.format( "'%s'='%s' must not be larger than '%s'='%s'.", SCAN_PARTITION_LOWER_BOUND.key(), lowerBound, SCAN_PARTITION_UPPER_BOUND.key(), upperBound)); } } checkAllOrNone(config, new ConfigOption[]{ LOOKUP_CACHE_MAX_ROWS, LOOKUP_CACHE_TTL }); if (config.get(LOOKUP_MAX_RETRIES) < 0) { throw new IllegalArgumentException(String.format( "The value of '%s' option shouldn't be negative, but is %s.", LOOKUP_MAX_RETRIES.key(), config.get(LOOKUP_MAX_RETRIES))); } if (config.get(SINK_MAX_RETRIES) < 0) { throw new IllegalArgumentException(String.format( "The value of '%s' option shouldn't be negative, but is %s.", SINK_MAX_RETRIES.key(), config.get(SINK_MAX_RETRIES))); } }