auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) { CommandResponse response = initializeResponse(); if (zkServer instanceof QuorumZooKeeperServer) { QuorumPeer peer = ((QuorumZooKeeperServer) zkServer).self; response.put("current_config", peer.getVotingView()); } else { response.put("current_config", ""); } return response; }

Target:
public CommandResponse run(ZooKeeperServer zkServer, Map<String, String> kwargs) { CommandResponse response = initializeResponse(); if (zkServer instanceof QuorumZooKeeperServer) { QuorumPeer peer = ((QuorumZooKeeperServer) zkServer).self; VotingView votingView = new VotingView(peer.getVotingView()); response.put("current_config", votingView); } else { response.put("current_config", Collections.emptyMap()); } return response; }
Source:
public void setAsText(String name) throws IllegalArgumentException { String text = name; if (performTrimming) { text = name.trim(); } if (text.contains(" ")) { text = text.replaceAll(REPEATING_SPACES_REGEXP, " "); } setValue(text); }

Target:
public void setAsText(String name) throws IllegalArgumentException { String text = name; if (performTrimming) { text = name.trim(); } if (text.contains(" ")) { text = REPEATING_SPACES.matcher(text).replaceAll(" "); } setValue(text); }
Source:
void bucketAccessed(long bucketId) { accessedBucketIds.add(bucketId); if (System.currentTimeMillis() - lastUpdateAccessTime > updateAccessTimeInterval) { synchronized (this) { Iterator<BucketIdTimeWrapper> bucketIter = bucketHeapForAccess.iterator(); while (bucketIter.hasNext()) { if (accessedBucketIds.contains(bucketIter.next().bucketId)) { bucketIter.remove(); } } for (long id : accessedBucketIds) { bucketHeapForAccess.add(new BucketIdTimeWrapper(id)); } } accessedBucketIds.clear(); lastUpdateAccessTime = System.currentTimeMillis(); } }

Target:
void bucketAccessed(long bucketId) { long now = System.currentTimeMillis(); if (accessedBucketIds.add(bucketId) || now - lastUpdateAccessTime > updateAccessTimeInterval) { synchronized (bucketLastAccess) { for (long id : accessedBucketIds) { MutableLong lastAccessTime = bucketLastAccess.get(id); if (lastAccessTime != null) { lastAccessTime.setValue(now); } else { bucketLastAccess.put(id, new MutableLong(now)); } } } accessedBucketIds.clear(); lastUpdateAccessTime = now; } }
Source:
private ItemStack getOveralls(Entity entity) { if (entity instanceof EntityPlayer) { EntityPlayer player = ((EntityPlayer) entity); ItemStack pants = player.getItemStackFromSlot(EntityEquipmentSlot.LEGS); if (pants != InvTools.emptyStack() && RailcraftItems.OVERALLS.isInstance(pants) && !((EntityPlayer) entity).capabilities.isCreativeMode) return pants; } return InvTools.emptyStack(); }

Target:
private ItemStack getOveralls(Entity entity) { if (entity instanceof EntityPlayer) { EntityPlayer player = ((EntityPlayer) entity); ItemStack pants = player.getItemStackFromSlot(EntityEquipmentSlot.LEGS); if (!InvTools.isEmpty(pants) && RailcraftItems.OVERALLS.isInstance(pants) && !((EntityPlayer) entity).capabilities.isCreativeMode) return pants; } return InvTools.emptyStack(); }
Source:
public void setConf(final Configuration conf) { super.setConf(conf); try { long cacheRefreshPeriod = conf.getLong(HFILE_CACHE_REFRESH_PERIOD_CONF_KEY, DEFAULT_HFILE_CACHE_REFRESH_PERIOD); final FileSystem fs = CommonFSUtils.getCurrentFileSystem(conf); Path rootDir = CommonFSUtils.getRootDir(conf); Path workingDir = SnapshotDescriptionUtils.getWorkingSnapshotDir(rootDir, conf); FileSystem workingFs = workingDir.getFileSystem(conf); cache = new SnapshotFileCache(fs, rootDir, workingFs, workingDir, cacheRefreshPeriod, cacheRefreshPeriod, "snapshot-hfile-cleaner-cache-refresher", new SnapshotFileCache.SnapshotFileInspector() { @Override public Collection<String> filesUnderSnapshot(final FileSystem workingFs, final Path snapshotDir) throws IOException { return SnapshotReferenceUtil.getHFileNames(conf, workingFs, snapshotDir); } }); } catch (IOException e) { LOG.error("Failed to create cleaner util", e); } }

Target:
public void setConf(final Configuration conf) { super.setConf(conf); try { long cacheRefreshPeriod = conf.getLong(HFILE_CACHE_REFRESH_PERIOD_CONF_KEY, DEFAULT_HFILE_CACHE_REFRESH_PERIOD); final FileSystem fs = CommonFSUtils.getCurrentFileSystem(conf); Path rootDir = CommonFSUtils.getRootDir(conf); Path workingDir = SnapshotDescriptionUtils.getWorkingSnapshotDir(rootDir, conf); FileSystem workingFs = workingDir.getFileSystem(conf); cache = new SnapshotFileCache(fs, rootDir, workingFs, workingDir, cacheRefreshPeriod, cacheRefreshPeriod, "snapshot-hfile-cleaner-cache-refresher", new SnapshotFileCache.SnapshotFileInspector() { @Override public Collection<String> filesUnderSnapshot(final FileSystem fs, final Path snapshotDir) throws IOException { return SnapshotReferenceUtil.getHFileNames(conf, fs, snapshotDir); } }); } catch (IOException e) { LOG.error("Failed to create cleaner util", e); } }
Source:
protected void inflateBaseMenu(Context context, PopupMenu menu) { if (PreferenceManager.getDefaultSharedPreferences(context).getBoolean("replace-app-history-with-favs", false)) { if (context instanceof MainActivity) { menu.getMenuInflater().inflate(R.menu.menu_item_favorite_add, menu.getMenu()); } } }

Target:
protected void inflateBaseMenu(Context context, PopupMenu menu) { String favApps = PreferenceManager.getDefaultSharedPreferences(context). getString("favorite-apps-list", ""); if (!favApps.contains(this.pojo.id + ";")) { menu.getMenuInflater().inflate(R.menu.menu_item_favorite_add, menu.getMenu()); } }
Source:
private void initialize() { try { AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() { @Override public synchronized Void run() { if (threadPool == null) { threadPool = createThreadPool("common", minThreadsShared, maxThreadsShared, keepAliveTimeoutShared); } if (sharedHttpClient == null) { sharedHttpClient = createHttpClientInternal("common", null); sharedHttpClientFacade = new HttpClientDelegate(sharedHttpClient); logger.info("jetty shared http client created"); } return null; } }); } catch (PrivilegedActionException e) { Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } else { throw new RuntimeException(cause); } } }

