auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Collection<GameProfile> match(String lastKnownName) { lastKnownName = checkNotNull(lastKnownName, "lastKnownName").toLowerCase(Locale.ROOT); Collection<GameProfile> allProfiles = UserDiscoverer.getAllProfiles(); Collection<GameProfile> matching = Sets.newHashSet(); for (GameProfile profile : allProfiles) { Optional<String> name = profile.getName().map(n -> n.toLowerCase(Locale.ROOT)); <START> if (name.isPresent() && name.get().startsWith(lastKnownName)) { <END> matching.add(profile); } } return matching; }</code><technical_language>changing this immediately breaking out of optional-world optional-style not. do name.get().toLowerCase(Locale.ROOT).startsWith(lastKnownName), continue Optional chain terminates orElse(false), removing of isPresent get</technical_language>

Target:
public Collection<GameProfile> match(String lastKnownName) { lastKnownName = checkNotNull(lastKnownName, "lastKnownName").toLowerCase(Locale.ROOT); Collection<GameProfile> allProfiles = UserDiscoverer.getAllProfiles(); Collection<GameProfile> matching = Sets.newHashSet(); for (GameProfile profile : allProfiles) { Optional<String> name = profile.getName(); if (name.isPresent() && name.get().toLowerCase(Locale.ROOT).startsWith(lastKnownName)) { matching.add(profile); } } return matching; }
Source:
<code>private List<HudsonModelJob> getJobsFromFolder(final String folderUrl, final List<String> ids, final IOperationMonitor monitor) throws HudsonException { return new HudsonOperation<List<HudsonModelJob>>(client) { @Override protected List<HudsonModelJob> execute() throws IOException, HudsonException, JAXBException { String url = HudsonUrl.create(folderUrl) .depth(1) .include(" job/build") .toUrl(); HttpRequestBase request = createGetRequest(url); CommonHttpResponse response = execute(request, monitor); return processAndRelease(response, monitor); } @Override protected List<HudsonModelJob> doProcess(CommonHttpResponse response, IOperationMonitor monitor) throws IOException, HudsonException, JAXBException { InputStream in = response.getResponseEntityAsStream(); HudsonModelHudson hudson = unmarshal(parse(in, response.getRequestPath()), HudsonModelHudson.class); List<HudsonModelJob> buildPlans = new ArrayList<HudsonModelJob>(); List<Object> jobsNodes = hudson.getJob(); for (Object jobNode : jobsNodes) { Node node = (Node) jobNode; HudsonModelJob job = unmarshal(node, HudsonModelJob.class); if (job.getColor() != null) { String jobUrl = hudsonUrlUtil.assembleJobUrl(job.getName(), folderUrl); job.setUrl(jobUrl); buildPlans.add(job); } else { <START> buildPlans.addAll(getJobsFromFolder(job.getUrl(), ids, monitor)); <END> } } return buildPlans; } }.run(); }</code><technical_language>recurse if ids is null? retrieve more asked for</technical_language>

Target:
private List<HudsonModelJob> getJobsFromFolder(final String folderUrl, final List<String> ids, final IOperationMonitor monitor) throws HudsonException { return new HudsonOperation<List<HudsonModelJob>>(client) { @Override protected List<HudsonModelJob> execute() throws IOException, HudsonException, JAXBException { String url = HudsonUrl.create(folderUrl) .depth(1) .include(" job/build") .toUrl(); HttpRequestBase request = createGetRequest(url); CommonHttpResponse response = execute(request, monitor); return processAndRelease(response, monitor); } @Override protected List<HudsonModelJob> doProcess(CommonHttpResponse response, IOperationMonitor monitor) throws IOException, HudsonException, JAXBException { InputStream in = response.getResponseEntityAsStream(); HudsonModelHudson hudson = unmarshal(parse(in, response.getRequestPath()), HudsonModelHudson.class); List<HudsonModelJob> buildPlans = new ArrayList<HudsonModelJob>(); List<Object> jobsNodes = hudson.getJob(); for (Object jobNode : jobsNodes) { Node node = (Node) jobNode; HudsonModelJob job = unmarshal(node, HudsonModelJob.class); if (job.getColor() != null) { String jobUrl = hudsonUrlUtil.assembleJobUrl(job.getName(), folderUrl); job.setUrl(jobUrl); buildPlans.add(job); } else if (ids == null) { buildPlans.addAll(getJobsFromFolder(job.getUrl(), ids, monitor)); } } return buildPlans; } }.run(); }
Source:
<code>private void loadChildEntities(KitDescriptor kitDescriptor) throws IOException { for (TargetedSequencing ts : kitDescriptor.getTargetedSequencing()) { if (ts != null && ts.getId() != TargetedSequencing.UNSAVED_ID) { <START> kitDescriptor.addTargetedSequencing(targetedSequencingService.get(ts.getId())); <END> } } }</code><technical_language>original is removed, duplicates, hashcodes match add managed version do</technical_language>

Target:
private void loadChildEntities(KitDescriptor kitDescriptor) throws IOException { Set<TargetedSequencing> maybeManaged = Sets.newHashSet(kitDescriptor.getTargetedSequencing()); kitDescriptor.clearTargetedSequencing(); for (TargetedSequencing ts : maybeManaged) { if (ts != null && ts.getId() != TargetedSequencing.UNSAVED_ID) { kitDescriptor.addTargetedSequencing(targetedSequencingService.get(ts.getId())); } } }
Source:
<code>public void testImportWithoutPadding() throws IOException { if(failWithoutExtraArgs){ thrown.expect(IOException.class); thrown.expectMessage("Failure during job; return status 1"); <START> NumericTypesTestUtils.configureJunitToExpectFailure(thrown); <END> } ArgumentArrayBuilder builder = getArgsBuilder(); String[] args = builder.build(); runImport(args); if (!failWithoutExtraArgs) { verify(); } }</code><technical_language>This method previous line</technical_language>

