auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testBeforeJobDocument() throws Exception { String csvFile = "data"+File.separator+"OrderLines.csv"; JobRunner jobRunner = new JobRunner(); String[] roles = { "admin" }; jobRunner.setRoles(roles); JSONDocumentManager jsonMgr = client.newJSONDocumentManager(); try (InputStream csvStream = openStream(csvFile); InputStream jobStream = openStream(JobRunner.jobFileFor(csvFile));) { jobRunner.run(client, csvStream, jobStream); ObjectMapper objectMapper = new ObjectMapper(); ObjectNode jobControlObj = (ObjectNode) objectMapper.readTree(jobStream); ObjectNode jobDef = (ObjectNode) jobControlObj.get("job"); String beforeDocId = JobRunner.getBeforeJobDocumentUri(jobDef.path("id").asText()); assertNotNull(jsonMgr.exists(beforeDocId)); DocumentMetadataHandle beforeDocumentMetadata = new DocumentMetadataHandle(); JacksonHandle readHandle = new JacksonHandle(); assertNotNull(jsonMgr.read(beforeDocId, beforeDocumentMetadata, readHandle)); assertTrue(beforeDocumentMetadata.getCollections().contains(JobRunner.getJobCollection(jobDef.path("id").asText()))); assertTrue(beforeDocumentMetadata.getCollections().contains("/beforeJob")); assertTrue(beforeDocumentMetadata.getPermissions().containsKey("admin")); assertTrue(beforeDocumentMetadata.getPermissions().get("admin").contains(Capability.READ)); assertTrue(beforeDocumentMetadata.getPermissions().get("admin").contains(Capability.UPDATE)); } catch(Exception ex) { ex.printStackTrace(); } }

Target:
public void testBeforeJobDocument() throws Exception { String csvFile = "data"+File.separator+"OrderLines.csv"; JobRunner jobRunner = new JobRunner(); String[] roles = { "admin" }; jobRunner.setRoles(roles); JSONDocumentManager jsonMgr = client.newJSONDocumentManager(); try (InputStream csvStream = openStream(csvFile); InputStream jobStream = openStream(JobRunner.jobFileFor(csvFile));) { jobRunner.run(client, csvStream, jobStream); ObjectMapper objectMapper = new ObjectMapper(); ObjectNode jobControlObj = (ObjectNode) objectMapper.readTree(jobStream); ObjectNode jobDef = (ObjectNode) jobControlObj.get("job"); String beforeDocId = JobRunner.getBeforeJobDocumentUri(jobDef.path("id").asText()); assertNotNull(jsonMgr.exists(beforeDocId)); DocumentMetadataHandle beforeDocumentMetadata = new DocumentMetadataHandle(); JacksonHandle readHandle = new JacksonHandle(); assertNotNull(jsonMgr.read(beforeDocId, beforeDocumentMetadata, readHandle)); assertTrue(beforeDocumentMetadata.getCollections().contains(JobRunner.getJobCollection(jobDef.path("id").asText()))); assertTrue(beforeDocumentMetadata.getCollections().contains("/beforeJob")); assertTrue(beforeDocumentMetadata.getPermissions().containsKey("admin")); assertTrue(beforeDocumentMetadata.getPermissions().get("admin").contains(Capability.READ)); assertTrue(beforeDocumentMetadata.getPermissions().get("admin").contains(Capability.UPDATE)); JsonNode readHandleNode = readHandle.get(); assertNotNull(readHandleNode); assertNotNull(readHandleNode.fields()); } catch(Exception ex) { ex.printStackTrace(); } }
Source:
private void addLayoutCombo(Composite parent) { Composite c2 = new Composite(parent, SWT.NONE); c2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout layout = new GridLayout(2, false); layout.marginWidth = 0; c2.setLayout(layout); ComboFieldEditor layoutEditor = new ComboFieldEditor(LAYOUT, Utilities.getString("ComparePreferencePage.layout.label"), new String[][]{getEntry(ICompareUIConstants.PREF_VALUE_RIGHT_TO_LEFT), getEntry(ICompareUIConstants.PREF_VALUE_LEFT_TO_RIGHT)}, c2); layoutEditor.fillIntoGrid(c2, 2); layoutEditor.setPreferenceStore(fOverlayStore); editors.add(layoutEditor); layoutEditor.setPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (fCompareConfiguration != null) { fCompareConfiguration.setProperty(LAYOUT, event.getNewValue()); } } }); }

Target:
private void addLayoutCombo(Composite parent) { Composite c2 = new Composite(parent, SWT.NONE); c2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); GridLayout layout = new GridLayout(2, false); layout.marginWidth = 0; c2.setLayout(layout); ComboFieldEditor layoutEditor = new ComboFieldEditor(LAYOUT, Utilities.getString("ComparePreferencePage.layout.label"), new String[][]{ getLayoutEntry( ICompareUIConstants.PREF_VALUE_RIGHT_TO_LEFT), getLayoutEntry( ICompareUIConstants.PREF_VALUE_LEFT_TO_RIGHT)}, c2); layoutEditor.fillIntoGrid(c2, 2); layoutEditor.setPreferenceStore(fOverlayStore); editors.add(layoutEditor); layoutEditor.setPropertyChangeListener(new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (fCompareConfiguration != null) { fCompareConfiguration.setProperty(LAYOUT, event.getNewValue()); } } }); }
Source:
public synchronized String registerProcessorAndGetId(final Object data) { if (ephemeralPath == null) { ephemeralPath = zkClient.createEphemeralSequential(keyBuilder.getProcessorsPath() + "/processor-", data); return ephemeralPath; } else { return ephemeralPath; } }

Target:
public synchronized String registerProcessorAndGetId(final Object data) { if (ephemeralPath == null) { ephemeralPath = zkClient.createEphemeralSequential( keyBuilder.getProcessorsPath() + "/", data); return ephemeralPath; } else { return ephemeralPath; } }
Source:
protected Supplier<?> putSupplier(Map<String,String> map, int key) { return (()-> { int bucket = key % stripedLock.size(); Lock lock = stripedLock.get(bucket); try { lock.tryLock(); map.put("key" + key, "value" + key); } catch (Exception e) { this.putSupplier(map, key); } finally { try { lock.unlock(); } catch (Exception e) } return null; }); }

Target:
protected Supplier<?> putSupplier(Map<String,String> map, int key) { return (()-> { int bucket = key % stripedLock.size(); Lock lock = stripedLock.get(bucket); lock.lock(); try { return map.put("key" + key, "value" + key); } finally { lock.unlock(); } }); }
Source:
default int getGroupedJobInitializerCacheSize() { return 10; }