Target:
private synchronized void initialize() { if (threadPool == null || commonHttpClient == null) { try { AccessController.doPrivileged(new PrivilegedExceptionAction<Void>() { @Override public Void run() { if (threadPool == null) { threadPool = createThreadPool("common", minThreadsShared, maxThreadsShared, keepAliveTimeoutShared); } if (commonHttpClient == null) { commonHttpClient = createHttpClientInternal("common", null); commonHttpClientFacade = new HttpClientDelegate(commonHttpClient); logger.info("jetty shared http client created"); } return null; } }); } catch (PrivilegedActionException e) { Throwable cause = e.getCause(); if (cause instanceof RuntimeException) { throw (RuntimeException) cause; } else { throw new RuntimeException(cause); } } } }
Source:
protected void enqueue(Collection<?> col) { assert Thread.holdsLock(this); if(limit <= 0 || total.addAndGet(col.size()) <= limit) { queue.add((Collection<R>)col); cnt.addAndGet(col.size()); } else { int toAdd = col.size() - total.get() + limit; queue.add(new ArrayList(col).subList(0, toAdd)); cnt.addAndGet(toAdd); } }

Target:
protected void enqueue(Collection<?> col) { assert Thread.holdsLock(this); if (limitDisabled) { queue.add((Collection<R>)col); cnt.addAndGet(col.size()); } else { if (capacity >= col.size()) { queue.add((Collection<R>)col); capacity -= col.size(); cnt.addAndGet(col.size()); } else if (capacity > 0) { queue.add(new ArrayList<>((Collection<R>)col).subList(0, capacity)); capacity = 0; cnt.addAndGet(capacity); } } }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((key == null) ? 0 : key.hashCode()); result = prime * result + ((value == null) ? 0 : value.hashCode()); return result; }

Target:
public int hashCode() { return Objects.hashCode(key, value); }
Source:
private boolean showDeletionNotification(Context context, Media media, boolean result) { String message; String title = context.getString(R.string.delete_helper_show_deletion_notification_title); if (result) { title += context.getString(R.string.delete_helper_show_deletion_notification_title_if); message = context.getString(R.string.delete_helper_show_deletion_notification_message_if_1)+ " " + media.getDisplayTitle() + context.getString(R.string.delete_helper_show_deletion_notification_message_if_2); } else { title += context.getString(R.string.delete_helper_show_deletion_notification_title_else); message = context.getString(R.string.delete_helper_show_deletion_notification_message_else); } String urlForDelete = BuildConfig.COMMONS_URL + "/wiki/Commons:Deletion_requests/" + media.getFilename(); Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(urlForDelete)); notificationHelper.showNotification(context, title, message, NOTIFICATION_DELETE, browserIntent); return result; }

Target:
private boolean showDeletionNotification(Context context, Media media, boolean result) { String message; String title = context.getString(R.string.delete_helper_show_deletion_title); if (result) { title += ": " + context.getString(R.string.delete_helper_show_deletion_title_success); message = context.getString((R.string.delete_helper_show_deletion_message_if),media.getDisplayTitle()); } else { title += ": " + context.getString(R.string.delete_helper_show_deletion_title_failed); message = context.getString(R.string.delete_helper_show_deletion_message_else) ; } String urlForDelete = BuildConfig.COMMONS_URL + "/wiki/Commons:Deletion_requests/" + media.getFilename(); Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(urlForDelete)); notificationHelper.showNotification(context, title, message, NOTIFICATION_DELETE, browserIntent); return result; }
Source:
public void callPrivateMethodWithBigIntegerParam() { Assert.assertNull(controller.getModel().getBigIntegerValue()); BigInteger value = BigInteger.TEN; controller.invoke(PUBLIC_WITH_BIGINTEGER_PARAM_ACTION, new Param(PARAM_NAME, value)); Assert.assertEquals(controller.getModel().getBigIntegerValue(), value); }

Target:
public void callPrivateMethodWithBigIntegerParam() { Assert.assertNull(controller.getModel().getBigIntegerValue()); final BigInteger value = BigInteger.TEN; controller.invoke(PUBLIC_WITH_BIGINTEGER_PARAM_ACTION, new Param(PARAM_NAME, value)); Assert.assertEquals(controller.getModel().getBigIntegerValue(), value); }
Source:
public IMemorySpaceAwareMemoryBlock getMemoryBlock(String expression, Object context, String memorySpaceID) throws DebugException { IMemoryDMContext memoryDmc = null; IDMContext dmc = null; if (context instanceof IAdaptable) { dmc = (IDMContext)((IAdaptable)context).getAdapter(IDMContext.class); if (dmc != null) { memoryDmc = DMContexts.getAncestorOfType(dmc, IMemoryDMContext.class); } } if (memoryDmc == null) { return null; } BigInteger blockAddress; try { int base = 10; int offset = 0; if (expression.startsWith("0x") || expression.startsWith("0X")) { base = 16; offset = 2; } else if (expression.startsWith("0b")) { base = 2; offset = 2; } else if (expression.startsWith("0")) { base = 8; offset = 1; } blockAddress = new BigInteger(expression.substring(offset), base); } catch (NumberFormatException nfexc) { blockAddress = resolveMemoryAddress(dmc, expression); if (blockAddress == null) { return null; } } int addressSize = getAddressSize(memoryDmc, memorySpaceID); int addressableSize = getAddressableSize(memoryDmc, memorySpaceID); BigInteger endAddress = BigInteger.ONE.shiftLeft(addressSize*8).divide(BigInteger.valueOf(addressableSize)).subtract(BigInteger.ONE); if (endAddress.compareTo(blockAddress) < 0) { throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, MessageFormat.format(Messages.Err_ExceedsMaxAddress, expression, endAddress.toString(16)), null)); } return new GdbMemoryBlock(this, memoryDmc, getModelId(), expression, blockAddress, addressableSize, 0, memorySpaceID); }

