auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected static Optional<RingTime> getProgressiveRingTime(final long accountId, final DateTime nowAlignedToStartOfMinute, final RingTime nextRingTimeFromWorker, final TrackerMotionDAO trackerMotionDAO){ final DateTime dataCollectionBeginTime = nowAlignedToStartOfMinute.minusMinutes(PROGRESSIVE_MOTION_WINDOW_MIN); final List<TrackerMotion> motionWithinProgressiveWindow = trackerMotionDAO.getBetween(accountId, dataCollectionBeginTime, nowAlignedToStartOfMinute.plusMinutes(1)); if(motionWithinProgressiveWindow.size() == 0){ LOGGER.info("No motion data in last minutes for Account ID: {}. Not computing progressive alarm.", PROGRESSIVE_MOTION_WINDOW_MIN, accountId); return Optional.absent(); } final List<AmplitudeData> amplitudeData = TrackerMotionUtils.trackerMotionToAmplitudeData(motionWithinProgressiveWindow); final List<AmplitudeData> kickOffCounts = TrackerMotionUtils.trackerMotionToKickOffCounts(motionWithinProgressiveWindow); if(SleepCycleAlgorithm.isUserAwakeInGivenDataSpan(amplitudeData, kickOffCounts)){ final RingTime progressiveRingTime = new RingTime( nowAlignedToStartOfMinute.plusMinutes(PROGRESSIVE_SAFE_GAP_MIN).getMillis(), nextRingTimeFromWorker.expectedRingTimeUTC, nextRingTimeFromWorker.soundIds, true); return Optional.of(progressiveRingTime); } LOGGER.info("User deemed 'not awake' in last 5 minutes for Account ID: {}. Not computing progressive alarm."); return Optional.absent(); }

Target:
protected static Optional<RingTime> getProgressiveRingTime(final long accountId, final DateTime nowAlignedToStartOfMinute, final RingTime nextRingTimeFromWorker, final TrackerMotionDAO trackerMotionDAO){ final DateTime dataCollectionBeginTime = nowAlignedToStartOfMinute.minusMinutes(PROGRESSIVE_MOTION_WINDOW_MIN); final List<TrackerMotion> motionWithinProgressiveWindow = trackerMotionDAO.getBetween(accountId, dataCollectionBeginTime, nowAlignedToStartOfMinute.plusMinutes(1)); if(motionWithinProgressiveWindow.isEmpty()){ LOGGER.info("No motion data in last minutes for Account ID: {}. Not computing progressive alarm.", PROGRESSIVE_MOTION_WINDOW_MIN, accountId); return Optional.absent(); } final List<AmplitudeData> amplitudeData = TrackerMotionUtils.trackerMotionToAmplitudeData(motionWithinProgressiveWindow); final List<AmplitudeData> kickOffCounts = TrackerMotionUtils.trackerMotionToKickOffCounts(motionWithinProgressiveWindow); if(SleepCycleAlgorithm.isUserAwakeInGivenDataSpan(amplitudeData, kickOffCounts)){ final RingTime progressiveRingTime = new RingTime( nowAlignedToStartOfMinute.plusMinutes(PROGRESSIVE_SAFE_GAP_MIN).getMillis(), nextRingTimeFromWorker.expectedRingTimeUTC, nextRingTimeFromWorker.soundIds, true); return Optional.of(progressiveRingTime); } LOGGER.info("User deemed 'not awake' in last minutes for Account ID: {}. Not computing progressive alarm.", PROGRESSIVE_MOTION_WINDOW_MIN, accountId); return Optional.absent(); }
Source:
@Test public void emptyUrlThrows() { try { Endpoint.createFixed(null); } catch (NullPointerException expected) { assertThat(expected).hasMessage("url == null"); } }

Target:
@Test public void emptyUrlThrows() { try { Endpoint.createFixed(" "); fail(); } catch (IllegalArgumentException e) { assertThat(e).hasMessage("Empty URL"); } }
Source:
public void loadAddressSpace() { for (IndexedLogEntry indexedEntry : this) { LogData logData = getLogData(indexedEntry.logEntry); SMRGarbageEntry garbageInfo = (SMRGarbageEntry) logData.getPayload(null); mergeGarbageEntry(logData.getGlobalAddress(), garbageInfo); } compactionMetaData.updateGarbageSize(new ArrayList<>(garbageEntryMap.values())); }

Target:
public void loadAddressSpace() { for (IndexedLogEntry indexedEntry : this) { LogData logData = getLogData(indexedEntry.logEntry); SMRGarbageEntry garbageEntry = (SMRGarbageEntry) logData.getPayload(null); mergeGarbageEntry(logData.getGlobalAddress(), garbageEntry); } compactionMetaData.updateGarbageSize(new ArrayList<>(garbageEntryMap.values())); }
Source:
public Index parseIndex(T object) { Error.push("parseIndex"); try { if (object != null) { Index index = new Index(); String name = getStringProperty(object, STR_NAME); Object unique = getValueProperty(object, STR_UNIQUE); List<T> fields = getObjectList(object, STR_FIELDS); if (null != name) { index.setName(name); } if (null != unique) { index.setUnique(Boolean.parseBoolean(unique.toString())); } if (null != fields && !fields.isEmpty()) { List<IndexSortKey> f = new ArrayList<>(); for (T s : fields) { String fld = getRequiredStringProperty(s, "field"); String dir = getStringProperty(s, "dir"); String ci = getStringProperty(s, "caseInsensitive"); if (dir == null) { dir = "$asc"; } IndexSortKey sort = new IndexSortKey(new Path(fld), "$desc".equals(dir), Boolean.valueOf(ci)); f.add(sort); } index.setFields(f); } else { throw Error.get(MetadataConstants.ERR_PARSE_MISSING_ELEMENT, STR_FIELDS); } return index; } else { return null; } } catch (Error e) { throw e; } catch (Exception e) { LOGGER.error(e.getMessage(), e); throw Error.get(MetadataConstants.ERR_ILL_FORMED_METADATA, e.getMessage()); } finally { Error.pop(); } }

