auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static void extractGzArchive(URL sourceDistribution, File tar) throws IOException { BufferedInputStream in = new BufferedInputStream(sourceDistribution.openStream()); 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); } } }

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:
public boolean equals(Object obj) { if (obj == null) { return false; } if (!(obj instanceof AbstractReferenceData)) { return false; } final AbstractReferenceData other = (AbstractReferenceData) obj; return Objects.equals(getClass(), other.getClass()) && Objects.equals(getName(), other.getName()); }

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:
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) { 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; }

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:
public String getPort() { return nettyPort.orElse(address.getPort()).toString(); }

Target:
public Integer getPort() { return nettyPort.orElse(address.getPort()); }
Source:
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); entropy -= Streams.stream(histogram.iterator()).mapToDouble( 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; }

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:
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() : availableDataCenters, osInstallationBase, osFamily, os, osVersion, osArchitecture, osImageType, minHddSize, type, state, version, categories == null ? ImmutableList.<String>of() : categories, eulaUrl); }

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:
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; } if (Boolean.TRUE.equals(suppressViaSearchParam)) { return false; } return true; }

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:
public Mono<Void> runAsync() { return receiverAsync .receiveMessages() .take(options.getMessagesToReceive()) .map(messageContext -> { receiverAsync.complete(messageContext.getMessage().getLockToken()).block(); return messageContext; }) .then(); }

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

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:
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); returnValue = true; } return returnValue; }

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:
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.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; }

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:
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 (args.getRangeLength() != null || args.getRangeStart() != null ) { 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; }

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:
public void serialize(JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException { 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(); } }

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:
private static Request addSocketHeaders(final Request req, final Socket socket) { final String ptss = "%s: %s"; 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() ) ); }

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:
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); 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)); }

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:
public void fullPopulationStatisticsJob() throws Exception { Config.setOpenCGAHome(opencgaHome); 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()); }

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:
public void initialize() throws Exception { TestPlainTextSerializer.inject(); Game game = mock(Game.class); CauseStackManager csm = mock(CauseStackManager.class); Mockito.when(game.getCauseStackManager()).thenReturn(csm); 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); }

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:
public static boolean hasPushStatusBug(int[] version) { int cmp = compare(version, v1_7_8_6); if (cmp < 0) return true; else if (cmp == 0) return false; if (compare(version, v1_7_9) <= 0) return true; return false; }

Target:
public static boolean hasPushStatusBug(int[] version) { return false; }
Source:
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()); con.put("usageID", String.format("ovirt/%s/%s", libvirtSecret.getProviderId(), libvirtSecret.getId())); return con; }

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:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; return true; }

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:
private void addHandle(JcrSessionHandle handle) { synchronized (handles) { handles.add(handle); } }

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

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:
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.nfsVersion = nfsVersion; }

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:
public static String sendPostRequest(String backendURL, String message, Map<String, String> requestProps) { OutputStream outputStream = null; InputStream inputStream = null; BufferedReader reader = null; String response = null; URL url = null; try { url = new URL(backendURL); httpsURLConnection = (HttpsURLConnection) url.openConnection(); httpsURLConnection.setSSLSocketFactory(sslSocketFactory); httpsURLConnection.setDoOutput(true); httpsURLConnection.setDoInput(true); httpsURLConnection.setRequestMethod(HTTP_POST); if (requestProps != null && !requestProps.isEmpty()) { for (Map.Entry<String, String> entry : requestProps.entrySet()) { httpsURLConnection.setRequestProperty(entry.getKey(), entry.getValue()); } } outputStream = httpsURLConnection.getOutputStream(); if (StringUtils.isNotEmpty(message)) { outputStream.write(message.getBytes(Charset.forName("UTF-8"))); } inputStream = httpsURLConnection.getInputStream(); reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("UTF-8"))); StringBuilder builder = new StringBuilder(); String line; while (StringUtils.isNotEmpty(line = reader.readLine())) { builder.append(line); } response = builder.toString(); } catch (IOException e) { log.error("Sending " + HTTP_POST + " request to URL : " + url + "failed.", e); } finally { try { if (reader != null) { reader.close(); } if (inputStream != null) { inputStream.close(); } if (outputStream != null) { outputStream.close(); } } catch (IOException e) { log.error("Closing stream for " + url + " failed", e); } } return response; }