Target:
public void testImportWithoutPadding() throws IOException { if(failWithoutExtraArgs){ NumericTypesTestUtils.configureJunitToExpectFailure(thrown); } ArgumentArrayBuilder builder = getArgsBuilder(); String[] args = builder.build(); runImport(args); if (!failWithoutExtraArgs) { verify(); } }
Source:
<code>public synchronized void updateTableStatistics(String databaseName, String tableName, Function<PartitionStatistics, PartitionStatistics> update) { PartitionStatistics currentStatistics = getTableStatistics(databaseName, tableName); PartitionStatistics updatedStatistics = update.apply(currentStatistics); Table metastoreApiTable = getTable(databaseName, tableName) .orElseThrow(() -> new TableNotFoundException(new SchemaTableName(databaseName, tableName))); <START> metastoreApiTable.setParameters(updateStatisticParameters(metastoreApiTable.getParameters(), updatedStatistics.getBasicStatistics())); <END> alterTable(databaseName, tableName, metastoreApiTable); com.facebook.presto.hive.metastore.Table table = fromMetastoreApiTable(metastoreApiTable); List<ColumnStatisticsObj> metastoreColumnStatistics = updatedStatistics.getColumnStatistics().entrySet() .stream() .map(entry -> createMetastoreColumnStatistics(entry.getKey(), table.getColumn(entry.getKey()).get().getType(), entry.getValue())) .collect(toImmutableList()); if (!metastoreColumnStatistics.isEmpty()) { setTableColumnStatistics(databaseName, tableName, metastoreColumnStatistics); } Set<String> removedColumnStatistics = difference(currentStatistics.getColumnStatistics().keySet(), updatedStatistics.getColumnStatistics().keySet()); removedColumnStatistics.forEach(column -> deleteTableColumnStatistics(databaseName, tableName, column)); }</code><technical_language>modify else's object. Do a deepCopy(). In particular, InMemoryHiveMetastore stores objects want modify original</technical_language>

Target:
public synchronized void updateTableStatistics(String databaseName, String tableName, Function<PartitionStatistics, PartitionStatistics> update) { PartitionStatistics currentStatistics = getTableStatistics(databaseName, tableName); PartitionStatistics updatedStatistics = update.apply(currentStatistics); Table originalTable = getTable(databaseName, tableName) .orElseThrow(() -> new TableNotFoundException(new SchemaTableName(databaseName, tableName))); Table modifiedTable = originalTable.deepCopy(); modifiedTable.setParameters(updateStatisticParameters(modifiedTable.getParameters(), updatedStatistics.getBasicStatistics())); alterTable(databaseName, tableName, modifiedTable); com.facebook.presto.hive.metastore.Table table = fromMetastoreApiTable(modifiedTable); List<ColumnStatisticsObj> metastoreColumnStatistics = updatedStatistics.getColumnStatistics().entrySet().stream() .map(entry -> createMetastoreColumnStatistics(entry.getKey(), table.getColumn(entry.getKey()).get().getType(), entry.getValue())) .collect(toImmutableList()); if (!metastoreColumnStatistics.isEmpty()) { setTableColumnStatistics(databaseName, tableName, metastoreColumnStatistics); } Set<String> removedColumnStatistics = difference(currentStatistics.getColumnStatistics().keySet(), updatedStatistics.getColumnStatistics().keySet()); removedColumnStatistics.forEach(column -> deleteTableColumnStatistics(databaseName, tableName, column)); }
Source:
<code>public void playFile(String fileName, String sink, PercentType volume) throws AudioException { <START> if (fileName == null) { <END> throw new NullPointerException("File cannot be played as fileName is null."); } File file = new File( ConfigConstants.getConfigFolder() + File.separator + SOUND_DIR + File.separator + fileName); FileAudioStream is = new FileAudioStream(file); play(is, sink, volume); }</code><technical_language>a suggestion: Objects#requireNonNull(Object, String)</technical_language>

Target:
public void playFile(String fileName, String sink, PercentType volume) throws AudioException { Objects.requireNonNull(fileName, "File cannot be played as fileName is null."); File file = new File( ConfigConstants.getConfigFolder() + File.separator + SOUND_DIR + File.separator + fileName); FileAudioStream is = new FileAudioStream(file); play(is, sink, volume); }
Source:
<code>protected void handlePythonReadinessChange(boolean ready) { boolean wasPythonReady = pythonReady; firePropertyChange(PYTHON_READINESS_PROPERTY, pythonReady, pythonReady = ready); if (ready == false && wasPythonReady != ready) { <START> CompletableFuture.runAsync(() -> { <END> try { cleanUp(); setUpPythonThread(); } catch(IOException e) { LOG.error("Failed to load Python"); LOG.error(e); try { Thread.sleep(1000); } catch (InterruptedException e1) { LOG.error(e); } handlePythonReadinessChange(ready); } }, THREAD); } }</code><technical_language>discussed, this is superfluous. Executor submit task suffice</technical_language>

Target:
protected void handlePythonReadinessChange(boolean ready) { boolean wasPythonReady = pythonReady; firePropertyChange(PYTHON_READINESS_PROPERTY, pythonReady, pythonReady = ready); if (ready == false && wasPythonReady != ready) { THREAD.submit(() -> restartPython()); } }
Source:
<code>public void remove(EntityKey entityKey) { <START> Map<String, Object> parameters = parameters( entityKey ); <END> StringBuilder query = new StringBuilder( "MATCH" ); appendNodePattern( entityKey, parameters, query, NodeLabel.ENTITY ); query.append( " OPTIONAL MATCH (n) - [r] - () DELETE r,n" ); engine.execute( query.toString(), parameters ); }</code><technical_language>if parameters added map in appendNodePattern()</technical_language>

Target:
public void remove(EntityKey entityKey) { Map<String, Object> parameters = new HashMap<String, Object>( entityKey.getColumnNames().length ); StringBuilder query = new StringBuilder( "MATCH" ); appendNodePattern( entityKey, parameters, query, NodeLabel.ENTITY ); query.append( " OPTIONAL MATCH (n) - [r] - () DELETE r,n" ); engine.execute( query.toString(), parameters ); }
Source:
<code>public Object getValueAt(int row, int col) { <START> assert row >= 0 && row < getRowCount() && col >= 0 && col < getColumnCount(); <END> if (row == myAssignments.size()) { return null; } ResourceAssignment ra = myAssignments.get(row); Column column = Column.values()[col]; switch (column) { case ID: { return ra.getTask().getTaskID(); } case NAME: { return ra.getTask(); } case UNIT: { return ra.getLoad(); } default: throw new IllegalArgumentException("Illegal row number=" + row); } }</code><technical_language>Add assertion message row, col, row count column count values</technical_language>

