auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
@Override public double getMissRate(){ double missRate = 0; for(ManagedCache<K, V> mc : managedCache){ missRate += mc.getMissRate(); } return missRate; }

Target:
@Override public double getMissRate(){ double missRate = 0; for(ManagedCache<K, V> mc : managedCache){ missRate += mc.getMissRate(); } return missRate/managedCache.size(); }
Source:
public SELF isPositive() { isNotNull(); final boolean negative = actual.isNegative(); final int days = actual.getDays(); final int months = actual.getMonths(); final int years = actual.getYears(); if (negative || (days == 0 && months == 0 && years == 0)) { throw Failures.instance().failure(info, shouldBePositive(actual)); } return myself; }

Target:
public SELF isPositive() { isNotNull(); final boolean negative = actual.isNegative(); if (negative || Period.ZERO.equals(actual)) { throw Failures.instance().failure(info, shouldBePositive(actual)); } return myself; }
Source:
@Override public void accept(List<Span> spans, Callback<Void> callback) { if (spans.isEmpty()) { callback.onSuccess(null); return; } Map<String, Set<Pair<String>>> indexToServiceSpans = new LinkedHashMap<>(); try { HttpBulkIndexer indexer = new HttpBulkIndexer("index-span", es); indexToServiceSpans = indexSpans(indexer, spans); if (!indexToServiceSpans.isEmpty()) { indexNames(indexer, indexToServiceSpans); } indexer.execute(callback); } catch (Throwable t) { propagateIfFatal(t); callback.onError(t); synchronized(indexToServiceSpansCache) { for (String index : indexToServiceSpans.keySet()) { Set<Pair<String>> serviceSpansEntry = indexToServiceSpans.get(index); Set<Pair<String>> serviceSpansEntryCached = indexToServiceSpansCache.get(index); serviceSpansEntryCached.removeAll(serviceSpansEntry); } } } }

Target:
@Override public void accept(List<Span> spans, Callback<Void> callback) { Callback<Void> callbackWrapper = new Callback<Void>() { @Override public void onSuccess(Void value) { callback.onSuccess(value); } @Override public void onError(Throwable t) { clearIndexToServiceSpansCache(indexToServiceSpans, indexToServiceSpansCache); callback.onError(t); } }; if (spans.isEmpty()) { callbackWrapper.onSuccess(null); return; } try { HttpBulkIndexer indexer = new HttpBulkIndexer("index-span", es); indexToServiceSpans = indexSpans(indexer, spans); for (Map.Entry<String, Set<Pair<String>>> entry : indexToServiceSpans.entrySet()) { Set<Pair<String>> serviceSpansEntryCached = null; synchronized(indexToServiceSpansCache) { serviceSpansEntryCached = indexToServiceSpansCache.get(entry.getKey()); } if (serviceSpansEntryCached == null) { synchronized(indexToServiceSpansCache) { indexToServiceSpansCache.put(entry.getKey(), serviceSpansEntryCached = Collections.newSetFromMap(new LinkedHashMap<Pair<String>, Boolean>() { @Override protected boolean removeEldestEntry(Map.Entry<Pair<String>, Boolean> eldest) { return size() > MAX_CACHE_ENTRIES; } })); } } Set<Pair<String>> serviceSpansEntry = entry.getValue(); synchronized(serviceSpansEntryCached) { serviceSpansEntry.removeAll(serviceSpansEntryCached); serviceSpansEntryCached.addAll(serviceSpansEntry); } } if (!indexToServiceSpans.isEmpty()) { indexNames(indexer, indexToServiceSpans); } indexer.execute(callbackWrapper); } catch (Throwable t) { propagateIfFatal(t); callbackWrapper.onError(t); } }
Source:
public void onPearlDamage(PlayerTeleportEvent event) { Player player = event.getPlayer(); TeleportCause cause = event.getCause(); Location destination = event.getTo(); if (BattlePlayer.getBattlePlayer(player).isSpectator()) { return; } else { if (event.getPlayer().getLocation().getWorld().getName().equals(name)) { if (disablePearlDamage(true)) { if (cause == TeleportCause.ENDER_PEARL) { event.setCancelled(true); player.teleport(destination); } } } } }

Target:
public void onPearlDamage(PlayerTeleportEvent event) { Player player = event.getPlayer(); TeleportCause cause = event.getCause(); Location destination = event.getTo(); if (!BattlePlayer.getBattlePlayer(player).isSpectator()) { if (event.getPlayer().getLocation().getWorld().getName().equals(name)) { if (pearlDamage) { if (cause == TeleportCause.ENDER_PEARL) { player.teleport(destination); event.setCancelled(true); } } } } }
Source:
public RuleResult validate(final PasswordData passwordData) { final RuleResult result = new RuleResult(true); String text = passwordData.getPassword(); if (text.length() > 1) { String matchingWord = doWordSearch(text); if (matchingWord != null) { result.setValid(false); result.getDetails().add(new RuleResultDetail(ERROR_CODE, createRuleResultDetailParameters(matchingWord))); } if (matchBackwards) { text = new StringBuilder(passwordData.getPassword()).reverse().toString(); matchingWord = doWordSearch(text); if (matchingWord != null) { result.setValid(false); result.getDetails().add( new RuleResultDetail(ERROR_CODE_REVERSED, createRuleResultDetailParameters(matchingWord))); } } } return result; }

Target:
public RuleResult validate(final PasswordData passwordData) { final RuleResult result = new RuleResult(true); String text = passwordData.getPassword(); String matchingWord = doWordSearch(text); if (matchingWord != null) { result.setValid(false); result.getDetails().add(new RuleResultDetail(ERROR_CODE, createRuleResultDetailParameters(matchingWord))); } if (matchBackwards && text.length() > 1) { text = new StringBuilder(passwordData.getPassword()).reverse().toString(); matchingWord = doWordSearch(text); if (matchingWord != null) { result.setValid(false); result.getDetails().add( new RuleResultDetail(ERROR_CODE_REVERSED, createRuleResultDetailParameters(matchingWord))); } } return result; }
Source:
protected Method getSuperMethod(Method method, final Class<?> clazz) { Method[] methods = new Method[0]; try { if (System.getSecurityManager() == null) { methods = clazz.getDeclaredMethods(); } else { methods = AccessController.doPrivileged(new PrivilegedExceptionAction<Method[]>() { @Override public Method[] run() throws Exception { return clazz.getDeclaredMethods(); } }); } } catch (PrivilegedActionException pae) { LogMessages.LOGGER.error(pae.getMessage()); } for (int i = 0; i < methods.length; i++) { if (overrides(method, methods[i])) { return methods[i]; } } return null; }