Target:
public static String sendPostRequest(String backendURL, String message, Map<String, String> requestProps) { OutputStream outputStream = null; InputStream inputStream = null; BufferedReader reader = null; String response = null; URL url = null; try { url = new URL(backendURL); httpsURLConnection = (HttpsURLConnection) url.openConnection(); httpsURLConnection.setSSLSocketFactory(sslSocketFactory); httpsURLConnection.setDoOutput(true); httpsURLConnection.setDoInput(true); httpsURLConnection.setRequestMethod(HTTP_POST); if (requestProps != null) { for (Map.Entry<String, String> entry : requestProps.entrySet()) { httpsURLConnection.setRequestProperty(entry.getKey(), entry.getValue()); } } outputStream = httpsURLConnection.getOutputStream(); if (StringUtils.isNotEmpty(message)) { outputStream.write(message.getBytes(StandardCharsets.UTF_8)); } inputStream = httpsURLConnection.getInputStream(); reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); StringBuilder builder = new StringBuilder(); String line; while (StringUtils.isNotEmpty(line = reader.readLine())) { builder.append(line); } response = builder.toString(); } catch (IOException e) { log.error("Sending " + HTTP_POST + " request to URL : " + url + "failed.", e); } finally { try { if (reader != null) { reader.close(); } if (inputStream != null) { inputStream.close(); } if (outputStream != null) { outputStream.close(); } } catch (IOException e) { log.error("Closing stream for " + url + " failed", e); } } return response; }
Source:
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); 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(); }

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:
public void run() { int numTimeouts = checkPendingTimeouts(); if (!pendingData.isEmpty() || !pendingEvent.isEmpty() || numTimeouts > 0) { Collection<Data> newData = getAndClearPendingData(); Collection<Event> newEvent = getAndClearPendingEvent(); 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(); } } }

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:
private void recordStartPageView() { App.getInstance().getGdgXHub().getEventDetail( 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) { } } ); }

Target:
private void recordStartPageView() { if (mEventFullDetails != null) { Action viewAction = createAppIndexAction(mEventFullDetails.getTitle(), mEventId); recordStartPageView(viewAction); } }
Source:
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, ""); assertDataIOSet(emptySubprocessEvent.getDataIOSet(), EMPTY_VALUE); }

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:
public ScheduledJobRepositoryDecorator(Repository<ScheduledJob> decorated, JobScheduler scheduler) { this.decorated = decorated; this.scheduler = scheduler; }

Target:
public ScheduledJobRepositoryDecorator(Repository<ScheduledJob> decorated, JobScheduler scheduler) { this.decorated = requireNonNull(decorated); this.scheduler = requireNonNull(scheduler); }
Source:
public LogUnitServerCache(LogUnitServerConfig config, StreamLog streamLog) { this.streamLog = streamLog; this.dataCache = Caffeine.newBuilder() .<Long, ILogData>weigher((addr, logData) -> getLogDataTotalSize(logData)) .maximumWeight(config.getMaxCacheSize()) .recordStats() .removalListener(this::handleEviction) .build(this::handleRetrieval); MeterRegistryProvider.getInstance().ifPresent(registry -> CaffeineCacheMetrics.monitor(registry, dataCache, "logunit.read_cache")); readTimer = MeterRegistryProvider.getInstance().map(registry -> Timer.builder("logunit.read.timer").register(registry)); }

Target:
public LogUnitServerCache(LogUnitServerConfig config, StreamLog streamLog) { this.streamLog = streamLog; this.dataCache = Caffeine.newBuilder() .<Long, ILogData>weigher((addr, logData) -> getLogDataTotalSize(logData)) .maximumWeight(config.getMaxCacheSize()) .recordStats() .removalListener(this::handleEviction) .build(this::handleRetrieval); MeterRegistryProvider.getInstance().ifPresent(registry -> CaffeineCacheMetrics.monitor(registry, dataCache, "logunit.read_cache")); hitRatio = MeterRegistryProvider.getInstance().map(registry -> Gauge.builder(hitRatioName, dataCache, cache -> cache.stats().hitRate()).register(registry)); loadTime = MeterRegistryProvider.getInstance().map(registry -> Gauge.builder(loadTimeName, dataCache, cache -> cache.stats().totalLoadTime()) .register(registry)); weight = MeterRegistryProvider.getInstance().map(registry -> Gauge.builder(weightName, dataCache, cache -> cache.stats().evictionWeight()) .register(registry)); readTimer = MeterRegistryProvider.getInstance().map(registry -> Timer.builder("logunit.read.timer").register(registry)); }
Source:
public static Strand decode(final char ch) { switch (ch) { case '+': return POSITIVE; case '-': return NEGATIVE; case '!': return NONE; default: throw new IllegalArgumentException( "Unable to match encoding to Strand enum for encoding char: " + ch); } }