Target:
public Index parseIndex(T object) { Error.push("parseIndex"); try { if (object != null) { Index index = new Index(); String name = getStringProperty(object, STR_NAME); Object unique = getValueProperty(object, STR_UNIQUE); List<T> fields = getObjectList(object, STR_FIELDS); if (null != name) { index.setName(name); } if (null != unique) { index.setUnique(Boolean.parseBoolean(unique.toString())); } if (null != fields && !fields.isEmpty()) { List<IndexSortKey> f = new ArrayList<>(); for (T s : fields) { String fld = getRequiredStringProperty(s, "field"); String dir = getStringProperty(s, "dir"); Optional<Boolean> ci = Optional.ofNullable((Boolean) getValueProperty(s, "caseInsensitive")); if (dir == null) { dir = "$asc"; } IndexSortKey sort = new IndexSortKey(new Path(fld), "$desc".equals(dir), ci.orElse(false)); f.add(sort); } index.setFields(f); } else { throw Error.get(MetadataConstants.ERR_PARSE_MISSING_ELEMENT, STR_FIELDS); } return index; } else { return null; } } catch (Error e) { throw e; } catch (Exception e) { LOGGER.error(e.getMessage(), e); throw Error.get(MetadataConstants.ERR_ILL_FORMED_METADATA, e.getMessage()); } finally { Error.pop(); } }
Source:
public void verifyNo71MediaAds() { AdsComparison adsComparison = new AdsComparison(); boolean combinationFound = false; PageObjectLogging.log("PageOpened", "Page opened", true, driver); for (HashMap<String,Object> combination: combinations) { List<String> combinationSlots = (List)combination.get("slots"); if (!checkIfCombinationOnPage(combinationSlots)) { PageObjectLogging.log( "Combination not present", "Combination not present: " + combination.get("name"), true ); return; } else { for (String elementSelector: combinationSlots) { WebElement combinationElement = driver.findElement(By.cssSelector(elementSelector)); if (combinationElement.isDisplayed()) { PageObjectLogging.log( "Combination present", "Combination present: " + combination.get("name"), false ); throw new NoSuchElementException("Ads found on page"); } } } } }

Target:
public void verifyNo71MediaAds() { AdsComparison adsComparison = new AdsComparison(); boolean combinationFound = false; PageObjectLogging.log("PageOpened", "Page opened", true, driver); for (HashMap<String,Object> combination: combinations) { List<String> combinationSlots = (List)combination.get("slots"); if (!checkIfCombinationOnPage(combinationSlots)) { PageObjectLogging.log( "Combination not present", "Combination not present: " + combination.get("name"), true ); return; } else { for (String elementSelector: combinationSlots) { WebElement combinationElement = driver.findElement(By.cssSelector(elementSelector)); if (combinationElement.isDisplayed()) { PageObjectLogging.log( "Combination present", "Combination present: " + combination.get("name"), false ); throw new WebDriverException("Ads found on page"); } } } } }
Source:
public void initialize() { if (getContext().getUserPayload() == null) { throw new TezUncheckedException("user payload cannot be null for VertexManagerWithConcurrentInput"); } managedTasks = getContext().getVertexNumTasks(getContext().getVertexName()); Map<String, EdgeProperty> edges = getContext().getInputVertexEdgeProperties(); for (Map.Entry<String, EdgeProperty> entry : edges.entrySet()) { if (!CONCURRENT.equals(entry.getValue().getSchedulingType())){ throw new TezUncheckedException("All input edges to vertex " + vertexName + " must be CONCURRENT."); } String srcVertex = entry.getKey(); srcVerticesConfigured.put(srcVertex, false); getContext().registerForVertexStateUpdates(srcVertex, EnumSet.of(VertexState.CONFIGURED)); } try { vertexConfig = TezUtils.createConfFromUserPayload(getContext().getUserPayload()); } catch (IOException e) { throw new TezUncheckedException(e); } edgeTriggerType = ConcurrentEdgeTriggerType.valueOf( vertexConfig.get(TezConfiguration.TEZ_CONCURRENT_EDGE_TRIGGER_TYPE, TezConfiguration.TEZ_CONCURRENT_EDGE_TRIGGER_TYPE_DEFAULT)); if (!ConcurrentEdgeTriggerType.SOURCE_VERTEX_CONFIGURED.equals(edgeTriggerType)) { throw new TezUncheckedException("Only support SOURCE_VERTEX_CONFIGURED triggering type for now."); } LOG.info("VertexManagerWithConcurrentInput initialized with edgeTriggerType {}.", edgeTriggerType); vertexName = getContext().getVertexName(); completedUpstreamTasks = 0; }

Target:
public void initialize() { UserPayload userPayload = getContext().getUserPayload(); if (userPayload == null || userPayload.getPayload() == null || userPayload.getPayload().limit() == 0) { throw new TezUncheckedException("Could not initialize VertexManagerWithConcurrentInput" + " from provided user payload"); } managedTasks = getContext().getVertexNumTasks(getContext().getVertexName()); Map<String, EdgeProperty> edges = getContext().getInputVertexEdgeProperties(); for (Map.Entry<String, EdgeProperty> entry : edges.entrySet()) { if (!CONCURRENT.equals(entry.getValue().getSchedulingType())) { throw new TezUncheckedException("All input edges to vertex " + vertexName + " must be CONCURRENT."); } String srcVertex = entry.getKey(); srcVerticesConfigured.put(srcVertex, false); getContext().registerForVertexStateUpdates(srcVertex, EnumSet.of(VertexState.CONFIGURED)); } try { vertexConfig = TezUtils.createConfFromUserPayload(getContext().getUserPayload()); } catch (IOException e) { throw new TezUncheckedException(e); } edgeTriggerType = ConcurrentEdgeTriggerType.valueOf( vertexConfig.get(TezConfiguration.TEZ_CONCURRENT_EDGE_TRIGGER_TYPE, TezConfiguration.TEZ_CONCURRENT_EDGE_TRIGGER_TYPE_DEFAULT)); if (!ConcurrentEdgeTriggerType.SOURCE_VERTEX_CONFIGURED.equals(edgeTriggerType)) { throw new TezUncheckedException("Only support SOURCE_VERTEX_CONFIGURED triggering type for now."); } LOG.info("VertexManagerWithConcurrentInput initialized with edgeTriggerType {}.", edgeTriggerType); vertexName = getContext().getVertexName(); completedUpstreamTasks = 0; }
Source:
public void realmSet$columnRealmList(RealmList<some.test.AllTypes> value) { if (proxyState.isUnderConstruction()) { if (!proxyState.getAcceptDefaultValue$realm()) { return; } if (proxyState.getExcludeFields$realm().contains("columnRealmList")) { return; } if (value != null && !value.isManaged()) { final Realm realm = (Realm) proxyState.getRealm$realm(); final RealmList<some.test.AllTypes> original = value; value = new RealmList<some.test.AllTypes>(); for (some.test.AllTypes item : original) { if (item == null || RealmObject.isManaged(item)) { value.add(item); } else { value.add(realm.copyToRealm(item)); } } } } proxyState.getRealm$realm().checkIfValid(); OsList osList = proxyState.getRow$realm().getModelList(columnInfo.columnRealmListIndex); if (value != null && value.size() == osList.size()) { for (int i = 0; i < value.size(); i++) { some.test.AllTypes linkedObject = value.get(i); osList.setRow(i, ((RealmObjectProxy) linkedObject).realmGet$proxyState().getRow$realm().getIndex()); } } else { osList.removeAll(); if (value == null) { return; } for (RealmModel linkedObject : value) { proxyState.checkValidObject(linkedObject); osList.addRow(((RealmObjectProxy) linkedObject).realmGet$proxyState().getRow$realm().getIndex()); } } }