Target:
public IMemorySpaceAwareMemoryBlock getMemoryBlock(String expression, Object context, String memorySpaceID) throws DebugException { IMemoryDMContext memoryDmc = null; IDMContext dmc = null; if (context instanceof IAdaptable) { dmc = (IDMContext)((IAdaptable)context).getAdapter(IDMContext.class); if (dmc != null) { memoryDmc = DMContexts.getAncestorOfType(dmc, IMemoryDMContext.class); } } if (memoryDmc == null) { return null; } BigInteger blockAddress; try { int base = 10; int offset = 0; if (expression.startsWith("0x") || expression.startsWith("0X")) { base = 16; offset = 2; } else if (expression.startsWith("0b")) { base = 2; offset = 2; } else if (expression.startsWith("0")) { base = 8; offset = 1; } blockAddress = new BigInteger(expression.substring(offset), base); } catch (NumberFormatException nfexc) { blockAddress = resolveMemoryAddress(dmc, expression); if (blockAddress == null) { return null; } } int addressSize = getAddressSize(memoryDmc, memorySpaceID); BigInteger endAddress = BigInteger.ONE.shiftLeft(addressSize*8).subtract(BigInteger.ONE); if (endAddress.compareTo(blockAddress) < 0) { throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, MessageFormat.format(Messages.Err_ExceedsMaxAddress, expression, endAddress.toString(16)), null)); } return new GdbMemoryBlock(this, memoryDmc, getModelId(), expression, blockAddress, getAddressableSize(memoryDmc, memorySpaceID), 0, memorySpaceID); }
Source:
private void testTrackerAtKey(CloudBigtableIO.Reader<Result> underTest, ByteKeyRangeTracker tracker, final String key, final int count) throws IOException { setRowKey(key); tracker.tryReturnRecordAt(false, ByteKey.copyFrom(key.getBytes())); Assert.assertTrue(underTest.start()); Assert.assertEquals(count, underTest.getRowsReadCount()); Assert.assertEquals(tracker.getFractionConsumed(), underTest.getFractionConsumed().doubleValue(), .001d); }

Target:
private void testTrackerAtKey(CloudBigtableIO.Reader<Result> underTest, ByteKeyRangeTracker tracker, final String key, final int count) throws IOException { setRowKey(key); tracker.tryReturnRecordAt(true, ByteKey.copyFrom(key.getBytes())); Assert.assertTrue(underTest.start()); Assert.assertEquals(count, underTest.getRowsReadCount()); Assert.assertEquals(tracker.getFractionConsumed(), underTest.getFractionConsumed().doubleValue(), .001d); }
Source:
public boolean canInsert( final ItemStack stack ) { if( stack.isEmpty() || stack.getItem() == Items.AIR ) { return false; } try { final IMEMonitor<IAEItemStack> inv = this.getProxy().getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ); final IAEItemStack out = inv.injectItems( this.lastItemChecked = AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( stack ), Actionable.SIMULATE, this.source ); if( out == null ) { return true; } return out.getStackSize() != stack.getCount(); } catch( GridAccessException ex ) { return false; } }

Target:
public boolean canInsert( final ItemStack stack ) { if( stack.isEmpty() || stack.getItem() == Items.AIR ) { return false; } try { final IMEMonitor<IAEItemStack> inv = this.getProxy().getStorage().getInventory( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ) ); final IAEItemStack out = inv.injectItems( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( stack ), Actionable.SIMULATE, this.source ); if( out == null ) { return true; } return out.getStackSize() != stack.getCount(); } catch( GridAccessException ex ) { return false; } }
Source:
public void addRuleConfig (String key, String defaultValue, String value) { this.ruleConfigs.put(key, new RuleConfig(key, defaultValue, value)); }

Target:
public void addRuleConfig (String key, String defaultValue, String value) { this.ruleConfigs.put(key, new RuleConfig(key, defaultValue, value)); if (! this.getConfig().containsKey(key)) { this.getConfig().setProperty(key, value); } }
Source:
public void testGetColumnsFromJSONElement() { String json = "{" + "\"value\": " + "\"test-value\"" + "}"; YailList expecetdColumn = YailList.makeList(Arrays.asList("value", "test-value")); YailList expected = YailList.makeList(Collections.singletonList(expecetdColumn)); YailList result = JsonUtil.getColumnsFromJSON(json); assertEquals(expected, result); }

Target:
public void testGetColumnsFromJSONElement() { String json = "{" + "\"value\": " + "\"test-value\"" + "}"; YailList expectedColumn = YailList.makeList(Arrays.asList("value", "test-value")); YailList expected = YailList.makeList(Collections.singletonList(expectedColumn)); YailList result = JsonUtil.getColumnsFromJSON(json); assertEquals(expected, result); }
Source:
protected void doStore() { IJavaDebugTarget target; IJavaThread thread; for (IDebugTarget target2 : getDebugTargets()) { target = target2.getAdapter(IJavaDebugTarget.class); if (target != null) { try { if (fThreadViewer.getChecked(target)) { for (IThread thread2 : target.getThreads()) { thread= (IJavaThread)thread2; if (fThreadViewer.getChecked(thread)) { fPage.getBreakpoint().setThreadFilter(thread); break; } } } else { fPage.getBreakpoint().removeThreadFilter(target); } } catch (CoreException e) { JDIDebugUIPlugin.log(e); } } } }

Target:
protected void doStore() { IJavaDebugTarget target; IJavaThread thread; for (IDebugTarget debugTarget : getDebugTargets()) { target = debugTarget.getAdapter(IJavaDebugTarget.class); if (target != null) { try { if (fThreadViewer.getChecked(target)) { for (IThread targetThread : target.getThreads()) { thread= (IJavaThread)targetThread; if (fThreadViewer.getChecked(thread)) { fPage.getBreakpoint().setThreadFilter(thread); break; } } } else { fPage.getBreakpoint().removeThreadFilter(target); } } catch (CoreException e) { JDIDebugUIPlugin.log(e); } } } }
Source:
public void setRangeNotifier( RangeNotifier notifier ) { addRangeNotifier( notifier ); }

Target:
public void setRangeNotifier ( RangeNotifier notifier ) { synchronized ( rangeNotifiers ) { rangeNotifiers.clear(); rangeNotifiers.add( notifier ); } }
Source:
public void testIndexCreationAndQueryDeterministicConcurrency() { Config config = getConfig(); HazelcastInstance node = createHazelcastInstance(config); IMap<Integer, Person> map = node.getMap(randomMapName()); for (int i = 0; i < 10000; ++i) { map.put(i, new Person(i)); } Person.accessCountDown = new AtomicLong(5000); AtomicReference<Throwable> exception = new AtomicReference<Throwable>(); Thread indexer = new Thread(new Runnable() { @Override public void run() { try { map.addIndex("age", true); } catch (Throwable t) { exception.compareAndSet(null, t); } } }); indexer.start(); assertOpenEventually(Person.queryLatch); Person.accessCountDown = null; Collection<Person> persons = map.values(new SqlPredicate("age >= 5000")); assertEquals(5000, persons.size()); persons = map.values(Predicates.equal("age", "20")); assertEquals(1, persons.size()); persons = map.values(Predicates.greaterThan("age", "5000")); assertEquals(4999, persons.size()); Person.indexerLatch.countDown(); assertJoinable(indexer); assertNull(exception.get()); }