Target:
protected Method getSuperMethod(Method method, final Class<?> clazz) { Method[] methods = new Method[0]; try { if (System.getSecurityManager() == null) { methods = clazz.getDeclaredMethods(); } else { methods = AccessController.doPrivileged(new PrivilegedExceptionAction<Method[]>() { @Override public Method[] run() throws Exception { return clazz.getDeclaredMethods(); } }); } } catch (PrivilegedActionException pae) { throw new ResteasyViolationException(pae.getMessage()); } for (int i = 0; i < methods.length; i++) { if (overrides(method, methods[i])) { return methods[i]; } } return null; }
Source:
public Matrix(String matrixAsString) { String[] rows = newlinePattern.split(matrixAsString); matrix = new int[rows.length][]; for (int i = 0; i < rows.length; i++) { String[] columnValues = spacePattern.split(rows[i]); matrix[i] = new int[columnValues.length]; for (int j = 0; j < columnValues.length; j++) { matrix[i][j] = Integer.parseInt(columnValues[j]); } } }

Target:
Matrix(String matrixAsString) { String[] rows = newlinePattern.split(matrixAsString); matrix = new int[rows.length][]; for (int i = 0; i < rows.length; i++) { String[] columnValues = spacePattern.split(rows[i]); matrix[i] = new int[columnValues.length]; for (int j = 0; j < columnValues.length; j++) { matrix[i][j] = Integer.parseInt(columnValues[j]); } } }
Source:
public boolean areDeadServersInProgress() throws IOException { return master.getMasterProcedureExecutor().getActiveProceduresNoCopy().stream() .anyMatch(p -> p instanceof ServerCrashProcedure); }

Target:
public boolean areDeadServersInProgress() throws IOException { return master.getProcedures().stream() .anyMatch(p -> !p.isFinished() && p instanceof ServerCrashProcedure); }
Source:
public Object fromStorage(Object stored) { checkConverters(); if (stored == null) return null; return encoder.fromStorage(wrapper.unwrap(stored)); }

Target:
public Object fromStorage(Object stored) { if (stored == null) return null; checkConverters(); return encoder.fromStorage(wrapper.unwrap(stored)); }
Source:
public void testAdminAssignTicketOrder() { Map<String, Object> order = new HashMap<>(); List<String> options = Arrays.asList(CH_MEMBER, PICKUP_SERVICE); order.put("type", TEST_TICKET); order.put("options", options); User user = createUser(); User admin = createAdmin(); given(). header(getXAuthTokenHeaderForUser(admin)). when(). body(order).contentType(ContentType.JSON). post("/orders/ " + user.getId() + "/test/assigngiveaway"). then(). statusCode(HttpStatus.SC_CREATED). body("object.id", is(16)). body("object.tickets", hasSize(1)). body("object.tickets.type.name", hasItem(is(TEST_TICKET))). body("object.tickets.type.text", anything()). body("object.amount",equalTo(30F)); }