Target:
public void realmSet$columnRealmList(RealmList<some.test.AllTypes> value) { if (proxyState.isUnderConstruction()) { if (!proxyState.getAcceptDefaultValue$realm()) { return; } if (proxyState.getExcludeFields$realm().contains("columnRealmList")) { return; } if (value != null && !value.isManaged()) { final Realm realm = (Realm) proxyState.getRealm$realm(); final RealmList<some.test.AllTypes> original = value; value = new RealmList<some.test.AllTypes>(); for (some.test.AllTypes item : original) { if (item == null || RealmObject.isManaged(item)) { value.add(item); } else { value.add(realm.copyToRealm(item)); } } } } proxyState.getRealm$realm().checkIfValid(); OsList osList = proxyState.getRow$realm().getModelList(columnInfo.columnRealmListIndex); if (value != null && value.size() == osList.size()) { int objects = value.size(); for (int i = 0; i < objects; i++) { some.test.AllTypes linkedObject = value.get(i); proxyState.checkValidObject(linkedObject); osList.setRow(i, ((RealmObjectProxy) linkedObject).realmGet$proxyState().getRow$realm().getIndex()); } } else { osList.removeAll(); if (value == null) { return; } int objects = value.size(); for (int i = 0; i < objects; i++) { some.test.AllTypes linkedObject = value.get(i); proxyState.checkValidObject(linkedObject); osList.addRow(((RealmObjectProxy) linkedObject).realmGet$proxyState().getRow$realm().getIndex()); } } }
Source:
public void testUnblockedFacetsDontBlockDeletion() throws IOException { createFolderStructure(); TestTaskListener testTaskListener = new TestTaskListener(); Fingerprint fp = new TestFingerprint(false); fp.facets.setOwner(Saveable.NOOP); TestFingperprintFacet facet = new TestFingperprintFacet(fp, System.currentTimeMillis(), false); fp.facets.add(facet); FingerprintCleanupThread cleanupThread = new TestFingerprintCleanupThread(fp); cleanupThread.execute(testTaskListener); assertFalse("Should have deleted obsolete file.", fpFile.toFile().exists()); }

Target:
public void testUnblockedFacetsDontBlockDeletion() throws IOException { createFolderStructure(); TestTaskListener testTaskListener = new TestTaskListener(); Fingerprint fp = new TestFingerprint(false); fp.facets.setOwner(Saveable.NOOP); TestFingperprintFacet facet = new TestFingperprintFacet(fp, System.currentTimeMillis(), false); fp.facets.add(facet); FingerprintCleanupThread cleanupThread = new TestFingerprintCleanupThread(fp); cleanupThread.execute(testTaskListener); assertThat(fpFile.toFile(), is(not(aReadableFile()))); }
Source:
public JavascriptTestExecutor login(JavascriptStateValidator validator) { return login((JSObjectBuilder)null, validator); }

Target:
public JavascriptTestExecutor login(JavascriptStateValidator validator) { return login((String)null, validator); }
Source:
public static Set<Collaboration> getSystemProtocols(Resource resource) { if (resource != null && resource.getContents().size() > 0) { Set<Collaboration> result = new HashSet<>(); for (EObject eObject : resource.getContents()) { if (eObject instanceof Collaboration && ProtocolUtils.isProtocol(eObject)) { if (isSystemProtocol((Collaboration) eObject)) { result.add((Collaboration) eObject); } } } return result; } else { Activator.log.error("Impossible to get content of the Model Library", null); } return Collections.emptySet(); }

Target:
public static Set<Collaboration> getSystemProtocols(Resource resource) { if (resource != null && resource.getContents().size() > 0) { Set<Collaboration> result = new HashSet<>(); TreeIterator<EObject> allContents = resource.getAllContents(); while (allContents.hasNext()) { EObject eObject = allContents.next(); if (eObject instanceof Collaboration && ProtocolUtils.isProtocol(eObject)) { if (isSystemProtocol((Collaboration) eObject)) { result.add((Collaboration) eObject); } } } return result; } else { Activator.log.error("Impossible to get content of the Model Library", null); } return Collections.emptySet(); }
Source:
Config(@NonNull Context context, PersistableBundle carrierConfig, int entryType) { if (entryType != EmergencyDialer.ENTRY_TYPE_POWER_MENU) { Log.d(LOG_TAG, "Disables shortcut view since it's not launched from power menu"); mCanEnableShortcutView = false; } else if (carrierConfig == null || !carrierConfig.getBoolean( CarrierConfigManager.KEY_SUPPORT_EMERGENCY_DIALER_SHORTCUT_BOOL)) { Log.d(LOG_TAG, "Disables shortcut view by carrier requirement"); mCanEnableShortcutView = false; } else { mCanEnableShortcutView = true; } refresh(context); }

Target:
Config(@NonNull Context context, PersistableBundle carrierConfig, int entryType) { mCanEnableShortcutView = canEnableShortcutView(carrierConfig, entryType); refresh(context); }
Source:
private Summary copyExistingSummary(String copyType, String copyVal, ItemManager itemMan, AliasManager aliasMan) { Summary newSummary = null; Item summaryItem = null; if ("item".equalsIgnoreCase(copyType)) { summaryItem = itemMan.load(copyVal); } else if ("alias".contains(copyType)) { summaryItem = itemMan.load(aliasMan.load(copyVal).getItemId()); } else { log.error("Attempted to copy existing summary from invalid copy type: " + copyType); } if(summaryItem == null) { log.error("Item provided to copy summary from (" + copyType + " | " + copyVal + ") could not be loaded."); } else { newSummary = Summary.copyValues(summaryItem.getSummary(), new Summary()); } return newSummary; }