Target:
public Object getValueAt(int row, int col) { assert row >= 0 && row < getRowCount() && col >= 0 && col < getColumnCount() : String.format("Row/column index is out of bounds: (%d,%d) [%d,%d]", row, col, getRowCount(), getColumnCount()); if (row == myAssignments.size()) { return null; } ResourceAssignment ra = myAssignments.get(row); Column column = Column.values()[col]; switch (column) { case ID: { return ra.getTask().getTaskID(); } case NAME: { return ra.getTask(); } case UNIT: { return ra.getLoad(); } default: throw new IllegalArgumentException("Illegal row number=" + row); } }
Source:
<code>public List<GerritQueryResult> queryMyReviews(IProgressMonitor monitor) throws GerritException { <START> return executeQuery(monitor, "owner:self OR reviewer:self", ImmutableList.of(GET_DETAILED_ACCOUNTS_OPTION)); END> }</code><technical_language>Sorry! I meant need pass options in</technical_language>

Target:
public List<GerritQueryResult> queryMyReviews(IProgressMonitor monitor) throws GerritException { return executeQuery(monitor, "owner:self OR reviewer:self"); }
Source:
<code>private void setUserId(String userId) throws IllegalArgumentException { <START> if (userId == null || userId.trim().isEmpty()) { <END> throw new IllegalArgumentException("User ID cannot be null or an empty string."); } else { this.userId = userId; } }</code><technical_language>@jjl014 User id is optional, client id session id, required for user info</technical_language>

Target:
private void setUserId(String userId) throws IllegalArgumentException { if (userId != null && userId.trim().isEmpty()) { throw new IllegalArgumentException("User ID cannot be an empty string."); } else { this.userId = userId; } }
Source:
<code>private Result getMockResult(String id) { Metacard metacard = mock(Metacard.class); MetacardType metacardType = mock(MetacardType.class); doReturn(id).when(metacard).getId(); <START> metacard.setAttribute(new AttributeImpl(Core.ID, id)); <END> doReturn(metacardType).when(metacard).getMetacardType(); Result result = mock(Result.class); doReturn(metacard).when(result).getMetacard(); return result; }</code><technical_language>This do metacard is a mock</technical_language>

Target:
private Result getMockResult(String id) { Metacard metacard = mock(Metacard.class); MetacardType metacardType = mock(MetacardType.class); doReturn(id).when(metacard).getId(); doReturn(metacardType).when(metacard).getMetacardType(); return getMockResult(metacard); }
Source:
<code>void nonAirWithMovementLeftAreMarkedAsMoved() { final BattleState battleState = givenBattleStateBuilder() .battleRound(1) .headless(false) .attackingUnits(List.of(givenNonAirUnitWithMovementLeft(BigDecimal.ONE))) .build(); final MarkNoMovementLeft markNoMovementLeft = new MarkNoMovementLeft(battleState, battleActions); markNoMovementLeft.execute(executionStack, delegateBridge); <START> verify(delegateBridge).addChange(any()); <END> }</code><technical_language>change object is interesting thing, right? structure data of change object do expect in a way, defines correctness? For example, if null, I this test pass. A captor grab change object verify it. pretty tied implementation another code smell code change, correct, tests breaking testing implementation behavior. So, captor is option, another option is execute method return change object. In case test code get a reference directly. IF limited compatibility concerns (we be), if are, existing code converted a facade invokes a method is visible testing return a change object. WDYT</technical_language>