Target:
default int getGroupedJobInitializerCacheSize() { return 100; }
Source:
void setBelongsToRecentIndexSegment(boolean belongsToRecentIndexSegment) { this.belongsToRecentIndexSegment.compareAndSet(false, belongsToRecentIndexSegment); }

Target:
void setBelongsToRecentIndexSegment(boolean belongsToRecentIndexSegment) { this.belongsToRecentIndexSegment = this.belongsToRecentIndexSegment || belongsToRecentIndexSegment; }
Source:
public void addNotificationEvent(NotificationEvent entry) throws MetaException { if (addNotificationEventModifier != null) { Boolean success = addNotificationEventModifier.apply(entry); if ((success != null) && !success) { throw new MetaException("InjectableBehaviourObjectStore: Invalid addNotificationEvent operation on DB: " + entry.getDbName() + " table: " + entry.getTableName() + " event : " + entry.getEventType()); } } else { super.addNotificationEvent(entry); } }

Target:
public void addNotificationEvent(NotificationEvent entry) throws MetaException { if (addNotificationEventModifier != null) { Boolean success = addNotificationEventModifier.apply(entry); if ((success != null) && !success) { throw new MetaException("InjectableBehaviourObjectStore: Invalid addNotificationEvent operation on DB: " + entry.getDbName() + " table: " + entry.getTableName() + " event : " + entry.getEventType()); } } super.addNotificationEvent(entry); }
Source:
private void addBarrierParticipantPath() { new ZKAsyncCreateHandler(m_barrierParticipantsPath, null, CreateMode.PERSISTENT) { @Override public void run() { if (checkForCommonKeeperExceptions(m_resultCode)) { try { initializeStateMachine(m_startingMemberSet); if (m_pendingStateMachineInits.decrementAndGet() == 0) { m_initComplete.set(true); } } catch (KeeperException.SessionExpiredException e) { m_done.set(true); m_initComplete.set(false); } catch (KeeperException.ConnectionLossException e) { m_done.set(true); m_initComplete.set(false); } catch (InterruptedException e) { m_done.set(true); } catch (Exception e) { org.voltdb.VoltDB.crashLocalVoltDB( "Unexpected failure in initializeInstances.", true, e); m_done.set(true); m_initComplete.set(false); } } } }; }

Target:
private void addBarrierParticipantPath() { new ZKAsyncCreateHandler(m_barrierParticipantsPath, null, CreateMode.PERSISTENT) { @Override public void run() { if (noCommonKeeperExceptions(m_resultCode)) { try { initializeStateMachine(m_startingMemberSet); if (m_pendingStateMachineInits.decrementAndGet() == 0) { m_initComplete.set(true); } } catch (KeeperException.SessionExpiredException | KeeperException.ConnectionLossException e) { initializationFailed(); } catch (InterruptedException e) { initializationFailed(); } catch (Exception e) { org.voltdb.VoltDB.crashLocalVoltDB( "Unexpected failure in initializeInstances.", true, e); initializationFailed(); } } } }; }
Source:
protected void populateResults(final LocalDate startDate, final LocalDate endDate, final Iterable<InvoiceItem> billedItems, final BigDecimal billedUsage, final BigDecimal toBeBilledUsage, final UsageInArrearDetail toBeBilledUsageDetails, final boolean areAllBilledItemsWithDetails, final List<InvoiceItem> result) { if (!billedItems.iterator().hasNext() || billedUsage.compareTo(toBeBilledUsage) < 0) { final BigDecimal amountToBill = areAllBilledItemsWithDetails ? toBeBilledUsage : toBeBilledUsage.subtract(billedUsage); if (amountToBill.compareTo(BigDecimal.ZERO) > 0) { if (UsageDetailMode.DETAIL == usageDetailMode) { for (UsageConsumableInArrearTierUnitDetail toBeBilledUsageDetail : ((UsageConsumableInArrearDetail) toBeBilledUsageDetails).getTierDetails()) { final InvoiceItem item = new UsageInvoiceItem(invoiceId, accountId, getBundleId(), getSubscriptionId(), getPlanName(), getPhaseName(), usage.getName(), startDate, endDate, toBeBilledUsageDetail.getAmount(), toBeBilledUsageDetail.getTierPrice(), getCurrency(), toBeBilledUsageDetail.getQuantity(), null); result.add(item); } } else { final String itemDetails = areAllBilledItemsWithDetails ? toBeBilledUsageDetails.toJson(objectMapper) : null; final InvoiceItem item = new UsageInvoiceItem(invoiceId, accountId, getBundleId(), getSubscriptionId(), getPlanName(), getPhaseName(), usage.getName(), startDate, endDate, amountToBill, null, getCurrency(), null, itemDetails); result.add(item); } } } }

Target:
protected void populateResults(final LocalDate startDate, final LocalDate endDate, final Iterable<InvoiceItem> billedItems, final BigDecimal billedUsage, final BigDecimal toBeBilledUsage, final UsageInArrearDetail toBeBilledUsageDetails, final boolean areAllBilledItemsWithDetails, final List<InvoiceItem> result) { if (!billedItems.iterator().hasNext() || billedUsage.compareTo(toBeBilledUsage) < 0) { final BigDecimal amountToBill = areAllBilledItemsWithDetails ? toBeBilledUsage : toBeBilledUsage.subtract(billedUsage); if (amountToBill.compareTo(BigDecimal.ZERO) > 0) { if (UsageDetailMode.DETAIL == usageDetailMode) { for (UsageConsumableInArrearTierUnitDetail toBeBilledUsageDetail : ((UsageConsumableInArrearDetail) toBeBilledUsageDetails).getTierDetails()) { final InvoiceItem item = new UsageInvoiceItem(invoiceId, accountId, getBundleId(), getSubscriptionId(), getPlanName(), getPhaseName(), usage.getName(), startDate, endDate, toBeBilledUsageDetail.getAmount(), toBeBilledUsageDetail.getTierPrice(), getCurrency(), toBeBilledUsageDetail.getQuantity(), null); result.add(item); } } else { final String itemDetails = toBeBilledUsageDetails.toJson(objectMapper); final InvoiceItem item = new UsageInvoiceItem(invoiceId, accountId, getBundleId(), getSubscriptionId(), getPlanName(), getPhaseName(), usage.getName(), startDate, endDate, amountToBill, null, getCurrency(), null, itemDetails); result.add(item); } } } }
Source:
public void execute(Tuple input, BasicOutputCollector collector) { try { Thread.sleep(1000); } catch (InterruptedException e) { Throwables.propagate(e); } }