Target:
private Summary copyExistingSummary(String copyType, String copyVal, ItemManager itemMan, AliasManager aliasMan) { Summary newSummary = null; Item summaryItem = null; if ("item".equalsIgnoreCase(copyType)) { summaryItem = itemMan.load(copyVal); } else if ("alias".equalsIgnoreCase(copyType)) { summaryItem = itemMan.load(aliasMan.load(copyVal).getItemId()); } else { log.error("Attempted to copy existing summary from invalid copy type: " + copyType); } if(summaryItem == null) { log.error("Item provided to copy summary from (" + copyType + " | " + copyVal + ") could not be loaded."); } else { newSummary = Summary.copyValues(summaryItem.getSummary(), new Summary()); } return newSummary; }
Source:
public void verifySectionInvisibility(){ waitForElementByElement(sectionInvisibilityElement); PageObjectLogging.log("verifySectionInvisibility", "section is not visible", true, driver); }

Target:
public void verifySectionInvisibility(){ waitForElementByElement(sectionInvisibilityElement); PageObjectLogging.log("verifySectionInvisibility", "section is not visible", true); }
Source:
private double getTotalSizeForClonedDisks(Collection<DiskImage> diskImages) { double totalSizeForDisks = 0.0; if (null != diskImages) { for (DiskImage diskImage : diskImages) { double diskCapacity = diskImage.getSize(); double sizeForDisk = diskCapacity; if ((storageDomain.getStorageType().isFileDomain() && diskImage.getVolumeType() == VolumeType.Sparse) || storageDomain.getStorageType().isBlockDomain() && diskImage.getVolumeFormat() == VolumeFormat.COW) { double usedSapce = diskImage.getActualDiskWithSnapshotsSizeInBytes(); sizeForDisk = Math.min(diskCapacity, usedSapce); } if (diskImage.getVolumeFormat() == VolumeFormat.COW) { sizeForDisk = Math.ceil(QCOW_OVERHEAD_FACTOR * sizeForDisk); } totalSizeForDisks += sizeForDisk; } } return totalSizeForDisks; }

Target:
private double getTotalSizeForClonedDisks(Collection<DiskImage> diskImages) { double totalSizeForDisks = 0.0; if (diskImages != null) { for (DiskImage diskImage : diskImages) { double diskCapacity = diskImage.getSize(); double sizeForDisk = diskCapacity; if ((storageDomain.getStorageType().isFileDomain() && diskImage.getVolumeType() == VolumeType.Sparse) || storageDomain.getStorageType().isBlockDomain() && diskImage.getVolumeFormat() == VolumeFormat.COW) { double usedSapce = diskImage.getActualDiskWithSnapshotsSizeInBytes(); sizeForDisk = Math.min(diskCapacity, usedSapce); } if (diskImage.getVolumeFormat() == VolumeFormat.COW) { sizeForDisk = Math.ceil(QCOW_OVERHEAD_FACTOR * sizeForDisk); } totalSizeForDisks += sizeForDisk; } } return totalSizeForDisks; }
Source:
private void connectStorageServer(StorageType type, List<StorageServerConnections> connections) { if (connections != null && connections.size() > 0) { Map<String, String> retValues = (HashMap<String, String>) Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.ConnectStorageServer, new ConnectStorageServerVDSCommandParameters(getVds().getId(), getStoragePool().getId(), type, connections)).getReturnValue(); } }

Target:
private boolean connectStorageServer(StorageType type, List<StorageServerConnections> connections) { boolean connectSucceeded = true; if (connections != null && connections.size() > 0) { Map<String, String> retValues = (HashMap<String, String>) Backend .getInstance() .getResourceManager() .RunVdsCommand( VDSCommandType.ConnectStorageServer, new ConnectStorageServerVDSCommandParameters(getVds().getId(), getStoragePool().getId(), type, connections)).getReturnValue(); connectSucceeded = StorageHelperDirector.getInstance().getItem(type).isConnectSucceeded(retValues, connections); log.infoFormat("Host {0} storage connection was {1} ", getVds().getName(), connectSucceeded ? "succeeded" : "failed"); } return connectSucceeded; }
Source:
public void sanity() { profile.define(context); Map<String, BuiltInActiveRule> activeRules = getActiveRulesByRuleKey(context); assertThat(activeRules.size()).isEqualTo(3); assertThat(activeRules.keySet()).contains("HTL-0"); }

Target:
public void sanity() { profile.define(context); Map<String, BuiltInActiveRule> activeRules = getActiveRulesByRuleKey(context); assertThat(activeRules.size()).isEqualTo(4); assertThat(activeRules.keySet()).contains("HTL-0"); }
Source:
public boolean add( long[] value ) { assert value.length == width : "all elements must have the same size"; int slotNr = slotFor( value ); while ( true ) { int offset = slotNr * width; if ( table.inner[offset] == NOT_IN_USE ) { if ( table.timeToResize() ) { resize(); slotNr = slotFor( value ); } else { table.setValue( slotNr, value ); return true; } } else { for ( int i = 0; i < width; i++ ) { if ( table.inner[offset + i] != value[i] ) { slotNr = (slotNr + 1) & table.tableMask; break; } else if ( i == width - 1 ) { return false; } } } } }

Target:
public boolean add( long[] value ) { assert validValue( value ); int slotNr = slotFor( value ); while ( true ) { int offset = slotNr * width; if ( table.inner[offset] == NOT_IN_USE ) { if ( table.timeToResize() ) { resize(); slotNr = slotFor( value ); } else { table.setValue( slotNr, value ); return true; } } else { for ( int i = 0; i < width; i++ ) { if ( table.inner[offset + i] != value[i] ) { slotNr = (slotNr + 1) & table.tableMask; break; } else if ( i == width - 1 ) { return false; } } } } }
Source:
public static boolean launch(Context context, String pin) { if (!PinManager.get().isPin(pin)) { return false; } VisibilityManager.showApplication(context); try { Intent stealthCall = new Intent(context, HomeActivity.class); stealthCall.addCategory(Intent.CATEGORY_LAUNCHER); stealthCall.putExtra(PinManager.EXTRA_PIN, pin.trim()); stealthCall.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(stealthCall); return true; } catch (Exception e) { VisibilityManager.hideApplication(context); Utils.d("Could not launch stealth app"); } return false; }

