auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Range setCell(final int rowIndex, final int columnIndex, final Supplier<GridCell<?>> cellSupplier) { return doSetCell(rowIndex, columnIndex, <START> (p) -> cellSupplier.get()); <END> }</code><technical_language>indexes stored in Pair p used, is ok</technical_language>

Target:
public Range setCell(final int rowIndex, final int columnIndex, final Supplier<GridCell<?>> cellSupplier) { return doSetCell(rowIndex, columnIndex, (pair) -> cellSupplier.get()); }
Source:
<code>protected void handleChanges(Collection<Change> changes) throws InterruptedException { Set<Change> trueChanges; try (Context ctx = rdfRepositoryFetchTime.time()) { trueChanges = getRevisionUpdates(changes); } noopedChangesByRevisionCheck.inc(changes.size() - trueChanges.size()); List<Change> processedChanges; try (Context ctx = wikibaseDataFetchTime.time()) { List<Future<Change>> futureChanges = new ArrayList<>(); for (Change change : trueChanges) { futureChanges.add(executor.submit(() -> { while (true) { try { handleChange(change); return change; } catch (RetryableException e) { log.warn("Retryable error syncing. Retrying.", e); } catch (ContainedException e) { log.warn("Contained error syncing. Giving up on {}", change.entityId(), e); throw e; } } })); } processedChanges = new ArrayList<>(futureChanges.size()); for (Future<Change> f : futureChanges) { try { processedChanges.add(f.get()); } catch (ExecutionException ignore) { } } } int nbTriples; <START> try (Context ctx = rdfRepositoryImportTime.time()) { <END> nbTriples = rdfRepository.syncFromChanges(processedChanges, verify); } updatesMeter.mark(processedChanges.size()); importedChanged.inc(processedChanges.size()); importedTriples.inc(nbTriples); }</code><technical_language>Instead of this semi-abuse of try-with-resources, codahale timers provide a time(Runnable) method cleaner me. sense implement a similar interface in TimerCounter? (And no, I idea before)</technical_language>

Target:
protected void handleChanges(Collection<Change> changes) throws InterruptedException { final Set<Change> trueChanges = rdfRepositoryFetchTime.time(() -> getRevisionUpdates(changes)); noopedChangesByRevisionCheck.inc(changes.size() - trueChanges.size()); List<Change> processedChanges = wikibaseDataFetchTime .timeCheckedCallable(() -> fetchDataFromWikibaseAndMunge(trueChanges)); int nbTriples = rdfRepositoryImportTime.time(() -> rdfRepository.syncFromChanges(processedChanges, verify)); updatesMeter.mark(processedChanges.size()); importedChanged.inc(processedChanges.size()); importedTriples.inc(nbTriples); }
Source:
<code>private MetricNames workerMetricName(String name, String stormId, String componentId, Integer taskId, Integer workerPort) { StringBuilder sb = new StringBuilder(WORKER_METRIC_PREFIX); sb.append(stormId); sb.append("."); sb.append(hostName); sb.append("."); sb.append(dotToUnderScore(componentId)); sb.append("."); sb.append(taskId); sb.append("."); sb.append(workerPort); sb.append("-"); sb.append(name); String longName = sb.toString(); <START> String shortName = WORKER_METRIC_PREFIX + name; <END> MetricNames names = new MetricNames(longName, shortName); return names; }</code><technical_language>I understand storm.worker storm.topology prefix. Do need prefix shortnames</technical_language>

Target:
private MetricNames workerMetricName(String name, String stormId, String componentId, Integer taskId, Integer workerPort) { StringBuilder sb = new StringBuilder(WORKER_METRIC_PREFIX); sb.append(stormId); sb.append("."); sb.append(hostName); sb.append("."); sb.append(dotToUnderScore(componentId)); sb.append("."); sb.append(taskId); sb.append("."); sb.append(workerPort); sb.append("-"); sb.append(name); String longName = sb.toString(); MetricNames names = new MetricNames(longName, name); return names; }
Source:
<code>protected static double averageMetricOverOperations(ASTClassOrInterfaceDeclaration node, OperationMetricKey key, MetricVersion version, boolean includeNested) { List<ASTMethodOrConstructorDeclaration> operations = findOperations(node, includeNested); double total = 0; for (ASTMethodOrConstructorDeclaration op : operations) { double val = Metrics.get(key, op, version); <START> total += val == Double.NaN ? 1 : val; <END> } return total / operations.size(); }</code><technical_language>Is "1" correct? I guess, in "sumMetricOverOperations" -> 0 if is value</technical_language>

Target:
protected static double averageMetricOverOperations(ASTClassOrInterfaceDeclaration node, OperationMetricKey key, MetricVersion version, boolean includeNested) { List<ASTMethodOrConstructorDeclaration> operations = findOperations(node, includeNested); double total = 0; for (ASTMethodOrConstructorDeclaration op : operations) { double val = Metrics.get(key, op, version); total += val == Double.NaN ? 0 : val; } return total / operations.size(); }
Source:
<code>private Collection<UfsStatus> getChildrenIfAbsent(AlluxioURI path, MountTable mountTable) throws InvalidPathException { Collection<UfsStatus> children = getChildren(path); if (children != null) { return children; } MountTable.Resolution resolution = mountTable.resolve(path); AlluxioURI ufsUri = resolution.getUri(); try (CloseableResource<UnderFileSystem> ufsResource = resolution.acquireUfsResource()) { UnderFileSystem ufs = ufsResource.get(); UfsStatus[] statuses = ufs.listStatus(ufsUri.toString()); if (statuses == null) { return null; } children = Arrays.asList(statuses); addChildren(path, children); } catch (IllegalArgumentException | IOException e) { <START> LOG.debug("Failed to add status to cache", e); <END> } return children; }</code><technical_language>add path message</technical_language>