Target:
void nonAirWithMovementLeftAreMarkedAsMoved() { final BattleState battleState = givenBattleStateBuilder() .battleRound(1) .headless(false) .attackingUnits(List.of(givenNonAirUnitWithMovementLeft(BigDecimal.ONE))) .build(); final MarkNoMovementLeft markNoMovementLeft = new MarkNoMovementLeft(battleState, battleActions); markNoMovementLeft.execute(executionStack, delegateBridge); verify(delegateBridge) .addChange( argThat( compositeChangeContains( propertyChange(Unit.ALREADY_MOVED, BigDecimal.ONE, BigDecimal.ZERO)))); }
Source:
<code>public List<NewsConfiguration> getNewsConfigurations(String subscribeId) { logger.debug("fetching news configurations for " + subscribeId); Query<NewsConfiguration> query = createQuery( <START> "from NewsConfiguration config where " <END> + "subscribeId = ? and displayed = true " + "order by newsDefinition.name"); query.setParameter(0, subscribeId); return query.list(); }</code><technical_language>[SQL code style](<LINK_3>, [all caps for HQL/SQL reserved keywords](<LINK_2>, [newlines for new statements](<LINK_0>, [explicit aliasing](<LINK_1></technical_language>

Target:
public List<NewsConfiguration> getNewsConfigurations(String subscribeId) { String hql = " FROM NewsConfiguration AS config " + " WHERE subscribeId = ? " + " AND displayed = TRUE " + "ORDER BY newsDefinition.name"; Query<NewsConfiguration> query = generateQuery(hql); query.setParameter(0, subscribeId); return query.list(); }
Source:
<code>private List<MavenProject> trimResumedProjects( List<MavenProject> projects, MavenExecutionRequest request ) throws MavenExecutionException { List<MavenProject> result = projects; if ( StringUtils.isNotEmpty( request.getResumeFrom() ) || request.isResumeFromLastFailedProject() ) { File reactorDirectory = null; if ( request.getBaseDirectory() != null ) { reactorDirectory = new File( request.getBaseDirectory() ); } String selector; if ( StringUtils.isNotEmpty( request.getResumeFrom() ) ) { selector = request.getResumeFrom(); } else { <START> String buildDirectory = projects.stream() <END> .filter( mp -> mp.getBasedir().toString().equals( request.getBaseDirectory() ) ) .findFirst() .map( mp -> mp.getBuild().getDirectory() ) .orElseThrow( () -> new MavenExecutionException( "Could not determine build directory for root project", request.getPom() ) ); Path resumeFromCacheFile = Paths.get( buildDirectory, "resume-from-cache" ); try ( Stream<String> allLines = Files.lines( resumeFromCacheFile ) ) { selector = allLines.findFirst().orElseThrow( () -> new MavenExecutionException( "resume-from-cache file was empty", request.getPom() ) ); } catch ( IOException e ) { throw new MavenExecutionException( "Error occurred while reading resume-from-cache file", request.getPom() ); } } result = new ArrayList<>( projects.size() ); boolean resumed = false; for ( MavenProject project : projects ) { if ( !resumed && isMatchingProject( project, selector, reactorDirectory ) ) { resumed = true; } if ( resumed ) { result.add( project ); } } if ( !resumed ) { throw new MavenExecutionException( "Could not find project to resume reactor build from: " + selector + " vs " + formatProjects( projects ), request.getPom() ); } } return result; }</code><technical_language>I suggest refactor this a dedicated method, determineWhereToResumeBuild()</technical_language>

Target:
private List<MavenProject> trimResumedProjects( List<MavenProject> projects, MavenExecutionRequest request ) throws MavenExecutionException { List<MavenProject> result = projects; String resumeFrom = request.getResumeFrom(); if ( resumeFrom != null ) { File reactorDirectory = null; if ( request.getBaseDirectory() != null ) { reactorDirectory = new File( request.getBaseDirectory() ); } String selector; if ( StringUtils.isNotEmpty( resumeFrom ) ) { selector = resumeFrom; } else { selector = getLastFailedProject( projects, request ); } result = new ArrayList<>( projects.size() ); boolean resumed = false; for ( MavenProject project : projects ) { if ( !resumed && isMatchingProject( project, selector, reactorDirectory ) ) { resumed = true; } if ( resumed ) { result.add( project ); } } if ( !resumed ) { throw new MavenExecutionException( "Could not find project to resume reactor build from: " + selector + " vs " + formatProjects( projects ), request.getPom() ); } } return result; }
Source:
<code>public void testFactoryNamedParameters() { <START> final List<String> names = new ArrayList<>(); <END> names.add("a"); names.add("b"); names.add("c"); final ParsedParameters parameters = ParsedParameters.of(false, names); assertThat(parameters).isNotNull(); assertThat(parameters.isPositional()).isFalse(); assertThat(parameters.getParameterCount()).isEqualTo(3); assertThat(parameters.getParameterNames()).containsExactly("a", "b", "c"); }</code><technical_language>please more concise methods Arrays.asList</technical_language>

Target:
public void testFactoryNamedParameters() { final List<String> names = Arrays.asList("a", "b", "c"); final ParsedParameters parameters = ParsedParameters.named(names); assertThat(parameters).isNotNull(); assertThat(parameters.isPositional()).isFalse(); assertThat(parameters.getParameterCount()).isEqualTo(3); assertThat(parameters.getParameterNames()).containsExactly("a", "b", "c"); }
Source:
<code>public static Status fromValue(String value) { if (value == null) { return PENDING; } Optional<Status> status = Enums.getIfPresent(Status.class, value.toUpperCase()); <START> checkArgument(status.isPresent(), "%s is not a valid value", value); <END> return status.get(); }</code><technical_language>Again, add valid values error? "Expected of ... X"</technical_language>

Target:
public static Status fromValue(String value) { if (value == null) { return PENDING; } Optional<Status> status = Enums.getIfPresent(Status.class, value.toUpperCase()); checkArgument(status.isPresent(), "Expected one of %s but was", Joiner.on(',').join(Status.values()), value); return status.get(); }
Source:
<code>public void testPushesAggregationThroughLeftJoin() { new RuleTester().assertThat(new PushAggregationThroughOuterJoin()) .on(p -> p.aggregation(ab -> ab .source( p.join( JoinNode.Type.LEFT, p.values(ImmutableList.of(p.symbol("COL1", BIGINT)), ImmutableList.of(expressions("10"))), p.values(p.symbol("COL2", BIGINT)), ImmutableList.of(new JoinNode.EquiJoinClause(p.symbol("COL1", BIGINT), p.symbol("COL2", BIGINT))), ImmutableList.of(p.symbol("COL1", BIGINT), p.symbol("COL2", BIGINT)), Optional.empty(), Optional.empty(), Optional.empty() )) .addAggregation(p.symbol("AVG", DOUBLE), PlanBuilder.expression("avg(COL2)"), ImmutableList.of(DOUBLE)) <START> .groupingSets(ImmutableList.of(ImmutableList.of(p.symbol("COL1", BIGINT)))))) <END> .matches( project(ImmutableMap.of( "COL1", expression("COL1"), "COALESCE", expression("coalesce(AVG, AVG_NULL)")), join(JoinNode.Type.INNER, ImmutableList.of(), join(JoinNode.Type.LEFT, ImmutableList.of(equiJoinClause("COL1", "COL2")), values(ImmutableMap.of("COL1", 0)), aggregation( ImmutableList.of(ImmutableList.of("COL2")), ImmutableMap.of(Optional.of("AVG"), functionCall("avg", ImmutableList.of("COL2"))), ImmutableMap.of(), Optional.empty(), SINGLE, values(ImmutableMap.of("COL2", 0)))), aggregation( ImmutableList.of(ImmutableList.of()), ImmutableMap.of(Optional.of("AVG_NULL"), functionCall("avg", ImmutableList.of("null_literal"))), ImmutableMap.of(), Optional.empty(), SINGLE, values(ImmutableMap.of("null_literal", 0)))))); }</code><technical_language>awful. .groupBy(Symbol... ) for cases this? remove need for ImmutableList.of(ImmutableList.of(...))</technical_language>

Target:
public void testPushesAggregationThroughLeftJoin() { new RuleTester().assertThat(new PushAggregationThroughOuterJoin()) .on(p -> p.aggregation(ab -> ab .source( p.join( JoinNode.Type.LEFT, p.values(ImmutableList.of(p.symbol("COL1", BIGINT)), ImmutableList.of(expressions("10"))), p.values(p.symbol("COL2", BIGINT)), ImmutableList.of(new JoinNode.EquiJoinClause(p.symbol("COL1", BIGINT), p.symbol("COL2", BIGINT))), ImmutableList.of(p.symbol("COL1", BIGINT), p.symbol("COL2", BIGINT)), Optional.empty(), Optional.empty(), Optional.empty() )) .addAggregation(p.symbol("AVG", DOUBLE), PlanBuilder.expression("avg(COL2)"), ImmutableList.of(DOUBLE)) .addGroupingSet(p.symbol("COL1", BIGINT)))) .matches( project(ImmutableMap.of( "COL1", expression("COL1"), "COALESCE", expression("coalesce(AVG, AVG_NULL)")), join(JoinNode.Type.INNER, ImmutableList.of(), join(JoinNode.Type.LEFT, ImmutableList.of(equiJoinClause("COL1", "COL2")), values(ImmutableMap.of("COL1", 0)), aggregation( ImmutableList.of(ImmutableList.of("COL2")), ImmutableMap.of(Optional.of("AVG"), functionCall("avg", ImmutableList.of("COL2"))), ImmutableMap.of(), Optional.empty(), SINGLE, values(ImmutableMap.of("COL2", 0)))), aggregation( ImmutableList.of(ImmutableList.of()), ImmutableMap.of(Optional.of("AVG_NULL"), functionCall("avg", ImmutableList.of("null_literal"))), ImmutableMap.of(), Optional.empty(), SINGLE, values(ImmutableMap.of("null_literal", 0)))))); }
Source:
<code>private Map<String, Value> getValueAttributes(Schematic sch, Map<String, TypeValue> expectedTypes, JsonObject obj) throws UndeclaredIdentifierException, UndeclaredAttributeException { JsonObject attributeMapJson = obj.getAsJsonObject(ATTRIBUTES); HashMap<String, Value> attributeMap = new HashMap<>(); if (attributeMapJson == null) { return attributeMap; } TypeValue bool = sch.getUserDefinedType("Bool"); TypeValue integer = sch.getUserDefinedType("Int"); TypeValue str = sch.getUserDefinedType("String"); for (Entry<String, JsonElement> attrEntry : attributeMapJson.entrySet()) { TypeValue type = expectedTypes.get(attrEntry.getKey()); Value attrValue = null; String valueString = attrEntry.getValue().getAsString(); if (type == null) { throw new UndeclaredAttributeException(attrEntry.getKey()); } if (type.equals(bool)) { <START> attrValue = BooleanValue.getInstance(Boolean.valueOf(valueString)); <END> } else if (type.equals(integer)) { attrValue = new IntegerValue(IntegerTypeValue.getInstance(), Integer.valueOf(valueString)); } else if (type.equals(str)) { attrValue = new StringValue(StringTypeValue.getInstance(), valueString); } else { throw new UndeclaredAttributeException(attrEntry.getKey()); } attributeMap.put(attrEntry.getKey(), attrValue); } return attributeMap; }</code><technical_language>For purposes of error detection, if valueString is "true" "false"? Is a check for this case throw exception? (I valueOf throws if convert argument.)</technical_language>

Target:
private Map<String, Value> getValueAttributes(Schematic sch, Map<String, TypeValue> expectedTypes, JsonObject obj) throws UndeclaredIdentifierException, UndeclaredAttributeException { JsonObject attributeMapJson = obj.getAsJsonObject(ATTRIBUTES); HashMap<String, Value> attributeMap = new HashMap<>(); if (attributeMapJson == null) { return attributeMap; } TypeValue bool = sch.getUserDefinedType("Bool"); TypeValue integer = sch.getUserDefinedType("Int"); TypeValue str = sch.getUserDefinedType("String"); for (Entry<String, JsonElement> attrEntry : attributeMapJson.entrySet()) { TypeValue type = expectedTypes.get(attrEntry.getKey()); Value attrValue = null; String valueString = attrEntry.getValue().getAsString(); if (type == null) { throw new UndeclaredAttributeException(attrEntry.getKey()); } if (type.equals(bool)) { if (!(Boolean.TRUE.toString().equals(valueString) || Boolean.FALSE.toString().equals(valueString))) { throw new IllegalArgumentException(String.format( "Expected boolean value of true or false, got %s", valueString)); } attrValue = BooleanValue.getInstance(Boolean.parseBoolean(valueString)); } else if (type.equals(integer)) { attrValue = new IntegerValue(IntegerTypeValue.getInstance(), Integer.valueOf(valueString)); } else if (type.equals(str)) { attrValue = new StringValue(StringTypeValue.getInstance(), valueString); } else { throw new UndeclaredAttributeException(attrEntry.getKey()); } attributeMap.put(attrEntry.getKey(), attrValue); } return attributeMap; }
Source:
<code>public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { long start = System.currentTimeMillis(); while (!done && System.currentTimeMillis() - start < unit.toMillis(timeout)) { Thread.sleep(250); } <START> return resultObject; <END> }</code><technical_language>docs for Future, I this throw TimeoutException if !done</technical_language>

Target:
public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { long start = System.currentTimeMillis(); while (!done && System.currentTimeMillis() - start < unit.toMillis(timeout)) { Thread.sleep(250); } if (!done) { throw new TimeoutException("ListenableFutureJob.get() could not get the result!"); } return resultObject; }
Source:
<code>public PriceIndexCurveMultiplyFixedCurve(final String name, final PriceIndexCurve curve, final DoublesCurve fixedCurve) { <START> ArgumentChecker.notNull(curve, "Curve"); <END> ArgumentChecker.notNull(fixedCurve, "Curve fixed"); _name = name; _curve = curve; _fixedCurve = fixedCurve; }</code><technical_language>guessing want name null either. is assumed obvious</technical_language>

Target:
public PriceIndexCurveMultiplyFixedCurve(final String name, final PriceIndexCurve curve, final DoublesCurve fixedCurve) { ArgumentChecker.notNull(name, "name"); ArgumentChecker.notNull(curve, "Curve"); ArgumentChecker.notNull(fixedCurve, "Curve fixed"); _name = name; _curve = curve; _fixedCurve = fixedCurve; }
Source:
<code>private RelationPlan planLateralJoin(Join join, RelationPlan leftPlan, Lateral lateral) { RelationPlan rightPlan = process(lateral.getQuery(), null); PlanBuilder leftPlanBuilder = initializePlanBuilder(leftPlan); PlanBuilder rightPlanBuilder = initializePlanBuilder(rightPlan); <START> PlanBuilder planBuilder = <END> subqueryPlanner.appendLateralJoin(leftPlanBuilder, rightPlanBuilder, subQueryNotSupportedError(lateral.getQuery()), true, LateralJoinNode.Type.INNER); List<Symbol> outputSymbols = ImmutableList.<Symbol>builder() .addAll(leftPlan.getRoot().getOutputSymbols()) .addAll(rightPlan.getRoot().getOutputSymbols()) .build(); return new RelationPlan(planBuilder.getRoot(), analysis.getScope(join), outputSymbols); }</code><technical_language>nit: put in line follow this pattern: java PlanBuilder planBuilder = subqueryPlanner.appendLateralJoin( leftPlanBuilder, rightPlanBuilder, subQueryNotSupportedError(lateral.getQuery()), true, LateralJoinNode.Type.INNER); done appendApplyNode</technical_language>

Target:
private RelationPlan planLateralJoin(Join join, RelationPlan leftPlan, Lateral lateral) { RelationPlan rightPlan = process(lateral.getQuery(), null); PlanBuilder leftPlanBuilder = initializePlanBuilder(leftPlan); PlanBuilder rightPlanBuilder = initializePlanBuilder(rightPlan); PlanBuilder planBuilder = subqueryPlanner.appendLateralJoin(leftPlanBuilder, rightPlanBuilder, lateral.getQuery(), true, LateralJoinNode.Type.INNER); List<Symbol> outputSymbols = ImmutableList.<Symbol>builder() .addAll(leftPlan.getRoot().getOutputSymbols()) .addAll(rightPlan.getRoot().getOutputSymbols()) .build(); return new RelationPlan(planBuilder.getRoot(), analysis.getScope(join), outputSymbols); }
Source:
<code>public Long clear(String key, String... fields) { RedisConnection<byte[], byte[]> redisCommands = null; try { redisCommands = getRedisConnection(); int maxBytes = Integer.MIN_VALUE; for (int i = 0; i < fields.length; i++) { if (fields[i].getBytes().length > maxBytes) maxBytes = fields[i].getBytes().length; } <START> byte[][] fieldsInBytes = new byte[fields.length][maxBytes + 1]; <END> for (int i = 0; i < fields.length; i++) { fieldsInBytes[i] = fields[i].getBytes(); } return redisCommands.hdel(key.getBytes(), fieldsInBytes); } catch (Exception e) { logger.error("Exception Occurred while clearing a value from redis", e); } finally { closeConnection(redisCommands); } return new Long(-1); }</code><technical_language>new byte[fields.length][] is sufficient initialize dimension in loop if fields empty (empty array) initialization fails size is Integer.MIN_VALUE + 1 is -2147483648 (-2^31 + 1)</technical_language>

Target:
public Long clear(String key, String... fields) { RedisConnection<byte[], byte[]> redisCommands = null; try { redisCommands = getRedisConnection(); byte[][] fieldsInBytes = new byte[fields.length][]; for (int i = 0; i < fields.length; i++) { fieldsInBytes[i] = fields[i].getBytes(); } return redisCommands.hdel(key.getBytes(), fieldsInBytes); } finally { closeConnection(redisCommands); } }
Source:
<code>private <T> CompletionStage<T> fireRequest(final HttpRequest request, final Class<T> responseType) { return _http.singleRequest(request.addHeader(AcceptEncoding.create(HttpEncodings.GZIP)), _materializer) .thenCompose(httpResponse -> { final HttpEncoding encoding = httpResponse.encoding(); final Coder flow; if (encoding == HttpEncodings.GZIP) { flow = Gzip$.MODULE$; } else if (encoding == HttpEncodings.DEFLATE) { flow = Deflate$.MODULE$; } else { flow = NoCoding$.MODULE$; } return httpResponse.entity() .toStrict(READ_TIMEOUT.toMillis(), _materializer) .thenCompose(strict -> FutureConverters.toJava(flow.decode(strict.getData(), _materializer))); }) .thenApply(body -> { try { return _mapper.readValue(body.utf8String(), responseType); } catch (final IOException e) { throw new RuntimeException(e); } }); <START> } <END></code><technical_language>return a URI; rename</technical_language>

Target:
private <T> CompletionStage<T> fireRequest(final HttpRequest request, final Class<T> responseType) { return _http.singleRequest(request.addHeader(AcceptEncoding.create(HttpEncodings.GZIP)), _materializer) .thenCompose(httpResponse -> { final HttpEncoding encoding = httpResponse.encoding(); final Coder flow; if (HttpEncodings.GZIP.equals(encoding)) { flow = Gzip$.MODULE$; } else if (HttpEncodings.DEFLATE.equals(encoding)) { flow = Deflate$.MODULE$; } else { flow = NoCoding$.MODULE$; } return httpResponse.entity() .toStrict(_readTimeout.toMillis(), _materializer) .thenCompose(strict -> FutureConverters.toJava(flow.decode(strict.getData(), _materializer))); }) .thenApply(body -> { try { return _mapper.readValue(body.utf8String(), responseType); } catch (final IOException e) { throw new RuntimeException(e); } }); }
Source:
<code>String processedIndexHtml() throws IOException { <START> InputStream is = indexHtml.getInputStream(); <END> Document soup = Jsoup.parse(is, null, ui.getBasePath()); is.close(); if (soup.head().getElementsByTag("base").isEmpty()) { soup.head().appendChild( soup.createElement("base") ); } soup.head().getElementsByTag("base").html(ui.getBasePath()); return soup.html(); }</code><technical_language>this in a try block ensure stream is closed if a parsing exception</technical_language>

Target:
String processedIndexHtml() throws IOException { String baseTagValue = "/".equals(ui.getBasepath()) ? "/" : ui.getBasepath() + "/"; Document soup; try (InputStream is = indexHtml.getInputStream()) { soup = Jsoup.parse(is, null, baseTagValue); } if (soup.head().getElementsByTag("base").isEmpty()) { soup.head().appendChild( soup.createElement("base") ); } soup.head().getElementsByTag("base").attr("href", baseTagValue); return soup.html(); }
Source:
<code>void updateCommittedTail(long newCommittedTail) { if (updateIfGreater(committedTail, newCommittedTail, COMMITTED_TAIL_RECORD)) { log.debug("Updated committed log tail to: {}", newCommittedTail); } else { <START> log.trace("New committed log tail not greater than current, ignore."); <END> } }</code><technical_language>Is log concrete of newCommittedTail if is greater existing one</technical_language>

Target:
void updateCommittedTail(long newCommittedTail) { if (update(COMMITTED_TAIL_RECORD, committedTail, newCommittedTail, (curr, next) -> next > curr)) { log.debug("Updated committed log tail to: {}", newCommittedTail); } else { log.trace("New committed log tail not greater than current, ignore.", newCommittedTail); } }
Source:
<code>public void notifyCheckpointComplete(long checkpointId, OperatorChain<?, ?> operatorChain, Supplier<Boolean> isRunning) throws Exception { if (isRunning.get()) { <START> LOG.debug("Notification of complete checkpoint for task {}", checkpointId, taskName); <END> for (StreamOperatorWrapper<?, ?> operatorWrapper : operatorChain.getAllOperators(true)) { operatorWrapper.notifyCheckpointComplete(checkpointId); } } else { LOG.debug("Ignoring notification of complete checkpoint for not-running task {}", taskName); } env.getTaskStateManager().notifyCheckpointComplete(checkpointId); }</code><technical_language>nit: a separate hotfix commit</technical_language>

Target:
public void notifyCheckpointComplete(long checkpointId, OperatorChain<?, ?> operatorChain, Supplier<Boolean> isRunning) throws Exception { if (isRunning.get()) { LOG.debug("Notification of complete checkpoint for task {}", taskName); for (StreamOperatorWrapper<?, ?> operatorWrapper : operatorChain.getAllOperators(true)) { operatorWrapper.notifyCheckpointComplete(checkpointId); } } else { LOG.debug("Ignoring notification of complete checkpoint for not-running task {}", taskName); } env.getTaskStateManager().notifyCheckpointComplete(checkpointId); }
Source:
<code>public static StashPullRequest extractPullRequest(String project, String repository, String pullRequestId, String jsonBody) throws StashReportExtractionException { StashPullRequest result = new StashPullRequest(project, repository, pullRequestId); try { JSONObject jsonPullRequest = (JSONObject) new JSONParser().parse(jsonBody); long version = (long) jsonPullRequest.get("version"); result.setVersion(version); JSONArray jsonReviewers = (JSONArray) jsonPullRequest.get("reviewers"); if (jsonReviewers != null) { for (Object objReviewer : jsonReviewers.toArray()) { JSONObject jsonReviewer = (JSONObject) objReviewer; JSONObject jsonUser = (JSONObject) jsonReviewer.get("user"); if (jsonUser != null){ long id = (long) jsonUser.get("id"); String name = (String) jsonUser.get("name"); String slug = (String) jsonUser.get("slug"); <START> String email = (String) jsonUser.get("email"); <END> StashUser reviewer = new StashUser(id, name, slug, email); result.addReviewer(reviewer); } } } } catch (ParseException e) { throw new StashReportExtractionException(e); } return result; }</code><technical_language>REST API if i wrong, key for email is emailAddress email (<LINK_0> IN this case, this call factorized extractUser() method</technical_language>

Target:
public static StashPullRequest extractPullRequest(String project, String repository, String pullRequestId, String jsonBody) throws StashReportExtractionException { StashPullRequest result = new StashPullRequest(project, repository, pullRequestId); try { JSONObject jsonPullRequest = (JSONObject) new JSONParser().parse(jsonBody); long version = (long) jsonPullRequest.get("version"); result.setVersion(version); JSONArray jsonReviewers = (JSONArray) jsonPullRequest.get("reviewers"); if (jsonReviewers != null) { for (Object objReviewer : jsonReviewers.toArray()) { JSONObject jsonReviewer = (JSONObject) objReviewer; JSONObject jsonUser = (JSONObject) jsonReviewer.get("user"); if (jsonUser != null){ StashUser reviewer = extractUser(jsonUser.toJSONString()); result.addReviewer(reviewer); } } } } catch (ParseException e) { throw new StashReportExtractionException(e); } return result; }
Source:
<code>public VmDevice addSoundDevice(VmBase vmBase, Supplier<Cluster> clusterSupplier) { ChipsetType chipset = EmulatedMachineUtils.getEffectiveChipset(vmBase, clusterSupplier); Version compatibilityVersion = vmBase instanceof VmTemplate ? <START> CompatibilityVersionUtils.getEffective((VmBase) null, clusterSupplier) <END> : clusterUtils.getCompatibilityVersion(vmBase); return addSoundDevice(vmBase.getId(), vmBase.getOsId(), compatibilityVersion, chipset); }</code><technical_language>custom compatibility level of template, if is set</technical_language>

Target:
public VmDevice addSoundDevice(VmBase vmBase, Supplier<Cluster> clusterSupplier) { ChipsetType chipset = EmulatedMachineUtils.getEffectiveChipset(vmBase, clusterSupplier); Version compatibilityVersion = CompatibilityVersionUtils.getEffective(vmBase, clusterSupplier); return addSoundDevice(vmBase.getId(), vmBase.getOsId(), compatibilityVersion, chipset); }
Source:
<code>protected boolean canDoAction() { boolean result=true; <START> if (getParameters().getEvent() == null || getParameters().getEvent().equals(OVIRT)){ <END> addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_ILLEGAL_ORIGIN); result = false; } if (!result) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ADD); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__EXTERNAL_EVENT); } return result; }</code><technical_language>getEvent equal OVIRT</technical_language>

Target:
protected boolean canDoAction() { boolean result=true; if (getParameters().getEvent() == null || getParameters().getEvent().getOrigin().equalsIgnoreCase(OVIRT)){ addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_ILLEGAL_ORIGIN); result = false; } if (!result) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ADD); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__EXTERNAL_EVENT); } return result; }
Source:
<code>public void getStrategyThrowsOnUncheckedException() { when(mockKvs.getMetadataForTable(any())).thenThrow(new RuntimeException()); assertThatThrownBy(() -> partitioner.getStrategy(getWriteInfoWithFixedCellHash(getTableRef("a"), 0))) <START> .isInstanceOf(UncheckedExecutionException.class); <END> }</code><technical_language>is worth .hasCause(new RuntimeException())</technical_language>