Target:
public static Strand decode(final char ch) { for(final Strand value : VALUES) { if (value.charEncoding == ch) { return value; } } return NONE; }
Source:
private void suspendPublisher(long timeout, TimeUnit timeUnit) throws InterruptedException { try { lock.lock(); if (!publisherEnabled) { throw new InterruptedException(); } if (!notifyPending) { if (timeout == -1) { logger.debug("Suspending publishing thread indefinitely"); lockCondition.await(); } else { logger.debug("Suspending publishing thread for milliseconds", timeout); lockCondition.await(timeout, timeUnit); } } notifyPending = false; } finally { lock.unlock(); } }

Target:
private void suspendPublisher(long timeout, TimeUnit timeUnit) { if (!publisherEnabled.get()) { return; } try { lock.lock(); if (!notifyPending) { if (timeout == -1) { logger.debug("Suspending publishing thread indefinitely"); lockCondition.await(); } else { logger.debug("Suspending publishing thread for milliseconds", timeout); lockCondition.await(timeout, timeUnit); } } notifyPending = false; } catch (InterruptedException e) { } finally { lock.unlock(); } }
Source:
private static void initializeRealm(Realm realm) { boolean commitChanges = false; try { realm.beginTransaction(); long currentVersion = realm.getVersion(); boolean unversioned = currentVersion == UNVERSIONED; commitChanges = unversioned; if (unversioned) { realm.setVersion(realm.configuration.getSchemaVersion()); } final RealmProxyMediator mediator = realm.configuration.getSchemaMediator(); final Set<Class<? extends RealmModel>> modelClasses = mediator.getModelClasses(); final Map<Class<? extends RealmModel>, ColumnInfo> columnInfoMap = new HashMap<>(modelClasses.size()); for (Class<? extends RealmModel> modelClass : modelClasses) { if (unversioned) { mediator.createTable(modelClass, realm.sharedRealm); } columnInfoMap.put(modelClass, mediator.validateTable(modelClass, realm.sharedRealm, false)); } realm.schema.columnIndices = new ColumnIndices( (unversioned) ? realm.configuration.getSchemaVersion() : currentVersion, columnInfoMap); if (unversioned) { final Transaction transaction = realm.configuration.getInitialDataTransaction(); if (transaction != null) { transaction.execute(realm); } } } finally { if (commitChanges) { realm.commitTransaction(false); } else { realm.cancelTransaction(); } } }

Target:
private static void initializeRealm(Realm realm) { boolean commitChanges = false; try { realm.beginTransaction(); long currentVersion = realm.getVersion(); boolean unversioned = currentVersion == UNVERSIONED; commitChanges = unversioned; if (unversioned) { realm.setVersion(realm.configuration.getSchemaVersion()); } final RealmProxyMediator mediator = realm.configuration.getSchemaMediator(); final Set<Class<? extends RealmModel>> modelClasses = mediator.getModelClasses(); final Map<Class<? extends RealmModel>, ColumnInfo> columnInfoMap = new HashMap<>(modelClasses.size()); for (Class<? extends RealmModel> modelClass : modelClasses) { if (unversioned) { mediator.createTable(modelClass, realm.sharedRealm); } columnInfoMap.put(modelClass, mediator.validateTable(modelClass, realm.sharedRealm, false)); } realm.schema.columnIndices = new ColumnIndices( (unversioned) ? realm.configuration.getSchemaVersion() : currentVersion, columnInfoMap); if (unversioned) { final Transaction transaction = realm.configuration.getInitialDataTransaction(); if (transaction != null) { transaction.execute(realm); } } } catch (Exception e) { commitChanges = false; throw e; } finally { if (commitChanges) { realm.commitTransaction(false); } else { realm.cancelTransaction(); } } }
Source:
private boolean exec(List<String> cmd) throws Exception { Reader reader = null; InputStream in = null; BufferedReader buf = null; StringBuffer log = null; Process proc = null; try { log = new StringBuffer(); ProcessBuilder pb = new ProcessBuilder(cmd); pb.redirectErrorStream(true); proc = pb.start(); in = proc.getInputStream(); reader = new InputStreamReader(in); buf = new BufferedReader(reader); for ( String line = null; (line=buf.readLine()) != null; ){ log.append( line + "\n" ); System.out.println(" Zoomify tiles creation: " + line + "\n"); } DAMSClient.close(in); DAMSClient.close(reader); DAMSClient.close(buf); int status = proc.waitFor(); if ( status == 0 ) return true; else { in = proc.getErrorStream(); reader = new InputStreamReader(in); buf = new BufferedReader(reader); for ( String line = null; (line=buf.readLine()) != null; ) log.append( line + "\n" ); throw new Exception( log.toString() ); } } catch ( Exception ex ) { throw new Exception( log.toString(), ex ); } finally { DAMSClient.close(in); DAMSClient.close(reader); DAMSClient.close(buf); if(proc != null){ proc.destroy(); proc = null; } } }