Target:
Collection<UfsStatus> getChildrenIfAbsent(AlluxioURI path, MountTable mountTable) throws InvalidPathException { Collection<UfsStatus> children = getChildren(path); if (children != null) { return children; } MountTable.Resolution resolution = mountTable.resolve(path); AlluxioURI ufsUri = resolution.getUri(); try (CloseableResource<UnderFileSystem> ufsResource = resolution.acquireUfsResource()) { UnderFileSystem ufs = ufsResource.get(); UfsStatus[] statuses = ufs.listStatus(ufsUri.toString()); if (statuses == null) { return null; } children = Arrays.asList(statuses); addChildren(path, children); } catch (IllegalArgumentException | IOException e) { LOG.debug("Failed to add status to cache {}", path, e); } return children; }
Source:
<code>public void changeSchedulerVer(Integer ver) throws ConfirmModSchemaException { if (ver == schedVer()) { return; } if (!fSupportedSchedulerVersions.contains(ver)) { throw new RuntimeException("Unsupported scheduler version"); } modSchema(true); SchedV2 v2Sched = new SchedV2(this); <START> clearUndo() <END> if (ver == 1) { v2Sched.moveToV1(); } else { v2Sched.moveToV2(); } try { mConf.put("schedVer", ver); } catch (JSONException e) { throw new RuntimeException(e); } setMod(); _loadScheduler(); }</code><technical_language>correct idea needs semi-colon</technical_language>

Target:
public void changeSchedulerVer(Integer ver) throws ConfirmModSchemaException { if (ver == schedVer()) { return; } if (!fSupportedSchedulerVersions.contains(ver)) { throw new RuntimeException("Unsupported scheduler version"); } modSchema(true); SchedV2 v2Sched = new SchedV2(this); clearUndo(); if (ver == 1) { v2Sched.moveToV1(); } else { v2Sched.moveToV2(); } try { mConf.put("schedVer", ver); } catch (JSONException e) { throw new RuntimeException(e); } setMod(); _loadScheduler(); }
Source:
<code>public CliCommand init(final Arguments args) throws Exception { processCommandOptions(requiredArgs, optionalArgs, args); this.bucketName = args.getBucket(); this.priority = args.getPriority(); this.objectName = args.getObjectName(); this.prefix = args.getDirectory(); if (this.prefix == null) { this.prefix = "."; } this.discard = args.isDiscard(); if (this.discard && !Guard.isStringNullOrEmpty(args.getDirectory())) { throw new CommandException("Cannot set both " + DIRECTORY.getOpt() + " and " + DISCARD.getLongOpt()); } if (this.discard) { <START> LOG.warn("Using /dev/null getter -- all incoming data will be discarded"); <END> } if (args.isSync()) { LOG.info("Using sync command"); this.sync = true; } this.numberOfThreads = args.getNumberOfThreads(); if (!Guard.isStringNullOrEmpty(args.getRangeLength()) || !Guard.isStringNullOrEmpty(args.getRangeOffset())) { if (Guard.isStringNullOrEmpty(args.getRangeLength()) || Guard.isStringNullOrEmpty(args.getRangeOffset())) { throw new MissingOptionException("Partial recovery must provide values for both " + RANGE_OFFSET.getLongOpt() + " and " + RANGE_LENGTH.getLongOpt()); } else { this.rangeOffset = Long.parseLong(args.getOptionValue(RANGE_OFFSET.getLongOpt())); this.rangeLength = Long.parseLong(args.getOptionValue(RANGE_LENGTH.getLongOpt())); } } return this; }</code><technical_language>This sense platforms</technical_language>

Target:
public CliCommand init(final Arguments args) throws Exception { processCommandOptions(requiredArgs, optionalArgs, args); this.bucketName = args.getBucket(); this.priority = args.getPriority(); this.objectName = args.getObjectName(); this.prefix = args.getDirectory(); if (this.prefix == null) { this.prefix = "."; } this.discard = args.isDiscard(); if (this.discard && !Guard.isStringNullOrEmpty(args.getDirectory())) { throw new CommandException("Cannot set both " + DIRECTORY.getOpt() + " and " + DISCARD.getLongOpt()); } if (this.discard) { LOG.warn("Discard flag set -- all incoming data will be discarded"); } if (args.isSync()) { LOG.info("Using sync command"); this.sync = true; } this.numberOfThreads = args.getNumberOfThreads(); if (!Guard.isStringNullOrEmpty(args.getRangeLength()) || !Guard.isStringNullOrEmpty(args.getRangeOffset())) { if (Guard.isStringNullOrEmpty(args.getRangeLength()) || Guard.isStringNullOrEmpty(args.getRangeOffset())) { throw new MissingOptionException("Partial recovery must provide values for both " + RANGE_OFFSET.getLongOpt() + " and " + RANGE_LENGTH.getLongOpt()); } else { this.rangeOffset = Long.parseLong(args.getOptionValue(RANGE_OFFSET.getLongOpt())); this.rangeLength = Long.parseLong(args.getOptionValue(RANGE_LENGTH.getLongOpt())); } } return this; }
Source:
<code>public HAProxyMessage retain() { if (leak != null) { leak.record(); <START> } <END> return (HAProxyMessage) super.retain(); }</code><technical_language>move this a method re-use.... private void tryRecord() { if (leak != null) { leak.record(); } }</technical_language>

Target:
public HAProxyMessage retain() { tryRecord(); return (HAProxyMessage) super.retain(); }
Source:
<code>public CompletableFuture<Boolean> closeTransaction(PublicKeyHash owner, TransactionId tid) { if (! isPeergosServer) return CompletableFuture.completedFuture(true); <START> return poster.get(apiPrefix + "transaction/close?arg=" + tid.toString() + "&owner=" + encode(owner.toString())) <END> .thenApply(raw -> new String(raw).equals("1")); }</code><technical_language>extract actions class constants. bothered params</technical_language>

Target:
public CompletableFuture<Boolean> closeTransaction(PublicKeyHash owner, TransactionId tid) { if (! isPeergosServer) return CompletableFuture.completedFuture(true); return poster.get(apiPrefix + TRANSACTION_CLOSE + "?arg=" + tid.toString() + "&owner=" + encode(owner.toString())) .thenApply(raw -> new String(raw).equals("1")); }
Source:
<code>public void onManagementStarting() { super.onManagementStarting(); getBrokerName(); <START> Preconditions.checkNotNull(brokerName, "ActiveMQ broker name must be specified"); <END> try { brokerMBeanName = new ObjectName("org.apache.activemq:type=Broker,brokerName=" + brokerName); jmxHelper = new JmxHelper((EntityLocal) getParent()); } catch (MalformedObjectNameException e) { throw Exceptions.propagate(e); } }</code><technical_language>I replace references brokerName a call getBrokerName()</technical_language>

