auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Object onTraversalSuccess() { logger.info("Tagging whether genotypes are in one of the artifact modes."); <START> double fdrThresh = 0.01; <END> final List<VariantContext> finalVariants = OrientationBiasFilterer.annotateVariantContextsWithFilterResults(fdrThresh, relevantArtifactModes, firstPassVariants, artifactModeToPreAdapterScoreMap); logger.info("Writing variants to VCF..."); for (final VariantContext vc: finalVariants) { vcfWriter.add(vc); } logger.info("Writing a simple summary table..."); final List<String> sampleNames = finalVariants.get(0).getSampleNamesOrderedByName(); final List<Pair<String, ArtifactMode>> sampleArtifactModeCombinations = new ArrayList<>(); for (ArtifactMode relevantArtifactMode : relevantArtifactModes) { for (String sampleName : sampleNames) { sampleArtifactModeCombinations.add(Pair.of(sampleName, relevantArtifactMode)); } } OrientationBiasUtils.writeOrientationBiasSummaryTable(sampleArtifactModeCombinations, finalVariants, artifactModeToPreAdapterScoreMap, new File(outputFile.getAbsolutePath() + ".summary")); return null; }</code><technical_language>abbreviate "threshold" "fdr" is fine me</technical_language>

Target:
public Object onTraversalSuccess() { logger.info("Tagging whether genotypes are in one of the artifact modes."); double fdrThreshold = 0.01; final List<VariantContext> finalVariants = OrientationBiasFilterer.annotateVariantContextsWithFilterResults(fdrThreshold, relevantTransitions, firstPassVariants, transitionToPreAdapterScoreMap); logger.info("Writing variants to VCF..."); finalVariants.forEach(vcfWriter::add); logger.info("Writing a simple summary table..."); final List<String> sampleNames = finalVariants.get(0).getSampleNamesOrderedByName(); final List<Pair<String, Transition>> sampleTransitionCombinations = new ArrayList<>(); for (Transition relevantTransition : relevantTransitions) { for (String sampleName : sampleNames) { sampleTransitionCombinations.add(Pair.of(sampleName, relevantTransition)); } } OrientationBiasUtils.writeOrientationBiasSummaryTable(sampleTransitionCombinations, finalVariants, transitionToPreAdapterScoreMap, new File(outputFile.getAbsolutePath() + ".summary")); return null; }
Source:
<code><START> public DateTime (Composite parent, int style) { <END> super (parent, checkStyle (style)); if (isDate() || isTime()) { createText(); } if (isDateWithDropDownButton()) { createDropDownButton(); createPopupShell(-1, -1, -1); addListener(SWT.Resize, new Listener() { public void handleEvent(Event event) { setDropDownButtonSize(); } }); } initAccessible (); if (isDateWithDropDownButton()) { Point size = computeSize(SWT.DEFAULT, SWT.DEFAULT); setBounds(0, 0, size.x, size.y); } }</code><technical_language>class instantiation if style is of type CALENDAR please highlight current date bold this achieved this call OS.gtk_calendar_mark_day(handle, Calendar.getInstance().get(Calendar.DAY_OF_MONTH));</technical_language>

Target:
public DateTime (Composite parent, int style) { super (parent, checkStyle (style)); if (isDate() || isTime()) { createText(); } if (isCalendar()) { OS.gtk_calendar_mark_day(calendarHandler, Calendar.getInstance().get(Calendar.DAY_OF_MONTH)); } if (isDateWithDropDownButton()) { createDropDownButton(); createPopupShell(-1, -1, -1); addListener(SWT.Resize, new Listener() { public void handleEvent(Event event) { setDropDownButtonSize(); } }); } initAccessible (); if (isDateWithDropDownButton()) { Point size = computeSize(SWT.DEFAULT, SWT.DEFAULT); setBounds(0, 0, size.x, size.y); } }
Source:
<code>private void init() { reset(fileListener); <START> Mockito.doAnswer(this::mockitoDoTest) <END> .when(fileListener) .onFileCreate(any(File.class), any(Synchronization.class)); Mockito.doAnswer(this::mockitoDoTest) .when(fileListener) .onFileChange(any(File.class), any(Synchronization.class)); Mockito.doAnswer(this::mockitoDoTest) .when(fileListener) .onFileDelete(any(File.class), any(Synchronization.class)); timesToFail.set(0); failures = 0; }</code><technical_language>static import Mockito.doAnswer</technical_language>

Target:
private void init() { reset(fileListener); doAnswer(this::mockitoDoTest) .when(fileListener) .onFileCreate(any(File.class), any(Synchronization.class)); doAnswer(this::mockitoDoTest) .when(fileListener) .onFileChange(any(File.class), any(Synchronization.class)); doAnswer(this::mockitoDoTest) .when(fileListener) .onFileDelete(any(File.class), any(Synchronization.class)); timesToFail.set(0); failures = 0; }
Source:
<code>public Runtime.NoneType extend( Object items, Location loc, Environment env) throws EvalException { <START> addAll((Collection<? extends E>) EvalUtils.toCollection(items, loc, env), loc, env.mutability()); <END> return Runtime.NONE; }</code><technical_language>cast sound, result in "unchecked" warning. Do (and why) suppressed in Bazel codebase? treated errors</technical_language>

Target:
public Runtime.NoneType extend( Object items, Location loc, Environment env) throws EvalException { addAll(new ArrayList(EvalUtils.toCollection(items, loc, env)), loc, env.mutability()); return Runtime.NONE; }
Source:
<code>public void testDefaults() { <START> Assert.assertEquals(FluoConfiguration.CONNECTION_ZOOKEEPERS_DEFAULT, <END> base.getInstanceZookeepers()); Assert.assertEquals(FluoConfiguration.CONNECTION_ZOOKEEPER_TIMEOUT_DEFAULT, base.getZookeeperTimeout()); Assert.assertEquals(FluoConfiguration.CONNECTION_RETRY_TIMEOUT_MS_DEFAULT, base.getConnectionRetryTimeout()); Assert .assertEquals(FluoConfiguration.ACCUMULO_ZOOKEEPERS_DEFAULT, base.getAccumuloZookeepers()); Assert.assertEquals(FluoConfiguration.ADMIN_ACCUMULO_CLASSPATH_DEFAULT, base.getAccumuloClasspath()); Assert.assertEquals(FluoConfiguration.WORKER_NUM_THREADS_DEFAULT, base.getWorkerThreads()); Assert.assertEquals(FluoConfiguration.TRANSACTION_ROLLBACK_TIME_DEFAULT, base.getTransactionRollbackTime()); Assert.assertEquals(FluoConfiguration.LOADER_NUM_THREADS_DEFAULT, base.getLoaderThreads()); Assert.assertEquals(FluoConfiguration.LOADER_QUEUE_SIZE_DEFAULT, base.getLoaderQueueSize()); Assert.assertEquals(FluoConfiguration.MINI_START_ACCUMULO_DEFAULT, base.getMiniStartAccumulo()); Assert.assertTrue(base.getMiniDataDir().endsWith("/mini")); Assert.assertEquals(FluoConfiguration.OBSERVER_INIT_DIR_DEFAULT, base.getObserverInitDir()); Assert.assertEquals(FluoConfiguration.OBSERVER_JARS_URL_DEFAULT, base.getObserverJarsUrl()); Assert.assertEquals(FluoConfiguration.HDFS_ROOT_DEFAULT, base.getHdfsRoot()); }</code><technical_language>try running this test code coverage? If I try that</technical_language>