Target:
public void testAdminAssignTicketOrder() { Map<String, Object> assignObject = new HashMap<>(); User user = createUser(); assignObject.put("userID", user.getId()); assignObject.put("ticketType", TEST_TICKET); User admin = createAdmin(); given(). header(getXAuthTokenHeaderForUser(admin)). when(). body(assignObject).contentType(ContentType.JSON). post("/orders/assigngiveaway"). then(). statusCode(HttpStatus.SC_CREATED). body("object.tickets", hasSize(1)). body("object.tickets.type.name", hasItem(is(TEST_TICKET))). body("object.tickets.type.text", anything()). body("object.amount",equalTo(30F)); }
Source:
private void run_version(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { if (!sender.isPlayer() && ess.getUserMap().getUser(sender.getPlayer().getName()).isAuthorized("essentials.version")) return; boolean isMismatched = false; final PluginManager pm = server.getPluginManager(); sender.sendMessage("Server version: " + server.getBukkitVersion()); final String essVer = pm.getPlugin("Essentials").getDescription().getVersion(); sender.sendMessage("EssentialsX version: " + essVer); for (Plugin plugin : pm.getPlugins()) { final PluginDescriptionFile desc = plugin.getDescription(); if (desc.getName().startsWith("Essentials")) { String version = desc.getVersion(); if (!version.equalsIgnoreCase(essVer)) { version = "\u00a7c" + version; isMismatched = true; } sender.sendMessage(desc.getName().replace("Essentials", "EssentialsX") + " version: " + version); } } if (isMismatched) { sender.sendMessage("Version mismatch - make sure all EssentialsX plugins are the same version!"); } }

Target:
private void run_version(final Server server, final CommandSource sender, final String commandLabel, final String[] args) throws Exception { if (sender.isPlayer() && !ess.getUser(sender.getPlayer()).isAuthorized("essentials.version")) return; boolean isMismatched = false; boolean isVaultInstalled = false; final PluginManager pm = server.getPluginManager(); final String essVer = pm.getPlugin("Essentials").getDescription().getVersion(); sender.sendMessage("Server version: " + server.getBukkitVersion() + " " + server.getVersion()); sender.sendMessage("EssentialsX version: " + essVer); for (Plugin plugin : pm.getPlugins()) { final PluginDescriptionFile desc = plugin.getDescription(); String name = desc.getName(); String version = desc.getVersion(); if (name.startsWith("Essentials") && !name.equalsIgnoreCase("Essentials")) { if (!version.equalsIgnoreCase(essVer)) { version = "\u00a7c" + version; isMismatched = true; } sender.sendMessage(name.replace("Essentials", "EssentialsX") + " version: " + version); } if (versionPlugins.contains(name)) { sender.sendMessage(name + " version: " + version); } if (name.equals("Vault")) isVaultInstalled = true; } if (isMismatched) { sender.sendMessage(tl("versionMismatchAll")); } if (!isVaultInstalled) { sender.sendMessage("Vault is not installed - chat and permissions may not work."); } }
Source:
public void testExtendedModifiedSinceTermMatchException() { final ExtendedModifiedSinceTerm extendedModifiedSinceTerm = new ExtendedModifiedSinceTerm(1L); UnsupportedOperationException actual = null; try { extendedModifiedSinceTerm.match(null); } catch (final UnsupportedOperationException e) { actual = e; } Assert.assertNotNull(actual, "Should throw exception"); }

Target:
public void testExtendedModifiedSinceTermMatchException() { final ExtendedModifiedSinceTerm extendedModifiedSinceTerm = new ExtendedModifiedSinceTerm(1L); extendedModifiedSinceTerm.match(null); }
Source:
public PluginContainer getPlugin() { Object base = this; if (this instanceof CarriedInventory) { Optional<?> carrier = ((CarriedInventory<?>) this).getCarrier(); if (carrier.isPresent()) { base = carrier.get(); } } if (base instanceof TileEntity) { String id = ((TileEntity) this).getBlock().getType().getId(); String pluginId = id.substring(0, id.indexOf(":")); return Sponge.getPluginManager().getPlugin(pluginId) .orElseThrow(() -> new AssertionError("Missing plugin " + pluginId + " for block " + id)); } if (base instanceof Entity) { String id = ((Entity) this).getType().getId(); String pluginId = id.substring(0, id.indexOf(":")); return Sponge.getPluginManager().getPlugin(pluginId) .orElseThrow(() -> new AssertionError("Missing plugin " + pluginId + " for entity " + id + " (" + getClass().getName() + ")")); } if (base instanceof SpongeUser) { return SpongeImpl.getMinecraftPlugin(); } SpongeImpl.getLogger().warn("Unknown plugin for " + this); return SpongeImpl.getMinecraftPlugin(); }

Target:
public PluginContainer getPlugin() { Object base = this; if (this instanceof CarriedInventory) { Optional<?> carrier = ((CarriedInventory<?>) this).getCarrier(); if (carrier.isPresent()) { base = carrier.get(); } } if (base instanceof TileEntity) { String id = ((TileEntity) base).getBlock().getType().getId(); String pluginId = id.substring(0, id.indexOf(":")); return Sponge.getPluginManager().getPlugin(pluginId) .orElseThrow(() -> new AssertionError("Missing plugin " + pluginId + " for block " + id)); } if (base instanceof Entity) { String id = ((Entity) base).getType().getId(); String pluginId = id.substring(0, id.indexOf(":")); return Sponge.getPluginManager().getPlugin(pluginId) .orElseThrow(() -> new AssertionError("Missing plugin " + pluginId + " for entity " + id + " (" + getClass().getName() + ")")); } if (base instanceof SpongeUser) { return SpongeImpl.getMinecraftPlugin(); } return Sponge.getPluginManager().getPlugin(SpongeImplHooks.getModIdFromClass(this.getClass())).orElseGet(() -> { SpongeImpl.getLogger().warn("Unknown plugin for " + this); return SpongeImpl.getMinecraftPlugin(); }); }
Source:
private CompletionStage<RestResponse> getAllDetails(RestRequest request) { NettyRestResponse.Builder responseBuilder = new NettyRestResponse.Builder(); String cacheName = request.variables().get("cacheName"); Cache<?, ?> cache = invocationHelper.getRestCacheManager().getCache(cacheName, APPLICATION_JSON, APPLICATION_JSON, request); if (cache == null) { responseBuilder.status(HttpResponseStatus.NOT_FOUND); return CompletableFuture.completedFuture(responseBuilder.build()); } Stats stats = cache.getAdvancedCache().getStats(); Configuration configuration = cache.getCacheConfiguration(); int size = cache.getAdvancedCache().size(); boolean rehashInProgress = cache.getAdvancedCache().getDistributionManager().isRehashInProgress(); String version = cache.getVersion(); LocalizedCacheTopology cacheTopology = cache.getAdvancedCache().getDistributionManager().getCacheTopology(); Set<Address> membersSet = cacheTopology.getMembersSet(); ConsistentHash currentCH = cacheTopology.getCurrentCH(); try { CacheFullDetail fullDetail = new CacheFullDetail(); fullDetail.stats = stats; fullDetail.configuration = configuration; fullDetail.size = size; fullDetail.rehashInProgress = rehashInProgress; fullDetail.version = version; fullDetail.members = membersSet; fullDetail.consistentHash = currentCH; byte[] detailsResponse = invocationHelper.getMapper().writeValueAsBytes(fullDetail); responseBuilder.contentType(APPLICATION_JSON) .entity(detailsResponse) .status(OK); } catch (JsonProcessingException e) { responseBuilder.status(HttpResponseStatus.INTERNAL_SERVER_ERROR); } return CompletableFuture.completedFuture(responseBuilder.build()); }

Target:
private CompletionStage<RestResponse> getAllDetails(RestRequest request) { NettyRestResponse.Builder responseBuilder = new NettyRestResponse.Builder(); String cacheName = request.variables().get("cacheName"); Cache<?, ?> cache = invocationHelper.getRestCacheManager().getCache(cacheName, request); if (cache == null) { responseBuilder.status(HttpResponseStatus.NOT_FOUND); return CompletableFuture.completedFuture(responseBuilder.build()); } return CompletableFuture.supplyAsync(() -> getDetailResponse(responseBuilder, cache), invocationHelper.getExecutor()); }
Source:
public StorageDRModel() { setFrequency(new ListModel<StorageSyncSchedule.Frequency>()); setHour(new ListModel<Integer>()); setMins(new ListModel<Integer>()); setGeoRepSession(new ListModel<GlusterGeoRepSession>()); setNoSync(new EntityModel<Boolean>()); setStorageDomain(new EntityModel<StorageDomain>()); getNoSync().setEntity(false); frequency.setItems(Arrays.asList(StorageSyncSchedule.Frequency.values())); days = new ListModel<>(); List<StorageSyncSchedule.Day> daysList = Arrays.asList(StorageSyncSchedule.Day.values()); List<List<StorageSyncSchedule.Day>> list = new ArrayList<>(); list.add(daysList); days.setItems(list, new ArrayList<StorageSyncSchedule.Day>()); List<Integer> hours = new ArrayList<>(); for (int i=0; i < 24; i++) { hours.add(i); } hour.setItems(hours); List<Integer> minutes = new ArrayList<>(); for (int i=0; i < 60; i++) { minutes.add(i); } mins.setItems(minutes); getFrequency().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { if (getFrequency().getSelectedItem() == StorageSyncSchedule.Frequency.WEEKLY) { getDays().setIsAvailable(true); getHour().setIsAvailable(true); getMins().setIsAvailable(true); } else if (getFrequency().getSelectedItem() == StorageSyncSchedule.Frequency.DAILY) { getDays().setIsAvailable(false); getHour().setIsAvailable(true); getMins().setIsAvailable(true); } else { getDays().setIsAvailable(false); getHour().setIsAvailable(false); getMins().setIsAvailable(false); } } }); }