Target:
public void execute(Tuple input, BasicOutputCollector collector) { try { Thread.sleep(1000); } catch (InterruptedException e) { throw Throwables.propagate(e); } }
Source:
public boolean canMoveToMaintenance(VDS vds) { boolean retVal = true; for ( MonitoringStrategy monitoringStrategy : strategies ) { retVal = retVal && monitoringStrategy.canMoveToMaintenance(vds); if (retVal) { break; } } return retVal; }

Target:
public boolean canMoveToMaintenance(VDS vds) { for ( MonitoringStrategy monitoringStrategy : strategies ) { if (!monitoringStrategy.canMoveToMaintenance(vds)) { return false; } } return true; }
Source:
public HashMap<String, ArrayList<Order>> getBuyOrders() { return buyOrders; }

Target:
private HashMap<String, ArrayList<Order>> getBuyOrders() { return buyOrders; }
Source:
public static void init() { System.setProperty("zookeeper.authProvider.1", "org.apache.zookeeper.server.auth.SASLAuthenticationProvider"); try { File tmpDir = createTmpDir(); File saslConfFile = new File(tmpDir, "jaas.conf"); FileWriter fwriter = new FileWriter(saslConfFile); fwriter.write("" + "Server {\n" + " org.apache.zookeeper.server.auth.DigestLoginModule required\n" + " user_super=\"test\";\n" + "};\n" + "Client {\n" + " org.apache.zookeeper.server.auth.DigestLoginModule required\n" + " username=\"super\"\n" + " password=\"test\";\n" + "};" + "\n"); fwriter.close(); System.setProperty("java.security.auth.login.config", saslConfFile.getAbsolutePath()); } catch (IOException e) { } }

Target:
public static void init() { System.setProperty("zookeeper.authProvider.1", "org.apache.zookeeper.server.auth.SASLAuthenticationProvider"); try { File tmpDir = createTmpDir(); File saslConfFile = new File(tmpDir, "jaas.conf"); String jaasContent = getJaasFileContent(); FileWriter fwriter = new FileWriter(saslConfFile); fwriter.write(jaasContent); fwriter.close(); System.setProperty("java.security.auth.login.config", saslConfFile.getAbsolutePath()); } catch (IOException e) { } }
Source:
public JasmineResult execute(URL runnerUrl, File junitXmlReport, WebDriver driver, int timeout, boolean debug, Log log, String format) { try { if (!(driver instanceof JavascriptExecutor)) { throw new RuntimeException("The provided web driver can't execute JavaScript: " + driver.getClass()); } JavascriptExecutor executor = (JavascriptExecutor) driver; driver.get(runnerUrl.toString()); this.waitForRunnerToFinish(driver, timeout, debug, log); this.checkForConsoleErrors(driver, log); JasmineResult jasmineResult = new JasmineResult(); jasmineResult.setDetails(this.buildReport(executor,format)); FileUtils.writeStringToFile(junitXmlReport, this.buildJunitXmlReport(executor,debug), "UTF-8"); return jasmineResult; } catch (Exception e) { throw new RuntimeException(e); } finally { try { driver.quit(); } catch (Exception e) { System.err.println("There was an exception quitting WebDriver - " + e.getMessage()); } } }

Target:
public JasmineResult execute(URL runnerUrl, File junitXmlReport, WebDriver driver, int timeout, boolean debug, Log log, String format) { try { if (!(driver instanceof JavascriptExecutor)) { throw new RuntimeException("The provided web driver can't execute JavaScript: " + driver.getClass()); } JavascriptExecutor executor = (JavascriptExecutor) driver; driver.get(runnerUrl.toString()); this.waitForRunnerToFinish(driver, timeout, debug, log); this.checkForConsoleErrors(driver, log); JasmineResult jasmineResult = new JasmineResult(); jasmineResult.setDetails(this.buildReport(executor,format)); FileUtils.writeStringToFile(junitXmlReport, this.buildJunitXmlReport(executor,debug), "UTF-8"); return jasmineResult; } catch (Exception e) { throw new RuntimeException(e); } finally { try { driver.quit(); } catch (Exception e) { log.error("There was an exception quitting WebDriver.", e); } } }
Source:
public PreSharedKeyIdentity(String virtualHost, String identity) { if (identity == null) { throw new NullPointerException("Identity must not be null"); } else { this.identity = identity; this.virtualHost = virtualHost; final int prime = 31; int result = 1; result = prime * result + ((identity == null) ? 0 : identity.hashCode()); result = prime * result + ((virtualHost == null) ? 0 : virtualHost.hashCode()); this.hash = result; StringBuilder b = new StringBuilder(); if (virtualHost != null) { b.append(virtualHost).append(":"); } b.append(identity); this.name = b.toString(); } }

Target:
public PreSharedKeyIdentity(String virtualHost, String identity) { if (identity == null) { throw new NullPointerException("Identity must not be null"); } else { StringBuilder b = new StringBuilder(); if (virtualHost == null) { this.virtualHost = null; } else if (StringUtil.isValidHostName(virtualHost)) { this.virtualHost = virtualHost.toLowerCase(); b.append(this.virtualHost); } else { throw new IllegalArgumentException("virtual host is not a valid hostname"); } this.identity = identity; b.append(":").append(identity); this.name = b.toString(); } }
Source:
public static boolean hasBlockWaterTicket(World world, BlockPos pos) { if (world.isRemote) { throw new IllegalArgumentException("Water region is only determined server-side"); } Set<SimpleTicket<AxisAlignedBB>> tickets = wateredAABBs.get(world.provider.getDimension()); if (tickets == null) { return false; } Vec3d posAsVec3d = new Vec3d(pos); return tickets.stream().anyMatch(ticket -> ticket.getTarget().contains(posAsVec3d)); }

Target:
public static boolean hasBlockWaterTicket(World world, BlockPos pos) { ChunkTicketManager<Vec3d> ticketManager = getTicketManager(new ChunkPos(pos.getX() >> 4, pos.getZ() >> 4), world); if (ticketManager != null) { Vec3d posAsVec3d = new Vec3d(pos); for (SimpleTicket<Vec3d> ticket : ticketManager.getTickets()) { if (ticket.matches(posAsVec3d)) return true; } } return false; }
Source:
public Iterator<ChangesQueryTestCase[]> getChangesQueryTestCases() { return Iterables.transform(Arrays.asList( queryParameter( new TestQueryRequest().withQuery("is:open") ).expectUrl("/changes/?q=is%3Aopen"), queryParameter( new TestQueryRequest().withQuery("is:open is:watched") ).expectUrl("/changes/?q=is%3Aopen+is%3Awatched"), queryParameter( new TestQueryRequest().withLimit(10) ).expectUrl("/changes/?n=10"), queryParameter( new TestQueryRequest().withQuery("is:open").withLimit(10) ).expectUrl("/changes/?q=is%3Aopen&n=10"), queryParameter( new TestQueryRequest().withOption(ListChangesOption.LABELS) ).expectUrl("/changes/?o=LABELS"), queryParameter( new TestQueryRequest().withStart(50) ).expectUrl("/changes/?S=50"), queryParameter( new TestQueryRequest().withSortkey("003460ab0001ae15") ).expectUrl("/changes/?N=003460ab0001ae15"), queryParameter( new TestQueryRequest().withQuery("is:open") .withLimit(10) .withOption(ListChangesOption.CURRENT_FILES) .withStart(30) ).expectUrl("/changes/?q=is%3Aopen&n=10&S=30&o=CURRENT_FILES") ), WRAP_IN_ARRAY_FUNCTION).iterator(); }