Target:
public void getStrategyThrowsOnUncheckedException() { RuntimeException cause = new RuntimeException("cause"); when(mockKvs.getMetadataForTable(any())).thenThrow(cause); assertThatThrownBy(() -> partitioner.getStrategy(getWriteInfoWithFixedCellHash(getTableRef("a"), 0))) .isInstanceOf(UncheckedExecutionException.class) .hasCause(cause); }
Source:
<code>private RedirectHandler getOrInstall(Logger logger) { synchronized (this) { for (Handler handler : logger.getHandlers()) { if (handler instanceof RedirectHandler) { return (RedirectHandler) handler; } } RedirectHandler redirectHandler = new RedirectHandler(logContext.getLogger(logger.getName())); logger.addHandler(redirectHandler); logger.setUseParentHandlers(false); <START> return redirectHandler; <END> } }</code><technical_language>This right. If logger.setUseParentHandlers(true) is set this override it</technical_language>

Target:
private RedirectHandler getOrInstall(Logger logger) { synchronized (this) { for (Handler handler : logger.getHandlers()) { if (handler instanceof RedirectHandler) { logger.setUseParentHandlers(false); return (RedirectHandler) handler; } } RedirectHandler redirectHandler = new RedirectHandler(logContext.getLogger(logger.getName())); logger.addHandler(redirectHandler); logger.setUseParentHandlers(false); return redirectHandler; } }
Source:
<code>public APIResult getExtensionDefinition( @PathParam("extension-name") String extensionName) { checkIfExtensionServiceIsEnabled(); try { return new APIResult(APIResult.Status.SUCCEEDED, ExtensionStore.get().getResource(extensionName, extensionName.toLowerCase() + EXTENSION_PROPERTY_JSON_SUFFIX)); } catch (Throwable e) { <START> throw FalconWebException.newAPIException(e, Response.Status.BAD_REQUEST); <END> } }</code><technical_language>missed changing this one</technical_language>