Target:
public StorageDRModel() { setFrequency(new ListModel<StorageSyncSchedule.Frequency>()); setHour(new ListModel<Integer>()); setMins(new ListModel<Integer>()); setGeoRepSession(new ListModel<GlusterGeoRepSession>()); setNoSync(new EntityModel<Boolean>()); setStorageDomain(new EntityModel<StorageDomain>()); getNoSync().setEntity(false); frequency.setItems(Arrays.asList(StorageSyncSchedule.Frequency.values())); days = new ListModel<>(); List<StorageSyncSchedule.Day> daysList = Arrays.asList(StorageSyncSchedule.Day.values()); List<List<StorageSyncSchedule.Day>> list = new ArrayList<>(); list.add(daysList); days.setItems(list, new ArrayList<StorageSyncSchedule.Day>()); List<Integer> hours = new ArrayList<>(); for (int i = 0; i < MAX_HOUR; i++) { hours.add(i); } hour.setItems(hours); List<Integer> minutes = new ArrayList<>(); for (int i = 0; i < MAX_MINUTE; i++) { minutes.add(i); } mins.setItems(minutes); getFrequency().getSelectedItemChangedEvent().addListener(new IEventListener<EventArgs>() { @Override public void eventRaised(Event<? extends EventArgs> ev, Object sender, EventArgs args) { boolean weekly = getFrequency().getSelectedItem() == StorageSyncSchedule.Frequency.WEEKLY; boolean daily = getFrequency().getSelectedItem() == StorageSyncSchedule.Frequency.DAILY; getDays().setIsAvailable(weekly); getHour().setIsAvailable(weekly || daily); getMins().setIsAvailable(weekly || daily); } }); }
Source:
public Button(Composite parent, String imageUri, String tooltip, ButtonViewModel model) { super(parent, SWT.SHADOW_OUT); setLayout(new GridLayout()); setRightMargin(0); GridData gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false); model.addPropertyChangeListener("width", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { gridData.widthHint = model.getWidth(); requestLayout(); } }); } }); setLayoutData(gridData); setToolTipText(tooltip); setImage(ResourceManager.getPluginImageFromUri(imageUri)); addMouseMoveListener(new MouseMoveListener() { @Override public void mouseMove(MouseEvent arg0) { mouseEnterAction(); } }); addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { mouseClickAction(); } @Override public void mouseDoubleClick(MouseEvent e) { mouseClickAction(); } }); addMouseTrackListener(new MouseTrackAdapter() { @Override public void mouseExit(MouseEvent e) { mouseExitAction(); } }); this.model = model; bindingContext.bindValue(WidgetProperties.background().observe(this), BeanProperties.value("color").observe(model)); bindingContext.bindValue(WidgetProperties.text().observe(this), BeanProperties.value("text").observe(model)); bindingContext.bindValue(WidgetProperties.font().observe(this), BeanProperties.value("font").observe(model)); }

Target:
public Button(Composite parent, String imageUri, String tooltip, ButtonViewModel model) { super(parent, SWT.SHADOW_OUT); setLayout(new GridLayout()); setRightMargin(0); GridData gridData = new GridData(SWT.LEFT, SWT.CENTER, false, false); model.addPropertyChangeListener("width", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { gridData.widthHint = (int) evt.getNewValue(); requestLayout(); } }); } }); setLayoutData(gridData); setToolTipText(tooltip); setImage(ResourceManager.getPluginImageFromUri(imageUri)); addMouseMoveListener(new MouseMoveListener() { @Override public void mouseMove(MouseEvent arg0) { mouseEnterAction(); } }); addMouseListener(new MouseAdapter() { @Override public void mouseDown(MouseEvent e) { mouseClickAction(); } @Override public void mouseDoubleClick(MouseEvent e) { mouseClickAction(); } }); addMouseTrackListener(new MouseTrackAdapter() { @Override public void mouseExit(MouseEvent e) { mouseExitAction(); } }); this.model = model; bindingContext.bindValue(WidgetProperties.background().observe(this), BeanProperties.value("color").observe(model)); bindingContext.bindValue(WidgetProperties.text().observe(this), BeanProperties.value("text").observe(model)); bindingContext.bindValue(WidgetProperties.font().observe(this), BeanProperties.value("font").observe(model)); }
Source:
protected void registerDefaultFuelTypes() { registerFuel(new MachineFuel(80, new ItemStack(Material.COAL_BLOCK))); registerFuel(new MachineFuel(12, new ItemStack(Material.BLAZE_ROD))); registerFuel(new MachineFuel(20, new ItemStack(Material.DRIED_KELP_BLOCK))); for (Material mat : Tag.ITEMS_BOATS.getValues()) { registerFuel(new MachineFuel(6, new ItemStack(mat))); } registerFuel(new MachineFuel(8, new ItemStack(Material.COAL))); registerFuel(new MachineFuel(8, new ItemStack(Material.CHARCOAL))); for (Material mat : Tag.LOGS.getValues()) { registerFuel(new MachineFuel(2, new ItemStack(mat))); } for (Material mat : Tag.PLANKS.getValues()) { registerFuel(new MachineFuel(1, new ItemStack(mat))); } for (Material mat : Tag.WOODEN_SLABS.getValues()) { registerFuel(new MachineFuel(1, new ItemStack(mat))); } for (Material mat : Tag.WOODEN_BUTTONS.getValues()) { registerFuel(new MachineFuel(1, new ItemStack(mat))); } for (Material mat : Tag.WOODEN_FENCES.getValues()) { registerFuel(new MachineFuel(1, new ItemStack(mat))); } for (Material mat : Tag.WOODEN_TRAPDOORS.getValues()) { registerFuel(new MachineFuel(1, new ItemStack(mat))); } for (Material mat : Tag.WOODEN_PRESSURE_PLATES.getValues()) { registerFuel(new MachineFuel(1, new ItemStack(mat))); } for (Material mat : Tag.WOODEN_DOORS.getValues()) { registerFuel(new MachineFuel(1, new ItemStack(mat))); } for (Material mat : Tag.SIGNS.getValues()) { registerFuel(new MachineFuel(1, new ItemStack(mat))); } }