Target:
public Iterator<ChangesQueryTestCase[]> getChangesQueryTestCases() { return Iterables.transform(Arrays.asList( queryParameter( new TestQueryRequest().withQuery("is:open") ).expectUrl("/changes/?q=is:open"), queryParameter( new TestQueryRequest().withQuery("is:open+is:watched") ).expectUrl("/changes/?q=is:open+is:watched"), queryParameter( new TestQueryRequest().withLimit(10) ).expectUrl("/changes/?n=10"), queryParameter( new TestQueryRequest().withQuery("is:open").withLimit(10) ).expectUrl("/changes/?q=is:open&n=10"), queryParameter( new TestQueryRequest().withOption(ListChangesOption.LABELS) ).expectUrl("/changes/?o=LABELS"), queryParameter( new TestQueryRequest().withStart(50) ).expectUrl("/changes/?S=50"), queryParameter( new TestQueryRequest().withSortkey("003460ab0001ae15") ).expectUrl("/changes/?N=003460ab0001ae15"), queryParameter( new TestQueryRequest().withQuery("is:open") .withLimit(10) .withOption(ListChangesOption.CURRENT_FILES) .withStart(30) ).expectUrl("/changes/?q=is:open&n=10&S=30&o=CURRENT_FILES"), queryParameter( new TestQueryRequest().withQuery("is:merged is:watched").encode() ).expectUrl("/changes/?q=is%3Amerged+is%3Awatched") ), WRAP_IN_ARRAY_FUNCTION).iterator(); }
Source:
public static void clearUserData(@NonNull Context context) { ArrayList<String> exceptionsList = new ArrayList<>(); Collections.addAll(exceptionsList, PrefManager.Pref.getAllPreferenceFileNames()); exceptionsList.add(DbStructure.NAME); PackageManager packageManager = context.getPackageManager(); try { PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0); File dataDir = new File(packageInfo.applicationInfo.dataDir); File[] filesList = dataDir.listFiles(); if (filesList != null) { for (final File child : filesList) { FileUtil.deleteRecursive(child, exceptionsList); } } } catch (PackageManager.NameNotFoundException e) { logger.error(e); } File externalAppDir = FileUtil.getExternalAppDir(context); File[] filesList = externalAppDir.listFiles(); if (filesList != null) { for (final File child : filesList) { FileUtil.deleteRecursive(child, Collections.singletonList(AppConstants.Directories.VIDEOS)); } } PrefManager.nukeSharedPreferences(Collections.singletonList(PrefManager.Pref.APP_INFO)); }

Target:
public static void clearUserData(@NonNull Context context) { final ArrayList<String> exceptionsList = new ArrayList<>(); Collections.addAll(exceptionsList, PrefManager.Pref.getAllPreferenceFileNames()); exceptionsList.add(DbStructure.NAME); PackageManager packageManager = context.getPackageManager(); try { PackageInfo packageInfo = packageManager.getPackageInfo(context.getPackageName(), 0); File dataDir = new File(packageInfo.applicationInfo.dataDir); File[] filesList = dataDir.listFiles(); if (filesList != null) { for (final File child : filesList) { FileUtil.deleteRecursive(child, exceptionsList); } } } catch (PackageManager.NameNotFoundException e) { logger.error(e); } File externalAppDir = FileUtil.getExternalAppDir(context); File[] filesList = externalAppDir.listFiles(); if (filesList != null) { for (final File child : filesList) { FileUtil.deleteRecursive(child, Collections.singletonList(AppConstants.Directories.VIDEOS)); } } PrefManager.nukeSharedPreferences(Collections.singletonList(PrefManager.Pref.APP_INFO)); }
Source:
public void run(String[] args) throws IOException { CmdLineParser parser = new CmdLineParser(this); try { parser.parseArgument(args); } catch (CmdLineException e) { System.err.println(VERSION); System.err.println(e.getMessage()); System.err.println("java Fastq_liftOver [options...] arguments..."); parser.printUsage(System.err); System.err.println(); return; } if (printVersion) { System.out.println(VERSION); return; } long tStart = System.currentTimeMillis(); MapBlocks mapBlocks = new MapBlocks(mapFile); if (fastqType.equals("dwgsim")) { log.info("fastqFiles " + fastqFiles.get(0).getName() + " " + fastqFiles.get(1).getName()); doLiftOverDwgsimFastqMap(mapBlocks, getOutStream(outFiles.get(0), compress), getOutStream(outFiles.get(1), compress)); } if (fastqType.equals("art")) { log.info("fastqFiles " + fastqFiles.get(0).getName() + " " + fastqFiles.get(1).getName()); log.info("alnFiles " + alnFiles.get(0).getName() + " " + alnFiles.get(1).getName()); log.info("outFiles " + outFiles.get(0).getName() + " " + outFiles.get(1).getName()); doLiftOverArtFastqMap(mapBlocks, getOutStream(outFiles.get(0), compress), getOutStream(outFiles.get(1), compress)); } if (fastqType.equals("pbsim")) { log.info("fastqFiles " + fastqFiles.get(0).getName() + " "); log.info("mafFiles " + mafFiles.get(0).getName() + " "); log.info("refFiles " + refFiles.get(0).getName() + " "); log.info("outFiles " + outFiles.get(0).getName() + " "); doLiftOverPbsimFastqMap(mapBlocks, getOutStream(outFiles.get(0), compress)); } log.info("Conversion took " + (System.currentTimeMillis() - tStart) / 1e3 + " seconds."); }