Target:
public void testIndexCreationAndQueryDeterministicConcurrency() { Config config = getConfig(); HazelcastInstance node = createHazelcastInstance(config); final IMap<Integer, Person> map = node.getMap(randomMapName()); for (int i = 0; i < 10000; ++i) { map.put(i, new Person(i)); } Person.accessCountDown = new AtomicLong(5000); final AtomicReference<Throwable> exception = new AtomicReference<Throwable>(); Thread indexer = new Thread(new Runnable() { @Override public void run() { try { boolean ordered = indexDefinition.contains("BITMAP") ? false : true; map.addIndex(indexDefinition, ordered); } catch (Throwable t) { exception.compareAndSet(null, t); } } }); indexer.start(); assertOpenEventually(Person.queryLatch); Person.accessCountDown = null; assertQuery(map, new SqlPredicate("age >= 5000"), 5000); assertQuery(map, equal("age", "6000"), 1); assertQuery(map, greaterThan("age", "6000"), 3999); assertQuery(map, and(greaterThan("age", 6000), lessThan("age", 7000)), 999); assertQuery(map, or(equal("age", 6000), equal("age", 7000)), 2); assertQuery(map, greaterEqual("age", 5000), 5000); assertQuery(map, lessThan("age", 9000), 9000); assertQuery(map, lessEqual("age", 9000), 9001); assertQuery(map, between("age", 9000, 10000), 1000); assertQuery(map, in("age", 5000, 6000, 7000, 11111), 3); assertQuery(map, equal("age", "6000"), 1); assertQuery(map, like("name", "9999"), 1); Person.indexerLatch.countDown(); assertJoinable(indexer); assertNull(exception.get()); }
Source:
private void updateProgress() throws IOException, KeeperException, InterruptedException { Table snapshotTable = connection.getTable(masterSnapshotTable); Scan scan = new Scan(); try (ResultScanner scanner = snapshotTable.getScanner(scan)) { for (Result r : scanner) { byte[] rowKey = r.getRow(); long timestamp = new Long(new String(rowKey)); SpliceLogUtils.info(LOG, "Checking snapshot taken at %d", timestamp); CellScanner s = r.cellScanner(); long ts = -1; while (s.advance()) { Cell cell = s.current(); byte[] colName = CellUtil.cloneQualifier(cell); if(Arrays.equals(colName, HBaseConfiguration.REPLICATION_SNAPSHOT_TSCOL_BYTES)){ ts = Bytes.toLong(CellUtil.cloneValue(cell)); SpliceLogUtils.info(LOG, "Process snapshot take at %s", new DateTime(ts).toString()); } else { String walName = Bytes.toString(CellUtil.cloneQualifier(cell)); Long position = Bytes.toLong(CellUtil.cloneValue(cell)); if (replicationProgress.containsKey(walName)) { long appliedPosition = replicationProgress.get(walName); SpliceLogUtils.info(LOG, "WAL=%s, snapshot=%d, progress=%d", walName, position, appliedPosition); if (appliedPosition < position) { return; } } } } Delete d = new Delete(rowKey); snapshotTable.delete(d); SpliceLogUtils.info(LOG, "Deleted snapshot %d.", timestamp); ReplicationUtils.setTimestamp(timestamp); updateZkProgress(ts); } }finally { replicationProgress.clear(); } }

Target:
private void updateProgress() throws IOException, KeeperException, InterruptedException { Table snapshotTable = connection.getTable(masterSnapshotTable); Scan scan = new Scan(); try (ResultScanner scanner = snapshotTable.getScanner(scan)) { for (Result r : scanner) { byte[] rowKey = r.getRow(); long timestamp = new Long(new String(rowKey)); SpliceLogUtils.info(LOG, "Checking snapshot taken at %d", timestamp); CellScanner s = r.cellScanner(); long ts = -1; while (s.advance()) { Cell cell = s.current(); byte[] colName = CellUtil.cloneQualifier(cell); if(Arrays.equals(colName, HBaseConfiguration.REPLICATION_SNAPSHOT_TSCOL_BYTES)){ ts = Bytes.toLong(CellUtil.cloneValue(cell)); SpliceLogUtils.info(LOG, "Process snapshot take at %s", new DateTime(ts).toString()); } else { String walName = Bytes.toString(colName); Long position = Bytes.toLong(CellUtil.cloneValue(cell)); if (replicationProgress.containsKey(walName)) { long appliedPosition = replicationProgress.get(walName); SpliceLogUtils.info(LOG, "WAL=%s, snapshot=%d, progress=%d", walName, position, appliedPosition); if (appliedPosition < position) { return; } } } } Delete d = new Delete(rowKey); snapshotTable.delete(d); SpliceLogUtils.info(LOG, "Deleted snapshot %d.", timestamp); ReplicationUtils.setTimestamp(timestamp); updateZkProgress(ts); } }finally { replicationProgress.clear(); } }
Source:
private String getCamelEndpointId(WorkItem workItem) { String workItemCamelEndpointId = (String) workItem.getParameter(CAMEL_ENDPOINT_ID_PARAM); if (camelEndpointId != null && !camelEndpointId.isEmpty()) { if (workItemCamelEndpointId != null && !workItemCamelEndpointId.isEmpty()) { logger.debug( "The Camel Endpoint ID has been set on both the WorkItemHanlder and WorkItem. The camel-endpoint-id configured on the WorkItem overrides the global configuation."); } else { workItemCamelEndpointId = camelEndpointId; } } if (workItemCamelEndpointId == null || workItemCamelEndpointId.isEmpty()) { throw new IllegalArgumentException( "No Camel Endpoint ID specified. Please configure the 'camel-endpoint-id' in either the constructor of this WorkItemHandler, or pass it via the " + CAMEL_ENDPOINT_ID_PARAM + "' WorkItem parameter."); } return workItemCamelEndpointId; }