Target:
public void onManagementStarting() { super.onManagementStarting(); String brokerName = getBrokerName(); Preconditions.checkArgument(brokerName != null && !brokerName.isEmpty(), "ActiveMQ brokerName attribute must be specified"); try { brokerMBeanName = new ObjectName("org.apache.activemq:type=Broker,brokerName=" + brokerName); jmxHelper = new JmxHelper((EntityLocal) getParent()); } catch (MalformedObjectNameException e) { throw Exceptions.propagate(e); } }
Source:
<code>public void emitTuples() { if (!readThread.isAlive() && threadFailed) { <START> throw new RuntimeException("Exception in scan thread"); <END> } try { Result result = resultQueue.poll(); if (result == null) { return; } T tuple = getTuple(result); if (tuple != null) { outputPort.emit(tuple); tuplesRead++; } } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>ideally restart thread operator continue running</technical_language>

Target:
public void emitTuples() { if (!readThread.isAlive()) { throw new RuntimeException(threadFailureReason); } try { Result result = resultQueue.poll(); if (result == null) { return; } T tuple = getTuple(result); if (tuple != null) { emitTuple(tuple); tuplesRead++; } } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>public SessionInfo getSessionInfo(String sessionId) throws Exception { SessionInfo sessionInfo = sessions.get(sessionId); if (sessionInfo == null) { LOGGER.warn("No such session: " + sessionId); return null; } InterpreterGroup interpreterGroup = this.interpreterSettingManager.getInterpreterGroupById(sessionId); if (interpreterGroup != null) { RemoteInterpreterProcess remoteInterpreterProcess = ((ManagedInterpreterGroup) interpreterGroup).getRemoteInterpreterProcess(); if (remoteInterpreterProcess == null) { sessionInfo.setState(SessionState.READY.name()); } else if (remoteInterpreterProcess != null) { sessionInfo.setStartTime(remoteInterpreterProcess.getStartTime()); sessionInfo.setWeburl(interpreterGroup.getWebUrl()); if (remoteInterpreterProcess.isRunning()) { sessionInfo.setState(SessionState.RUNNING.name()); } else { <START> if (sessionInfo.getState() != null && sessionInfo.getState().equals(SessionState.RUNNING.name())) { <END> sessionInfo.setState(SessionState.STOPPED.name()); } } } } else { if (sessionInfo.getState().equals(SessionState.RUNNING.name())) { sessionInfo.setState(SessionState.STOPPED.name()); } } return sessionInfo; }</code><technical_language>swap objects of 'equals'. A null check longer necessary. SessionState.RUNNING.name().equals(sessionInfo.getState())</technical_language>

Target:
public SessionInfo getSessionInfo(String sessionId) throws Exception { SessionInfo sessionInfo = sessions.get(sessionId); if (sessionInfo == null) { LOGGER.warn("No such session: " + sessionId); return null; } InterpreterGroup interpreterGroup = this.interpreterSettingManager.getInterpreterGroupById(sessionId); if (interpreterGroup != null) { RemoteInterpreterProcess remoteInterpreterProcess = ((ManagedInterpreterGroup) interpreterGroup).getRemoteInterpreterProcess(); if (remoteInterpreterProcess == null) { sessionInfo.setState(SessionState.READY.name()); } else if (remoteInterpreterProcess != null) { sessionInfo.setStartTime(remoteInterpreterProcess.getStartTime()); sessionInfo.setWeburl(interpreterGroup.getWebUrl()); if (remoteInterpreterProcess.isRunning()) { sessionInfo.setState(SessionState.RUNNING.name()); } else { if (SessionState.RUNNING.name().equalsIgnoreCase(sessionInfo.getState())) { sessionInfo.setState(SessionState.STOPPED.name()); } } } } else { if (SessionState.RUNNING.name().equalsIgnoreCase(sessionInfo.getState())) { sessionInfo.setState(SessionState.STOPPED.name()); } } return sessionInfo; }
Source:
<code>private void releaseNetworkResourcesOnExpunge(long id) throws ConcurrentOperationException, ResourceUnavailableException { <START> final VMInstanceVO vmInstance = _vmDao.findById(id); <END> final VirtualMachineProfile profile = new VirtualMachineProfileImpl(vmInstance); _networkMgr.release(profile, false); }</code><technical_language>is for _vmDao.findById return null. Please handling for case</technical_language>

Target:
private void releaseNetworkResourcesOnExpunge(long id) throws ConcurrentOperationException, ResourceUnavailableException { final VMInstanceVO vmInstance = _vmDao.findById(id); if (vmInstance != null){ final VirtualMachineProfile profile = new VirtualMachineProfileImpl(vmInstance); _networkMgr.release(profile, false); } else { s_logger.error("Couldn't find vm with id = " + id + ", unable to release network resources"); } }
Source:
<code>private Function<Cursor, Result<TopNResultValue>> getMapFn(TopNQuery query, final StorageAdapter adapter) { final Capabilities capabilities = adapter.getCapabilities(); final String dimension = query.getDimensionSpec().getDimension(); final int cardinality; <START> if (dimension.equals(Column.TIME_COLUMN_NAME)) { <END> cardinality = Integer.MAX_VALUE; } else { cardinality = adapter.getDimensionCardinality(dimension); } int numBytesPerRecord = 0; for (AggregatorFactory aggregatorFactory : query.getAggregatorSpecs()) { numBytesPerRecord += aggregatorFactory.getMaxIntermediateSize(); } final TopNAlgorithmSelector selector = new TopNAlgorithmSelector(cardinality, numBytesPerRecord); query.initTopNAlgorithmSelector(selector); final TopNAlgorithm topNAlgorithm; if (selector.isHasExtractionFn() && dimension.equals(Column.TIME_COLUMN_NAME)) { topNAlgorithm = new TimeExtractionTopNAlgorithm(capabilities, query); } else if(selector.isHasExtractionFn()) { topNAlgorithm = new DimExtractionTopNAlgorithm(capabilities, query); } else if (selector.isAggregateAllMetrics()) { topNAlgorithm = new PooledTopNAlgorithm(capabilities, query, bufferPool); } else if (selector.isAggregateTopNMetricFirst() || query.getContextValue("doAggregateTopNMetricFirst", false)) { topNAlgorithm = new AggregateTopNMetricFirstAlgorithm(capabilities, query, bufferPool); } else { topNAlgorithm = new PooledTopNAlgorithm(capabilities, query, bufferPool); } return new TopNMapFn(query, topNAlgorithm); }</code><technical_language>This weird... adapter care of instead</technical_language>

Target:
private Function<Cursor, Result<TopNResultValue>> getMapFn(TopNQuery query, final StorageAdapter adapter) { final Capabilities capabilities = adapter.getCapabilities(); final String dimension = query.getDimensionSpec().getDimension(); final int cardinality = adapter.getDimensionCardinality(dimension); int numBytesPerRecord = 0; for (AggregatorFactory aggregatorFactory : query.getAggregatorSpecs()) { numBytesPerRecord += aggregatorFactory.getMaxIntermediateSize(); } final TopNAlgorithmSelector selector = new TopNAlgorithmSelector(cardinality, numBytesPerRecord); query.initTopNAlgorithmSelector(selector); final TopNAlgorithm topNAlgorithm; if ( selector.isHasExtractionFn() && dimension.equals(Column.TIME_COLUMN_NAME) ) { topNAlgorithm = new TimeExtractionTopNAlgorithm(capabilities, query); } else if(selector.isHasExtractionFn()) { topNAlgorithm = new DimExtractionTopNAlgorithm(capabilities, query); } else if (selector.isAggregateAllMetrics()) { topNAlgorithm = new PooledTopNAlgorithm(capabilities, query, bufferPool); } else if (selector.isAggregateTopNMetricFirst() || query.getContextValue("doAggregateTopNMetricFirst", false)) { topNAlgorithm = new AggregateTopNMetricFirstAlgorithm(capabilities, query, bufferPool); } else { topNAlgorithm = new PooledTopNAlgorithm(capabilities, query, bufferPool); } return new TopNMapFn(query, topNAlgorithm); }
Source:
<code>public void onOpenTxn(OpenTxnEvent openTxnEvent) throws MetaException { <START> int totalTxns = openTxnEvent.getTxnIds().size() - 1; <END> OpenTxnMessage msg = msgFactory.buildOpenTxnMessage(openTxnEvent.getTxnIds().get(0), openTxnEvent.getTxnIds().get(totalTxns)); NotificationEvent event = new NotificationEvent(0, now(), EventType.OPEN_TXN.toString(), msg.toString()); try { addNotificationLog(event, openTxnEvent); } catch (SQLException e) { throw new MetaException("Unable to execute direct SQL " + StringUtils.stringifyException(e)); } }</code><technical_language>totalTxns name is misleading is means lastTxnId</technical_language>

Target:
public void onOpenTxn(OpenTxnEvent openTxnEvent) throws MetaException { int lastTxnIdx = openTxnEvent.getTxnIds().size() - 1; OpenTxnMessage msg = msgFactory.buildOpenTxnMessage(openTxnEvent.getTxnIds().get(0), openTxnEvent.getTxnIds().get(lastTxnIdx)); NotificationEvent event = new NotificationEvent(0, now(), EventType.OPEN_TXN.toString(), msg.toString()); try { addNotificationLog(event, openTxnEvent); } catch (SQLException e) { throw new MetaException("Unable to execute direct SQL " + StringUtils.stringifyException(e)); } }
Source:
<code>public List<String> getJobsForAnExtension(final String extensionName) throws FalconException { List<ExtensionJobsBean> extensionJobs = metaStore.getJobsForAnExtension(extensionName); if (null != extensionJobs && !extensionJobs.isEmpty()){ List<String> extensionJobNames = new ArrayList<>(); for (ExtensionJobsBean extensionJobsBean: extensionJobs) { extensionJobNames.add(extensionJobsBean.getJobName()); } return extensionJobNames; <START> } else { <END> return null; } }</code><technical_language>is good return empty list instead. Avoids NPEs</technical_language>

Target:
public List<String> getJobsForAnExtension(final String extensionName) throws FalconException { List<ExtensionJobsBean> extensionJobs = metaStore.getJobsForAnExtension(extensionName); List<String> extensionJobNames = new ArrayList<>(); if (null != extensionJobs && !extensionJobs.isEmpty()) { for (ExtensionJobsBean extensionJobsBean : extensionJobs) { extensionJobNames.add(extensionJobsBean.getJobName()); } } return extensionJobNames; }
Source:
<code>private void estimateVoterMatchStrengths(AffOrgMatcher affOrgMatcher, String affOrgMatcherName, List<AffOrgMatchVoter> voters) throws IOException { printMatcherHeader(affOrgMatcherName); affMatchingService.setAffOrgMatchers(of(affOrgMatcher)); AffOrgMatchComputer affOrgMatchComputer = new AffOrgMatchComputer(); for (AffOrgMatchVoter voter : voters) { printVoterHeader(voter); affOrgMatchComputer.setAffOrgMatchVoters(Lists.newArrayList(voter)); affOrgMatcher.setAffOrgMatchComputer(affOrgMatchComputer); affMatchingService.matchAffiliations(sparkContext, inputAffDirPath, inputOrgDirPath, outputDirPath); calcAndPrintResult(of("src/test/resources/experimentalData/expectedOutput/set1/matched_aff.json", "src/test/resources/experimentalData/expectedOutput/set2/matched_aff.json", "src/test/resources/experimentalData/expectedOutput/set4/matched_aff.json")); <START> FileUtils.deleteDirectory(new File(outputDirPath)); <END> } out.println("\n\n"); }</code><technical_language>finally</technical_language>

Target:
private void estimateVoterMatchStrengths(AffOrgMatcher affOrgMatcher, String affOrgMatcherName, List<AffOrgMatchVoter> voters) throws IOException { printMatcherHeader(affOrgMatcherName); affMatchingService.setAffOrgMatchers(ImmutableList.of(affOrgMatcher)); AffOrgMatchComputer affOrgMatchComputer = new AffOrgMatchComputer(); for (AffOrgMatchVoter voter : voters) { printVoterHeader(voter); affOrgMatchComputer.setAffOrgMatchVoters(Lists.newArrayList(voter)); affOrgMatcher.setAffOrgMatchComputer(affOrgMatchComputer); affMatchingService.matchAffiliations(sparkContext, inputAffDirPath, inputOrgDirPath, outputDirPath); calcAndPrintResult(ImmutableList.of( "src/test/resources/experimentalData/expectedOutput/set1/matched_aff.json", "src/test/resources/experimentalData/expectedOutput/set2/matched_aff.json", "src/test/resources/experimentalData/expectedOutput/set4/matched_aff.json")); FileUtils.deleteDirectory(new File(outputDirPath)); } out.println("\n\n"); }
Source:
<code>public List<Kind> nodesToVisit() { return ImmutableList.of(Kind.EQUAL_TO, Kind.NOT_EQUAL_TO); <START> } <END></code><technical_language>@vilchik-elena factor list of kinds a static field Kind[] kinds = {Kind.EQUAL_TO, Kind.NOT_EQUAL_TO} in enclosing class</technical_language>

Target:
public List<Kind> nodesToVisit() { return Lists.newArrayList(EQUALITY_KINDS); }
Source:
<code>public String toString() { <START> return "KubernetesCloud name:" + name +" serverUrl:" + serverUrl; <END> }</code><technical_language>NIT: replaced String.format</technical_language>

Target:
public String toString() { return String.format("KubernetesCloud name: %n serverUrl: %n", name, serverUrl); }
Source:
<code>public static Set<PoolOrderDto> asPoolOrderDtos(Collection<PoolOrder> from) { Set<PoolOrderDto> dtoSet = Sets.newHashSet(); for (PoolOrder kd : from) { dtoSet.add(asDto(kd)); <START> } <END> return dtoSet; }</code><technical_language>'kd' is ambiguous for kitDescriptor, a dealbreaker</technical_language>

Target:
public static Set<PoolOrderDto> asPoolOrderDtos(Collection<PoolOrder> from) { Set<PoolOrderDto> dtoSet = Sets.newHashSet(); for (PoolOrder po : from) { dtoSet.add(asDto(po)); } return dtoSet; }
Source:
<code><START> public JFormattedTextField getDashArrayField(final ConstantColorAndDashesPSLegend cps){ <END> final JFormattedTextField jrf = new JFormattedTextField(NumberFormat.getNumberInstance()); jrf.setText(cps.getDashArray()); jrf.setHorizontalAlignment(JFormattedTextField.RIGHT); jrf.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cps.setDashArray(((JTextField)e.getSource()).getText()); } }); jrf.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { JTextField jtf = (JTextField)e.getSource(); String tmp = jtf.getText(); cps.setDashArray(tmp); if(!tmp.equals(cps.getDashArray())){ LOGGER.warn(I18N.tr("Could not validate your input.")); jtf.setText(cps.getDashArray()); } } }); jrf.addFocusListener( EventHandler.create(FocusListener.class, preview, "imageChanged")); return jrf; }</code><technical_language>changes break dash pattern implementation. is defined in symbology model, dash patterns space separated double values, double values. I added listeners. Moreover, obtained exception set content of field a blank text</technical_language>