Target:
public void run(String[] args) throws IOException { if (!parseArguments(args)) { return; } long tStart = System.currentTimeMillis(); MapBlocks mapBlocks = new MapBlocks(mapFile); if (fastqType.equals("dwgsim")) { log.info("fastqFiles " + fastqFiles.get(0).getName() + " " + fastqFiles.get(1).getName()); doLiftOverDwgsimFastqMap(mapBlocks, getOutStream(outFiles.get(0), compress), getOutStream(outFiles.get(1), compress)); } if (fastqType.equals("art")) { log.info("fastqFiles " + fastqFiles.get(0).getName() + " " + fastqFiles.get(1).getName()); log.info("alnFiles " + alnFiles.get(0).getName() + " " + alnFiles.get(1).getName()); log.info("outFiles " + outFiles.get(0).getName() + " " + outFiles.get(1).getName()); doLiftOverArtFastqMap(mapBlocks, getOutStream(outFiles.get(0), compress), getOutStream(outFiles.get(1), compress)); } if (fastqType.equals("pbsim")) { log.info("fastqFiles " + fastqFiles.get(0).getName() + " "); log.info("mafFiles " + mafFiles.get(0).getName() + " "); log.info("refFiles " + refFiles.get(0).getName() + " "); log.info("outFiles " + outFiles.get(0).getName() + " "); doLiftOverPbsimFastqMap(mapBlocks, getOutStream(outFiles.get(0), compress)); } log.info("Conversion took " + (System.currentTimeMillis() - tStart) / 1e3 + " seconds."); }
Source:
private void discoverHostName_SelectedItemChanged() { ExternalDiscoveredHost dhost = (ExternalDiscoveredHost) getExternalDiscoveredHosts().getSelectedItem(); ExternalHostGroup dhg = (ExternalHostGroup) getExternalHostGroups().getSelectedItem(); VDS vds = new VDS(); if (dhost != null && dhg != null) { vds.setVdsName(dhost.getName() + "." + dhg.getDomainName()); vds.setHostName(dhost.getIp()); } updateModelFromVds(vds, null, false, null); }

Target:
private void discoverHostName_SelectedItemChanged() { ExternalDiscoveredHost dhost = (ExternalDiscoveredHost) getExternalDiscoveredHosts().getSelectedItem(); ExternalHostGroup dhg = (ExternalHostGroup) getExternalHostGroups().getSelectedItem(); VDS vds = new VDS(); if (dhost != null && dhg != null) { vds.setVdsName(dhost.getName()); vds.setHostName(dhost.getName() + "." + dhg.getDomainName()); } updateModelFromVds(vds, null, false, null); }
Source:
public void variables() { setRootRule(PythonGrammar.ATOM); Name name = (Name) parse("foo", treeMaker::expression); assertThat(name.isVariable()).isTrue(); setRootRule(PythonGrammar.ATTRIBUTE_REF); QualifiedExpression qualifiedExpressionTree = (QualifiedExpression) parse("a.b", treeMaker::expression); assertThat(qualifiedExpressionTree.name().isVariable()).isFalse(); setRootRule(PythonGrammar.FUNCDEF); FunctionDef functionDefTree = parse("def func(x): pass", treeMaker::funcDefStatement); assertThat(functionDefTree.name().isVariable()).isFalse(); setRootRule(PythonGrammar.FILE_INPUT); FileInput fileInput = parse("func(x = 2)", treeMaker::fileInput); CallExpression callExpression = (CallExpression) ((ExpressionStatement) fileInput.statements().statements().get(0)).expressions().get(0); assertThat(((RegularArgument) callExpression.arguments().get(0)).keywordArgument().isVariable()).isFalse(); }

Target:
public void variables() { setRootRule(PythonGrammar.ATOM); Name name = (Name) parse("foo", treeMaker::expression); assertThat(name.isVariable()).isTrue(); setRootRule(PythonGrammar.ATTRIBUTE_REF); QualifiedExpression qualifiedExpressionTree = (QualifiedExpression) parse("a.b", treeMaker::expression); assertThat(qualifiedExpressionTree.name().isVariable()).isFalse(); setRootRule(PythonGrammar.FUNCDEF); FunctionDef functionDefTree = parse("def func(x): pass", treeMaker::funcDefStatement); assertThat(functionDefTree.name().isVariable()).isFalse(); }
Source:
public static CDIProvider getCDIProvider() { if (configuredProvider != null) { return configuredProvider; } else { if (discoveredProviders == null) { synchronized (lock) { if (discoveredProviders == null) { findAllProviders(); } } } configuredProvider = discoveredProviders.stream() .filter(c -> c.getCDI() != null) .findAny().orElseThrow(() -> new IllegalStateException("Unable to access CDI")); return configuredProvider; } }

Target:
private static CDIProvider getCDIProvider() { if (configuredProvider != null) { return configuredProvider; } else { if (discoveredProviders == null) { synchronized (lock) { if (discoveredProviders == null) { findAllProviders(); } } } configuredProvider = discoveredProviders.stream() .filter(c -> c.getCDI() != null) .findAny().orElseThrow(() -> new IllegalStateException("Unable to access CDI")); return configuredProvider; } }
Source:
public static void removeIncludedGroups(AccountGroup.UUID group, Set<AccountGroupIncludeByUuid.Key> ids, final AsyncCallback<VoidResult> cb) { if (ids.size() == 1) { AccountGroupIncludeByUuid.Key g = ids.iterator().next(); groups(group).id(g.getIncludeUUID().toString()).delete(cb); } else { IncludedGroupInput in = IncludedGroupInput.create(); for (AccountGroupIncludeByUuid.Key g : ids) { in.add_group(g.getIncludeUUID().toString()); } group(group).view("groups.delete").post(in, cb); } }

Target:
public static void removeIncludedGroups(AccountGroup.UUID group, Set<AccountGroupIncludeByUuid.Key> ids, final AsyncCallback<VoidResult> cb) { if (ids.size() == 1) { AccountGroupIncludeByUuid.Key g = ids.iterator().next(); groups(group).id(g.getIncludeUUID().get()).delete(cb); } else { IncludedGroupInput in = IncludedGroupInput.create(); for (AccountGroupIncludeByUuid.Key g : ids) { in.add_group(g.getIncludeUUID().get()); } group(group).view("groups.delete").post(in, cb); } }
Source:
protected void queueRequest(final ITmfDataRequest request) { if (fExecutor == null || fExecutor.isShutdown()) { request.cancel(); return; } TmfEventThread thread = new TmfEventThread(this, request); if (TmfCoreTracer.isRequestTraced()) { TmfCoreTracer.traceRequest(request, "QUEUED"); } fExecutor.execute(thread); }