Target:
protected void registerDefaultFuelTypes() { registerFuel(new MachineFuel(80, new ItemStack(Material.COAL_BLOCK))); registerFuel(new MachineFuel(12, new ItemStack(Material.BLAZE_ROD))); registerFuel(new MachineFuel(20, new ItemStack(Material.DRIED_KELP_BLOCK))); for (Material mat : Tag.ITEMS_BOATS.getValues()) { registerFuel(new MachineFuel(5, new ItemStack(mat))); } registerFuel(new MachineFuel(8, new ItemStack(Material.COAL))); registerFuel(new MachineFuel(8, new ItemStack(Material.CHARCOAL))); for (Material mat : Tag.LOGS.getValues()) { registerFuel(new MachineFuel(4, new ItemStack(mat))); } for (Material mat : Tag.PLANKS.getValues()) { registerFuel(new MachineFuel(1, new ItemStack(mat))); } for (Material mat : Tag.WOODEN_SLABS.getValues()) { registerFuel(new MachineFuel(1, new ItemStack(mat))); } for (Material mat : Tag.WOODEN_BUTTONS.getValues()) { registerFuel(new MachineFuel(1, new ItemStack(mat))); } for (Material mat : Tag.WOODEN_FENCES.getValues()) { registerFuel(new MachineFuel(1, new ItemStack(mat))); } for (Material mat : Tag.WOODEN_TRAPDOORS.getValues()) { registerFuel(new MachineFuel(3, new ItemStack(mat))); } for (Material mat : Tag.WOODEN_PRESSURE_PLATES.getValues()) { registerFuel(new MachineFuel(2, new ItemStack(mat))); } for (Material mat : Tag.WOODEN_DOORS.getValues()) { registerFuel(new MachineFuel(2, new ItemStack(mat))); } for (Material mat : Tag.SIGNS.getValues()) { registerFuel(new MachineFuel(2, new ItemStack(mat))); } }
Source:
private void pollExecution() { if (this.pollingCriteria.shouldPoll()) { if (this.pollingCriteria.satisfiesUnsavedDataAvailableCriteria()) { LOGGER.info("Saving Ramp Setting to Database."); FlowRampManager.this.saveSettings(); } LOGGER.info("Load Ramp Setting from Database."); FlowRampManager.this.loadSettings(); } }

Target:
private void pollExecution() { if (this.pollingCriteria.shouldPoll()) { if (this.pollingCriteria.satisfiesUnsavedDataAvailableCriteria()) { LOGGER.info("Save Ramp Setting to Database."); FlowRampManager.this.saveSettings(); } LOGGER.info("Load Ramp Setting from Database."); FlowRampManager.this.loadSettings(); } }
Source:
private List<Flight> searchByTime(SearchParams searchParams) { try { allFlights = dao.getAllFlights(); } catch (SQLException e) { e.printStackTrace(); } searchParams.setHour(Integer.parseInt(searchParams.getDate().substring(8, 10))); searchParams.setMinute(Integer.parseInt(searchParams.getDate().substring(10, 12))); for(int i=0; i < allFlights.size(); i++ ) { searchParams.setSearchDate(allFlights.get(i).getDate()); searchParams.setSearchHour(Integer.parseInt(searchParams.getSearchDate().substring(8, 10))); searchParams.setSearchMinute(Integer.parseInt(searchParams.getSearchDate().substring(10, 12))); if(searchParams.getSearchHour() == searchParams.getHour()){ if(searchParams.getSearchMinute() == searchParams.getMinute()){ searchFlights.add(allFlights.get(i)); } } } return searchFlights; }

Target:
private List<Flight> searchByTime(SearchParams searchParams) throws ParseException { try { allFlights = dao.getAllFlights(); } catch (SQLException e) { e.printStackTrace(); } searchParams.setHour(Integer.parseInt(searchParams.getDate().substring(8, 10))); searchParams.setMinute(Integer.parseInt(searchParams.getDate().substring(10, 12))); for(int i=0; i < allFlights.size(); i++ ) { searchParams.setSearchDate(allFlights.get(i).getDate()); searchParams.setSearchHour(Integer.parseInt(searchParams.getSearchDate().substring(8, 10))); searchParams.setSearchMinute(Integer.parseInt(searchParams.getSearchDate().substring(10, 12))); if(searchParams.getSearchHour() == searchParams.getHour()){ if(searchParams.getSearchMinute() == searchParams.getMinute()){ searchFlights.add(allFlights.get(i)); } } } return searchFlights; }
Source:
private static boolean directoryIsValidGitRepo(File f) { Repository subRepo = null; try { File gitDir = new File(f, Constants.DOT_GIT); if (gitDir.isDirectory()) { subRepo = new RepositoryBuilder().setGitDir(gitDir) .setMustExist(true).build(); subRepo.resolve(Constants.HEAD); return true; } else return false; } catch (IOException e) { return false; } finally { if (subRepo != null) subRepo.close(); } }

Target:
private static boolean directoryIsValidGitRepo(File f) { Repository subRepo = null; try { File dotGit = new File(f, Constants.DOT_GIT); subRepo = new RepositoryBuilder().setGitDir(dotGit) .setMustExist(true).build(); subRepo.resolve(Constants.HEAD); return true; } catch (IOException e) { return false; } finally { if (subRepo != null) subRepo.close(); } }
Source:
@Override public Object execute(GridClientConfiguration cfg, Logger logger) throws Exception { logger.warning("Command deprecated. Use " + SET_STATE.toString() + " instead."); try (GridClient client = Command.startClient(cfg)) { GridClientClusterState state = client.state(); state.state(ACTIVE, true); logger.info("Cluster activated"); } catch (Throwable e) { logger.severe("Failed to activate cluster."); throw e; } return null; }

Target:
@Override public Object execute(GridClientConfiguration cfg, Logger logger) throws Exception { logger.warning("Command deprecated. Use " + SET_STATE.toString() + " instead."); try (GridClient client = Command.startClient(cfg)) { GridClientClusterState state = client.state(); state.state(ACTIVE, false); logger.info("Cluster activated"); } catch (Throwable e) { logger.severe("Failed to activate cluster."); throw e; } return null; }
Source:
public Iterable<@NonNull ITmfEventAspect> getEventAspects() { return CTF_ASPECTS; }