Target:
protected String getCamelEndpointId(WorkItem workItem) { String workItemCamelEndpointId = (String) workItem.getParameter(JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM); if (camelEndpointId != null && !camelEndpointId.isEmpty()) { if (workItemCamelEndpointId != null && !workItemCamelEndpointId.isEmpty()) { logger.debug( "The Camel Endpoint ID has been set on both the WorkItemHanlder and WorkItem. The '" + JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM + "' configured on the WorkItem overrides the global configuation."); } else { workItemCamelEndpointId = camelEndpointId; } } if (workItemCamelEndpointId == null || workItemCamelEndpointId.isEmpty()) { throw new IllegalArgumentException( "No Camel Endpoint ID specified. Please configure the '" + JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM + "' in either the constructor of this WorkItemHandler, or pass it via the " + JBPMConstants.CAMEL_ENDPOINT_ID_WI_PARAM + "' WorkItem parameter."); } return workItemCamelEndpointId; }
Source:
protected ReftableBatchRefUpdate(DfsReftableDatabase refdb, DfsObjDatabase odb) { super(refdb); this.refdb = refdb; this.odb = odb; lock = refdb.getLock(); Config cfg = refdb.getRepository().getConfig(); reftableConfig = new ReftableConfig(); if (refdb instanceof InMemoryRepository.MemRefDatabase) { reftableConfig.setAlignBlocks(false); reftableConfig.setIndexObjects(false); } reftableConfig.fromConfig(cfg); }

Target:
protected ReftableBatchRefUpdate(DfsReftableDatabase refdb, DfsObjDatabase odb) { super(refdb); this.refdb = refdb; this.odb = odb; lock = refdb.getLock(); reftableConfig = refdb.getReftableConfig(); }
Source:
public void run() { try { ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) .childHandler(channelInitializer); Channel ch = b.bind(port).sync().channel(); logger.info("netty httpserver start"); ch.closeFuture().sync(); } catch (InterruptedException e) { logger.info("netty httpserver interrupted"); logger.error(e.getMessage(), e); } finally { shutdown(); } }

Target:
public void run() { try { ServerBootstrap b = new ServerBootstrap(); b.group(bossGroup, workerGroup) .channel(NioServerSocketChannel.class) .childHandler(channelInitializer); Channel ch = b.bind(port).sync().channel(); logger.info("netty httpserver start"); ch.closeFuture().sync(); } catch (InterruptedException e) { logger.info("netty httpserver interrupted"); logger.error(e.getMessage(), e); Thread.currentThread().interrupt(); } finally { shutdown(); } }
Source:
protected boolean shouldDoFakeParticles() { if(ConfigHandler.staticWandBeam) return true; ChunkCoordinates coords = getBurstSourceChunkCoordinates(); TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ); if(tile != null && tile instanceof IManaSpreader) return getMana() != getStartingMana() && fullManaLastTick || Math.abs(((IManaSpreader) tile).getBurstParticleTick() - getTicksExisted()) < 4; return false; }

Target:
public boolean shouldDoFakeParticles() { if(ConfigHandler.staticWandBeam) return true; ChunkCoordinates coords = getBurstSourceChunkCoordinates(); TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ); if(tile != null && tile instanceof IManaSpreader) return getMana() != getStartingMana() && fullManaLastTick || Math.abs(((IManaSpreader) tile).getBurstParticleTick() - getTicksExisted()) < 4; return false; }
Source:
private PrintRequest createPrintRequest(ActionParameters params) throws ActionException { PrintRequest request = new PrintRequest(); request.setSrsName(params.getRequiredParam(PARM_SRSNAME)); request.setResolution(params.getRequiredParamDouble(PARM_RESOLUTION)); request.setTitle(params.getHttpParam(PARM_TITLE)); request.setShowLogo(params.getHttpParam(PARM_LOGO, false)); request.setShowScale(params.getHttpParam(PARM_SCALE, false)); request.setShowDate(params.getHttpParam(PARM_DATE, false)); request.setScaleText(params.getHttpParam(PARM_SCALE_TEXT, "")); setPagesize(params, request); setCoordinates(params.getRequiredParam(PARM_COORD), request); setFormat(params.getRequiredParam(PARM_FORMAT), request); request.setUseConfiguredScale(params.getHttpParam(PARM_USE_CONFIGURED_SCALE, false)); List<PrintLayer> layers = getLayers(params.getRequiredParam(PARM_MAPLAYERS), params.getUser()); layers = filterLayersWithZeroOpacity(layers); if(request.isUseConfiguredScale()) { layers = filterLayersWithSupportOwnScale(layers); } request.setLayers(layers); setTiles(layers, params.getHttpParam(PARM_TILES)); return request; }

Target:
private PrintRequest createPrintRequest(ActionParameters params) throws ActionException { PrintRequest request = new PrintRequest(); request.setSrsName(params.getRequiredParam(PARM_SRSNAME)); request.setResolution(params.getRequiredParamDouble(PARM_RESOLUTION)); request.setTitle(params.getHttpParam(PARM_TITLE)); request.setShowLogo(params.getHttpParam(PARM_LOGO, false)); request.setShowScale(params.getHttpParam(PARM_SCALE, false)); request.setShowDate(params.getHttpParam(PARM_DATE, false)); request.setScaleText(params.getHttpParam(PARM_SCALE_TEXT, "")); setPagesize(params, request); setCoordinates(params.getRequiredParam(PARM_COORD), request); setFormat(params.getRequiredParam(PARM_FORMAT), request); List<PrintLayer> layers = getLayers(params.getRequiredParam(PARM_MAPLAYERS), params.getUser()); if(request.isScaleText()) { layers = filterLayersWithSupportOwnScale(layers); } request.setLayers(layers); setTiles(layers, params.getHttpParam(PARM_TILES)); return request; }
Source:
protected void onMethodInvocationFound(MethodInvocationTree mit) { ExpressionTree arg = mit.arguments().get(0); String domain = ConstantUtils.resolveAsStringConstant(arg); if (domain != null && !domain.substring(1).contains(".")) { reportIssue(arg, "Specify at least a second-level cookie domain."); } }