Target:
protected void queueRequest(final ITmfDataRequest request) { if (fExecutor.isShutdown()) { request.cancel(); return; } TmfEventThread thread = new TmfEventThread(this, request); if (TmfCoreTracer.isRequestTraced()) { TmfCoreTracer.traceRequest(request, "QUEUED"); } fExecutor.execute(thread); }
Source:
public void canRemoveRelease() throws Exception { final Releases releases = RtReleasesITCase.releases(); final Release release = releases.create("v.011"); MatcherAssert.assertThat( releases.iterate(), Matchers.hasItem(release) ); releases.remove(release.number()); MatcherAssert.assertThat( releases.iterate(), Matchers.not(Matchers.hasItem(release)) ); }

Target:
public void canRemoveRelease() throws Exception { final Releases releases = RtReleasesITCase.releases(); final Release release = releases.create( RandomStringUtils.randomAlphabetic(Tv.TEN) ); MatcherAssert.assertThat( releases.iterate(), Matchers.hasItem(release) ); releases.remove(release.number()); MatcherAssert.assertThat( releases.iterate(), Matchers.not(Matchers.hasItem(release)) ); }
Source:
public double getDemandedEnergy() { if( this.isOutput() ) { return 0; } try { for( PartP2PIC2Power t : this.getOutputs() ) { if( t.OutputEnergyA <= 0.0001 || t.OutputEnergyB <= 0.0001 ) { return 2048; } } } catch( GridAccessException e ) { return 0; } return 0; }

Target:
public double getDemandedEnergy() { if( this.isOutput() ) { return 0; } try { for( PartP2PIC2Power t : this.getOutputs() ) { if( t.bufferedEnergy1 <= 0.0001 || t.bufferedEnergy2 <= 0.0001 ) { return 2048; } } } catch( GridAccessException e ) { return 0; } return 0; }
Source:
public ComponentBuilder append(String text, FormatRetention retention) { parts.add( current ); TextComponent component = new TextComponent( current ); component.setText( text ); current = component; retain( retention ); return this; }

Target:
public ComponentBuilder append(String text, FormatRetention retention) { parts.add( current ); current = new TextComponent( (TextComponent) current ); ((TextComponent) current).setText( text ); retain( retention ); return this; }
Source:
public boolean push(Collection<Event> events) { HttpPost post = new HttpPost(eventGateUri); try { post.setEntity(new StringEntity(objectMapper.writeValueAsString(events), ContentType.APPLICATION_JSON)); try (CloseableHttpResponse response = httpClient.execute(post)) { if (response.getStatusLine().getStatusCode() >= 400) { log.error("Cannot send events to eventgate endpoint: {}: {}", eventGateUri, response.getStatusLine()); return false; } } return true; } catch (IOException e) { log.error("Cannot send events to eventgate endpoint: {}", eventGateUri, e); return false; } }

Target:
public int push(Collection<Event> events) { HttpPost post = new HttpPost(eventGateUri); try { post.setEntity(httpEntity(events)); try (CloseableHttpResponse response = httpClient.execute(post)) { if (response.getStatusLine().getStatusCode() >= 400) { log.error("Cannot send events to eventgate endpoint: {}: {}", eventGateUri, response.getStatusLine()); return 0; } } return events.size(); } catch (IOException e) { log.error("Cannot send events to eventgate endpoint: {}", eventGateUri, e); return 0; } }
Source:
public void init() { switch (this.getAttackStrength()) { case LOW: maxRequestCount = 4; break; case MEDIUM: maxRequestCount = 8; break; case HIGH: maxRequestCount = 12; break; case INSANE: maxRequestCount = 28; break; default: break; } }

Target:
public void init() { switch (this.getAttackStrength()) { case LOW: maxRequestCount = 4; break; case MEDIUM: maxRequestCount = 8; break; case HIGH: maxRequestCount = 12; break; case INSANE: maxRequestCount = 28; break; default: maxRequestCount = 8; break; } }
Source:
protected void testAddStereotypedElementMergeLToR(Resource left, Resource right) throws IOException { final Comparison comparison = compare(left, right); final EList<Diff> differences = comparison.getDifferences(); final StereotypedElementChange stereotypedElementChange = getStereotypedElementChange(differences, DifferenceKind.ADD, 2); assertAddedBaseElementDiff(differences, "model.Class0", stereotypedElementChange); mergeLeftToRight(stereotypedElementChange); for (Diff diff : differences) { assertSame(DifferenceState.MERGED, diff.getState()); } assertEqualsB4Left(right); }

Target:
protected void testAddStereotypedElementMergeLToR(Resource left, Resource right) throws IOException { final Comparison comparison = compare(left, right); final EList<Diff> differences = comparison.getDifferences(); final StereotypedElementChange stereotypedElementChange = getStereotypedElementChange(differences, DifferenceKind.ADD, 2); assertAddedBaseElementDiff(differences, "model.Class0", stereotypedElementChange); mergeLeftToRight(stereotypedElementChange); for (Diff diff : differences) { assertSame(DifferenceState.MERGED, diff.getState()); } assertEqualsM1(right); assertEqualsM1(left); }
Source:
public boolean architectureMatches(String productArch) { if (productArch != null) { Set<String> supportedArches = org.candlepin.util.Util.asSet(productArch.toUpperCase().trim().split("\\s*,\\s*")); if (supportedArches.contains("X86")) { supportedArches.add("I386"); supportedArches.add("I586"); supportedArches.add("I686"); } if (!supportedArches.contains("ALL") && (!this.hasFact(Consumer.Facts.ARCH) || this.getFact(Consumer.Facts.ARCH).isEmpty() || !supportedArches.contains(this.getFact(Consumer.Facts.ARCH).toUpperCase()))) { return false; } } return true; }

Target:
public boolean architectureMatches(String productArch) { if (productArch != null) { Set<String> supportedArches = Util.asSet(productArch.toUpperCase().trim().split("\\s*,\\s*")); if (supportedArches.contains("X86")) { supportedArches.add("I386"); supportedArches.add("I586"); supportedArches.add("I686"); } if (!supportedArches.contains("ALL") && (!this.hasFact(Consumer.Facts.ARCH) || this.getFact(Consumer.Facts.ARCH).isEmpty() || !supportedArches.contains(this.getFact(Consumer.Facts.ARCH).toUpperCase()))) { return false; } } return true; }
Source:
private void maybeAddNewline(Node n) { Node previousNode = n.getPrevious(); boolean hasComment = nodeComments.hasComment(n) || nodeComments.hasComment(n.getParent()); if (isEmptyAndHasComment(previousNode) || (n.getParent() != null && isEmptyAndHasComment(n.getParent().getPrevious()))) { hasComment = true; } if (!hasComment && TOKENS_TO_ADD_NEWLINES_BEFORE.contains(n.getToken())) { add("\n"); } }