Target:
public Iterable<ITmfEventAspect> getEventAspects() { return CTF_ASPECTS; }
Source:
public boolean implies(Permission permission) { if (!(permission instanceof PrincipalPermission)) { return false; } PrincipalPermission permissionToRespect = (PrincipalPermission) permission; if (permissionToRespect.principals.isEmpty()) return true; int nbPrincipals = permissionToRespect.principals.size(); long nbExcludedPrincipals = permissionToRespect.principals.stream() .filter(c -> c instanceof NotIdentityPrincipal) .count(); if (nbExcludedPrincipals == 0) { for (Permission p : permissions) { if (p.implies(permission)) { return true; } } return false; } else if (nbExcludedPrincipals == nbPrincipals) { for (Permission p : permissions) { if (!p.implies(permission)) { return false; } } return true; } else { throw new IllegalArgumentException("Not supposed to find mixed included/excluded principals in permission"); } }

Target:
public boolean implies(Permission permission) { if (!(permission instanceof PrincipalPermission)) { return false; } PrincipalPermission permissionToRespect = (PrincipalPermission) permission; if (permissionToRespect.principals.isEmpty()) { return true; } int nbPrincipals = permissionToRespect.principals.size(); long nbExcludedPrincipals = permissionToRespect.principals.stream() .filter(c -> c instanceof ExcludedIdentityPrincipal) .count(); if (nbExcludedPrincipals == 0) { return permissions.stream().anyMatch(p -> p.implies(permission)); } else if (nbExcludedPrincipals == nbPrincipals) { return !permissions.stream().anyMatch(p -> !p.implies(permission)); } else { return false; } }
Source:
public boolean equals(Object other) { if (this == other) { return true; } if (other == null || !(other instanceof Features)) { return false; } final Features that = (Features) other; return Objects.equals(this.features, that.features); }

Target:
public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof Features)) { return false; } final Features that = (Features) other; return Objects.equals(this.features, that.features); }
Source:
private void offerInternal(Mailbox mailbox, Item item, long handle) { if (item.getSpHandle() <= handle) { mailbox.send(item.getResponseHSId(), item.getMessage()); } else { m_bufferedReads.add(item); releaseBufferedReads(mailbox, handle); } }

Target:
private void offerInternal(Mailbox mailbox, Item item, long handle) { m_bufferedReads.add(item); releaseBufferedReads(mailbox, handle); }
Source:
public void onAttachFragment(Fragment fragment) { if (fragment instanceof FavoritesFragmentStateHolder) { if (intentParams != null && intentParams.getInt(TAB_ID, -1) != -1) { Bundle b = new Bundle(); int tabId = intentParams.getInt(TAB_ID, FAV_TAB); if (tabId == FAV_TAB && fragment instanceof FavoritesTreeFragment) { b.putString(FavoritesFragmentStateHolder.GROUP_NAME_TO_SHOW, intentParams.getString(FavoritesFragmentStateHolder.GROUP_NAME_TO_SHOW)); b.putInt(FavoritesFragmentStateHolder.GROUP_POSITION, intentParams.getInt( FavoritesFragmentStateHolder.GROUP_POSITION, 0)); b.putInt(FavoritesFragmentStateHolder.ITEM_POSITION, intentParams.getInt(FavoritesFragmentStateHolder.ITEM_POSITION, 0)); } else if (tabId == GPX_TAB && fragment instanceof AvailableGPXFragment) { b.putInt(FavoritesFragmentStateHolder.GROUP_POSITION, intentParams.getInt(FavoritesFragmentStateHolder.GROUP_POSITION, 0)); b.putInt(FavoritesFragmentStateHolder.ITEM_POSITION, intentParams.getInt(FavoritesFragmentStateHolder.ITEM_POSITION, 0)); } else if (tabId == NOTES_TAB && fragment instanceof NotesFragment) { b.putInt(FavoritesFragmentStateHolder.ITEM_POSITION, intentParams.getInt(FavoritesFragmentStateHolder.ITEM_POSITION, 0)); } else if (tabId == OSM_TAB && fragment instanceof OsmEditsFragment) { b.putInt(FavoritesFragmentStateHolder.ITEM_POSITION, intentParams.getInt(FavoritesFragmentStateHolder.ITEM_POSITION, 0)); } fragment.setArguments(b); } fragList.add(new WeakReference<>((FavoritesFragmentStateHolder) fragment)); } }

Target:
public void onAttachFragment(Fragment fragment) { if (fragment instanceof FavoritesFragmentStateHolder) { if (intentParams != null && intentParams.getInt(TAB_ID, -1) != -1) { Bundle b = new Bundle(); int tabId = intentParams.getInt(TAB_ID, FAV_TAB); b.putInt(TAB_ID, intentParams.getInt(TAB_ID, FAV_TAB)); if (tabId == FAV_TAB) { b.putString(FavoritesFragmentStateHolder.GROUP_NAME_TO_SHOW, intentParams.getString(FavoritesFragmentStateHolder.GROUP_NAME_TO_SHOW)); b.putInt(FavoritesFragmentStateHolder.GROUP_POSITION, intentParams.getInt( FavoritesFragmentStateHolder.GROUP_POSITION, 0)); } b.putInt(FavoritesFragmentStateHolder.ITEM_POSITION, intentParams.getInt(FavoritesFragmentStateHolder.ITEM_POSITION, 0)); fragment.setArguments(b); } fragList.add(new WeakReference<>((FavoritesFragmentStateHolder) fragment)); } }
Source:
public Pair<Double, Double> getRawExtrema(LayerConfiguration config) throws ConfigurationException { if (_minVals == null) { String layer = config.getPropertyValue(LayerConfiguration.LAYER_ID); _minVals = parseExtremum(config, LayerConfiguration.LEVEL_MINIMUMS, "minimum", layer, 0.0); _maxVals = parseExtremum(config, LayerConfiguration.LEVEL_MAXIMUMS, "maximum", layer, 1000.0); if (_startBucket == null) { _startBucket = 0; _endBucket = _minVals.size(); } } double minimumValue = Double.MIN_VALUE; double maximumValue = -Double.MAX_VALUE; if (_startBucket == _endBucket) { minimumValue = _minVals.get(_startBucket); maximumValue = _maxVals.get(_startBucket); } else { if (_endBucket <= _minVals.size()) { for (int i = _startBucket; i < _endBucket; i++) { Double val = _minVals.get(i); if (val < minimumValue) { minimumValue = val; } val = _maxVals.get(i); if (val > maximumValue) { maximumValue = val; } } } else { minimumValue = maximumValue = 0; } } return new Pair<>(minimumValue, maximumValue); }