Target:
public JTextField getDashArrayField(final ConstantColorAndDashesPSLegend cps){ final JTextField jrf = new JTextField("", 8); jrf.setText(cps.getDashArray()); jrf.setHorizontalAlignment(JFormattedTextField.RIGHT); jrf.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { cps.setDashArray(((JTextField)e.getSource()).getText()); } }); jrf.addFocusListener(new FocusAdapter() { @Override public void focusLost(FocusEvent e) { JTextField jtf = (JTextField)e.getSource(); String tmp = jtf.getText(); cps.setDashArray(tmp); if(!tmp.equals(cps.getDashArray())){ LOGGER.warn(I18N.tr("Could not validate your input.")); jtf.setText(cps.getDashArray()); } } }); jrf.addFocusListener( EventHandler.create(FocusListener.class, preview, "imageChanged")); return jrf; }
Source:
<code>protected Long nullUnsafeScalar(LocalDateTime value) { <START> return value.atZone( ZoneOffset.UTC ).toInstant().toEpochMilli(); <END> }</code><technical_language>call value.toInstant( ZoneOffset.UTC ) instead of atZone(...).toInstant()</technical_language>

Target:
protected Long nullUnsafeScalar(LocalDateTime value) { return value.toInstant( ZoneOffset.UTC ).toEpochMilli(); }
Source:
<code>public IMetadataTable getMetadataFromConnector(String connector) { for (IMetadataTable table : metadataList) { if (table != null && table.getAttachedConnector() != null) { if (table.getAttachedConnector().equals(connector)) { return table; } } } if (EConnectionType.FLOW_MAIN.equals(EConnectionType.getTypeFromName(connector))) { for (IMetadataTable table : metadataList) { if (table != null && EConnectionType.getTypeFromName(table.getAttachedConnector()) == null) { return table; } } <START> } <END> return null; }</code><technical_language>this modification return table if find table connector. I null if find</technical_language>