Target:
public APIResult getExtensionDefinition( @PathParam("extension-name") String extensionName) { checkIfExtensionServiceIsEnabled(); try { return new APIResult(APIResult.Status.SUCCEEDED, ExtensionStore.get().getResource(extensionName, extensionName.toLowerCase() + EXTENSION_PROPERTY_JSON_SUFFIX)); } catch (FalconException e) { throw FalconWebException.newAPIException(e, Response.Status.BAD_REQUEST); } catch (Throwable e) { throw FalconWebException.newAPIException(e, Response.Status.INTERNAL_SERVER_ERROR); } }
Source:
<code>public ValidationResult initialize(RuntimeContainer container, Properties properties) { ValidationResultMutable validationResult = new ValidationResultMutable(); if (properties instanceof MarkLogicBulkLoadProperties) { bulkLoadProperties = (MarkLogicBulkLoadProperties) properties; MarkLogicConnectionProperties connection = bulkLoadProperties.connection; if (!connection.isReferenceConnectionUsed()) { <START> boolean isRequiredPropertiesSet = !connection.host.getStringValue().isEmpty() <END> && connection.port.getValue() != null && !connection.database.getStringValue().isEmpty() && !connection.username.getStringValue().isEmpty() && !connection.password.getStringValue().isEmpty() && !bulkLoadProperties.loadFolder.getStringValue().isEmpty(); if (!isRequiredPropertiesSet) { validationResult.setStatus(ValidationResult.Result.ERROR); validationResult.setMessage(MESSAGES.getMessage("error.missedProperties")); } } } else { validationResult.setStatus(ValidationResult.Result.ERROR); validationResult.setMessage(MESSAGES.getMessage("error.wrongProperties")); } return validationResult; }</code><technical_language>this moved separate method good description simplify understanding</technical_language>