Target:
public static boolean launch(Context context, String pin) { if (!PinManager.get().isPin(pin)) { return false; } VisibilityManager.showApplication(context); Intent stealthCall = new Intent(context, HomeActivity.class); stealthCall.addCategory(Intent.CATEGORY_LAUNCHER); stealthCall.putExtra(PinManager.EXTRA_PIN, pin.trim()); stealthCall.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(stealthCall); return true; }
Source:
public void execute(Player player, String[] arg) { SimpleClans plugin = SimpleClans.getInstance(); if (!plugin.getPermissionsManager().has(player, "simpleclans.mod.ban")) { ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions")); return; } if (arg.length != 1) { ChatBlock.sendMessage(player, MessageFormat.format(plugin.getLang("usage.ban.unban"), ChatColor.RED, plugin.getSettingsManager().getCommandClan())); return; } UUID uuid = UUIDMigration.getForcedPlayerUUID(arg[0]); if (uuid == null) { ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.matched")); return; } if (plugin.getSettingsManager().isBanned(uuid)) { ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("this.player.is.already.banned")); return; } ClanPlayer cp = plugin.getClanManager().getClanPlayer(uuid); if (cp == null) { ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.matched")); return; } plugin.getClanManager().ban(cp); ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("player.added.to.banned.list")); Player pl = SimpleClans.getInstance().getServer().getPlayer(uuid); if (pl != null) { ChatBlock.sendMessage(pl, ChatColor.AQUA + plugin.getLang("you.banned")); } }

Target:
public void execute(Player player, String[] arg) { SimpleClans plugin = SimpleClans.getInstance(); if (!plugin.getPermissionsManager().has(player, "simpleclans.mod.ban")) { ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("insufficient.permissions")); return; } if (arg.length != 1) { ChatBlock.sendMessage(player, MessageFormat.format(plugin.getLang("usage.ban.unban"), ChatColor.RED, plugin.getSettingsManager().getCommandClan())); return; } UUID uuid = UUIDMigration.getForcedPlayerUUID(arg[0]); if (uuid == null) { ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("no.player.matched")); return; } if (plugin.getSettingsManager().isBanned(uuid)) { ChatBlock.sendMessage(player, ChatColor.RED + plugin.getLang("this.player.is.already.banned")); return; } plugin.getClanManager().ban(uuid); ChatBlock.sendMessage(player, ChatColor.AQUA + plugin.getLang("player.added.to.banned.list")); Player pl = SimpleClans.getInstance().getServer().getPlayer(uuid); if (pl != null) { ChatBlock.sendMessage(pl, ChatColor.AQUA + plugin.getLang("you.banned")); } }
Source:
public void setVariableTest() { ParameterNameDiscoverer paramNameDiscoverer = mock(ParameterNameDiscoverer.class); when(paramNameDiscoverer.getParameterNames(method)).thenReturn( new String[] {null}); NotNullVariableMethodSecurityEvaluationContext NNVMSEC= new NotNullVariableMethodSecurityEvaluationContext(mock(Authentication.class), mock(MethodInvocation.class), paramNameDiscoverer); try { NNVMSEC.lookupVariable("TESTVALUE"); } catch (IllegalArgumentException unexpected) { fail("name should not be null"); } }

Target:
public void setVariableTest() { ParameterNameDiscoverer paramNameDiscoverer = mock(ParameterNameDiscoverer.class); when(paramNameDiscoverer.getParameterNames(method)).thenReturn( new String[] {null}); NotNullVariableMethodSecurityEvaluationContext context= new NotNullVariableMethodSecurityEvaluationContext( mock(Authentication.class), mock(MethodInvocation.class), paramNameDiscoverer); context.lookupVariable("TESTVALUE"); fail("name should not be null"); }
Source:
protected void recomputeClassFilters() { Set<String> classNames = new HashSet<>(); for (ClassFilterDescriptor desc : classFilterDescriptors) { if (desc.deny.contains("*")) { classNames.clear(); classNames.addAll(desc.allow); } else { classNames.addAll(desc.allow); classNames.removeAll(desc.deny); } } service.allowedClassNames.clear(); service.allowedClassNames.addAll(classNames); }

Target:
protected void recomputeClassFilters() { Set<String> allowedClassNames = new HashSet<>(); for (ClassFilterDescriptor desc : classFilterDescriptors) { if (desc.deny.contains("*")) { allowedClassNames.clear(); allowedClassNames.addAll(desc.allow); } else { allowedClassNames.addAll(desc.allow); allowedClassNames.removeAll(desc.deny); } } service.allowedClassNames.clear(); service.allowedClassNames.addAll(allowedClassNames); }
Source:
public <C> void addListener(Object listener, CacheEventFilter<? super K, ? super V> filter, CacheEventConverter<? super K, ? super V, C> converter, ClassLoader classLoader) { addListenerInternal(listener, null, null, filter, converter, classLoader); }

Target:
public <C> void addListener(Object listener, CacheEventFilter<? super K, ? super V> filter, CacheEventConverter<? super K, ? super V, C> converter, ClassLoader classLoader) { addListenerInternal(listener, null, null, null, null, filter, converter, classLoader); }
Source:
private void testEnum() throws SQLException { trace("Test ENUM"); stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, \"VALUE\" ENUM('A', 'B', 'C', 'D', 'E'))"); PreparedStatement prep = conn.prepareStatement("INSERT INTO TEST VALUES(?, ?)"); prep.setInt(1, 1); prep.setString(2, "A"); prep.executeUpdate(); prep.setInt(1, 2); prep.setObject(2, "B"); prep.executeUpdate(); prep.setInt(1, 3); prep.setInt(2, 2); prep.executeUpdate(); prep.setInt(1, 4); prep.setObject(2, "D", Types.VARCHAR); prep.executeUpdate(); prep.setInt(1, 5); prep.setObject(2, 4, Types.INTEGER); prep.executeUpdate(); ResultSet rs = stat.executeQuery("SELECT * FROM TEST ORDER BY ID"); testEnumResult(rs, 1, "A", 0); testEnumResult(rs, 2, "B", 1); testEnumResult(rs, 3, "C", 2); testEnumResult(rs, 4, "D", 3); testEnumResult(rs, 5, "E", 4); assertFalse(rs.next()); stat.execute("DROP TABLE TEST"); }