Target:
public IMetadataTable getMetadataFromConnector(String connector) { for (IMetadataTable table : metadataList) { if (table != null && table.getAttachedConnector() != null) { if (table.getAttachedConnector().equals(connector)) { return table; } } } return null; }
Source:
<code>public void setContentType(RequestContext res, ResponseContext resp, Operation operation) { if (resp.getContentType() != null) { return; } ApiResponses responses = operation.getResponses(); if (responses != null) { for (String responseCode : responses.keySet()) { final ApiResponse response = responses.get(responseCode); Content content = response.getContent(); if(content == null) { return; } for(String key : content.keySet()) { MediaType mediaType = MediaType.valueOf(key); if (res.getHeaders().get("Content-Type")!= null) { for (String acceptable : res.getHeaders().get("Content-Type")) { String subtype = acceptable.substring(acceptable.lastIndexOf("/") + 1); <START> if (subtype.equals(mediaType.getSubtype())) { <END> resp.setContentType(mediaType); return; }else { resp.setContentType(mediaType); } } }else { for (MediaType acceptable : res.getAcceptableMediaTypes()){ if (mediaType.isCompatible(acceptable)) { resp.setContentType(mediaType); return; }else { resp.setContentType(mediaType); } } } } } } }</code><technical_language>statements sense, expression: resp.setContentType(mediaType); is executed matter if condition happen. Is conditional necessary else statement different</technical_language>

Target:
public void setContentType(RequestContext res, ResponseContext resp, Operation operation) { if (resp.getContentType() != null) { return; } ApiResponses responses = operation.getResponses(); if (responses != null) { for (String responseCode : responses.keySet()) { final ApiResponse response = responses.get(responseCode); Content content = response.getContent(); if(content == null) { return; } for(String key : content.keySet()) { MediaType mediaType = MediaType.valueOf(key); if (res.getHeaders().get("Accept")!= null) { for (String acceptable : res.getHeaders().get("Accept")) { String subtype = acceptable.substring(acceptable.lastIndexOf("/") + 1); resp.setContentType(mediaType); if (subtype.equals(mediaType.getSubtype())) { return; } } }else { for (MediaType acceptable : res.getAcceptableMediaTypes()){ resp.setContentType(mediaType); if (mediaType.isCompatible(acceptable)) { return; } } } } } } }
Source:
<code>public int partition(final long dataId) { <START> return (int) (dataId >> partitionSizeBits); <END> }</code><technical_language>put this change a separate PR</technical_language>