Target:
protected void onMethodInvocationFound(MethodInvocationTree mit) { ExpressionTree arg = mit.arguments().get(0); String domain = ConstantUtils.resolveAsStringConstant(arg); if (domain != null && !domain.isEmpty() && !domain.substring(1).contains(".")) { reportIssue(arg, "Specify at least a second-level cookie domain."); } }
Source:
private void handleEvent(LogEvent event) throws InterruptedException { if (usingAsyncLogger) { sendEventToSystemProducer(encodeLogEventToBytes(event)); return; } if (!logQueue.offer(encodeLogEventToBytes(event), queueTimeoutS, TimeUnit.SECONDS)) { int messagesDropped = logQueue.drainTo(new ArrayList<>()) + 1; log.warn(String.format("Exceeded timeout %ss while trying to log to %s. Dropping %d log messages.", queueTimeoutS, systemStream.toString(), messagesDropped)); metrics.logMessagesDropped.inc(messagesDropped); } metrics.bufferFillPct.set(Math.round(100f * logQueue.size() / DEFAULT_QUEUE_SIZE)); }

Target:
private void handleEvent(LogEvent event) throws InterruptedException { if (usingAsyncLogger) { sendEventToSystemProducer(encodeLogEventToBytes(event)); return; } if (!logQueue.offer(encodeLogEventToBytes(event), queueTimeoutS, TimeUnit.SECONDS)) { int messagesDropped = logQueue.drainTo(new ArrayList<>()) + 1; System.err.println(String.format("Exceeded timeout %ss while trying to log to %s. Dropping %d log messages.", queueTimeoutS, systemStream.toString(), messagesDropped)); metrics.logMessagesDropped.inc(messagesDropped); } metrics.bufferFillPct.set(Math.round(100f * logQueue.size() / DEFAULT_QUEUE_SIZE)); }
Source:
void setSelectedGame(Game game) { gameDetailController.setGame(game); if (game == null) { gameDetailPane.setVisible(false); return; } if (preferencesService.getPreferences().isShowGameDetailsSidePane()) { gameDetailPane.setVisible(true); } }

Target:
void setSelectedGame(Game game) { gameDetailController.setGame(game); }
Source:
private synchronized void loadSettings() { try (InputStream is = settingsFacade.getRawConfig(SETTINGS_FILE_NAME)) { String jsonText = IOUtils.toString(is); LOGGER.debug("Loading DHIS2 settings..."); Gson gson = new Gson(); settings = gson.fromJson(jsonText, Settings.class); String URI = settings.getServerURI(); if(settings.getServerURI().endsWith("/")) { settings.setServerURI(URI.substring(0,URI.length()-1)); } } catch (Exception e) { String message = "There was an error loading json from the DHIS2 settings."; LOGGER.debug(message); throw new JsonIOException(message, e); } }

Target:
private synchronized void loadSettings() { try (InputStream is = settingsFacade.getRawConfig(SETTINGS_FILE_NAME)) { String jsonText = IOUtils.toString(is); LOGGER.debug("Loading DHIS2 settings..."); Gson gson = new Gson(); settings = gson.fromJson(jsonText, Settings.class); if (settings.getServerURI() != null) { settings.setServerURI(removeTrailingSlash()); } } catch (Exception e) { String message = "There was an error loading json from the DHIS2 settings."; LOGGER.debug(message); throw new JsonIOException(message, e); } }
Source:
public LinkedHashMap<String, String> getLanguageList() { LinkedHashMap<String, String> languageArray = new LinkedHashMap<>(); for (Map.Entry<String, String> entry : this.entrySet()) { if (entry.getValue() != null) { final Locale locale = new Locale(entry.getKey()); languageArray.put(entry.getKey(), locale.getDisplayLanguage()); } } return this.size() == 0 ? null : languageArray; }

Target:
public LinkedHashMap<String, String> getLanguageList() { LinkedHashMap<String, String> languageArray = new LinkedHashMap<>(); for (Map.Entry<String, String> entry : this.entrySet()) { if (entry.getValue() != null) { try { languageArray.put(entry.getKey(), LocaleUtils.getLanguageNameFromCode(entry.getKey())); } catch (InvalidLocaleException e) { logger.error(e, true); } } } return this.size() == 0 ? null : languageArray; }
Source:
public AddApiVersionToRequest(@ApiVersion String apiVersion) { this.apiVersion = checkNotNull(apiVersion, "apiVersion"); }

Target:
AddApiVersionToRequest(@ApiVersion String apiVersion) { this.apiVersion = apiVersion; }
Source:
protected void unbindEventService(EventService eventService) { eventService.unregisterListener(EventConfigUpdate.class, this); }

Target:
protected void unbindEventService(EventService eventService) { eventService.unregisterListener(EventConfigUpdate.class, this); this.eventService = null; }
Source:
private StartIdentifiedAtlasDbTransactionResponse startTransactionResponseWith(LockToken lockToken) { return StartIdentifiedAtlasDbTransactionResponse.of( LockImmutableTimestampResponse.of(1L, lockToken), mock(TimestampAndPartition.class) ); }

Target:
private StartIdentifiedAtlasDbTransactionResponse startTransactionResponseWith(LockToken lockToken) { return StartIdentifiedAtlasDbTransactionResponse.of( LockImmutableTimestampResponse.of(1L, lockToken), timestampAndPartition); }
Source:
private static String fullyQualifiedModuleName(String fileName, String packageName) { int extensionIndex = fileName.lastIndexOf('.'); String moduleName = fileName.substring(0, extensionIndex); return packageName.isEmpty() ? moduleName : (packageName + "." + moduleName); }

Target:
private static String fullyQualifiedModuleName(String fileName, String packageName) { int extensionIndex = fileName.lastIndexOf('.'); String moduleName = extensionIndex > 0 ? fileName.substring(0, extensionIndex) : fileName; return packageName.isEmpty() ? moduleName : (packageName + "." + moduleName); }
Source:
public void shouldWaitForFunctionsWorkerStarted() { try (PulsarContainer pulsar = new PulsarContainer().withFunctionsWorker()) { pulsar.start(); } }

Target:
public void shouldWaitForFunctionsWorkerStarted() throws Exception { try (PulsarContainer pulsar = new PulsarContainer("2.5.1").withFunctionsWorker()) { pulsar.start(); PulsarAdmin pulsarAdmin = PulsarAdmin.builder() .serviceHttpUrl(pulsar.getHttpServiceUrl()) .build(); assertThat(pulsarAdmin.functions().getFunctions("public", "default")).hasSize(0); } }
Source:
public Object evaluate(Object feature) { Map map = getExpression(0).evaluate(feature, Map.class); String key = getExpression(1).evaluate(feature, String.class); if (map.containsKey(key)) { return map.get(key); } return null; }