Target:
public Pair<Double, Double> getRawExtrema(LayerConfiguration config) throws ConfigurationException { if (_minVals == null) { String layer = config.getPropertyValue(LayerConfiguration.LAYER_ID); _minVals = parseExtremum(config, LayerConfiguration.LEVEL_MINIMUMS, "minimum", layer, 0.0); _maxVals = parseExtremum(config, LayerConfiguration.LEVEL_MAXIMUMS, "maximum", layer, 1000.0); if (_startBucket == null) { _startBucket = 0; _endBucket = _minVals.size(); } } double minimumValue = Double.MIN_VALUE; double maximumValue = -Double.MAX_VALUE; if (_startBucket == _endBucket) { minimumValue = _minVals.get(_startBucket); maximumValue = _maxVals.get(_startBucket); } else { _endBucket = (_endBucket <= _minVals.size()) ? _endBucket : _minVals.size(); for (int i = _startBucket; i < _endBucket; i++) { Double val = _minVals.get(i); if (val < minimumValue) { minimumValue = val; } val = _maxVals.get(i); if (val > maximumValue) { maximumValue = val; } } } return new Pair<>(minimumValue, maximumValue); }
Source:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { super.doGet(request, response); String jsonp = request.getParameter(HTTPClientInterface.JSONP); AuthenticationResult authResult = null; String target = request.getPathInfo(); if (target == null) target = "/"; try { response.setContentType(HTTPAdminListener.JSON_CONTENT_TYPE); if (!HTTPClientInterface.validateJSONP(jsonp, (Request )request, response)) { return; } response.setStatus(HttpServletResponse.SC_OK); authResult = authenticate(request); if (!authResult.isAuthenticated()) { response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, authResult.m_message)); response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); return; } if (!target.equals("/")) { response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, "Resource not found")); response.setStatus(HttpServletResponse.SC_NOT_FOUND); return; } if (jsonp != null) { response.getWriter().write(jsonp + "("); } m_mapper.writeValue(response.getWriter(), new Profile(authResult.m_user, authResult.m_perms)); if (jsonp != null) { response.getWriter().write(")"); } } catch (Exception ex) { m_log.info("Not servicing url: " + target + " Details: " + ex.getMessage(), ex); } }

Target:
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { super.doGet(request, response); String jsonp = request.getParameter(HTTPClientInterface.JSONP); AuthenticationResult authResult = null; String target = request.getPathInfo(); if (target == null) target = "/"; try { response.setContentType(HTTPAdminListener.JSON_CONTENT_TYPE); if (!HTTPClientInterface.validateJSONP(jsonp, (Request )request, response)) { return; } response.setStatus(HttpServletResponse.SC_OK); authResult = authenticate(request); if (!authResult.isAuthenticated()) { response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, authResult.m_message)); response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); return; } if (!target.equals("/")) { response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, "Resource not found")); response.setStatus(HttpServletResponse.SC_NOT_FOUND); return; } if (jsonp != null) { response.getWriter().write(jsonp + "("); } m_mapper.writeValue(response.getWriter(), new Profile(authResult.m_user, authResult.m_perms)); if (jsonp != null) { response.getWriter().write(")"); } } catch (Exception ex) { rateLimitedLogWarn("Not servicing url: %s Details: ", target, ex.getMessage()); response.setStatus(HttpServletResponse.SC_BAD_REQUEST); response.getWriter().print(buildClientResponse(null, ClientResponse.UNEXPECTED_FAILURE, Throwables.getStackTraceAsString(ex))); } }
Source:
public HeroicConfig.Builder build(final ExtraParameters params) throws Exception { final BigtableMetricModule.Builder module = BigtableMetricModule.builder(); params.get("project").map(module::project); params.get("instance").map(module::instance); final String credentials = params.get("credential").orElse(DEFAULT_CREDENTIALS); switch (credentials) { case "json": final JsonCredentialsBuilder.Builder j = JsonCredentialsBuilder.builder(); params.get("json").map(Paths::get).ifPresent(j::path); module.credentials(j.build()); break; case "service-account": final ServiceAccountCredentialsBuilder.Builder sa = ServiceAccountCredentialsBuilder.builder(); params.get("serviceAccount").ifPresent(sa::serviceAccount); params.get("keyFile").ifPresent(sa::keyFile); module.credentials(sa.build()); break; case "compute-engine": module.credentials(new ComputeEngineCredentialsBuilder()); break; default: case "default": module.credentials(new DefaultCredentialsBuilder()); break; } return HeroicConfig.builder() .metrics( MetricManagerModule.builder() .backends(ImmutableList.<MetricModule>of(module.build())) ); }

Target:
public HeroicConfig.Builder build(final ExtraParameters params) throws Exception { final BigtableMetricModule.Builder module = BigtableMetricModule.builder(); params.get("project").map(module::project); params.get("instance").map(module::instance); final String credentials = params.get("credential").orElse(DEFAULT_CREDENTIALS); switch (credentials) { case "json": final JsonCredentialsBuilder.Builder j = JsonCredentialsBuilder.builder(); params.get("json").map(Paths::get).ifPresent(j::path); module.credentials(j.build()); break; case "service-account": final ServiceAccountCredentialsBuilder.Builder sa = ServiceAccountCredentialsBuilder.builder(); params.get("serviceAccount").ifPresent(sa::serviceAccount); params.get("keyFile").ifPresent(sa::keyFile); module.credentials(sa.build()); break; case "compute-engine": module.credentials(new ComputeEngineCredentialsBuilder()); break; case "default": module.credentials(new DefaultCredentialsBuilder()); break; default: throw new IllegalArgumentException("credentials: invalid value: " + credentials); } return HeroicConfig.builder() .metrics( MetricManagerModule.builder() .backends(ImmutableList.<MetricModule>of(module.build())) ); }
Source:
public void testAdminLogQuery() { ______TS("Test constructor with parameters"); List<String> versionList = new ArrayList<>(); versionList.add("5-44"); Calendar cal = new GregorianCalendar(); cal.set(1994, Calendar.MAY, 7, 15, 30, 12); long startTime = cal.getTimeInMillis(); cal.add(Calendar.YEAR, 22); long endTime = cal.getTimeInMillis(); AdminLogQuery query = new AdminLogQuery(versionList, startTime, endTime); assertEquals(startTime, query.getStartTime()); assertEquals(endTime, query.getEndTime()); assertNotNull(query.getQuery()); ______TS("Test setTimePeriod"); query = new AdminLogQuery(versionList, null, null); assertEquals(0, query.getStartTime()); AssertJUnit.assertNotSame(endTime, query.getStartTime()); query.setTimePeriod(startTime, endTime); assertEquals(startTime, query.getStartTime()); assertEquals(endTime, query.getEndTime()); assertNotNull(query.getQuery()); }