Target:
public long partition(final long dataId) { return dataId >> partitionSizeBits; }
Source:
<code>public RequestBuilder(URI baseURI) { builder = new URIBuilder(baseURI); paths = new ArrayList<>(); <START> Collections.addAll(paths, strip(strip(baseURI.getPath())).split("/")); <END> }</code><technical_language>Nested strip invocation unnecessary. I missing something</technical_language>

Target:
public RequestBuilder(URI baseURI) { builder = new URIBuilder(baseURI); paths = new ArrayList<>(); Collections.addAll(paths, strip(baseURI.getPath()).split("/")); }
Source:
<code>public static String getTimeFromNanoSeconds(long nanoSec, String format) throws Exception { if (!format.equals(TIME_FORMAT_HHMMSS) || (!format.equals(TIME_FORMAT_HH_HR_MM_MIN_SS_SEC))) { throw new Exception("given time format not supported"); } nanoSec = nanoSec / 1000; int hour = (int) nanoSec / 3600; nanoSec = nanoSec % 3600; int min = (int) nanoSec / 60; int sec = (int) nanoSec % 60; String time = ""; if (format.equals(TIME_FORMAT_HHMMSS)) { if (hour > 0) { time = time + hour + ":"; } if (min > 0) { <START> time = time + min + ";"; <END> } return time + sec; } else { if (hour > 0) { time = time + hour + " hr "; } if (min > 0) { time = time + min + " min "; } return time + sec + " sec"; } }</code><technical_language>time + min + ":" instead of time + min + ";"</technical_language>

Target:
public static String getTimeFromNanoSeconds(long nanoSec, String format) throws Exception { if (!format.equals(TIME_FORMAT_HHMMSS) || (!format.equals(TIME_FORMAT_HH_HR_MM_MIN_SS_SEC))) { throw new Exception("given time format not supported"); } nanoSec = nanoSec / 1000; int hour = (int) nanoSec / 3600; nanoSec = nanoSec % 3600; int min = (int) nanoSec / 60; int sec = (int) nanoSec % 60; String time = ""; if (format.equals(TIME_FORMAT_HHMMSS)) { if (hour > 0) { time = time + hour + ":"; } if (min > 0) { time = time + min + ":"; } return time + sec; } else { if (hour > 0) { time = time + hour + " hr "; } if (min > 0) { time = time + min + " min "; } return time + sec + " sec"; } }
Source:
<code>public void deleteFile(String screenToFrame) { File fileToDelete = new File(screenToFrame); <START> fileToDelete.delete(); <END> }</code><technical_language>do a safety check here</technical_language>

Target:
public void deleteFile(String screenToFrame) { File fileToDelete = new File(screenToFrame); if (fileToDelete.exists()) { fileToDelete.delete(); } }
Source:
<code>private String generateMessageTypes() { return dictionary .messages() .stream() .map((message) -> { final int type = message.packedType(); <START> final String constantName = "MSG_" + constantName(message.name()); <END> final String stringConstantName = constantName + "_AS_STR"; return generateMessageTypeConstant(stringConstantName, type) + generateIntConstant(constantName, type); }) .collect(joining()); }</code><technical_language>change constant name? a compatible change</technical_language>

Target:
private String generateMessageTypes() { return dictionary .messages() .stream() .map((message) -> { final int type = message.packedType(); final String constantName = constantName(message.name()) + "_MESSAGE"; final String stringConstantName = constantName + "_AS_STR"; return generateMessageTypeConstant(stringConstantName, type) + generateIntConstant(constantName, type); }) .collect(joining()); }
Source:
<code>public static void main(String[] args) throws Throwable { BenchmarkData data = new BenchmarkData(); data.setup(); new BenchmarkDictionaryBlockGetSizeInBytes().getSizeInBytes(data); Options options = new OptionsBuilder() .verbosity(VerboseMode.NORMAL) <START> .warmupMode(WarmupMode.INDI) <END> .include(".*" + BenchmarkDictionaryBlockGetSizeInBytes.class.getSimpleName() + ".*") .build(); new Runner(options).run(); }</code><technical_language>WarmupMode.INDI is default warmup mode, need it</technical_language>

Target:
public static void main(String[] args) throws Throwable { BenchmarkData data = new BenchmarkData(); data.setup(); new BenchmarkDictionaryBlockGetSizeInBytes().getSizeInBytes(data); Options options = new OptionsBuilder() .verbosity(VerboseMode.NORMAL) .include(".*" + BenchmarkDictionaryBlockGetSizeInBytes.class.getSimpleName() + ".*") .build(); new Runner(options).run(); }
Source:
<code>public boolean isValid(String cidr, ConstraintValidatorContext context) { <START> boolean isCidrFormat = CidrValidator.isCidrFormatValid(cidr); <END> if (!isCidrFormat) { return false; } boolean isNetworkAddress = CidrValidator.isCidrValidNetworkAddress(cidr); if (!isNetworkAddress) { context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate("CIDR_NOT_NETWORK_ADDRESS") .addNode("cidr") .addConstraintViolation(); return false; } return true; }</code><technical_language>inline condition</technical_language>

Target:
public boolean isValid(String cidr, ConstraintValidatorContext context) { if (!CidrValidator.isCidrFormatValid(cidr)) { return failWith(context, "BAD_CIDR_FORMAT"); } if (!CidrValidator.isCidrValidNetworkAddress(cidr)) { return failWith(context, "CIDR_NOT_NETWORK_ADDRESS"); } return true; }
Source:
<code>public static Locale getPreferredLanguage(OsmandSettings set){ if (set.usingEnglishNames()) { <START> return new Locale("en"); <END> } return Locale.getDefault(); }</code><technical_language>Locale.ENGLISH constant</technical_language>