Target:
public Object evaluate(Object feature) { Map map = getExpression(0).evaluate(feature, Map.class); String key = getExpression(1).evaluate(feature, String.class); if (map != null) { return map.get(key); } return null; }
Source:
public void hook(ExtensionHook extensionHook) { super.hook(extensionHook); extensionHook.addSessionListener(this); if (getView() != null) { extensionHook.getHookMenu().addToolsMenuItem(getMenuReload()); hookView = extensionHook.getHookView(); hookView.addStatusPanel(getStatusPanel()); } }

Target:
public void hook(ExtensionHook extensionHook) { super.hook(extensionHook); if (getView() != null) { extensionHook.addSessionListener(this); hookView = extensionHook.getHookView(); eventConsumerImpl = new EventConsumerImpl(getNotesTableModel()); hookView.addStatusPanel(getStatusPanel()); ZAP.getEventBus() .registerConsumer( eventConsumerImpl, HistoryReferenceEventPublisher.getPublisher().getPublisherName()); } }
Source:
private Object next() { if (this.iterator == null || !this.iterator.hasNext()) { this.iterator = this.listeners.iterator(); } return this.iterator.next(); }

Target:
private synchronized Object next() { if (this.iterator == null || !this.iterator.hasNext()) { this.iterator = this.listeners.iterator(); } return this.iterator.next(); }
Source:
public InstructorCourseEnrollPageData(AccountAttributes account, String courseId, String enrollStudents) { super(account); this.courseId = Sanitizer.sanitizeForHtml(courseId); this.enrollStudents = Sanitizer.sanitizeForHtml(enrollStudents); }

Target:
public InstructorCourseEnrollPageData(AccountAttributes account, String courseId, String enrollStudents) { super(account); this.courseId = sanitizeForHtml(courseId); this.enrollStudents = sanitizeForHtml(enrollStudents); }
Source:
public static String getPermissionStringValue(LabelledPermission labelledPermission) { PermissionSet permissionSet = labelledPermission.getPermission(); if (permissionSet != null) { int mask = permissionSet.getMask(); switch (mask) { case READ_META_MASK: return READMETA; case COUNT_MASK: return COUNT; case READ_MASK: return READ; case WRITE_MASK: return WRITE; case WRITEMETA_MASK: return WRITEMETA; default: throw new IllegalArgumentException(format("Unexpected mask '%d'", mask)); } } return null; }

Target:
public static Optional<String> getPermissionStringValue(LabelledPermission labelledPermission) { PermissionSet permissionSet = labelledPermission.getPermission(); if (permissionSet != null) { int mask = permissionSet.getMask(); switch (mask) { case READ_META_MASK: return Optional.of(READMETA); case COUNT_MASK: return Optional.of(COUNT); case READ_MASK: return Optional.of(READ); case WRITE_MASK: return Optional.of(WRITE); case WRITEMETA_MASK: return Optional.of(WRITEMETA); default: throw new IllegalArgumentException(format(UNEXPECTED_MASK_MESSAGE, mask)); } } return Optional.empty(); }
Source:
public Boolean call() throws Exception { RequestContext context = new RequestContext() { @Override public CurrentUser getCurrentUser() { return identifiedUserFactory.create(change.getOwner()); } @Override public Provider<ReviewDb> getReviewDbProvider() { return new Provider<ReviewDb>() { @Override public ReviewDb get() { if (reviewDb == null) { try { reviewDb = schemaFactory.open(); } catch (OrmException e) { throw new ProvisionException("Cannot open ReviewDb", e); } } return reviewDb; } }; } }; RequestContext old = tl.setContext(context); ReviewDb db = context.getReviewDbProvider().get(); try { PatchSet ps = db.patchSets().get(change.currentPatchSetId()); MergeableInfo info = mergeable.get().apply(new RevisionResource(new ChangeResource( changeControlFactory.controlFor(change, context.getCurrentUser())), ps)); return change.isMergeable() != info.mergeable; } finally { tl.setContext(old); if (reviewDb != null) { reviewDb.close(); reviewDb = null; } } }

Target:
public Boolean call() throws Exception { RequestContext context = new RequestContext() { @Override public CurrentUser getCurrentUser() { return identifiedUserFactory.create(change.getOwner()); } @Override public Provider<ReviewDb> getReviewDbProvider() { return new Provider<ReviewDb>() { @Override public ReviewDb get() { if (reviewDb == null) { try { reviewDb = schemaFactory.open(); } catch (OrmException e) { throw new ProvisionException("Cannot open ReviewDb", e); } } return reviewDb; } }; } }; RequestContext old = tl.setContext(context); ReviewDb db = context.getReviewDbProvider().get(); try { PatchSet ps = db.patchSets().get(change.currentPatchSetId()); MergeableInfo info = mergeable.get().apply(new RevisionResource(new ChangeResource( changeControlFactory.controlFor(change, context.getCurrentUser())), ps)); return change.isMergeable() != info.mergeable; } catch (ResourceConflictException e) { return false; } finally { tl.setContext(old); if (reviewDb != null) { reviewDb.close(); reviewDb = null; } } }
Source:
public CompletableFuture<Void> createJobManagerComponent(KubernetesJobManagerSpecification kubernetesJMSpec) { final Deployment deployment = kubernetesJMSpec.getDeployment(); final List<HasMetadata> accompanyingResources = kubernetesJMSpec.getAccompanyingResources(); LOG.debug("Start to create deployment with spec {}", deployment.getSpec().toString()); return CompletableFuture.runAsync(() -> { final Deployment createdDeployment = this.internalClient .apps() .deployments() .inNamespace(this.nameSpace) .create(deployment); setOwnerReference(createdDeployment, accompanyingResources); this.internalClient .resourceList(accompanyingResources) .inNamespace(this.nameSpace) .createOrReplace(); }, executorWrapper.getExecutor()); }

Target:
public void createJobManagerComponent(KubernetesJobManagerSpecification kubernetesJMSpec) { final Deployment deployment = kubernetesJMSpec.getDeployment(); final List<HasMetadata> accompanyingResources = kubernetesJMSpec.getAccompanyingResources(); LOG.debug("Start to create deployment with spec {}", deployment.getSpec().toString()); final Deployment createdDeployment = this.internalClient .apps() .deployments() .inNamespace(this.nameSpace) .create(deployment); setOwnerReference(createdDeployment, accompanyingResources); this.internalClient .resourceList(accompanyingResources) .inNamespace(this.nameSpace) .createOrReplace(); }
Source:
public boolean has_finished( int sample_idx ) { if( loop_length <= 1 && sample_idx > loop_start ) { return true; } else { return false; } }