Target:
public ValidationResult initialize(RuntimeContainer container, Properties properties) { ValidationResultMutable validationResult = new ValidationResultMutable(); if (properties instanceof MarkLogicBulkLoadProperties) { bulkLoadProperties = (MarkLogicBulkLoadProperties) properties; if (isRequiredPropertiesMissed()) { validationResult.setStatus(ValidationResult.Result.ERROR); validationResult.setMessage(MESSAGES.getMessage("error.missedProperties")); } } else { validationResult.setStatus(ValidationResult.Result.ERROR); validationResult.setMessage(MESSAGES.getMessage("error.wrongProperties")); } return validationResult; }
Source:
<code>public ImmutableBitmap getBitmapIndex(BitmapIndexSelector selector) { if (extractionFn == null) { return selector.getBitmapIndex(dimension, value); } else { final List<Filter> filters = makeFilters(selector); if (filters.isEmpty()) { return selector.getBitmapFactory().makeEmptyImmutableBitmap(); } <START> return new OrFilter(makeFilters(selector)).getBitmapIndex(selector); <END> } }</code><technical_language>makeFilters need called here? filters previously</technical_language>

Target:
public ImmutableBitmap getBitmapIndex(BitmapIndexSelector selector) { if (extractionFn == null) { return selector.getBitmapIndex(dimension, value); } else { final List<Filter> filters = makeFiltersUsingExtractionFn(selector); if (filters.isEmpty()) { return selector.getBitmapFactory().makeEmptyImmutableBitmap(); } return new OrFilter(filters).getBitmapIndex(selector); } }
Source:
<code><START> private boolean isPublisherEnabled() { <END> boolean publisherEnabled = false; for (ThriftClientInfo thriftClientInfo : thriftClientInfoList) { publisherEnabled = thriftClientInfo.isStatsPublisherEnabled(); if (publisherEnabled) { break; } } return publisherEnabled; }</code><technical_language>reduce some lines seems, private boolean isPublisherEnabled() { for (ThriftClientInfo thriftClientInfo : thriftClientInfoList) { if (thriftClientInfo.isStatsPublisherEnabled()) { return true; } } return false; }</technical_language>