Target:
public static Locale getPreferredLanguage(OsmandSettings set){ if (set.usingEnglishNames()) { return Locale.ENGLISH; } return Locale.getDefault(); }
Source:
<code>private String replaceBindingKeysByTheirValue(String scriptContent, Map<String, Serializable> binding) { for (Map.Entry<String, Serializable> variableMapping : binding.entrySet()) { <START> scriptContent = scriptContent.replace(variableMapping.getKey(), variableMapping.getValue().toString()); <END> } return scriptContent; }</code><technical_language>damn I forgot NPE</technical_language>

Target:
private String replaceBindingKeysByTheirValue(String scriptContent, Map<String, Serializable> binding) { for (Map.Entry<String, Serializable> variableMapping : binding.entrySet()) { Serializable bindingValue = variableMapping.getValue(); if (bindingValue != null) { scriptContent = scriptContent.replace(variableMapping.getKey(), bindingValue.toString()); } } return scriptContent; }
Source:
<code>public SwappedByteBuf(ByteBuf buf) { ObjectUtil.checkNotNull(buf, "buf"); <START> this.buf = buf; <END> if (buf.order() == ByteOrder.BIG_ENDIAN) { order = ByteOrder.LITTLE_ENDIAN; } else { order = ByteOrder.BIG_ENDIAN; } }</code><technical_language>nit: merge lines checkNotNull return argument</technical_language>

Target:
public SwappedByteBuf(ByteBuf buf) { this.buf = ObjectUtil.checkNotNull(buf, "buf"); if (buf.order() == ByteOrder.BIG_ENDIAN) { order = ByteOrder.LITTLE_ENDIAN; } else { order = ByteOrder.BIG_ENDIAN; } }
Source:
<code>public Object command(final OCommandRequestText iCommand) { try { while (true) { try { final OCommandExecutor executor = OCommandManager.instance().getExecutor(iCommand); executor.setContext(iCommand.getContext()); executor.setProgressListener(iCommand.getProgressListener()); executor.parse(iCommand); String currentThreadName = Thread.currentThread().getName(); try { Thread.currentThread().setName(currentThreadName + " <command>" + iCommand + "</command>"); return executeCommand(iCommand, executor); } finally { <START> Thread.currentThread().setName(String.valueOf(currentThreadName)); <END> } } catch (ORetryQueryException ignore) { if (iCommand instanceof OQueryAbstract) { final OQueryAbstract query = (OQueryAbstract) iCommand; query.reset(); } continue; } } } catch (RuntimeException e) { throw logAndPrepareForRethrow(e); } catch (Error e) { throw logAndPrepareForRethrow(e); } catch (Throwable t) { throw logAndPrepareForRethrow(t); } }</code><technical_language>String.valueOf, parameter is String, is it</technical_language>

Target:
public Object command(final OCommandRequestText iCommand) { try { while (true) { try { final OCommandExecutor executor = OCommandManager.instance().getExecutor(iCommand); executor.setContext(iCommand.getContext()); executor.setProgressListener(iCommand.getProgressListener()); executor.parse(iCommand); String currentThreadName = Thread.currentThread().getName(); try { if (currentThreadName == null || !(currentThreadName.contains("<query>") || currentThreadName.contains("<command>"))) { try { Thread.currentThread().setName(currentThreadName + " <command>" + iCommand + "</command>"); } catch (SecurityException x) { } } return executeCommand(iCommand, executor); } finally { try { Thread.currentThread().setName(currentThreadName); } catch (SecurityException x) { } } } catch (ORetryQueryException ignore) { if (iCommand instanceof OQueryAbstract) { final OQueryAbstract query = (OQueryAbstract) iCommand; query.reset(); } continue; } } } catch (RuntimeException e) { throw logAndPrepareForRethrow(e); } catch (Error e) { throw logAndPrepareForRethrow(e); } catch (Throwable t) { throw logAndPrepareForRethrow(t); } }
Source:
<code>private Schema getOutputSchema(Schema inputSchema) throws IllegalArgumentException { Schema outputSchema = schemaCache.get(inputSchema); if (outputSchema != null) { return outputSchema; } List<Schema.Field> outputFields = Lists.newArrayList(); for (Schema.Field inputField : inputSchema.getFields()) { if (inputField.getSchema().getType() != Schema.Type.STRING) { <START> throw new IllegalArgumentException("Input field type should be String"); <END> } else { if (fieldsMapping.containsKey(inputField.getName())) { outputFields.add(Schema.Field.of(fieldsMapping.get(inputField.getName()), Schema.of(Schema.Type.STRING))); } else { outputFields.add(inputField); } } } outputSchema = Schema.recordOf(inputSchema.getRecordName() + ".formatted", outputFields); schemaCache.put(inputSchema, outputSchema); return outputSchema; }</code><technical_language>name of field</technical_language>

Target:
private Schema getOutputSchema(Schema inputSchema) throws IllegalArgumentException { Schema outputSchema = schemaCache.get(inputSchema); if (outputSchema != null) { return outputSchema; } List<Schema.Field> outputFields = new ArrayList<>(); for (Schema.Field inputField : inputSchema.getFields()) { String inputFieldName = inputField.getName(); if (mappingValues.containsKey(inputFieldName)) { Schema fieldSchema = inputField.getSchema(); Schema.Type fieldType = fieldSchema.isNullable() ? fieldSchema.getNonNullable().getType() : fieldSchema .getType(); if (fieldType != Schema.Type.STRING) { throw new IllegalArgumentException("Input field " + inputFieldName + " must be of type string, but is" + " of type" + inputField.getSchema().getType().name()); } else { if (defaultsMapping.containsKey(inputFieldName)) { outputFields.add(Schema.Field.of(mappingValues.get(inputFieldName).getTargetField(), Schema.of(Schema.Type.STRING))); } else { outputFields.add(Schema.Field.of(mappingValues.get(inputFieldName).getTargetField(), Schema.nullableOf(Schema.of(Schema.Type.STRING)))); } } } else { outputFields.add(inputField); } } outputSchema = Schema.recordOf(inputSchema.getRecordName() + ".formatted", outputFields); schemaCache.put(inputSchema, outputSchema); return outputSchema; }
Source:
<code>private static List<JavadocTag> getMethodTags(final TextBlock comment) { final String[] lines = comment.getText(); <START> final List<JavadocTag> tags = new ArrayList<>(0); <END> int current = comment.getStartLineNo() - 1; final int start = comment.getStartColNo(); for (int line = 0; line < lines.length; line = line + 1) { current = current + 1; final Matcher docmatcher = MATCH_JAVADOC_ARG.matcher(lines[line]); final Matcher multiline = MATCH_JAVADOC_ARG_MULTILINE_START.matcher(lines[line]); if (docmatcher.find()) { final int col = calculateTagColumn( docmatcher, line, start ); tags.add( new JavadocTag( current, col, docmatcher.group(1), docmatcher.group(2) ) ); } else if (multiline.find()) { final int col = calculateTagColumn( multiline, line, start ); tags.addAll( getMultilineArgTags( multiline, col, lines, line, current ) ); } } return tags; }</code><technical_language>@paulodamaso LinkedList instead</technical_language>