Target:
public void testDefaults() { Assert.assertEquals(FluoConfiguration.CONNECTION_ZOOKEEPERS_DEFAULT, base.getInstanceZookeepers()); Assert.assertEquals(FluoConfiguration.CONNECTION_ZOOKEEPER_TIMEOUT_DEFAULT, base.getZookeeperTimeout()); Assert.assertEquals(FluoConfiguration.CONNECTION_RETRY_TIMEOUT_MS_DEFAULT, base.getConnectionRetryTimeout()); Assert .assertEquals(FluoConfiguration.ACCUMULO_ZOOKEEPERS_DEFAULT, base.getAccumuloZookeepers()); Assert.assertEquals(FluoConfiguration.ADMIN_ACCUMULO_CLASSPATH_DEFAULT, base.getAccumuloClasspath()); Assert.assertEquals(FluoConfiguration.WORKER_NUM_THREADS_DEFAULT, base.getWorkerThreads()); Assert.assertEquals(FluoConfiguration.TRANSACTION_ROLLBACK_TIME_DEFAULT, base.getTransactionRollbackTime()); Assert.assertEquals(FluoConfiguration.LOADER_NUM_THREADS_DEFAULT, base.getLoaderThreads()); Assert.assertEquals(FluoConfiguration.LOADER_QUEUE_SIZE_DEFAULT, base.getLoaderQueueSize()); Assert.assertEquals(FluoConfiguration.MINI_START_ACCUMULO_DEFAULT, base.getMiniStartAccumulo()); Assert.assertTrue(base.getMiniDataDir().endsWith("/mini")); Assert.assertEquals(FluoConfiguration.OBSERVER_INIT_DIR_DEFAULT, base.getObserverInitDir()); Assert.assertEquals(FluoConfiguration.OBSERVER_JARS_URL_DEFAULT, base.getObserverJarsUrl()); Assert.assertEquals(FluoConfiguration.DFS_ROOT_DEFAULT, base.getDfsRoot()); }
Source:
<code>public void invalidateUpTo(long trimMark) { log.debug("Invalidate sequencer cache. Trim mark: {}", trimMark); AtomicLong entries = new AtomicLong(); long first; <START> while((first = firstAddress()) != Address.NOT_FOUND && first <= trimMark) { <END> invalidateFirst(); entries.incrementAndGet(); } log.info("Invalidated entries: {}", entries.get()); }</code><technical_language>I is initialize earlier</technical_language>

Target:
public void invalidateUpTo(long trimMark) { log.debug("Invalidate sequencer cache. Trim mark: {}", trimMark); int entries = 0; int pqEntries = 0; while (Address.isAddress(firstAddress()) && firstAddress() < trimMark) { pqEntries += invalidateSmallestTxVersion(); entries++; } log.info("Invalidated entries addresses {}", pqEntries, entries); }
Source:
<code>private static void extractGzArchive(URL sourceDistribution, File tar) throws IOException { <START> BufferedInputStream in = new BufferedInputStream(sourceDistribution.openStream()); <END> try (FileOutputStream out = new FileOutputStream(tar); GzipCompressorInputStream gzIn = new GzipCompressorInputStream(in)) { final byte[] buffer = new byte[1000]; int n; while (-1 != (n = gzIn.read(buffer))) { out.write(buffer, 0, n); } } }</code><technical_language>This stream closed (use auto closable)</technical_language>

Target:
private static void extractGzArchive(URL sourceDistribution, File tar) throws IOException { try (BufferedInputStream in = new BufferedInputStream(sourceDistribution.openStream()); FileOutputStream out = new FileOutputStream(tar); GzipCompressorInputStream gzIn = new GzipCompressorInputStream(in)) { final byte[] buffer = new byte[1000]; int n; while (-1 != (n = gzIn.read(buffer))) { out.write(buffer, 0, n); } } }
Source:
<code>public boolean equals(Object obj) { if (obj == null) { return false; } if (!(obj instanceof AbstractReferenceData)) { return false; } final AbstractReferenceData other = (AbstractReferenceData) obj; <START> return Objects.equals(getClass(), other.getClass()) && Objects.equals(getName(), other.getName()); <END> }</code><technical_language>_could_ replace instanceof check getClass() == other.getClass() skip here. real benefit Objects.equals getClass(), is null (though prefer for consistency)</technical_language>