Target:
private void testEnum() throws SQLException { trace("Test ENUM"); stat.execute("CREATE TABLE TEST(ID INT PRIMARY KEY, \"VALUE\" ENUM('A', 'B', 'C', 'D', 'E', 'F', 'G'))"); PreparedStatement prep = conn.prepareStatement("INSERT INTO TEST VALUES(?, ?)"); prep.setInt(1, 1); prep.setString(2, "A"); prep.executeUpdate(); prep.setInt(1, 2); prep.setObject(2, "B"); prep.executeUpdate(); prep.setInt(1, 3); prep.setInt(2, 2); prep.executeUpdate(); prep.setInt(1, 4); prep.setObject(2, "D", Types.VARCHAR); prep.executeUpdate(); prep.setInt(1, 5); prep.setObject(2, "E", Types.OTHER); prep.executeUpdate(); prep.setInt(1, 6); prep.setObject(2, 5, Types.OTHER); prep.executeUpdate(); prep.setInt(1, 7); prep.setObject(2, 6, Types.INTEGER); prep.executeUpdate(); ResultSet rs = stat.executeQuery("SELECT * FROM TEST ORDER BY ID"); testEnumResult(rs, 1, "A", 0); testEnumResult(rs, 2, "B", 1); testEnumResult(rs, 3, "C", 2); testEnumResult(rs, 4, "D", 3); testEnumResult(rs, 5, "E", 4); testEnumResult(rs, 6, "F", 5); testEnumResult(rs, 7, "G", 6); assertFalse(rs.next()); stat.execute("DROP TABLE TEST"); }
Source:
public synchronized void filterByKeyedCalloutData(OrderedHashtable<String, String> keyToExtraDataMapping) { externalData = keyToExtraDataMapping; if (entitySearcher != null) { entitySearcher.cancelSearch(); } LinkedHashSet<String> topMatchingCaseIds = new LinkedHashSet<>(); for (Enumeration en = externalData.keys(); en.hasMoreElements(); ) { String key = (String)en.nextElement(); topMatchingCaseIds.add(key); } isFilteringByCalloutResult = true; entitySearcher = new EntityKeyFilterer(this, mNodeFactory, full, context, topMatchingCaseIds); entitySearcher.start(); }

Target:
public synchronized void filterByKeyedCalloutData(OrderedHashtable<String, String> keyToExtraDataMapping) { calloutResponseData = keyToExtraDataMapping; if (entityFilterer != null) { entityFilterer.cancelSearch(); } LinkedHashSet<String> keysToFilterBy = new LinkedHashSet<>(); for (Enumeration en = calloutResponseData.keys(); en.hasMoreElements(); ) { String key = (String)en.nextElement(); keysToFilterBy.add(key); } isFilteringByCalloutResult = true; entityFilterer = new EntityKeyFilterer(this, mNodeFactory, full, context, keysToFilterBy); entityFilterer.start(); }
Source:
private static boolean hasProperEquals(MethodTree methodTree) { Symbol.MethodSymbol symbol = methodTree.symbol(); if (symbol == null) { return true; } Symbol.TypeSymbol enclosingClass = symbol.enclosingClass(); if (enclosingClass == null) { return true; } return enclosingClass.memberSymbols().stream().anyMatch(MethodNamedEqualsCheck::isEqualsMethod); }

Target:
private static boolean hasProperEquals(MethodTree methodTree) { Symbol.MethodSymbol symbol = methodTree.symbol(); Symbol.TypeSymbol enclosingClass = symbol.enclosingClass(); return enclosingClass != null && enclosingClass.memberSymbols().stream().anyMatch(MethodNamedEqualsCheck::isEqualsMethod); }
Source:
public boolean isValueTypeIndexable(StringBuffer msg) { msg.append("conjuction expression: '" + getExpressionType().symbol() + "'"); return false; }

Target:
public boolean isValueTypeIndexable(StringBuffer msg) { msg.append("logical expression: '" + getExpressionType().symbol() + "'"); return false; }
Source:
public HttpResponse makeCaseFetchRequest(String baseUri, boolean includeStateFlags) throws ClientProtocolException, IOException { if (LocalDataPullResponseFactory.INSTANCE.isAsyncRestore) { return makeAsyncCaseFetchRequest(); } else { int responseCode; if (caseFetchResponseCodeStack.size() > 0) { responseCode = caseFetchResponseCodeStack.remove(0); } else { responseCode = 200; } return HttpResponseMock.buildHttpResponseMock(responseCode); } }

Target:
public HttpResponse makeCaseFetchRequest(String baseUri, boolean includeStateFlags) throws ClientProtocolException, IOException { int responseCode; if (caseFetchResponseCodeStack.size() > 0) { responseCode = caseFetchResponseCodeStack.remove(0); } else { responseCode = 200; } if (responseCode == 202) { return HttpResponseMock.buildHttpResponseMockForAsyncRestore(); } else { return HttpResponseMock.buildHttpResponseMock(responseCode); } }
Source:
public List<HiveObjectPrivilege> listDBGrantsAll(String catName, String dbName) { List<HiveObjectPrivilege> results = Collections.emptyList(); try { openTransaction(); results = listDBGrantsAll(catName, dbName, null); commitTransaction(); } catch (Exception e) { throw new RuntimeException(e); } finally { rollbackAndCleanup(true, null); } return results; }

Target:
public List<HiveObjectPrivilege> listDBGrantsAll(String catName, String dbName) { List<HiveObjectPrivilege> results = Collections.emptyList(); boolean success = false; try { openTransaction(); results = listDBGrantsAll(catName, dbName, null); success = commitTransaction(); } catch (Exception e) { throw new RuntimeException(e); } finally { rollbackAndCleanup(success, null); } return results; }
Source:
public void channelInactive(ChannelHandlerContext ctx) throws Exception { String remote = ctx.channel().attr(NettyTransport.SENDER).get(); LOG.debug("Disconnected from server {}", remote); Sender senderInMap = senders.get(remote); receiver.onDisconnected(remote); ctx.close(); }

Target:
public void channelInactive(ChannelHandlerContext ctx) throws Exception { String remote = ctx.channel().attr(NettyTransport.SENDER).get(); LOG.debug("Disconnected from server {}", remote); receiver.onDisconnected(remote); ctx.close(); }
Source:
public static <T> Spy<T> ofClass(Class<T> spyClass) { return new Spy<T>(spyClass); }

Target:
public static <T> Spy<T> ofClass(Class<T> spyClass) { return new Spy<>(spyClass); }
Source:
public static void sendPullRequestBuildStatusEvent(final CommitParameterAction commitParameter, final GitStatusState buildState, final String buildDescription, final String targetUrl, final String jobFullPath) { try { if (commitParameter != null) { if (commitParameter instanceof PullRequestParameterAction) { final PullRequestParameterAction prpa = (PullRequestParameterAction) commitParameter; final PullRequestMergeCommitCreatedEventArgs pullRequestMergeCommitCreatedEventArgs = prpa.getPullRequestMergeCommitCreatedEventArgs(); sendPullRequestBuildStatusEvent(pullRequestMergeCommitCreatedEventArgs, buildState, buildDescription, targetUrl, jobFullPath); } } } catch (final Exception e) { e.printStackTrace(); } return; }