Target:
private static List<JavadocTag> getMethodTags(final TextBlock comment) { final String[] lines = comment.getText(); final List<JavadocTag> tags = new LinkedList<>(); int current = comment.getStartLineNo() - 1; final int start = comment.getStartColNo(); for (int line = 0; line < lines.length; line = line + 1) { current = current + 1; final Matcher docmatcher = MATCH_JAVADOC_ARG.matcher(lines[line]); final Matcher multiline = MATCH_JAVADOC_ARG_MULTILINE_START.matcher(lines[line]); if (docmatcher.find()) { final int col = calculateTagColumn( docmatcher, line, start ); tags.add( new JavadocTag( current, col, docmatcher.group(1), docmatcher.group(2) ) ); } else if (multiline.find()) { final int col = calculateTagColumn( multiline, line, start ); tags.addAll( getMultilineArgTags( multiline, col, lines, line, current ) ); } } return tags; }
Source:
<code>public void init() { Assert.notNull(serverUriResolver, "serverUriResolver must be configured."); Assert.notNull(callbackUri, "callbackUri must be configured."); Assert.notNull(idSiteOrganizationResolver, "idSiteOrganizationResolver must be configured."); Assert.notNull(alreadyLoggedInUri, "alreadyLoggedInUri must be configured."); <START> Assert.isTrue(!(preRegisterHandler != null && preLoginHandler != null), "This IDSite controller must contain only one of preRegisterHandler and preLoginHandler"); <END> }</code><technical_language>a pre-login handler a pre-register handler? id site</technical_language>

Target:
public void init() { Assert.notNull(serverUriResolver, "serverUriResolver must be configured."); Assert.notNull(callbackUri, "callbackUri must be configured."); Assert.notNull(idSiteOrganizationResolver, "idSiteOrganizationResolver must be configured."); Assert.notNull(alreadyLoggedInUri, "alreadyLoggedInUri must be configured."); }
Source:
<code>public String get() { String localConfDir = System.getenv(CheBootstrap.CHE_LOCAL_CONF_DIR); if (localConfDir == null) { return null; } File extConfDir = new File(localConfDir, PLUGIN_CONF); if (!extConfDir.isDirectory()) { if (extConfDir.exists()) { LOG.warn("{} set to the but it must be directory not file", CheBootstrap.CHE_LOCAL_CONF_DIR, extConfDir); } return null; } if (volumeOptions == null) { <START> volumeOptions="ro,Z"; <END> } if (SystemInfo.isWindows()) { try { final Path cheHome = WindowsHostUtils.ensureCheHomeExist(); final Path plgConfDir = cheHome.resolve(PLUGIN_CONF); IoUtil.copy(extConfDir, plgConfDir.toFile(), null, true); return plgConfDir.toString() + CONTAINER_TARGET + ":" + volumeOptions; } catch (IOException e) { LOG.warn(e.getMessage()); throw new RuntimeException(e); } } else { return extConfDir.getAbsolutePath() + CONTAINER_TARGET + ":" + volumeOptions; } }</code><technical_language>IMHO default options in properties file a constant</technical_language>

Target:
public String get() { String localConfDir = System.getenv(CheBootstrap.CHE_LOCAL_CONF_DIR); if (localConfDir == null) { return null; } File extConfDir = new File(localConfDir, PLUGIN_CONF); if (!extConfDir.isDirectory()) { if (extConfDir.exists()) { LOG.warn("{} set to the but it must be directory not file", CheBootstrap.CHE_LOCAL_CONF_DIR, extConfDir); } return null; } if (SystemInfo.isWindows()) { try { final Path cheHome = WindowsHostUtils.ensureCheHomeExist(); final Path plgConfDir = cheHome.resolve(PLUGIN_CONF); IoUtil.copy(extConfDir, plgConfDir.toFile(), null, true); return getTargetOptions(plgConfDir.toString()); } catch (IOException e) { LOG.warn(e.getMessage()); throw new RuntimeException(e); } } else { return getTargetOptions(extConfDir.getAbsolutePath()); } }
Source:
<code>public void pulse() { super.pulse(); if (getTicksLived() >= ticksToLive) { remove(); } if (getTicksLived() == 1) { location.getWorld().playSound(location, Sound.AMBIENCE_THUNDER, 10000, 0.8F + random.nextFloat() * 0.2F); location.getWorld().playSound(location, Sound.EXPLODE, 2, 0.5F + random.nextFloat() * 0.2F); if (effect) { return; } else { for (LivingEntity livingEntity : location.getWorld().getLivingEntities()) { if (location.distanceSquared(livingEntity.getLocation()) <= distanceToDamage) { int damage = 5; livingEntity.damage(damage, this, EntityDamageEvent.DamageCause.LIGHTNING); } if (location.distanceSquared(livingEntity.getLocation()) <= distanceToIgnition) { livingEntity.setFireTicks(burnTicks); } } <START> } <END> } }</code><technical_language>I broke indentation this change</technical_language>

Target:
public void pulse() { super.pulse(); if (getTicksLived() >= ticksToLive) { remove(); } if (getTicksLived() == 1) { location.getWorld().playSound(location, Sound.AMBIENCE_THUNDER, 10000, 0.8F + random.nextFloat() * 0.2F); location.getWorld().playSound(location, Sound.EXPLODE, 2, 0.5F + random.nextFloat() * 0.2F); if (effect) { return; } else { for (LivingEntity livingEntity : location.getWorld().getLivingEntities()) { if (location.distanceSquared(livingEntity.getLocation()) <= distanceToDamageSquared) { int damage = 5; livingEntity.damage(damage, this, EntityDamageEvent.DamageCause.LIGHTNING); } if (location.distanceSquared(livingEntity.getLocation()) <= distanceToIgnitionSquared) { livingEntity.setFireTicks(burnTicks); } } } } }