Target:
private void maybeAddNewline(Node n) { boolean hasComment = nodeComments.hasComment(n) || nodeComments.hasComment(n.getParent()) || isPreviousEmptyAndHasComment(n) || (n.getParent() != null && isPreviousEmptyAndHasComment(n.getParent())); if (!hasComment && TOKENS_TO_ADD_NEWLINES_BEFORE.contains(n.getToken())) { add("\n"); } }
Source:
public Receive createReceive() { return receiveBuilder() .match(Tick.class, message -> { _periodicMetrics.recordCounter("job-executor-actor-ticks", 1); if (!_cachedJob.isPresent()) { LOGGER.info() .setMessage("uninitialized JobExecutorActor is trying to tick") .log(); return; } final CachedJob<T> cachedJob = _cachedJob.get(); final Optional<Instant> nextRun = cachedJob.getSchedule().nextRun(cachedJob.getLastRun()); if (!nextRun.isPresent()) { LOGGER.info() .setMessage("job has no more scheduled runs") .addData("cachedJob", cachedJob) .log(); stopForever(); return; } if (_clock.instant().isBefore(nextRun.get())) { scheduleExtraTickIfNecessary(nextRun.get()); } else { if (_executionMutex.tryAcquire()) { cachedJob.execute(getSelf(), nextRun.get()) .whenComplete((result, error) -> _executionMutex.release()); } } }) .match(Reload.class, message -> { final String eTag = message.getETag(); final CachedJob<T> cachedJob; try { cachedJob = initializeOrEnsureRefMatch(unsafeJobRefCast(message.getJobRef())); if (eTag == null) { cachedJob.reload(); } else { cachedJob.reloadIfOutdated(eTag); } } catch (final NoSuchElementException error) { LOGGER.warn() .setMessage("job no longer exists in repository; stopping actor") .addData("jobRef", message.getJobRef()) .log(); stopForever(); } }) .build(); }

Target:
public Receive createReceive() { return receiveBuilder() .match(Tick.class, this::tick) .match(Reload.class, message -> { @SuppressWarnings("unchecked") final Reload<T> typedMessage = (Reload<T>) message; this.reload(typedMessage); }) .match(JobCompleted.class, message -> { @SuppressWarnings("unchecked") final JobCompleted<T> typedMessage = (JobCompleted<T>) message; this.jobCompleted(typedMessage); }) .build(); }
Source:
public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; TestClass other = (TestClass) obj; if (fClass == null) return other.fClass == null; else return fClass.equals(other.fClass); }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } TestClass other = (TestClass) obj; return fClass == other.fClass; }
Source:
public void beginSpan(SpanType type, Attributes attributes) { if (delegate.isXhtmlStrict()) { assertOpenImplicitBlock(); } SpanStrategy strategy = pushSpanStrategy(type, attributes); strategy.beginSpan(delegate, type, attributes); }

Target:
public void beginSpan(SpanType type, Attributes attributes) { assertOpenBlock(); SpanStrategy strategy = pushSpanStrategy(type, attributes); strategy.beginSpan(delegate, type, attributes); }
Source:
public Transceiver readCategories(final ArticleIdentity id) throws IOException { return new Transceiver() { @Override protected Calendar getLastModifiedDate() { return null; } @Override protected Object getData() throws IOException { Article article = findArticleById(id); return article.getCategories(); } }; }

Target:
public Transceiver readCategories(final ArticleIdentity id) throws IOException { return new EntityTransceiver<Article>() { @Override protected Article fetchEntity() { return findArticleById(id); } @Override protected Object getView(Article entity) { return entity.getCategories(); } }; }
Source:
static Stream<Arguments> getTestParameters() { List<Arguments> argumentsList = new ArrayList<>(); getHttpClients() .forEach(httpClient -> { Arrays.stream(CertificateServiceVersion.values()).filter( CertificateClientTestBase::shouldServiceVersionBeTested) .forEach(serviceVersion -> { argumentsList.add(Arguments.of(httpClient, serviceVersion)); System.out.println("-----------------------------------------------------------"); System.out.println(httpClient); System.out.println(serviceVersion); System.out.println("-----------------------------------------------------------"); }); }); return argumentsList.stream(); }

Target:
static Stream<Arguments> getTestParameters() { List<Arguments> argumentsList = new ArrayList<>(); getHttpClients() .forEach(httpClient -> { Arrays.stream(CertificateServiceVersion.values()).filter( CertificateClientTestBase::shouldServiceVersionBeTested) .forEach(serviceVersion -> { argumentsList.add(Arguments.of(httpClient, serviceVersion)); }); }); return argumentsList.stream(); }
Source:
protected void resetView(ITmfTrace viewTrace) { super.resetView(viewTrace); ITimeGraphDataProvider<@NonNull TimeGraphEntryModel> dataProvider = DataProviderManager .getInstance().getDataProvider(viewTrace, getProviderId(), ITimeGraphDataProvider.class); if (dataProvider != null) { fEntries.row(dataProvider).clear(); } }

Target:
protected void resetView(ITmfTrace viewTrace) { List<@NonNull TimeGraphEntry> entryList = getEntryList(viewTrace); super.resetView(viewTrace); if (entryList != null) { synchronized (fEntries) { for (TimeGraphEntry entry : entryList) { if (entry instanceof TraceEntry) { fEntries.row(((TraceEntry) entry).getProvider()).clear(); } } } } }
Source:
public void setClassId() { ClassIds.assignClassId(getElement(), ClassIds.LEFT_RIGHT_TOGGLE_BTN + " _ " + left_.getInnerText() + "_" + right_.getInnerText()); ClassIds.assignClassId(left_, ClassIds.LEFT_TOGGLE_BTN + "_" + left_.getInnerText()); ClassIds.assignClassId(right_, ClassIds.RIGHT_TOGGLE_BTN + "_" + right_.getInnerText()); }

Target:
public void setClassId() { String leftId = ClassIds.idSafeString(left_.getInnerText()); String rightId = ClassIds.idSafeString(right_.getInnerText()); ClassIds.assignClassId(getElement(), ClassIds.LEFT_RIGHT_TOGGLE_BTN + "_" + leftId + "_" + rightId); ClassIds.assignClassId(left_, ClassIds.LEFT_TOGGLE_BTN + "_" + leftId); ClassIds.assignClassId(right_, ClassIds.RIGHT_TOGGLE_BTN + "_" + rightId); }
Source:
public Boolean getUnconfirmedAllowed(String product) { ProductEntry entry = products.get(product); if (entry != null) { return entry.getUnconfirmedAllowed(); } else { return false; } }