Target:
private boolean exec(List<String> cmd) throws Exception { Reader reader = null; InputStream in = null; BufferedReader buf = null; StringBuffer log = null; Process proc = null; try { log = new StringBuffer(); ProcessBuilder pb = new ProcessBuilder(cmd); pb.redirectErrorStream(true); proc = pb.start(); in = proc.getInputStream(); reader = new InputStreamReader(in); buf = new BufferedReader(reader); for ( String line = null; (line=buf.readLine()) != null; ){ log.append( line + "\n" ); } DAMSClient.close(in); DAMSClient.close(reader); DAMSClient.close(buf); int status = proc.waitFor(); if ( status == 0 ) return true; else { in = proc.getErrorStream(); reader = new InputStreamReader(in); buf = new BufferedReader(reader); for ( String line = null; (line=buf.readLine()) != null; ) log.append( line + "\n" ); throw new Exception( log.toString() ); } } catch ( Exception ex ) { throw new Exception( log.toString(), ex ); } finally { DAMSClient.close(in); DAMSClient.close(reader); DAMSClient.close(buf); if(proc != null){ proc.destroy(); proc = null; } } }
Source:
public void create_default_instance_according_to_place() { final int currentOffset = TimeZone.getDefault().getRawOffset()/1000; assertEquals(currentOffset, ZoneOffsets.getDefault().getAmountSeconds()); }

Target:
public void create_default_instance_according_to_place() { final int currentOffset = TimeZone.getDefault().getRawOffset()/(int)MILLIS_PER_SECOND; assertEquals(currentOffset, ZoneOffsets.getDefault().getAmountSeconds()); }
Source:
boolean isEqualMutation(Mutation expectedMutation, Mutation actualMutation){ List<Cell> expectedCells = new ArrayList<>(); for (List<Cell> cells : expectedMutation.getFamilyCellMap().values()) { expectedCells.addAll(cells); } List<Cell> actualCells = new ArrayList<>(); for (List<Cell> cells : actualMutation.getFamilyCellMap().values()) { actualCells.addAll(cells); } assertEquals(expectedCells.size(), actualCells.size()); for(Cell expected : expectedCells){ boolean found = false; for(Cell actual: actualCells){ if (isEqualCell(expected, actual)){ actualCells.remove(actual); found = true; break; } } if (!found) return false; } return true; }

Target:
boolean isEqualMutation(Mutation expectedMutation, Mutation actualMutation){ List<Cell> expectedCells = new ArrayList<>(); for (List<Cell> cells : expectedMutation.getFamilyCellMap().values()) { expectedCells.addAll(cells); } List<Cell> actualCells = new ArrayList<>(); for (List<Cell> cells : actualMutation.getFamilyCellMap().values()) { actualCells.addAll(cells); } if (expectedCells.size() != actualCells.size()) return false; for(Cell expected : expectedCells) { boolean found = false; for(Cell actual: actualCells){ if (isEqualCell(expected, actual)) { actualCells.remove(actual); found = true; break; } } if (!found) return false; } return true; }