Target:
public boolean equals(Object obj) { if (obj == null) { return false; } if (!getClass().equals(obj.getClass())) { return false; } final AbstractReferenceData other = (AbstractReferenceData) obj; return Objects.equals(getClass(), other.getClass()) && Objects.equals(getName(), other.getName()); }
Source:
<code>public static boolean shouldAnalyzeAutomatically(@Nullable VirtualFile file, @Nullable Module module) { if (!shouldAnalyze(file, module)) { return false; } <START> ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module); <END> ContentEntry[] entries = moduleRootManager.getContentEntries(); for (ContentEntry e : entries) { SourceFolder[] sourceFolders = e.getSourceFolders(); for (SourceFolder sourceFolder : sourceFolders) { if (sourceFolder.getFile() == null || sourceFolder.isSynthetic()) { continue; } if (VfsUtil.isAncestor(sourceFolder.getFile(), file, false)) { if (isExcludedOrUnderExcludedDirectory(file, e)) { SonarLintConsole.get(module.getProject()).debug("Not automatically analysing excluded file: " + file.getName()); return false; } else if (isJavaResource(sourceFolder)) { SonarLintConsole.get(module.getProject()).debug("Not automatically analysing file under resources: " + file.getName()); return false; } else if (isJavaGeneratedSource(sourceFolder)) { SonarLintConsole.get(module.getProject()).debug("Not automatically analysing file belonging to generated source folder: " + file.getName()); return false; } return true; } } } return false; }</code><technical_language>![CRITICAL](<LINK_1> Parameter 1 this call is marked "org.jetbrains.annotations.NotNull" null is passed. [![rule](<LINK_2>](<LINK_0></technical_language>

Target:
public static boolean shouldAnalyzeAutomatically(@Nullable VirtualFile file, @Nullable Module module) { if (!shouldAnalyze(file, module)) { return false; } ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module); ContentEntry[] entries = moduleRootManager.getContentEntries(); for (ContentEntry e : entries) { if (isExcludedOrUnderExcludedDirectory(file, e)) { SonarLintConsole.get(module.getProject()).debug("Not automatically analysing excluded file: " + file.getName()); return false; } SourceFolder[] sourceFolders = e.getSourceFolders(); for (SourceFolder sourceFolder : sourceFolders) { if (sourceFolder.getFile() == null || sourceFolder.isSynthetic()) { continue; } if (VfsUtil.isAncestor(sourceFolder.getFile(), file, false)) { if (isJavaResource(sourceFolder)) { SonarLintConsole.get(module.getProject()).debug("Not automatically analysing file under resources: " + file.getName()); return false; } else if (isJavaGeneratedSource(sourceFolder)) { SonarLintConsole.get(module.getProject()).debug("Not automatically analysing file belonging to generated source folder: " + file.getName()); return false; } return true; } } } return !"java".equalsIgnoreCase(file.getFileType().getDefaultExtension()); }
Source:
<code>public String getPort() { <START> return nettyPort.orElse(address.getPort()).toString(); <END> }</code><technical_language>address.getPort()</technical_language>

Target:
public Integer getPort() { return nettyPort.orElse(address.getPort()); }
Source:
<code>public double calculateEntropy() { Map<Double, Double> bucketWeights = Streams.stream(histogram.iterator()).collect( Collectors.groupingBy( FixedDoubleBreakdownHistogram.BucketWeight::getLeft, Collectors.summingDouble(e -> e.getCount() * e.getWeight()))); double sumW = bucketWeights.values().stream().mapToDouble(Double::doubleValue).sum(); if (sumW == 0.0) { return Double.NaN; } long n = Streams.stream(histogram.iterator()) .mapToLong(FixedDoubleBreakdownHistogram.BucketWeight::getCount) .sum(); double sumWLogW = bucketWeights.values().stream().mapToDouble(w -> w == 0.0 ? 0.0 : w * Math.log(w)).sum(); double entropy = n * calculateEntropy(histogram.getWidth(), sumW, sumWLogW); <START> entropy -= Streams.stream(histogram.iterator()).mapToDouble( <END> e -> { double bucketWeight = bucketWeights.get(e.getLeft()); if (bucketWeight == 0.0) { return 0.0; } return getHoldOutEntropy( n, e.getRight() - e.getLeft(), sumW, sumWLogW, bucketWeight, e.getWeight(), e.getCount()); }) .sum(); return entropy; }</code><technical_language>I rewrite this streams, a bit difficult read</technical_language>

Target:
public double calculateEntropy() { Map<Double, Double> bucketWeights = stream(histogram.iterator()).collect( groupingBy( FixedDoubleBreakdownHistogram.Bucket::getLeft, summingDouble(e -> e.getCount() * e.getWeight()))); double sumWeight = bucketWeights.values().stream().mapToDouble(Double::doubleValue).sum(); if (sumWeight == 0.0) { return Double.NaN; } long n = stream(histogram.iterator()) .mapToLong(FixedDoubleBreakdownHistogram.Bucket::getCount) .sum(); double sumWeightLogWeight = bucketWeights.values().stream().mapToDouble(w -> w == 0.0 ? 0.0 : w * Math.log(w)).sum(); double entropy = n * calculateEntropy(histogram.getWidth(), sumWeight, sumWeightLogWeight); for (FixedDoubleBreakdownHistogram.Bucket bucketWeight : histogram) { double weight = bucketWeights.get(bucketWeight.getLeft()); if (weight > 0.0) { entropy -= getHoldOutEntropy( n, bucketWeight.getRight() - bucketWeight.getLeft(), sumWeight, sumWeightLogWeight, weight, bucketWeight.getWeight(), bucketWeight.getCount()); } } return entropy; }
Source:
<code>public static ServerAppliance create(String id, String name, List<String> availableDataCenters, String osInstallationBase, Types.OSFamliyType osFamily, String os, String osVersion, int osArchitecture, Types.OSImageType osImageType, int minHddSize, ApplianceType type, String state, String version, List<String> categories, String eulaUrl) { <START> return new AutoValue_ServerAppliance(id, name, availableDataCenters == null ? ImmutableList.<String>of() : availableDataCenters, osInstallationBase, osFamily, os, osVersion, osArchitecture, osImageType, minHddSize, type, state, version, categories == null ? ImmutableList.<String>of() : categories, eulaUrl); <END> }</code><technical_language>ImmutableList.copyOf lists null</technical_language>

Target:
public static ServerAppliance create(String id, String name, List<String> availableDataCenters, String osInstallationBase, Types.OSFamliyType osFamily, String os, String osVersion, int osArchitecture, Types.OSImageType osImageType, int minHddSize, ApplianceType type, String state, String version, List<String> categories, String eulaUrl) { return new AutoValue_ServerAppliance(id, name, availableDataCenters == null ? ImmutableList.<String>of() : ImmutableList.copyOf(availableDataCenters), osInstallationBase, osFamily, os, osVersion, osArchitecture, osImageType, minHddSize, type, state, version, categories == null ? ImmutableList.<String>of() : ImmutableList.copyOf(categories), eulaUrl); }
Source:
<code>public static boolean tokenTextIndexingEnabledForSearchParam(ModelConfig theModelConfig, RuntimeSearchParam theSearchParam) { Boolean suppressViaSearchParam = null; List<IBaseExtension<?, ?>> suppressExt = theSearchParam.getExtensions(JpaConstants.EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING); if (suppressExt.size() > 0) { IPrimitiveType<?> value = (IPrimitiveType<?>) suppressExt.get(0).getValue(); if ("true".equals(value.getValueAsString())) { ourLog.trace("Suppressing text indexing for SearchParameter {}", theSearchParam.getName()); suppressViaSearchParam = true; } else if ("false".equals(value.getValueAsString())) { ourLog.trace("Not suppressing text indexing for SearchParameter {}", theSearchParam.getName()); suppressViaSearchParam = false; } } if (theModelConfig.isSuppressStringIndexingInTokens()) { if (!Boolean.FALSE.equals(suppressViaSearchParam)) return false; <START> } <END> if (Boolean.TRUE.equals(suppressViaSearchParam)) { return false; } return true; }</code><technical_language>Heya james, I a whack refactoring this, i relying nullity of a Boolean. this look? Is this logic encapsulating? Tests pass java public static boolean tokenTextIndexingEnabledForSearchParam(ModelConfig theModelConfig, RuntimeSearchParam theSearchParam) { Optional<Boolean> oSuppressForSearchParam = theSearchParam.getExtensions(JpaConstants.EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING).stream() .map(IBaseExtension::getValue) .map(val -> (IPrimitiveType<?>) val) .map(IPrimitiveType::getValueAsString) .map(Boolean::parseBoolean) .findFirst(); //if SP care, system default. if (!oSuppressForSearchParam.isPresent()) { return !theModelConfig.isSuppressStringIndexingInTokens(); //If SP care, value. } else { boolean suppressForSearchParam = oSuppressForSearchParam.get(); ourLog.trace("{} text indexing for SearchParameter {}", suppressForSearchParam? "Suppressing": "Not Suppressing", theSearchParam.getName()); return !suppressForSearchParam; } }</technical_language>

Target:
public static boolean tokenTextIndexingEnabledForSearchParam(ModelConfig theModelConfig, RuntimeSearchParam theSearchParam) { Optional<Boolean> noSuppressForSearchParam = theSearchParam.getExtensions(JpaConstants.EXT_SEARCHPARAM_TOKEN_SUPPRESS_TEXT_INDEXING).stream() .map(IBaseExtension::getValue) .map(val -> (IPrimitiveType<?>) val) .map(IPrimitiveType::getValueAsString) .map(Boolean::parseBoolean) .findFirst(); if (!noSuppressForSearchParam.isPresent()) { return !theModelConfig.isSuppressStringIndexingInTokens(); } else { boolean suppressForSearchParam = noSuppressForSearchParam.get(); ourLog.trace("Text indexing for SearchParameter {}: {}", theSearchParam.getName(), suppressForSearchParam); return !suppressForSearchParam; } }
Source:
<code>public Mono<Void> runAsync() { return receiverAsync .receiveMessages() .take(options.getMessagesToReceive()) .map(messageContext -> { <START> receiverAsync.complete(messageContext.getMessage().getLockToken()).block(); <END> return messageContext; }) .then(); }</code><technical_language>blocking here? this async throughout</technical_language>

Target:
public Mono<Void> runAsync() { return receiverAsync .receiveMessages() .take(options.getMessagesToReceive()) .flatMap(message -> { return receiverAsync.complete(message).thenReturn(true); }, 1).then(); }
Source:
<code>public static ChallengeCriteria criteria() { try { <START> Class defaultChallengeCriteriaClazz = Class.forName("com.stormpath.sdk.impl.challenge.DefaultChallengeCriteria"); <END> Constructor c = defaultChallengeCriteriaClazz.getDeclaredConstructor(FactorOptions.class); return (ChallengeCriteria) c.newInstance(options()); } catch (Exception e) { throw new IllegalStateException(e); } }</code><technical_language>rename DefaultChallengeCriteria AbstractChallengeCriteria specific concrete challenges (SMS Google) instantiated</technical_language>

Target:
public static ChallengeCriteria criteria() { try { Class defaultChallengeCriteriaClazz = Class.forName("com.stormpath.sdk.impl.challenge.DefaultChallengeCriteria"); Constructor c = defaultChallengeCriteriaClazz.getDeclaredConstructor(ChallengeOptions.class); return (ChallengeCriteria) c.newInstance(options()); } catch (Exception e) { throw new IllegalStateException(e); } }
Source:
<code>private static boolean hostIsMissingClusterNetworks(VDS vds) { boolean hasChanges = false; List<network> clusterNetworks = DbFacade.getInstance().getNetworkDAO() .getAllForCluster(vds.getvds_group_id()); network tempNetwork; java.util.List<network> networks = vds.getNetworks(); for (network net : clusterNetworks) { tempNetwork = null; String outterNetworkName = net.getname(); if (outterNetworkName != null) { for (network tempNet : networks) { if (outterNetworkName.equals(tempNet.getname())) { tempNetwork = tempNet; break; } } } if (net.getStatus() == NetworkStatus.Operational && tempNetwork == null) { hasChanges = true; break; } } if (hasChanges && vds.getstatus() != VDSStatus.Maintenance) { ResourceManager.getInstance() .getEventListener() .vdsNonOperational(vds.getId(), NonOperationalReason.NETWORK_UNREACHABLE, true, true, Guid.Empty); <START> returnValue = true; <END> } return returnValue; }</code><technical_language>this returnValue ^^ vv is defined in this method, compile</technical_language>

Target:
private static boolean hostIsMissingClusterNetworks(VDS vds) { boolean returnValue = false; boolean hasChanges = false; List<network> clusterNetworks = DbFacade.getInstance().getNetworkDAO() .getAllForCluster(vds.getvds_group_id()); network tempNetwork; java.util.List<network> networks = vds.getNetworks(); for (network net : clusterNetworks) { tempNetwork = null; String outterNetworkName = net.getname(); if (outterNetworkName != null) { for (network tempNet : networks) { if (outterNetworkName.equals(tempNet.getname())) { tempNetwork = tempNet; break; } } } if (net.getStatus() == NetworkStatus.Operational && tempNetwork == null) { hasChanges = true; break; } } if (hasChanges && vds.getstatus() != VDSStatus.Maintenance) { ResourceManager.getInstance() .getEventListener() .vdsNonOperational(vds.getId(), NonOperationalReason.NETWORK_UNREACHABLE, true, true, Guid.Empty); returnValue = true; } return returnValue; }
Source:
<code>private OutputApkSigningBlockRequestImpl outputZipSectionsInternal( DataSource zipEntries, DataSource zipCentralDirectory, DataSource zipEocd, boolean apkSigningBlockPaddingSupported) throws IOException, InvalidKeyException, SignatureException, NoSuchAlgorithmException { checkNotClosed(); checkV1SigningDoneIfEnabled(); if (!mV2SigningEnabled) { return null; } invalidateV2Signature(); checkOutputApkNotDebuggableIfDebuggableMustBeRejected(); Pair<DataSource, Integer> paddingPair = <START> ApkSigningBlockUtils.generateApKSigningBlockPadding(zipEntries, <END> apkSigningBlockPaddingSupported); DataSource beforeCentralDir = paddingPair.getFirst(); int padSizeBeforeApkSigningBlock = paddingPair.getSecond(); DataSource eocd = ApkSigningBlockUtils.generateApkSigningBlockCDOffset(beforeCentralDir, zipEocd); List<ApkSigningBlockUtils.SignerConfig> v2SignerConfigs = createV2SignerConfigs(apkSigningBlockPaddingSupported); Pair<List<ApkSigningBlockUtils.SignerConfig>, Map<ContentDigestAlgorithm, byte[]>> v2DigestInfo = ApkSigningBlockUtils.computeContentDigests(beforeCentralDir, zipCentralDirectory, eocd, v2SignerConfigs); Pair<byte[], Integer> apkSignatureSchemeV2Block = V2SchemeSigner.generateApkSignatureSchemeV2Block(v2DigestInfo.getFirst(), v2DigestInfo.getSecond()); byte[] apkSigningBlock = ApkSigningBlockUtils.generateApkSigningBlock(apkSignatureSchemeV2Block); mAddV2SignatureRequest = new OutputApkSigningBlockRequestImpl(apkSigningBlock, padSizeBeforeApkSigningBlock); return mAddV2SignatureRequest; }</code><technical_language>capital in ApK</technical_language>

Target:
private OutputApkSigningBlockRequestImpl outputZipSectionsInternal( DataSource zipEntries, DataSource zipCentralDirectory, DataSource zipEocd, boolean apkSigningBlockPaddingSupported) throws IOException, InvalidKeyException, SignatureException, NoSuchAlgorithmException { checkNotClosed(); checkV1SigningDoneIfEnabled(); if (!mV2SigningEnabled) { return null; } invalidateV2Signature(); checkOutputApkNotDebuggableIfDebuggableMustBeRejected(); Pair<DataSource, Integer> paddingPair = ApkSigningBlockUtils.generateApkSigningBlockPadding(zipEntries, apkSigningBlockPaddingSupported); DataSource beforeCentralDir = paddingPair.getFirst(); int padSizeBeforeApkSigningBlock = paddingPair.getSecond(); DataSource eocd = ApkSigningBlockUtils.copyWithModifiedCDOffset(beforeCentralDir, zipEocd); List<ApkSigningBlockUtils.SignerConfig> v2SignerConfigs = createV2SignerConfigs(apkSigningBlockPaddingSupported); Pair<byte[], Integer> apkSignatureSchemeV2Block = V2SchemeSigner.generateApkSignatureSchemeV2Block(beforeCentralDir, zipCentralDirectory, eocd, v2SignerConfigs); byte[] apkSigningBlock = ApkSigningBlockUtils.generateApkSigningBlock(apkSignatureSchemeV2Block); mAddV2SignatureRequest = new OutputApkSigningBlockRequestImpl(apkSigningBlock, padSizeBeforeApkSigningBlock); return mAddV2SignatureRequest; }
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 = "."; } if (args.isSync()) { LOG.info("Using sync command"); this.sync = true; } this.numberOfThreads = args.getNumberOfThreads(); <START> if (args.getRangeLength() != null || args.getRangeStart() != null ) { <END> if (args.getRangeLength() == null || args.getRangeStart() == null) { throw new MissingOptionException("Partial recovery must provide values for both " + RANGE_START.getLongOpt() + " and " + RANGE_LENGTH.getLongOpt()); } else { this.rangeStart = Long.parseLong(args.getOptionValue(RANGE_START.getLongOpt())); this.rangeLength = Long.parseLong(args.getOptionValue(RANGE_LENGTH.getLongOpt())); } } return this; }</code><technical_language>This Guard methods check for empty strings</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 = "."; } 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><START> public void serialize(JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException { <END> if (getTimeZone() == DateTimeZone.UTC && getOrigin() == null) { jsonGenerator.writeObject(granularityType.toString()); } else { jsonGenerator.writeStartObject(); jsonGenerator.writeStringField("type", "period"); jsonGenerator.writeObjectField("period", getPeriod()); jsonGenerator.writeObjectField("timeZone", getTimeZone()); jsonGenerator.writeObjectField("origin", getOrigin()); jsonGenerator.writeEndObject(); } }</code><technical_language>this weird is done allow rolling upgrade of cluster overlord is upgraded middle managers. possibly remove this if decide support rolling upgrade for 0.10.0</technical_language>

Target:
public void serialize(JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException { if (PREDEFINED_SEGMENT_GRANULARITIES.contains(this)) { jsonGenerator.writeString(granularityType.toString()); } else { jsonGenerator.writeStartObject(); jsonGenerator.writeStringField("type", "period"); jsonGenerator.writeObjectField("period", getPeriod()); jsonGenerator.writeObjectField("timeZone", getTimeZone()); jsonGenerator.writeObjectField("origin", getOrigin()); jsonGenerator.writeEndObject(); } }
Source:
<code>private static Request addSocketHeaders(final Request req, final Socket socket) { <START> final String ptss = "%s: %s"; <END> final String ptsd = "%s: %d"; return new RqWithHeaders( req, String.format( ptss, BkBasic.HEADER_TAKES_LOCAL_ADDRESS, socket.getLocalAddress().getHostAddress() ), String.format( ptsd, BkBasic.HEADER_TAKES_LOCAL_PORT, socket.getLocalPort() ), String.format( ptss, BkBasic.HEADER_TAKES_REMOTE_ADDRESS, socket.getInetAddress().getHostAddress() ), String.format( ptsd, BkBasic.HEADER_TAKES_REMOTE_PORT, socket.getPort() ) ); }</code><technical_language>@danff This variable name is useful, a "ptss"</technical_language>

Target:
private static Request addSocketHeaders(final Request req, final Socket socket) { return new RqWithHeaders( req, String.format( "%s: %s", BkBasic.HEADER_TAKES_LOCAL_ADDRESS, socket.getLocalAddress().getHostAddress() ), String.format( "%s: %d", BkBasic.HEADER_TAKES_LOCAL_PORT, socket.getLocalPort() ), String.format( "%s: %s", BkBasic.HEADER_TAKES_REMOTE_ADDRESS, socket.getInetAddress().getHostAddress() ), String.format( "%s: %d", BkBasic.HEADER_TAKES_REMOTE_PORT, socket.getPort() ) ); }
Source:
<code>public void testStatementPeriodBIMONTHLY() { Calendar date = Calendar.getInstance(); date.set(Calendar.DATE, QuotaStatementImpl.s_LAST_STATEMENT_SENT_DAYS + 1); Calendar period[] = quotaStatement.statementTime(date, STATEMENT_PERIODS.BIMONTHLY); assertTrue(period == null); date.set(Calendar.DATE, 1); period = quotaStatement.statementTime(date, STATEMENT_PERIODS.BIMONTHLY); assertTrue(period != null); assertTrue(period[0].toString(), period[0].before(period[1])); assertTrue(period[0].toString(), period[0].get(Calendar.DATE) == 1); assertTrue(period[1].toString(), period[1].get(Calendar.DATE) == 15); date = Calendar.getInstance(); date.set(Calendar.DATE, QuotaStatementImpl.s_LAST_STATEMENT_SENT_DAYS + 16); period = quotaStatement.statementTime(date, STATEMENT_PERIODS.BIMONTHLY); assertTrue(period == null); date.set(Calendar.DATE, 17); period = quotaStatement.statementTime(date, STATEMENT_PERIODS.BIMONTHLY); assertTrue(period != null); <START> assertTrue(period[0].toString(), period[0].before(period[1])); <END> assertTrue(period[0].toString(), period[0].get(Calendar.DATE) == 16); Calendar aCalendar = Calendar.getInstance(); aCalendar.add(Calendar.MONTH, -1); aCalendar.set(Calendar.DATE, aCalendar.getActualMaximum(Calendar.DAY_OF_MONTH) + 1); assertTrue(period[1].toString(), period[1].get(Calendar.DATE) == aCalendar.get(Calendar.DATE)); }</code><technical_language>Add assertion length of period is 2 avoid a confusing ArrayIndexOutofBoundsException</technical_language>

Target:
public void testStatementPeriodBIMONTHLY() { Calendar date = Calendar.getInstance(); date.set(Calendar.DATE, QuotaStatementImpl.s_LAST_STATEMENT_SENT_DAYS + 1); Calendar period[] = quotaStatement.statementTime(date, STATEMENT_PERIODS.BIMONTHLY); assertTrue(period == null); date.set(Calendar.DATE, 1); period = quotaStatement.statementTime(date, STATEMENT_PERIODS.BIMONTHLY); assertTrue(period != null); assertTrue(period.length == 2); assertTrue(period[0].toString(), period[0].before(period[1])); assertTrue(period[0].toString(), period[0].get(Calendar.DATE) == 1); assertTrue(period[1].toString(), period[1].get(Calendar.DATE) == 15); date = Calendar.getInstance(); date.set(Calendar.DATE, QuotaStatementImpl.s_LAST_STATEMENT_SENT_DAYS + 16); period = quotaStatement.statementTime(date, STATEMENT_PERIODS.BIMONTHLY); assertTrue(period == null); date.set(Calendar.DATE, 17); period = quotaStatement.statementTime(date, STATEMENT_PERIODS.BIMONTHLY); assertTrue(period != null); assertTrue(period.length == 2); assertTrue(period[0].toString(), period[0].before(period[1])); assertTrue(period[0].toString(), period[0].get(Calendar.DATE) == 16); Calendar aCalendar = Calendar.getInstance(); aCalendar.add(Calendar.MONTH, -1); aCalendar.set(Calendar.DATE, aCalendar.getActualMaximum(Calendar.DAY_OF_MONTH) + 1); assertTrue(period[1].toString(), period[1].get(Calendar.DATE) == aCalendar.get(Calendar.DATE)); }
Source:
<code>public void fullPopulationStatisticsJob() throws Exception { <START> Config.setOpenCGAHome(opencgaHome); <END> String input = SMALL_VCF_FILE; String statsDir = temporaryFolderRule.getRoot().getPath(); String dbName = mongoRule.restoreDumpInTemporaryDatabase(getResourceUrl(MONGO_DUMP)); String fileId = "1"; String studyId = "1"; JobParameters jobParameters = new EvaJobParameterBuilder() .collectionFilesName("files") .collectionVariantsName("variants") .databaseName(dbName) .inputStudyId(studyId) .inputVcf(getResource(input).getAbsolutePath()) .inputVcfAggregation("BASIC") .inputVcfId(fileId) .outputDirStats(statsDir) .timestamp() .toJobParameters(); JobExecution jobExecution = jobLauncherTestUtils.launchJob(jobParameters); assertCompleted(jobExecution); File statsFile = new File(URLHelper.getVariantsStatsUri(statsDir, studyId, fileId)); assertTrue(statsFile.exists()); File sourceStatsFile = new File(URLHelper.getSourceStatsUri(statsDir, studyId, fileId)); assertTrue(sourceStatsFile.exists()); VariantStorageManager variantStorageManager = StorageManagerFactory.getVariantStorageManager(); VariantDBAdaptor variantDBAdaptor = variantStorageManager.getDBAdaptor(dbName, null); VariantDBIterator iterator = variantDBAdaptor.iterator(new QueryOptions()); assertEquals(1, iterator.next().getSourceEntries().values().iterator().next().getCohortStats().size()); }</code><technical_language>chance move statements a setUp in other classes</technical_language>

Target:
public void fullPopulationStatisticsJob() throws Exception { String input = SMALL_VCF_FILE; String statsDir = temporaryFolderRule.getRoot().getPath(); String dbName = mongoRule.restoreDumpInTemporaryDatabase(getResourceUrl(MONGO_DUMP)); String fileId = "1"; String studyId = "1"; JobParameters jobParameters = new EvaJobParameterBuilder() .collectionFilesName("files") .collectionVariantsName("variants") .databaseName(dbName) .inputStudyId(studyId) .inputVcf(getResource(input).getAbsolutePath()) .inputVcfAggregation("BASIC") .inputVcfId(fileId) .outputDirStats(statsDir) .timestamp() .toJobParameters(); JobExecution jobExecution = jobLauncherTestUtils.launchJob(jobParameters); assertCompleted(jobExecution); File statsFile = new File(URLHelper.getVariantsStatsUri(statsDir, studyId, fileId)); assertTrue(statsFile.exists()); File sourceStatsFile = new File(URLHelper.getSourceStatsUri(statsDir, studyId, fileId)); assertTrue(sourceStatsFile.exists()); VariantStorageManager variantStorageManager = StorageManagerFactory.getVariantStorageManager(); VariantDBAdaptor variantDBAdaptor = variantStorageManager.getDBAdaptor(dbName, null); VariantDBIterator iterator = variantDBAdaptor.iterator(new QueryOptions()); assertEquals(1, iterator.next().getSourceEntries().values().iterator().next().getCohortStats().size()); }
Source:
<code>public void initialize() throws Exception { TestPlainTextSerializer.inject(); Game game = mock(Game.class); CauseStackManager csm = mock(CauseStackManager.class); <START> Mockito.when(game.getCauseStackManager()).thenReturn(csm); <END> Mockito.when(csm.pushCause(null)).thenReturn(csm); Mockito.when(csm.popCause()).thenReturn(null); CommandManager cm = mock(CommandManager.class); Mockito.when(game.getCommandManager()).thenReturn(cm); TestHooks.setGame(game); }</code><technical_language>Add a static import for Mockito.when here</technical_language>

Target:
public void initialize() throws Exception { TestPlainTextSerializer.inject(); Game game = mock(Game.class); CauseStackManager csm = mock(CauseStackManager.class); when(game.getCauseStackManager()).thenReturn(csm); when(csm.pushCause(null)).thenReturn(csm); when(csm.popCause()).thenReturn(null); CommandManager cm = mock(CommandManager.class); when(game.getCommandManager()).thenReturn(cm); TestHooks.setGame(game); TestHooks.setInstance("commandManager", cm); }
Source:
<code>public static boolean hasPushStatusBug(int[] version) { <START> int cmp = compare(version, v1_7_8_6); <END> if (cmp < 0) return true; else if (cmp == 0) return false; if (compare(version, v1_7_9) <= 0) return true; return false; }</code><technical_language>implementation "return false"</technical_language>

Target:
public static boolean hasPushStatusBug(int[] version) { return false; }
Source:
<code>public static Map<String, String> createStructFromLibvirtSecret(LibvirtSecret libvirtSecret) { HashMap<String, String> con = new HashMap<>(); con.put("uuid", libvirtSecret.getId().toString()); con.put("password", libvirtSecret.getValue()); con.put("description", libvirtSecret.getDescription()); con.put("usageType", libvirtSecret.getUsageType().name().toLowerCase()); <START> con.put("usageID", String.format("ovirt/%s/%s", libvirtSecret.getProviderId(), libvirtSecret.getId())); <END> return con; }</code><technical_language>Please add constant</technical_language>

Target:
public static Map<String, String> createStructFromLibvirtSecret(LibvirtSecret libvirtSecret) { HashMap<String, String> con = new HashMap<>(); con.put("uuid", libvirtSecret.getId().toString()); con.put("password", libvirtSecret.getValue()); con.put("description", libvirtSecret.getDescription() != null ? libvirtSecret.getDescription() : StringUtils.EMPTY); con.put("usageType", libvirtSecret.getUsageType().name().toLowerCase()); con.put("usageID", String.format("%s/%s/%s", VdsProperties.Ovirt, libvirtSecret.getProviderId(), libvirtSecret.getId())); return con; }
Source:
<code>public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; <START> return true; <END> }</code><technical_language>HashFunctionPartitioners equal other? 3 variables? hashCode is broken 2 of fields :(</technical_language>

Target:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; HashFunctionPartitioner that = (HashFunctionPartitioner) o; if (numSegments != that.numSegments) return false; return Objects.equals(hashFunction, that.hashFunction); }
Source:
<code>private void addHandle(JcrSessionHandle handle) { synchronized (handles) { handles.add(handle); <START> } <END> }</code><technical_language>do need synchronized block</technical_language>

Target:
private void addHandle(JcrSessionHandle handle) { handles.add(handle); }
Source:
<code>public void onLoadFinished(Loader<Cursor> loader, Cursor data) { data.moveToFirst(); route.buildFromCursor(data, DBAdapter.getInstance()); <START> data.close(); <END> stops = route.getStops(); int currentStop = predictionViewPager.getCurrentItem(); stopViewPagerAdapter.updatePredictions(currentStop, stops.get(currentStop).getPredictions()); updateMapItems((ArrayList) route.getVehicles(), false); }</code><technical_language>need call</technical_language>

Target:
public void onLoadFinished(Loader<Cursor> loader, Cursor data) { data.moveToFirst(); route.buildFromCursor(data, DBAdapter.getInstance()); stops = route.getStops(); int currentStop = predictionViewPager.getCurrentItem(); stopViewPagerAdapter.updatePredictions(currentStop, stops.get(currentStop).getPredictions()); updateMapItems((ArrayList) route.getVehicles(), false); }
Source:
<code>public storage_server_connections(String connection, String id, String iqn, String password, StorageType storageType, String userName, String port, String portal, String vfsType, String mountOptions, Short nfsVersion, Short nfsRetrans, Short nfsTimeo) { this.connection = connection; this.id = id; this.iqn = iqn; this.password = password; this.storageType = storageType; this.username = userName; this.port = port; this.portal = portal; this.vfsType = vfsType; this.mountOptions = mountOptions; this.nfsVersion = nfsVersion; this.nfsRetrans = nfsRetrans; <START> this.nfsVersion = nfsVersion; <END> }</code><technical_language>This is a bug. please change version timeo</technical_language>

Target:
public storage_server_connections(String connection, String id, String iqn, String password, StorageType storageType, String userName, String port, String portal, String vfsType, String mountOptions, Short nfsVersion, Short nfsRetrans, Short nfsTimeo) { this.connection = connection; this.id = id; this.iqn = iqn; this.password = password; this.storageType = storageType; this.username = userName; this.port = port; this.portal = portal; this.vfsType = vfsType; this.mountOptions = mountOptions; this.nfsVersion = nfsVersion; this.nfsRetrans = nfsRetrans; this.nfsTimeo = nfsTimeo; }
Source:
<code>private int processFileStatuses(HdfsInfo info, FileStatus[] fileStatuses) { final AtomicInteger totalMessageCount = new AtomicInteger(0); List<HdfsInputStream> hdfsFiles = Arrays.stream(fileStatuses) .filter(status -> normalFileIsDirectoryHasSuccessFile(status, info)) .filter(this::hasMatchingOwner) .map(this::asHdfsFile) .filter(Objects::nonNull) .collect(Collectors.toList()); log.info("Processing valid files out of available.", hdfsFiles.size(), fileStatuses.length); <START> for (int i = 0; i < hdfsFiles.size(); i++) { <END> HdfsInputStream hdfsFile = hdfsFiles.get(i); try { int messageCount = processHdfsInputStream(hdfsFile, totalMessageCount); log.debug("Processed files out of [{}].", i, hdfsFiles.size()); log.debug("File was split to messages.", i, messageCount); } finally { IOHelper.close(hdfsFile, "hdfs file", log); } } return totalMessageCount.get(); }</code><technical_language>IMHO tend replace this forEach readable concise, another reason perhaps</technical_language>

Target:
private int processFileStatuses(HdfsInfo info, FileStatus[] fileStatuses) { final AtomicInteger totalMessageCount = new AtomicInteger(0); List<HdfsInputStream> hdfsFiles = Arrays.stream(fileStatuses) .filter(status -> normalFileIsDirectoryHasSuccessFile(status, info)) .filter(this::hasMatchingOwner) .limit(endpointConfig.getMaxMessagesPerPoll()) .map(this::asHdfsFile) .filter(Objects::nonNull) .collect(Collectors.toList()); log.info("Processing valid files out of available.", hdfsFiles.size(), fileStatuses.length); for (int i = 0; i < hdfsFiles.size(); i++) { HdfsInputStream hdfsFile = hdfsFiles.get(i); try { int messageCount = processHdfsInputStream(hdfsFile, totalMessageCount); log.debug("Processed files out of [{}].", i, hdfsFiles.size()); log.debug("File was split to messages.", i, messageCount); } finally { IOHelper.close(hdfsFile, "hdfs file", log); } } return totalMessageCount.get(); }
Source:
<code>public void run() { int numTimeouts = checkPendingTimeouts(); if (!pendingData.isEmpty() || !pendingEvent.isEmpty() || numTimeouts > 0) { Collection<Data> newData = getAndClearPendingData(); <START> Collection<Event> newEvent = getAndClearPendingEvent(); <END> if (!newEvent.isEmpty()) { events.addAll(newEvent); } log.debugf("Executing rules engine on [%1d] datums, [%2d] events and [%3d] dampening timeouts.", newData.size(), newEvent.size(), numTimeouts); try { if (newData.isEmpty() && newEvent.isEmpty()) { rules.fireNoData(); } else { if (!newData.isEmpty()) { rules.addData(newData); newData.clear(); } if (!newEvent.isEmpty()) { rules.addEvent(newEvent); newEvent.clear(); } } rules.fire(); alertsService.addAlerts(alerts); alerts.clear(); alertsService.addEvents(events); events.clear(); handleDisabledTriggers(); handleAutoResolvedTriggers(); } catch (Exception e) { e.printStackTrace(); log.debugf("Error on rules processing: " + e); msgLog.errorProcessingRules(e.getMessage()); } finally { alerts.clear(); events.clear(); } } }</code><technical_language>sorry, plural..</technical_language>

Target:
public void run() { int numTimeouts = checkPendingTimeouts(); if (!pendingData.isEmpty() || !pendingEvents.isEmpty() || numTimeouts > 0) { Collection<Data> newData = getAndClearPendingData(); Collection<Event> newEvents = getAndClearPendingEvents(); log.debugf("Executing rules engine on [%1d] datums, [%2d] events and [%3d] dampening timeouts.", newData.size(), newEvents.size(), numTimeouts); try { if (newData.isEmpty() && newEvents.isEmpty()) { rules.fireNoData(); } else { if (!newData.isEmpty()) { rules.addData(newData); newData.clear(); } if (!newEvents.isEmpty()) { rules.addEvents(newEvents); newEvents.clear(); } } rules.fire(); alertsService.addAlerts(alerts); alerts.clear(); alertsService.persistEvents(events); events.clear(); handleDisabledTriggers(); handleAutoResolvedTriggers(); } catch (Exception e) { e.printStackTrace(); log.debugf("Error on rules processing: " + e); msgLog.errorProcessingRules(e.getMessage()); } finally { alerts.clear(); events.clear(); } } }
Source:
<code>private void recordStartPageView() { <START> App.getInstance().getGdgXHub().getEventDetail( <END> mEventId, new Callback<EventFullDetails>() { @Override public void success(EventFullDetails eventFullDetails, retrofit.client.Response response) { mEventFullDetails = eventFullDetails; Action viewAction = createAppIndexAction(eventFullDetails.getTitle(), mEventId); recordStartPageView(viewAction); } @Override public void failure(RetrofitError error) { } } ); }</code><technical_language>I realized this network call in EventDetailFragment too. for event detail page, network request twice</technical_language>

Target:
private void recordStartPageView() { if (mEventFullDetails != null) { Action viewAction = createAppIndexAction(mEventFullDetails.getTitle(), mEventId); recordStartPageView(viewAction); } }
Source:
<code>public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateEscalationEvent emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); <START> assertEscalationEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, ""); <END> assertDataIOSet(emptySubprocessEvent.getDataIOSet(), EMPTY_VALUE); }</code><technical_language>suggestion assertEscalationEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, EMPTY_VALUE);</technical_language>

Target:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateEscalationEvent emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertEscalationEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, CANCELLING, EMPTY_VALUE); assertDataIOSet(emptySubprocessEvent.getDataIOSet(), EMPTY_VALUE); }
Source:
<code>public ScheduledJobRepositoryDecorator(Repository<ScheduledJob> decorated, JobScheduler scheduler) { <START> this.decorated = decorated; <END> this.scheduler = scheduler; }</code><technical_language>requireNonNull</technical_language>

Target:
public ScheduledJobRepositoryDecorator(Repository<ScheduledJob> decorated, JobScheduler scheduler) { this.decorated = requireNonNull(decorated); this.scheduler = requireNonNull(scheduler); }