Target:
private boolean isPublisherEnabled() { for (ThriftClientInfo thriftClientInfo : thriftClientInfoList) { if (thriftClientInfo.isStatsPublisherEnabled()) { return true; } } return false; }
Source:
<code>public static int getFuelValue(@Nullable ItemStack fuel) { if (fuel == null) { return 0; } for (FuelEntry e : fuels) { if (e.getItem().isItemEqual(fuel)) { <START> return e.getFuelValue(); <END> } } return 0; }</code><technical_language>this implemented highest fuel of registered fuel values is is used, similarly normal Furnace fuels work. ([GameRegistry#getFuelValue](<LINK_0> This way, if multiple mods add say, blaze rods a fuel for 60 ticks for 80 ticks, 80 tick takes precedence 60 tick instead of is registered used</technical_language>

Target:
public static int getFuelValue(@Nullable ItemStack fuel) { if (fuel == null || fuel.getItem() == null) { return 0; } int max = 0; for (IFuelHandler e : fuels) { max = Math.max(e.getBurnTime(fuel), max); } if (fuel.hasCapability(BREWING_CAP, null)) { IBrewingStandFuel brewingStandFuel = fuel.getCapability(BREWING_CAP, null); if (brewingStandFuel != null) max = Math.max(brewingStandFuel.getFuelValue(), max); } return max; }