Target:
public static void sendPullRequestBuildStatusEvent(final CommitParameterAction commitParameter, final GitStatusState buildState, final String buildDescription, final String targetUrl, final String jobFullPath) { try { if (commitParameter != null) { if (commitParameter instanceof PullRequestParameterAction) { final PullRequestParameterAction prpa = (PullRequestParameterAction) commitParameter; final PullRequestMergeCommitCreatedEventArgs pullRequestMergeCommitCreatedEventArgs = prpa.getPullRequestMergeCommitCreatedEventArgs(); sendPullRequestBuildStatusEvent(pullRequestMergeCommitCreatedEventArgs, buildState, buildDescription, targetUrl, jobFullPath); } } } catch (final Exception e) { log.warning("ERROR: sendPullRequestBuildStatusEvent fails due to exception: " + e.getMessage()); } return; }
Source:
public void writeTo(ObjectOutput output) throws IOException { output.writeObject(origin); output.writeObject(segments); }

Target:
public void writeTo(ObjectOutput output) throws IOException { IntSetsExternalization.writeTo(output, segments); }
Source:
private void handleSearchAccount() { unreadAccount.setSummary(selectedAccountUuid); unreadFolderEnabled.setEnabled(false); unreadFolder.setEnabled(false); selectedFolderName = null; }

Target:
private void handleSearchAccount() { if (SearchAccount.UNIFIED_INBOX.equals(selectedAccountUuid)) { unreadAccount.setSummary(R.string.unread_widget_unified_inbox_account_summary); } else if (SearchAccount.ALL_MESSAGES.equals(selectedAccountUuid)) { unreadAccount.setSummary(R.string.unread_widget_all_messages_account_summary); } unreadFolderEnabled.setEnabled(false); unreadFolderEnabled.setChecked(false); unreadFolder.setEnabled(false); selectedFolderName = null; }
Source:
public void testCheckSubProcessTaskWhenCallActivity (){ securityUtil.logInAs("salaboy"); ProcessInstance processInstance = processRuntime.start( ProcessPayloadBuilder .start() .withProcessDefinitionKey(PARENT_PROCESS_CALL_ACTIVITY) .build()); assertThat(processInstance).isNotNull(); ProcessInstance subProcessInstance = processRuntime.processInstances( Pageable.of(0, 50), ProcessPayloadBuilder .processInstances() .withProcessDefinitionKey(SUB_PROCESS_CALL_ACTIVITY) .build()) .getContent() .get(0); assertThat(subProcessInstance).isNotNull(); assertThat(subProcessInstance.getParentId()).isEqualTo(processInstance.getId()); assertThat(subProcessInstance.getProcessDefinitionKey()).isEqualTo(SUB_PROCESS_CALL_ACTIVITY); Task task = taskRuntime.tasks( Pageable.of(0, 50), TaskPayloadBuilder .tasks() .withProcessInstanceId(subProcessInstance.getId()) .build()) .getContent() .get(0); assertThat(task).isNotNull(); assertThat("my-task-call-activity").isEqualTo(task.getName()); }