Target:
public boolean has_finished( int sample_idx ) { return loop_length <= 1 && sample_idx > loop_start; }
Source:
protected void onResume() { super.onResume(); EventBus.getDefault().register(this); mDispatcher.register(this); if (mPost == null) { finish(); return; } mPost = mPostStore.getPostByLocalPostId(mPost.getId()); if (hasPreviewFragment()) { refreshPreview(); } else { showPreviewFragment(); } showMessageViewIfNecessary(); }

Target:
protected void onResume() { super.onResume(); EventBus.getDefault().register(this); mDispatcher.register(this); if (mPost == null || (mPost = mPostStore.getPostByLocalPostId(mPost.getId())) == null) { finish(); return; } if (hasPreviewFragment()) { refreshPreview(); } else { showPreviewFragment(); } showMessageViewIfNecessary(); }
Source:
public InputStream openClasspathResource(Class<?> baseClass, String path) { Preconditions.notBlank(path, "Classpath resource [" + path + "] must not be null or blank"); InputStream inputStream = baseClass.getResourceAsStream(path); return Preconditions.notNull(inputStream, () -> "Classpath resource [" + path + "] does not exist"); }

Target:
public InputStream openClasspathResource(Class<?> baseClass, String path) { Preconditions.notBlank(path, () -> "Classpath resource [" + path + "] must not be null or blank"); InputStream inputStream = baseClass.getResourceAsStream(path); return Preconditions.notNull(inputStream, () -> "Classpath resource [" + path + "] does not exist"); }
Source:
public void testValidHostedFileNames() throws IOException { HostedApi api = new HostedApi(getWebClient(ADMIN_USERNAME, testingPostgres)); Workflow hostedWorkflow = api .createHostedWorkflow("awesomeTool", null, DescriptorLanguage.WDL.toString().toLowerCase(), null, null); SourceFile file = new SourceFile(); file.setContent(FileUtils.readFileToString(new File(ResourceHelpers.resourceFilePath("metadata_example2.wdl")), StandardCharsets.UTF_8)); file.setType(SourceFile.TypeEnum.DOCKSTORE_WDL); file.setPath("/Dockstore.wdl"); SourceFile file2 = new SourceFile(); file2.setContent(FileUtils.readFileToString(new File(ResourceHelpers.resourceFilePath("metadata_example2.wdl")), StandardCharsets.UTF_8)); file2.setPath("/"); List sourceFiles = new ArrayList(); sourceFiles.add(file); sourceFiles.add(file2); thrown.expectMessage("Files must have a name"); Workflow workflow = api.editHostedWorkflow(hostedWorkflow.getId(), sourceFiles); sourceFiles.remove(file2); file2.setPath("folder/"); sourceFiles.add(file2); thrown.expectMessage("Files must have a name"); workflow = api.editHostedWorkflow(hostedWorkflow.getId(), sourceFiles); sourceFiles.remove(file2); file2.setPath("/name.wdl"); workflow = api.editHostedWorkflow(hostedWorkflow.getId(), sourceFiles); }

Target:
public void testValidHostedFileNames() throws IOException { HostedApi api = new HostedApi(getWebClient(ADMIN_USERNAME, testingPostgres)); Workflow hostedWorkflow = api .createHostedWorkflow("awesomeTool", null, DescriptorLanguage.WDL.toString(), null, null); SourceFile file = new SourceFile(); file.setContent(FileUtils.readFileToString(new File(ResourceHelpers.resourceFilePath("metadata_example2.wdl")), StandardCharsets.UTF_8)); file.setType(SourceFile.TypeEnum.DOCKSTORE_WDL); file.setPath("/Dockstore.wdl"); SourceFile file2 = new SourceFile(); file2.setContent(FileUtils.readFileToString(new File(ResourceHelpers.resourceFilePath("metadata_example2.wdl")), StandardCharsets.UTF_8)); file2.setPath("/"); List sourceFiles = new ArrayList(); sourceFiles.add(file); sourceFiles.add(file2); String msg = "Files must have a name"; thrown.expectMessage(msg); Workflow workflow = api.editHostedWorkflow(hostedWorkflow.getId(), sourceFiles); sourceFiles.remove(file2); file2.setPath("folder/"); sourceFiles.add(file2); thrown.expectMessage(msg); workflow = api.editHostedWorkflow(hostedWorkflow.getId(), sourceFiles); sourceFiles.remove(file2); file2.setPath("/name.wdl"); workflow = api.editHostedWorkflow(hostedWorkflow.getId(), sourceFiles); }
Source:
public void close() { if (isConsumed) return; isConsumed = true; responseQueueReader.close(); }

Target:
public void close() { if (isConsumed) { return; } isConsumed = true; responseQueueReader.close(); }
Source:
public void testCamelLastExchangFailureTimestamp() throws Exception{ String rulePattern = "\n---\nrules:\n- pattern: 'org.apache.camel<context=([^,]+), type=routes, name=\"([^\"]+)\"><>LastExchangeFailureTimestamp'\n" + " name: org.apache.camel.LastExchangeFailureTimestamp\n" + " help: Exchanges Last Failure Timestamps\n" + " type: UNTYPED\n" + " labels:\n" + " context: \"$1\"\n" + " route: \"$2\"\n" + " type: routes"; JmxCollector jc = new JmxCollector(rulePattern).register(registry); assertEquals(Double.valueOf((double)Camel.EXPECTED_DATE_IN_MILLISECONDS / 1000), registry.getSampleValue("org_apache_camel_LastExchangeFailureTimestamp", new String[]{"context", "route", "type"}, new String[]{"my-camel-context", "my-route-name", "routes"})); }

Target:
public void testCamelLastExchangFailureTimestamp() throws Exception{ String rulePattern = "\n---\nrules:\n- pattern: 'org.apache.camel<context=([^,]+), type=routes, name=\"([^\"]+)\"><>LastExchangeFailureTimestamp'\n" + " name: org.apache.camel.LastExchangeFailureTimestamp\n" + " help: Exchanges Last Failure Timestamps\n" + " type: UNTYPED\n" + " labels:\n" + " context: \"$1\"\n" + " route: \"$2\"\n" + " type: routes"; JmxCollector jc = new JmxCollector(rulePattern).register(registry); Double actual = registry.getSampleValue("org_apache_camel_LastExchangeFailureTimestamp", new String[]{"context", "route", "type"}, new String[]{"my-camel-context", "my-route-name", "routes"}); assertEquals(Camel.EXPECTED_SECONDS, actual, 0); }