Target:
public void testAdminLogQuery() { ______TS("Test constructor with parameters"); List<String> versionList = new ArrayList<>(); versionList.add("5-44"); Calendar cal = new GregorianCalendar(); cal.set(1994, Calendar.MAY, 7, 15, 30, 12); long startTime = cal.getTimeInMillis(); cal.add(Calendar.YEAR, 22); long endTime = cal.getTimeInMillis(); AdminLogQuery query = new AdminLogQuery(versionList, startTime, endTime); assertEquals(startTime, query.getStartTime()); assertEquals(endTime, query.getEndTime()); assertNotNull(query.getQuery()); ______TS("Test setTimePeriod"); query = new AdminLogQuery(versionList, null, null); assertEquals(0, query.getStartTime()); assertNotEquals(endTime, query.getStartTime()); query.setTimePeriod(startTime, endTime); assertEquals(startTime, query.getStartTime()); assertEquals(endTime, query.getEndTime()); assertNotNull(query.getQuery()); }
Source:
private void onChannelClose(Channel channel) { if (channels.remove(channel.id()) != null && channels.isEmpty()) messageSender.close(); }

Target:
private synchronized void onChannelClose(Channel channel) { if (channels.remove(channel.id()) != null && channels.isEmpty()) messageSender.close(); }
Source:
public PieceCount getPieceCount() { return new PieceCount(1); }

Target:
public PieceCount getPieceCount() { return new PieceCount(0); }
Source:
public void shouldRegisterAndUnregisterMetric() { healthCheckRegistryService.register("foo", new HealthCheck() { @Override public Result check() throws HealthCheckException { return null; } }); Set<String> registered = healthCheckRegistryService.getNames(); assertNotNull(registered); assertTrue(registered.size() == 2); assertTrue(registered.contains("foo")); healthCheckRegistryService.unregister("foo"); Set<String> unregistered = healthCheckRegistryService.getNames(); assertTrue(unregistered.size() == 1); assertFalse(unregistered.contains("foo")); }

Target:
public void shouldRegisterAndUnregisterMetric() { healthCheckRegistryService.register("foo", new HealthCheck() { @Override public Result check() throws HealthCheckException { return null; } }); Set<String> registered = healthCheckRegistryService.getNames(); assertNotNull(registered); assertEquals(2, registered.size()); assertTrue(registered.contains("foo")); healthCheckRegistryService.unregister("foo"); Set<String> unregistered = healthCheckRegistryService.getNames(); assertEquals(1, unregistered.size()); assertFalse(unregistered.contains("foo")); }
Source:
public FileSystemWatcher createFileSystemWatcher(String name, OptionMap options) { boolean useWatchService = options.get(Options.USE_WATCH_SERVICE, true); boolean daemonThread = options.get(Options.THREAD_DAEMON, true); if(useWatchService) { try { return new WatchServiceFileSystemWatcher(name, daemonThread); } catch (LinkageError e) { } } int pollInterval = options.get(Options.WATCHER_POLL_INTERVAL, 5000); return new PollingFileSystemWatcher(name, pollInterval, daemonThread); }

Target:
public FileSystemWatcher createFileSystemWatcher(String name, OptionMap options) { try { boolean daemonThread = options.get(Options.THREAD_DAEMON, true); return new WatchServiceFileSystemWatcher(name, daemonThread); } catch (LinkageError e) { } return super.createFileSystemWatcher(name, options); }
Source:
private RemoteTenantManagerServiceStub getStub() throws UserStoreException { if (stub == null) { try { stub = new RemoteTenantManagerServiceStub(UserMgtWSAPIDSComponent .getCcServiceInstance().getClientConfigContext(), url + SERVICE_NAME); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); LoginSender sender = new LoginSender(); String sessionCookie = sender.login(); if (sessionCookie == null) { throw new UserStoreException(SERVER_LOGIN_ERROR); } option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie); } catch (AxisFault axisFault) { if (log.isDebugEnabled()) { log.debug(AXIS_FAULT_MESSAGE, axisFault); } } } return stub; }

Target:
private RemoteTenantManagerServiceStub getStub() throws UserStoreException { if (stub == null) { try { stub = new RemoteTenantManagerServiceStub(UserMgtWSAPIDSComponent .getCcServiceInstance().getClientConfigContext(), url + SERVICE_NAME); ServiceClient client = stub._getServiceClient(); Options option = client.getOptions(); option.setManageSession(true); LoginSender sender = new LoginSender(); String sessionCookie = sender.login(); if (sessionCookie == null) { throw new UserStoreException(SERVER_LOGIN_ERROR); } option.setProperty(org.apache.axis2.transport.http.HTTPConstants.COOKIE_STRING, sessionCookie); } catch (AxisFault axisFault) { throw new UserStoreException("Axis error occurred while creating service client stub",axisFault); } } return stub; }
Source:
private static void handleEDTException(Throwable t) { Logging.error("Exception raised in EDT: {0}", t); }

Target:
private static void handleEDTException(Throwable t) { Logging.logWithStackTrace(Logging.LEVEL_ERROR, t, "Exception raised in EDT"); }
Source:
public void testOnTimerDurationChange() { String value = ""; editor.setValue(value); when(view.getTimeDuration()).thenReturn(VALUE_1); editor.onTimerDurationChange(); verify(changeHandler, times(1)).onValueChange(oldValueCaptor.capture(), newValueCaptor.capture()); assertEquals(value, oldValueCaptor.getValue()); value = VALUE_1; assertEquals(value, newValueCaptor.getValue()); }

Target:
public void testOnTimerDurationChange() { String value = ""; editor.setValue(value); when(view.getTimeDuration()).thenReturn("P6D"); when(view.isValid()).thenReturn(true); editor.onTimerDurationChange(); verify(changeHandler, times(1)).onValueChange(oldValueCaptor.capture(), newValueCaptor.capture()); assertEquals(value, oldValueCaptor.getValue()); assertEquals("P6D", newValueCaptor.getValue()); }