Target:
public boolean getUnconfirmedAllowed(String product) { ProductEntry entry = products.get(product); if (entry != null && entry.getUnconfirmedAllowed() != null) { return entry.getUnconfirmedAllowed().booleanValue(); } else { return false; } }
Source:
public Window merge(Window that) { final List<Expression> partitionBy; if (that.getPartitions().isEmpty()) { partitionBy = this.getPartitions(); } else { if (!this.getPartitions().isEmpty()) { throw new IllegalArgumentException( "Cannot override PARTITION BY clause of window " + this.windowRef); } partitionBy = that.getPartitions(); } final List<SortItem> orderBy; if (that.getOrderBy().isEmpty()) { orderBy = this.getOrderBy(); } else { if (!this.getOrderBy().isEmpty()) { throw new IllegalArgumentException( "Cannot override ORDER BY clause of window " + this.windowRef); } orderBy = that.getOrderBy(); } if (that.getWindowFrame().isPresent()) { throw new IllegalArgumentException( "Cannot copy window " + this.windowRef() + " because it has a frame clause"); } return new Window(null, partitionBy, orderBy, this.getWindowFrame()); }

Target:
public Window merge(Window that) { if (this.empty()) { return that; } final List<Expression> partitionBy; if (!this.partitions.isEmpty()) { throw new IllegalArgumentException( "Cannot override PARTITION BY clause of window " + this.windowRef); } else { partitionBy = that.getPartitions(); } final List<SortItem> orderBy; if (that.getOrderBy().isEmpty()) { orderBy = this.getOrderBy(); } else { if (!this.getOrderBy().isEmpty()) { throw new IllegalArgumentException( "Cannot override ORDER BY clause of window " + this.windowRef); } orderBy = that.getOrderBy(); } if (that.getWindowFrame().isPresent()) { throw new IllegalArgumentException( "Cannot copy window " + this.windowRef() + " because it has a frame clause"); } return new Window(that.windowRef, partitionBy, orderBy, this.getWindowFrame()); }
Source:
public ResponseEntity<?> commitCursors(@PathVariable("subscriptionId") final String subscriptionId, @RequestBody final List<Cursor> cursors, final NativeWebRequest request) { if (!featureToggleService.isFeatureEnabled(FeatureToggleService.Feature.HIGH_LEVEL_API)) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } try { final boolean allCommitted = cursorsCommitService.commitCursors(subscriptionId, cursors); return allCommitted ? ResponseEntity.ok().build() : ResponseEntity.noContent().build(); } catch (final NakadiException e) { return Responses.create(e.asProblem(), request); } catch (InvalidCursorException e) { return Responses.create(Problem.valueOf(MoreStatus.UNPROCESSABLE_ENTITY, e.getMessage()), request); } }

Target:
public ResponseEntity<?> commitCursors(@PathVariable("subscriptionId") final String subscriptionId, @RequestBody final List<Cursor> cursors, final NativeWebRequest request) { if (!featureToggleService.isFeatureEnabled(HIGH_LEVEL_API)) { return new ResponseEntity<>(NOT_IMPLEMENTED); } try { final boolean allCommitted = cursorsService.commitCursors(subscriptionId, cursors); return allCommitted ? ok().build() : noContent().build(); } catch (final NakadiException e) { return create(e.asProblem(), request); } catch (InvalidCursorException e) { return create(Problem.valueOf(UNPROCESSABLE_ENTITY, e.getMessage()), request); } }
Source:
public static String humanReadable(long bytes) { if (bytes > GB) { return String.format("%.03f GB", ((float) bytes) / GB); } else if (bytes > MB) { return String.format("%.03f MB", ((float) bytes) / MB); } else if (bytes > KB) { return String.format("%.03f kB", ((float) bytes) / KB); } else { return String.format("%d B", bytes); } }

Target:
public static String humanReadable(long bytes) { if (bytes > TB) { return String.format("%.03f TB", ((float) bytes) / TB); } else if (bytes > GB) { return String.format("%.03f GB", ((float) bytes) / GB); } else if (bytes > MB) { return String.format("%.03f MB", ((float) bytes) / MB); } else if (bytes > KB) { return String.format("%.03f kB", ((float) bytes) / KB); } else { return String.format("%d B", bytes); } }
Source:
private void deleteRoutingDataPath() throws Exception { TestHelper.verify(() -> { ZK_SERVER_MAP.get(ZK_ADDR).getZkClient() .deleteRecursively(MetadataStoreRoutingConstants.ROUTING_DATA_PATH); if (ZK_SERVER_MAP.get(ZK_ADDR).getZkClient() .exists(MetadataStoreRoutingConstants.ROUTING_DATA_PATH)) { return false; } return true; }, TestHelper.WAIT_DURATION); }

Target:
private void deleteRoutingDataPath() throws Exception { Assert.assertTrue(TestHelper.verify(() -> { ZK_SERVER_MAP.get(ZK_ADDR).getZkClient() .deleteRecursively(MetadataStoreRoutingConstants.ROUTING_DATA_PATH); if (ZK_SERVER_MAP.get(ZK_ADDR).getZkClient() .exists(MetadataStoreRoutingConstants.ROUTING_DATA_PATH)) { return false; } return true; }, TestHelper.WAIT_DURATION), "Routing data path should be deleted after the tests."); }
Source:
public void testFilterPublic() { filter.inClazz = DummyPublicPOJO.class; filter.setCondition("({$}.val == 100)"); filter.activate(null); logger.debug("start round 0"); filter.beginWindow(0); pdata.val = 100; filter.input.process(pdata); Assert.assertEquals("true tuples", 1, filter.trueTuples); Assert.assertEquals("false tuples", 0, filter.falseTuples); filter.endWindow(); logger.debug("end round 0"); logger.debug("start round 1"); filter.beginWindow(1); pdata.val = 1000; filter.input.process(pdata); Assert.assertEquals("true tuples", 0, filter.trueTuples); Assert.assertEquals("false tuples", 1, filter.falseTuples); filter.endWindow(); logger.debug("end round 1"); filter.deactivate(); }

Target:
public void testFilterPublic() { prepareFilterOperator(DummyPublicPOJO.class, "({$}.val == 100)"); filter.beginWindow(0); pdata.val = 100; filter.input.put(pdata); Assert.assertEquals("true condition true tuples", 1, trueSink.getCount()); Assert.assertEquals("true condition false tuples", 0, falseSink.getCount()); Assert.assertEquals("true condition error tuples", 0, errorSink.getCount()); filter.endWindow(); clearSinks(); filter.beginWindow(1); pdata.val = 1000; filter.input.put(pdata); Assert.assertEquals("false condition true tuples", 0, trueSink.getCount()); Assert.assertEquals("false condition false tuples", 1, falseSink.getCount()); Assert.assertEquals("false condition error tuples", 0, errorSink.getCount()); filter.endWindow(); clearFilterOperator(); }