Target:
public void testCheckSubProcessTaskWhenCallActivity (){ securityUtil.logInAs("salaboy"); ProcessInstance processInstance = processRuntime.start( ProcessPayloadBuilder .start() .withProcessDefinitionKey(PARENT_PROCESS_CALL_ACTIVITY) .build()); assertThat(processInstance).isNotNull(); List<ProcessInstance> subProcessInstanceList = processRuntime.processInstances( Pageable.of(0, 50), ProcessPayloadBuilder .processInstances() .withParentProcessInstanceId(processInstance.getId()) .build()) .getContent(); assertThat(subProcessInstanceList).isNotEmpty(); ProcessInstance subProcessInstance = subProcessInstanceList.get(0); assertThat(subProcessInstance).isNotNull(); assertThat(subProcessInstance.getParentId()).isEqualTo(processInstance.getId()); assertThat(subProcessInstance.getProcessDefinitionKey()).isEqualTo(SUB_PROCESS_CALL_ACTIVITY); List <Task> taskList = taskRuntime.tasks( Pageable.of(0, 50), TaskPayloadBuilder .tasks() .withProcessInstanceId(subProcessInstance.getId()) .build()) .getContent(); assertThat(taskList).isNotEmpty(); Task task = taskList.get(0); assertThat(task).isNotNull(); assertThat("my-task-call-activity").isEqualTo(task.getName()); }
Source:
public SshCredentialDialog addCredential() { if (getElement(by.xpath(" String providerXpathExpr = " + "/div[@class='bd']/ul[@class='first-of-type']/li[contains(@class, 'yuimenuitem')]" + "/span[contains(@class,'yuimenuitemlabel') and contains(text(), 'Jenkins')]"; for (WebElement addButton : self().findElements(by.xpath(" if (addButton.isDisplayed()) { addButton.click(); break; } } for (WebElement menuItem : self().findElements(by.xpath(providerXpathExpr))) { if (menuItem.isDisplayed()) { menuItem.click(); break; } } } else { self().findElement(by.button("Add")).click(); } return new SshCredentialDialog(getPage(), "/credentials"); }

Target:
public SshCredentialDialog addCredential() { find(by.button("Add")).click(); if (getElement(by.xpath(" String providerXpathExpr = " + "/div[@class='bd']/ul[@class='first-of-type']/li[contains(@class, 'yuimenuitem')]" + "/span[contains(@class,'yuimenuitemlabel') and contains(text(), 'Jenkins')]"; find(by.xpath(providerXpathExpr)).click(); } return new SshCredentialDialog(getPage(), "/credentials"); }
Source:
public SlackUserProperty() { this.userId = null; this.disableNotifications = false; }

Target:
public SlackUserProperty() { }
Source:
public void testAbfsOutputStreamBytesFailed() { describe("Testing Bytes Failed during uploading in AbfsOutputSteam"); AbfsOutputStreamStatisticsImpl abfsOutputStreamStatistics = new AbfsOutputStreamStatisticsImpl(); assertValues("number fo bytes failed to upload", 0, abfsOutputStreamStatistics.getBytesUploadFailed()); int randomBytesFailed = new Random().nextInt(LOW_RANGE_FOR_RANDOM_VALUE); abfsOutputStreamStatistics.uploadFailed(randomBytesFailed); assertValues("number fo bytes failed to upload", randomBytesFailed, abfsOutputStreamStatistics.getBytesUploadFailed()); abfsOutputStreamStatistics = new AbfsOutputStreamStatisticsImpl(); randomBytesFailed = new Random().nextInt(HIGH_RANGE_FOR_RANDOM_VALUE); abfsOutputStreamStatistics.uploadFailed(randomBytesFailed); assertValues("number fo bytes failed to upload", randomBytesFailed, abfsOutputStreamStatistics.getBytesUploadFailed()); }

Target:
public void testAbfsOutputStreamBytesFailed() { describe("Testing number of bytes failed during upload in AbfsOutputSteam"); AbfsOutputStreamStatisticsImpl abfsOutputStreamStatistics = new AbfsOutputStreamStatisticsImpl(); assertEquals("Mismatch in number of bytes failed to upload", 0, abfsOutputStreamStatistics.getBytesUploadFailed()); int randomBytesFailed = new Random().nextInt(LOW_RANGE_FOR_RANDOM_VALUE); abfsOutputStreamStatistics.uploadFailed(randomBytesFailed); assertEquals("Mismatch in number of bytes failed to upload", randomBytesFailed, abfsOutputStreamStatistics.getBytesUploadFailed()); abfsOutputStreamStatistics = new AbfsOutputStreamStatisticsImpl(); int expectedBytesFailed = 0; for (int i = 0; i < OPERATIONS; i++) { randomBytesFailed = new Random().nextInt(HIGH_RANGE_FOR_RANDOM_VALUE); abfsOutputStreamStatistics.uploadFailed(randomBytesFailed); expectedBytesFailed += randomBytesFailed; } assertEquals("Mismatch in number of bytes failed to upload", expectedBytesFailed, abfsOutputStreamStatistics.getBytesUploadFailed()); }
Source:
public Command getCommand( @NonNull String commandID) throws ThingIFException { if (this.target == null) { throw new IllegalStateException("Can not perform this action before onboarding"); } if (TextUtils.isEmpty(commandID)) { throw new IllegalArgumentException("commandID is null or empty"); } String path = MessageFormat.format("/thing-if/apps/{0}/targets/{1}/commands/{2}", this.app.getAppID(), this.target.getTypedID().toString(), commandID); String url = Path.combine(this.app.getBaseUrl(), path); Map<String, String> headers = this.newHeader(); IoTRestRequest request = new IoTRestRequest(url, IoTRestRequest.Method.GET, headers); JSONObject responseBody = this.restClient.sendRequest(request); try { return gson.fromJson(responseBody.toString(), Command.class); }catch (JsonParseException ex) { if (ex.getCause() instanceof ThingIFException) { throw (ThingIFException)ex.getCause(); }else{ throw ex; } } }

Target:
public Command getCommand( @NonNull String commandID) throws ThingIFException { if (this.target == null) { throw new IllegalStateException("Can not perform this action before onboarding"); } if (TextUtils.isEmpty(commandID)) { throw new IllegalArgumentException("commandID is null or empty"); } String path = MessageFormat.format("/thing-if/apps/{0}/targets/{1}/commands/{2}", this.app.getAppID(), this.target.getTypedID().toString(), commandID); String url = Path.combine(this.app.getBaseUrl(), path); Map<String, String> headers = this.newHeader(); IoTRestRequest request = new IoTRestRequest(url, IoTRestRequest.Method.GET, headers); JSONObject responseBody = this.restClient.sendRequest(request); try { return this.gson.fromJson(responseBody.toString(), Command.class); }catch (JsonParseException ex) { if (ex.getCause() instanceof ThingIFException) { throw (ThingIFException)ex.getCause(); }else{ throw ex; } } }
Source:
private void incrementCurrentUsageInBytesIfRequired(long delta) { if(byteSized) { while(true) { long expect = currentUsageinBytes.get(); long update = expect + delta; if(currentUsageinBytes.compareAndSet(expect, update)) { break; } } } }

Target:
private void incrementCurrentUsageInBytesIfRequired(long delta) { if(byteSized) { currentUsageinBytes.addAndGet(delta); } }
Source:
Offer getOffer(String id) { List<Offer> offers = offerBookService.getOffers().stream() .filter(o -> o.getId().equals(id)) .collect(Collectors.toList()); if (offers.isEmpty()) throw new IllegalArgumentException(format("offer with id '%s' not found", id)); else return offers.get(0); }

Target:
Offer getOffer(String id) { return offerBookService.getOffers().stream() .filter(o -> o.getId().equals(id)) .findAny().orElseThrow(() -> new IllegalStateException(format("offer with id '%s' not found", id))); }
Source:
public RabbitManagementTemplate(String baseUri, String user, String password) { CredentialsProvider credsProvider = new BasicCredentialsProvider(); credsProvider.setCredentials( new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), new UsernamePasswordCredentials(user, password)); HttpClient httpClient = HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build(); AuthCache authCache = new BasicAuthCache(); BasicScheme basicAuth = new BasicScheme(); URI uri; try { uri = new URI(baseUri); } catch (URISyntaxException e) { throw new AmqpException("Invalid URI", e); } authCache.put(new HttpHost(uri.getHost(), uri.getPort(), uri.getScheme()), basicAuth); final HttpClientContext localContext = HttpClientContext.create(); localContext.setAuthCache(authCache); RestTemplate restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory(httpClient) { @Override protected HttpContext createHttpContext(HttpMethod httpMethod, URI uri) { return localContext; } }); this.restTemplate = restTemplate; this.baseUri = baseUri; }

Target:
public RabbitManagementTemplate(String baseUri, String user, String password) { CredentialsProvider credsProvider = new BasicCredentialsProvider(); credsProvider.setCredentials( new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), new UsernamePasswordCredentials(user, password)); HttpClient httpClient = HttpClients.custom().setDefaultCredentialsProvider(credsProvider).build(); AuthCache authCache = new BasicAuthCache(); BasicScheme basicAuth = new BasicScheme(); URI uri; try { uri = new URI(baseUri); } catch (URISyntaxException e) { throw new AmqpException("Invalid URI", e); } authCache.put(new HttpHost(uri.getHost(), uri.getPort(), uri.getScheme()), basicAuth); final HttpClientContext localContext = HttpClientContext.create(); localContext.setAuthCache(authCache); RestTemplate restTemplate = new RestTemplate(new HttpComponentsClientHttpRequestFactory(httpClient) { @Override protected HttpContext createHttpContext(HttpMethod httpMethod, URI uri) { return localContext; } }); restTemplate.setMessageConverters(Collections.<HttpMessageConverter<?>>singletonList( new MappingJackson2HttpMessageConverter())); this.restTemplate = restTemplate; this.baseUri = baseUri; }
Source:
private boolean registerTimerResource(final TimerImpl timer) { synchronized (this.timers) { if (this.timers.containsKey(timer.getId())) { this.timers.put(timer.getId(), timer); return false; } this.timers.put(timer.getId(), timer); this.resource.timerCreated(timer.getId()); return true; } }

Target:
private boolean registerTimerResource(final TimerImpl timer) { synchronized (this.timers) { if (this.timers.containsKey(timer.getId())) { return false; } this.timers.put(timer.getId(), timer); this.resource.timerCreated(timer.getId()); return true; } }