auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
XmrTxProofRequest(Socks5ProxyProvider socks5ProxyProvider, XmrTxProofModel model) { this.parser = new XmrTxProofParser(); this.model = model; httpClient = new XmrTxProofHttpClient(socks5ProxyProvider); if (model.getServiceAddress().regionMatches(0, "http:", 0, 5)) { httpClient.setBaseUrl(model.getServiceAddress()); httpClient.setIgnoreSocks5Proxy(true); } if (model.getServiceAddress().regionMatches(0, "https:", 0, 6)) { httpClient.setBaseUrl(model.getServiceAddress()); httpClient.setIgnoreSocks5Proxy(false); } else { httpClient.setBaseUrl("http://" + model.getServiceAddress()); httpClient.setIgnoreSocks5Proxy(false); } terminated = false; firstRequest = System.currentTimeMillis(); }

Target:
XmrTxProofRequest(Socks5ProxyProvider socks5ProxyProvider, XmrTxProofModel model) { this.parser = new XmrTxProofParser(); this.model = model; httpClient = new XmrTxProofHttpClient(socks5ProxyProvider); if (model.getServiceAddress().regionMatches(0, "http:", 0, 5)) { httpClient.setBaseUrl(model.getServiceAddress()); httpClient.setIgnoreSocks5Proxy(true); } else if (model.getServiceAddress().regionMatches(0, "https:", 0, 6)) { httpClient.setBaseUrl(model.getServiceAddress()); httpClient.setIgnoreSocks5Proxy(false); } else { httpClient.setBaseUrl("http://" + model.getServiceAddress()); httpClient.setIgnoreSocks5Proxy(false); } terminated = false; firstRequest = System.currentTimeMillis(); }
Source:
private static Class<? extends ICategoryFilter> getCategoryFilterClass(IConfigurationElement element) { try { return (Class<? extends ICategoryFilter>)element.createExecutableExtension("category-filter-class").getClass(); } catch(CoreException e) { WebUiPlugin.getDefault().logError(e); return null; } }

Target:
private static Class<? extends ICategoryFilter> getCategoryFilterClass(IConfigurationElement element) { if(element.getAttribute("category-filter-class") != null){ try { Object o = element.createExecutableExtension("category-filter-class"); if(o instanceof ICategoryFilter) { return (Class<? extends ICategoryFilter>)o.getClass(); } else { WebUiPlugin.getDefault().logError("Category Filter " + element.getAttribute("category-filter-class") + " should implement ICategoryFilter."); } } catch(CoreException e) { WebUiPlugin.getDefault().logError(e); } } return null; }
Source:
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { pos = pos.offset(facing); ItemStack itemstack = player.getHeldItem(hand); Binding binding = getBinding(player.getHeldItem(hand)); if (binding != null) { if (!player.canPlayerEdit(pos, facing, itemstack)) return EnumActionResult.FAIL; if (worldIn.isAirBlock(pos) && NetworkHelper.getSoulNetwork(binding).syphonAndDamage(player, SoulTicket.item(player.getHeldItem(hand), 100)).isSuccess()) { worldIn.playSound(player, pos, SoundEvents.ITEM_FIRECHARGE_USE, SoundCategory.BLOCKS, 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); worldIn.setBlockState(pos, Blocks.FIRE.getDefaultState(), 11); } else return EnumActionResult.FAIL; if (player instanceof EntityPlayerMP) CriteriaTriggers.PLACED_BLOCK.trigger((EntityPlayerMP) player, pos, itemstack); return EnumActionResult.SUCCESS; } else return EnumActionResult.FAIL; }

Target:
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { pos = pos.offset(facing); ItemStack itemstack = player.getHeldItem(hand); Binding binding = getBinding(player.getHeldItem(hand)); if (binding == null) return EnumActionResult.FAIL; if (!player.canPlayerEdit(pos, facing, itemstack)) return EnumActionResult.FAIL; if (worldIn.isAirBlock(pos) && NetworkHelper.getSoulNetwork(binding).syphonAndDamage(player, SoulTicket.item(player.getHeldItem(hand), 100)).isSuccess()) { worldIn.playSound(player, pos, SoundEvents.ITEM_FIRECHARGE_USE, SoundCategory.BLOCKS, 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); worldIn.setBlockState(pos, Blocks.FIRE.getDefaultState(), 11); } else return EnumActionResult.FAIL; if (player instanceof EntityPlayerMP) CriteriaTriggers.PLACED_BLOCK.trigger((EntityPlayerMP) player, pos, itemstack); return EnumActionResult.SUCCESS; }
Source:
public void update(SolGame game) { addRemove(game); float ts = game.getTimeStep(); myWorld.step(ts, 6, 2); SolCam cam = game.getCam(); Vector2 camPos = cam.getPos(); myFarEndDist = 1.5f * cam.getViewDist(); myFarBeginDist = 1.33f * myFarEndDist; boolean recalcRad = false; if (myRadiusRecalcAwait > 0) { myRadiusRecalcAwait -= ts; } else { myRadiusRecalcAwait = MAX_RADIUS_RECALC_AWAIT; recalcRad = true; } for (SolObject o : myObjs) { o.update(game); SolMath.checkVectorsTaken(o); List<Drawable> drawables = o.getDrawables(); for (Drawable drawable : drawables) { drawable.update(game, o); } if (o.shouldBeRemoved(game)) { removeObjDelayed(o); continue; } if (isFar(o, camPos)) { if (o != game.getHero().getHero()) { FarObj fo = o.toFarObj(); if (fo != null) { addFarObjNow(fo); } removeObjDelayed(o); continue; } } if (recalcRad) { recalcRadius(o); } } for (Iterator<FarObjData> it = myFarObjs.iterator(); it.hasNext(); ) { FarObjData fod = it.next(); FarObj fo = fod.fo; fo.update(game); SolMath.checkVectorsTaken(fo); if (fo.shouldBeRemoved(game)) { removeFo(it, fo); continue; } if (isNear(fod, camPos, ts)) { SolObject o = fo.toObj(game); if (o instanceof StarPort) { addObjNow(game, o); } else { addObjDelayed(o); } removeFo(it, fo); } } addRemove(game); }

Target:
public void update(SolGame game) { addRemove(game); float ts = game.getTimeStep(); myWorld.step(ts, 6, 2); SolCam cam = game.getCam(); Vector2 camPos = cam.getPos(); myFarEndDist = 1.5f * cam.getViewDist(); myFarBeginDist = 1.33f * myFarEndDist; boolean recalcRad = false; if (myRadiusRecalcAwait > 0) { myRadiusRecalcAwait -= ts; } else { myRadiusRecalcAwait = MAX_RADIUS_RECALC_AWAIT; recalcRad = true; } for (SolObject o : myObjs) { o.update(game); SolMath.checkVectorsTaken(o); List<Drawable> drawables = o.getDrawables(); for (Drawable drawable : drawables) { drawable.update(game, o); } if (o.shouldBeRemoved(game)) { removeObjDelayed(o); if (game.getHero().isAlive() && game.getHero().isNonTranscendent() && o == game.getHero().getHero()) { game.getHero().die(); } continue; } if (isFar(o, camPos)) { if (game.getHero().isAlive() && game.getHero().isNonTranscendent() && o != game.getHero().getHero()) { FarObj fo = o.toFarObj(); if (fo != null) { addFarObjNow(fo); } removeObjDelayed(o); continue; } } if (recalcRad) { recalcRadius(o); } } for (Iterator<FarObjData> it = myFarObjs.iterator(); it.hasNext(); ) { FarObjData fod = it.next(); FarObj fo = fod.fo; fo.update(game); SolMath.checkVectorsTaken(fo); if (fo.shouldBeRemoved(game)) { removeFo(it, fo); continue; } if (isNear(fod, camPos, ts)) { SolObject o = fo.toObj(game); if (o instanceof StarPort) { addObjNow(game, o); } else { addObjDelayed(o); } removeFo(it, fo); } } addRemove(game); }
Source:
public void run() { getWrappedRunnable().run(); if (!sd.isDisposed()) { long nextTick; long nowNanoseconds = now(TimeUnit.NANOSECONDS); if (nowNanoseconds + CLOCK_DRIFT_TOLERANCE_NANOSECONDS < lastNowNanoseconds || nowNanoseconds >= lastNowNanoseconds + periodInNanoseconds + CLOCK_DRIFT_TOLERANCE_NANOSECONDS) { nextTick = nowNanoseconds + periodInNanoseconds; startInNanoseconds = nextTick - (periodInNanoseconds * (++count)); } else { nextTick = startInNanoseconds + (++count * periodInNanoseconds); } lastNowNanoseconds = nowNanoseconds; long delay = nextTick - nowNanoseconds; sd.replace(schedule(this, delay, TimeUnit.NANOSECONDS)); } }

Target:
public void run() { decoratedRun.run(); if (!sd.isDisposed()) { long nextTick; long nowNanoseconds = now(TimeUnit.NANOSECONDS); if (nowNanoseconds + CLOCK_DRIFT_TOLERANCE_NANOSECONDS < lastNowNanoseconds || nowNanoseconds >= lastNowNanoseconds + periodInNanoseconds + CLOCK_DRIFT_TOLERANCE_NANOSECONDS) { nextTick = nowNanoseconds + periodInNanoseconds; startInNanoseconds = nextTick - (periodInNanoseconds * (++count)); } else { nextTick = startInNanoseconds + (++count * periodInNanoseconds); } lastNowNanoseconds = nowNanoseconds; long delay = nextTick - nowNanoseconds; sd.replace(schedule(this, delay, TimeUnit.NANOSECONDS)); } }
Source:
protected void onCreate(Bundle savedInstanceState) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); setTheme(UIUtils.getThemeResourceId( prefs.getString(Settings.KEY_PREF_THEME, Settings.DEFAULT_PREF_THEME))); super.onCreate(savedInstanceState); hostManager = HostManager.getInstance(this); if (hostManager.getHostInfo() == null && !(this instanceof AddHostActivity)) { final Intent intent = new Intent(this, AddHostActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); finish(); } }

Target:
protected void onCreate(Bundle savedInstanceState) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); setTheme(UIUtils.getThemeResourceId( prefs.getString(Settings.KEY_PREF_THEME, Settings.DEFAULT_PREF_THEME))); super.onCreate(savedInstanceState); }
Source:
public StreamsAddressRequest() { this.reqType = ALL_STREAMS; this.streamsRanges = Collections.EMPTY_LIST; beforeCompactionMark = false; }

Target:
public StreamsAddressRequest() { this.reqType = ALL_STREAMS; this.streamsRanges = Collections.emptyList(); forSequencerTrim = false; }
Source:
public void optimizeStatement() throws StandardException { SubqueryFlattening.flatten(this); resultSet = resultSet.preprocess(getCompilerContext().getNumTables(), null, null); accept(new ConstantExpressionVisitor()); GenericLanguageConnectionContext lcc = (GenericLanguageConnectionContext) ContextService.getContext(LanguageConnectionContext.CONTEXT_ID); if (lcc == null || !lcc.getUnSatTreePruningOff()) accept(new TreePruningVisitor()); resultSet = resultSet.optimize(getDataDictionary(), null, 1.0d); resultSet = resultSet.modifyAccessPaths(); }

Target:
public void optimizeStatement() throws StandardException { SubqueryFlattening.flatten(this); resultSet = resultSet.preprocess(getCompilerContext().getNumTables(), null, null); accept(new ConstantExpressionVisitor()); accept(new TreePruningVisitor()); resultSet = resultSet.optimize(getDataDictionary(), null, 1.0d); resultSet = resultSet.modifyAccessPaths(); }
Source:
public void testBitwiseSrl() { assertFunction("bitwise_shift_right_logical(7, 2, 4)", BIGINT, 1L); assertFunction("bitwise_shift_right_logical(7, 2, 64)", BIGINT, 7L >>> 2L); assertFunction("bitwise_shift_right_logical(-4, 6, 64)", BIGINT, -4L >>> 6L); assertFunction("bitwise_shift_right_logical(-8, 2, 5)", BIGINT, 6L); assertFunction("bitwise_shift_right_logical(-1152905011916701696, 62, 64)", BIGINT, 3L); assertFunction("bitwise_shift_right_logical(-1152905011916701696, 62, 4)", BIGINT, 0L); assertFunction("bitwise_shift_right_logical(-1152905011916701696, 1, 4)", BIGINT, 0L); assertInvalidFunction("bitwise_shift_right_logical(7, -3, 2)", INVALID_FUNCTION_ARGUMENT); }

Target:
public void testBitwiseSrl() { assertFunction("bitwise_logical_shift_right(7, 2, 4)", BIGINT, 1L); assertFunction("bitwise_logical_shift_right(7, 2, 64)", BIGINT, 7L >>> 2L); assertFunction("bitwise_logical_shift_right(-4, 6, 64)", BIGINT, -4L >>> 6L); assertFunction("bitwise_logical_shift_right(-8, 2, 5)", BIGINT, 6L); assertFunction(format("bitwise_logical_shift_right(%s, 62, 64)", 0xF0000F0000F00000L), BIGINT, 3L); assertFunction(format("bitwise_logical_shift_right(%s, 62, 4)", 0xF0000F0000F00000L), BIGINT, 0L); assertFunction(format("bitwise_logical_shift_right(%s, 1, 4)", 0xF0000F0000F00000L), BIGINT, 0L); assertInvalidFunction("bitwise_logical_shift_right(7, -3, 2)", INVALID_FUNCTION_ARGUMENT); }
Source:
public Map<String, PartitionStatistics> getPartitionStatistics(String databaseName, String tableName, Set<String> partitionNames) { return Collections.unmodifiableMap( partitionNames.stream().collect(Collectors.toMap(identity(), (p) -> PartitionStatistics.empty()))); }

Target:
public Map<String, PartitionStatistics> getPartitionStatistics(String databaseName, String tableName, Set<String> partitionNames) { return partitionNames.stream().collect(toImmutableMap(identity(), (p) -> PartitionStatistics.empty())); }
Source:
public void ovfUpdate_timer() { ITEMS_COUNT_PER_UPDATE = reloadConfigValue(); log.info("OvfDataUpdater: Attempting to update VMs/Templates Ovf."); List<storage_pool> storagePools = getStoragePoolDao().getAllByStatus(StoragePoolStatus.Up); for (storage_pool pool : storagePools) { try { initProccessedInfoLists(); log.infoFormat("OvfDataUpdater: Attempting to update VM OVFs in Data Center {0}", pool.getname()); updateOvfForVmsOfStoragePool(pool.getId()); log.infoFormat("OvfDataUpdater: Attempting to update template OVFs in Data Center {0}", pool.getname()); updateOvfForTemplatesOfStoragePool(pool.getId()); log.infoFormat("OvfDataUpdater: Attempting to remove uneeded template/vm OVFs in Data Center {0}", pool.getname()); removeOvfForTemplatesAndVmsOfStoragePool(pool.getId()); } catch (Exception ex) { addAuditLogError(pool.getname()); log.errorFormat("Exception while trying to update VMs/Templates ovf in Data Center {0}, the exception is {1}", pool.getname(), ex.getMessage()); log.debug(ex.getStackTrace()); } } proccessedIdsInfo = null; proccessedOvfGenerationsInfo = null; }

Target:
public void ovfUpdate_timer() { itemsCountPerUpdate = reloadConfigValue(); log.info("OvfDataUpdater: Attempting to update VMs/Templates Ovf."); List<storage_pool> storagePools = getStoragePoolDao().getAllByStatus(StoragePoolStatus.Up); for (storage_pool pool : storagePools) { try { log.infoFormat("OvfDataUpdater: Attempting to update VM OVFs in Data Center {0}", pool.getname()); initProccessedInfoLists(); updateOvfForVmsOfStoragePool(pool.getId()); log.infoFormat("OvfDataUpdater: Attempting to update template OVFs in Data Center {0}", pool.getname()); updateOvfForTemplatesOfStoragePool(pool.getId()); log.infoFormat("OvfDataUpdater: Attempting to remove uneeded template/vm OVFs in Data Center {0}", pool.getname()); removeOvfForTemplatesAndVmsOfStoragePool(pool.getId()); } catch (Exception ex) { addAuditLogError(pool.getname()); log.errorFormat("Exception while trying to update VMs/Templates ovf in Data Center {0}, the exception is {1}", pool.getname(), ex.getMessage()); log.debug(ex.getStackTrace()); } } proccessedIdsInfo = null; proccessedOvfGenerationsInfo = null; }
Source:
public boolean shouldAlertUpgrade(ArrayList<RpmVersion> isos, String hostOs) { boolean alert = false; Version hostVersion = new Version(hostOs[1].trim()); String release_host = hostOs[2].trim(); for (RpmVersion iso : isos) { if (hostVersion.getMajor() == iso.getMajor()) { if (iso.getMinor() > hostVersion.getMinor() || iso.getBuild() > hostVersion.getBuild()) { alert = true; break; } String rpmFromIso = iso.getRpmName(); int isoIndex = iso.getRpmName().indexOf(".iso"); if (isoIndex != -1) { rpmFromIso = iso.getRpmName().substring(0, isoIndex); } String rpmRelease = RpmVersionUtils.splitRpmToParts(rpmFromIso)[2]; if (RpmVersionUtils.compareRpmPart(rpmRelease, release_host) > 0) { alert = true; break; } } } return alert; }

Target:
protected static boolean shouldAlertUpgrade(ArrayList<RpmVersion> isos, String[] hostOs) { boolean alert = false; Version hostVersion = new Version(hostOs[1].trim()); String release_host = hostOs[2].trim(); for (RpmVersion iso : isos) { if (hostVersion.getMajor() == iso.getMajor()) { if (iso.getMinor() > hostVersion.getMinor() || iso.getBuild() > hostVersion.getBuild()) { alert = true; break; } String rpmFromIso = iso.getRpmName(); int isoIndex = iso.getRpmName().indexOf(".iso"); if (isoIndex != -1) { rpmFromIso = iso.getRpmName().substring(0, isoIndex); } if (RpmVersionUtils.compareRpmPart(RpmVersionUtils.splitRpmToParts(rpmFromIso)[2], release_host) > 0) { alert = true; break; } } } return alert; }
Source:
private void toggleTwitterPreference() { if (!isAdded()) return; View view = getView(); if (view != null) { View twitterCard = getView().findViewById(R.id.card_view_twitter); for (int i = 0; i < mPublicizeButtons.size(); i++) { PublicizeButton publicizeButton = mPublicizeButtons.get(i); if (publicizeButton.getId().equals(TWITTER_ID) && publicizeButton.isEnabled()) { twitterCard.setVisibility(View.VISIBLE); return; } } twitterCard.setVisibility(View.GONE); } }

Target:
private void toggleTwitterPreference() { if (!isAdded()) return; View view = getView(); if (view != null) { View twitterCard = view.findViewById(R.id.card_view_twitter); for (int i = 0; i < mPublicizeButtons.size(); i++) { PublicizeButton publicizeButton = mPublicizeButtons.get(i); if (publicizeButton.getId().equals(TWITTER_ID) && publicizeButton.isEnabled()) { twitterCard.setVisibility(View.VISIBLE); return; } } twitterCard.setVisibility(View.GONE); } }
Source:
synchronized private Long updateAllowance(String key) { String derivedKey = getKeyForWindow(key); StatefulRedisConnection<String, String> connection = redisClient.connect(); Long count = connection.sync().incr(derivedKey); if (count == 1) { connection.sync().expire(derivedKey, perMillis / 1000); } return count; }

Target:
synchronized private Long updateAllowance(String key) { String derivedKey = getKeyForWindow(key); Long count = redisClientManager.getRedisConnection().sync().incr(derivedKey); if (count == 1) { redisClientManager.getRedisConnection().sync().expire(derivedKey, perMillis / 1000); } return count; }
Source:
protected <KIn> Set<KIn> filterLocalPrimaryOwner(Set<KIn> nodeLocalKeys, DistributionManager dm) { Set<KIn> selectedKeys = new HashSet<KIn>(); for (KIn key : nodeLocalKeys) { Address primaryLocation = dm != null ? dm.getPrimaryLocation(key) : localAddress; if (primaryLocation != null && primaryLocation.equals(localAddress)) { selectedKeys.add(key); } } return selectedKeys; }

Target:
protected <KIn> Set<KIn> filterLocalPrimaryOwner(Set<KIn> nodeLocalKeys, DistributionManager dm) { Set<KIn> selectedKeys = new HashSet<KIn>(); for (KIn key : nodeLocalKeys) { Address primaryLocation = dm != null ? dm.getPrimaryLocation(key) : cdl.getAddress(); if (primaryLocation != null && primaryLocation.equals(cdl.getAddress())) { selectedKeys.add(key); } } return selectedKeys; }
Source:
public void setAdvancedRecentChangesCheckbox() { selectTab(PreferencesPageObject.tabNames.UNDER); waitForElementClickableByElement(useAdvancedRecentChangesCheckbox); useAdvancedRecentChangesCheckbox.click(); PageObjectLogging.log("Use_advanced_recent_changes_checkbox", "Use_advanced_recent_changes_checkbox clicked", true); }

Target:
public PreferencesPageObject setAdvancedRecentChangesCheckbox() { selectTab(PreferencesPageObject.tabNames.UNDER); waitForElementClickableByElement(useAdvancedRecentChangesCheckbox); useAdvancedRecentChangesCheckbox.click(); PageObjectLogging.log("Use_advanced_recent_changes_checkbox", "Use_advanced_recent_changes_checkbox clicked", true); return this; }
Source:
public static void setUp() throws Exception { System.setProperty(Constants.Properties.VXQUERY_PROPERTIES_FILE, "src/test/resources/vxquery.properties"); startLocalHyracks(); CCConfig ccConfig = clusterControllerService.getCCConfig(); System.setProperty(Constants.Properties.HYRACKS_CLIENT_IP, ccConfig.clientNetIpAddress); System.setProperty(Constants.Properties.HYRACKS_CLIENT_PORT, String.valueOf(ccConfig.clientNetPort)); application = new VXQueryApplication(); application.start(); restServer = application.getRestServer(); }

Target:
public static void setUp() throws Exception { vxqueryLocalCluster.init(new VXQueryConfig()); vxQueryService = vxqueryLocalCluster.getVxQueryService(); restIpAddress = vxqueryLocalCluster.getIpAddress(); restPort = vxqueryLocalCluster.getRestPort(); }
Source:
public boolean isSsoIntegrationEnabled() { try { final Predicate ssoEnabledPredicate = ssoEnabledConfiguration == null ? null : PredicateUtils.fromJSON(ssoEnabledConfiguration); return ssoIntegrationSupported && ssoEnabledPredicate != null && ssoEnabledPredicate.evaluate(configHelper.calculateExistingConfigurations(ambariManagementController, cluster)); } catch (AmbariException e) { throw new AmbariRuntimeException("Error while evaulating if SSO integration is enabled", e); } }

Target:
public boolean isSsoIntegrationEnabled() { try { return ssoIntegrationSupported && ssoEnabledConfiguration != null && ssoEnabledConfiguration.evaluate(configHelper.calculateExistingConfigurations(ambariManagementController, cluster)); } catch (AmbariException e) { throw new AmbariRuntimeException("Error while evaulating if SSO integration is enabled", e); } }
Source:
public static long fromInfluxDBTimeFormat(final String time) { try { if (time.length() == 20) { return FORMATTER_SECONDS.get().parse(time).getTime(); } return FORMATTER_MILLIS.get().parse(time).getTime(); } catch (Exception e) { throw new RuntimeException("unexpected date format", e); } }

Target:
public static long fromInfluxDBTimeFormat(final String time) { try { if (time.length() == TIME_IN_SECOND_LENGTH) { return FORMATTER_SECONDS.get().parse(time).getTime(); } return FORMATTER_MILLIS.get().parse(time).getTime(); } catch (Exception e) { throw new RuntimeException("unexpected date format", e); } }
Source:
public void deleteSelectedInstances(@PathVariable Long entityId, @PathVariable String instanceIds) throws ParseException { List<Long> instanceIdsList = new ArrayList(); JSONParser parser = new JSONParser(); Object instanceIdsJson = parser.parse(instanceIds); JSONObject instanceIdsJsonObject = (JSONObject) instanceIdsJson; Iterator iterator = instanceIdsJsonObject.keySet().iterator(); while (iterator.hasNext()) { String key = (String) iterator.next(); String value = instanceIdsJsonObject.get(key).toString(); instanceIdsList.add(Long.parseLong(value)); } instanceService.deleteSelectedInstances(entityId, instanceIdsList); }

Target:
public void deleteSelectedInstances(@PathVariable Long entityId, @PathVariable String instanceIds) { List<Long> instanceIdsList = new ArrayList(); JsonParser parser = new JsonParser(); JsonObject instanceIdsJsonObject = parser.parse(instanceIds).getAsJsonObject(); Set<Map.Entry<String, JsonElement>> entrySet = instanceIdsJsonObject.entrySet(); for (Map.Entry<String, JsonElement> entry : entrySet) { String value = instanceIdsJsonObject.get(entry.getKey()).toString(); value = value.substring(1).substring(0, 2); instanceIdsList.add(Long.parseLong(value)); } instanceService.deleteSelectedInstances(entityId, instanceIdsList); }
Source:
public String read(int addr, WR3223Commands command) throws IOException { if (inputStream.available() > 0) { inputStream.skipBytes(inputStream.available()); } byte[] message = new byte[8]; message[0] = EOT; setControllerAddressToMessage(message, addr, 1); setCommandToMessage(message, command, 5); message[7] = ENQ; outputStream.write(message); outputStream.flush(); if (logger.isDebugEnabled()) { logger.debug("Write data: {}", bytesToHexString(message)); } byte[] answer = readAnswer(); int chkSum = inputStream.read(); if (logger.isDebugEnabled()) { logger.debug("Read data: with checksum {}.", bytesToHexString(answer), Integer.toHexString(chkSum)); } if (answer[0] == STX && answer[answer.length - 1] == ETX) { if (chkSum == buildCheckSum(answer, 1, answer.length - 1)) { if (command.name().equals(toString(answer, 1, 2))) { return toString(answer, 3, answer.length - 2); } else { logger.error("Wrong command receive. Expected but got {}.", command.name(), toString(answer, 1, 2)); } } else { logger.error("Checksum error. Expected but got {}.", chkSum, buildCheckSum(answer, 1, answer.length - 1)); } } else { logger.error("Start/end of the controller answer is wrong."); } return null; }

Target:
public String read(int addr, WR3223Commands command) throws IOException { if (inputStream.available() > 0) { inputStream.skipBytes(inputStream.available()); } byte[] message = new byte[8]; message[0] = EOT; setControllerAddressToMessage(message, addr, 1); setCommandToMessage(message, command, 5); message[7] = ENQ; outputStream.write(message); outputStream.flush(); if (logger.isDebugEnabled()) { logger.debug("Write data: {}", bytesToHexString(message)); } byte[] answer = readAnswer(); int chkSum = inputStream.read(); if (logger.isDebugEnabled()) { logger.debug("Read data: with checksum {}.", bytesToHexString(answer), Integer.toHexString(chkSum)); } if (answer[0] == STX && answer[answer.length - 1] == ETX) { if (chkSum == buildCheckSum(answer, 1, answer.length - 1)) { if (command.name().equals(toString(answer, 1, 2))) { return toString(answer, 3, answer.length - 2); } else { logger.error("Wrong command received. Expected but got {}.", command.name(), toString(answer, 1, 2)); } } else { logger.error("Checksum error. Expected but got {}.", chkSum, buildCheckSum(answer, 1, answer.length - 1)); } } else { logger.error("Start/end of the controller answer is wrong."); } return null; }
Source:
public void repetitiveRecoveryIfCorruptedLogsWithCheckpoints() throws IOException { GraphDatabaseAPI database = (GraphDatabaseAPI) databaseFactory.newEmbeddedDatabase( storeDir ); generateTransactionsAndRotate( database, 4, true ); database.shutdown(); while ( logFiles.getHighestLogVersion() > 0 ) { int bytesToTrim = 1 + random.nextInt( 100 ); System.out.println("Trim: " + bytesToTrim); truncateBytesFromLastLogFile( bytesToTrim ); databaseFactory.newEmbeddedDatabase( storeDir ).shutdown(); int numberOfRecoveredTransactions = recoveryMonitor.getNumberOfRecoveredTransactions(); assertThat( numberOfRecoveredTransactions, Matchers.greaterThanOrEqualTo( 0 ) ); } File corruptedLogArchives = new File( storeDir, CorruptedLogsTruncator.CORRUPTED_TX_LOGS_BASE_NAME ); assertThat( corruptedLogArchives.listFiles(), not( emptyArray() ) ); }

Target:
public void repetitiveRecoveryIfCorruptedLogsWithCheckpoints() throws IOException { GraphDatabaseAPI database = (GraphDatabaseAPI) databaseFactory.newEmbeddedDatabase( storeDir ); generateTransactionsAndRotate( database, 4, true ); database.shutdown(); while ( logFiles.getHighestLogVersion() > 0 ) { int bytesToTrim = 1 + random.nextInt( 100 ); truncateBytesFromLastLogFile( bytesToTrim ); databaseFactory.newEmbeddedDatabase( storeDir ).shutdown(); int numberOfRecoveredTransactions = recoveryMonitor.getNumberOfRecoveredTransactions(); assertThat( numberOfRecoveredTransactions, Matchers.greaterThanOrEqualTo( 0 ) ); } File corruptedLogArchives = new File( storeDir, CorruptedLogsTruncator.CORRUPTED_TX_LOGS_BASE_NAME ); assertThat( corruptedLogArchives.listFiles(), not( emptyArray() ) ); }
Source:
protected abstract void processIncoming() throws IOException, ClientConnectionException; private void processHeartbeat() { if (!this.isInInit() && this.policy.isIncomingHeartbeat() && this.isIncomingHeartbeatExeeded()) { log.info("Heartbeat exceeded for " + getHostname() + " last response was " + getHeartbeatTime() + " milliseconds ago."); this.disconnect("Heartbeat exceeded"); } }

Target:
protected abstract void processIncoming() throws IOException, ClientConnectionException; private void processHeartbeat() { if (!this.isInInit() && this.policy.isIncomingHeartbeat() && this.isIncomingHeartbeatExeeded()) { log.error("Heartbeat exceeded for host '{}', last response arrived ms ago.", getHostname(), getHeartbeatTime()); this.disconnect("Heartbeat exceeded"); } }
Source:
public void shouldConvertToReviewInput() { Review review = new Review(ImmutableList.of(new ReviewFile("test"))); ReviewInput reviewInput = review.toReviewInput(); assertThat(reviewInput.comments).hasSize(1); assertThat(reviewInput.comments).containsKey("test"); assertThat(reviewInput.comments).containsValue(Collections.<ReviewFileComment>emptyList()); }

Target:
public void shouldConvertToReviewInput() { Review review = new Review(ImmutableList.of(new ReviewFile("test"))); ReviewInput reviewInput = review.toReviewInput(); assertThat(reviewInput.comments) .hasSize(1) .containsEntry("test", Collections.<ReviewFileComment>emptyList()); }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } UsernamePasswordIdentityConfig other = (UsernamePasswordIdentityConfig) obj; if (password == null) { if (other.password != null) { return false; } } else if (!password.equals(other.password)) { return false; } if (username == null) { if (other.username != null) { return false; } } else if (!username.equals(other.username)) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } UsernamePasswordIdentityConfig other = (UsernamePasswordIdentityConfig) obj; return Objects.equals(password, other.password) && Objects.equals(username, other.username); }
Source:
public synchronized void put(final JobRequest request) { mCacheId.put(request.getJobId(), request); if (!TextUtils.isEmpty(request.getTag())) { mCacheTag.put(request.getTag(), request); } mExecutorService.execute(new Runnable() { @Override public void run() { store(request); } }); }

Target:
public synchronized void put(final JobRequest request) { mCacheId.put(request.getJobId(), request); if (!TextUtils.isEmpty(request.getTag())) { mCacheTag.put(request.getTag(), request); } store(request); }
Source:
private DirContext authenticate(String username, String password) throws AccountException, NamingException { final Properties env = createContextProperties(); if (username != null) { env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.SECURITY_PRINCIPAL, username); env.put(Context.SECURITY_CREDENTIALS, password != null ? password : ""); } return new InitialDirContext(env); }

Target:
private DirContext authenticate(String username, String password) throws AccountException { final Properties env = createContextProperties(); env.put(Context.SECURITY_AUTHENTICATION, "simple"); env.put(Context.SECURITY_PRINCIPAL, username); env.put(Context.SECURITY_CREDENTIALS, password != null ? password : ""); DirContext ctx; try { ctx = new InitialDirContext(env); } catch (NamingException e) { throw new AccountException("Incorrect username or password", e); } return ctx; }
Source:
private StandardEvaluationContext createMethodInvocationEvaluationContext(Object[] arguments) { StandardEvaluationContext context = ExpressionUtils.createStandardEvaluationContext(this.beanFactory); context.setVariable("args", arguments); context.setVariable("method", this.method.getName()); context.setVariable("methodName", this.method.getName()); context.setVariable("methodString", this.method.toString()); context.setVariable("methodObject", this.method); return context; }

Target:
private StandardEvaluationContext createMethodInvocationEvaluationContext(Object[] arguments) { StandardEvaluationContext context = ExpressionUtils.createStandardEvaluationContext(this.beanFactory); context.setVariable("args", arguments); context.setVariable("method", this.method.getName()); context.setVariable("gatewayMethod", this.method); return context; }
Source:
public void deleteEntityLockedState(String entityName, String entityType, String operation) throws WorkflowException { Connection connection = null; PreparedStatement prepStmt = null; try { connection = JDBCPersistenceManager.getInstance().getDBConnection(); prepStmt = connection.prepareStatement(SQLConstants.DELETE_ENTITY_STATE_QUERY); prepStmt.setString(1, entityName); prepStmt.setString(2, entityType); prepStmt.setString(3, "Operation"); prepStmt.setString(4, operation); prepStmt.execute(); connection.commit(); } catch (SQLException | IdentityException e) { log.error("Error while saving new user data for Identity database.", e); throw new WorkflowException("Error while deleting temporary user record from Identity database.", e); } finally { IdentityDatabaseUtil.closeStatement(prepStmt); IdentityDatabaseUtil.closeConnection(connection); } }

Target:
public void deleteEntityLockedState(String entityName, String entityType, String operation) throws WorkflowException { Connection connection = null; PreparedStatement prepStmt = null; try { connection = IdentityDatabaseUtil.getDBConnection();; prepStmt = connection.prepareStatement(SQLConstants.DELETE_ENTITY_STATE_QUERY); prepStmt.setString(1, entityName); prepStmt.setString(2, entityType); prepStmt.setString(3, "Operation"); prepStmt.setString(4, operation); prepStmt.execute(); connection.commit(); } catch (SQLException | IdentityException e) { throw new WorkflowException("Error while deleting temporary user record from Identity database.", e); } finally { IdentityDatabaseUtil.closeStatement(prepStmt); IdentityDatabaseUtil.closeConnection(connection); } }
Source:
public Date getLastHeartBeat() { return lastHeartBeat; }

Target:
public Date getLastHeartBeat() { return new Date(lastHeartBeat); }
Source:
void initRepoCache() { lockAnd( () -> { if ( !resourceMap.isEmpty() ) { repoQueue.addAll( resourceMap.keySet() ); sortRepoQueue(); } hasMore = !repoQueue.isEmpty() && !resourceMap.isEmpty(); return null; } ); }

Target:
void initRepoCache() { lockAnd( t -> { if ( !resourceCache.isEmpty() ) { for ( RemoteRepository repo : resourceCache.execute( c -> c.keySet() ) ) { if ( !repoQueue.contains( repo ) ) { repoQueue.add( repo ); } } sortRepoQueue(); } hasMore = !repoQueue.isEmpty() && !resourceCache.isEmpty(); return null; } ); }
Source:
public boolean isSingleton() { return true; }

Target:
public boolean isSingleton() { return false; }
Source:
protected void onDestroy() { super.onDestroy(); if (iconSpinningAnimator != null) { iconSpinningAnimator.end(); } mapView.onDestroy(); }

Target:
protected void onDestroy() { super.onDestroy(); if (iconSpinningAnimator != null) { iconSpinningAnimator.cancel(); } mapView.onDestroy(); }
Source:
protected Address getReplyToAddress(Message request) throws Exception { Address replyTo = request.getMessageProperties().getReplyToAddress(); Address defaultReplyTo = delegatingHandler.getDefaultReplyTo(); if (replyTo == null && defaultReplyTo == null) { throw new AmqpException( "Cannot determine ReplyTo message property value: " + "Request message does not contain reply-to property, " + "and no @SendTo annotation found."); } return replyTo == null ? defaultReplyTo : replyTo; }

Target:
protected Address getReplyToAddress(Message request) throws Exception { Address replyTo = request.getMessageProperties().getReplyToAddress(); Address defaultReplyTo = null; if (delegatingHandler != null) { defaultReplyTo = delegatingHandler.getDefaultReplyTo(); } if (replyTo == null && defaultReplyTo == null) { throw new AmqpException( "Cannot determine ReplyTo message property value: " + "Request message does not contain reply-to property, " + "and no @SendTo annotation found."); } return replyTo == null ? defaultReplyTo : replyTo; }
Source:
public Sequence<T> run(final Query<T> query, final Map<String, Object> responseContext) { if (query instanceof BaseQuery) { final BaseQuery singleSourceBaseQuery = (BaseQuery) query; final DataSource dataSource = singleSourceBaseQuery.getDataSource(); if (dataSource instanceof UnionDataSource) { return new MergeSequence<>( query.getResultOrdering(), Sequences.simple( Lists.transform( ((UnionDataSource) dataSource).getDataSources(), new Function<DataSource, Sequence<T>>() { @Override public Sequence<T> apply(DataSource singleSource) { return baseRunner.run( singleSourceBaseQuery.withDataSource(singleSource), responseContext ); } } ) ) ); } else { return baseRunner.run(query, responseContext); } } else { return baseRunner.run(query, responseContext); } }

Target:
public Sequence<T> run(final Query<T> query, final Map<String, Object> responseContext) { if (query instanceof BaseQuery) { final BaseQuery singleSourceBaseQuery = (BaseQuery) query; final DataSource dataSource = singleSourceBaseQuery.getDataSource(); if (dataSource instanceof UnionDataSource) { return new MergeSequence<>( query.getResultOrdering(), Sequences.simple( Lists.transform( ((UnionDataSource) dataSource).getDataSources(), new Function<DataSource, Sequence<T>>() { @Override public Sequence<T> apply(DataSource singleSource) { return baseRunner.run( singleSourceBaseQuery.withDataSource(singleSource), responseContext ); } } ) ) ); } else { return baseRunner.run(query, responseContext); } } else { throw new UnsupportedOperationException(); } }
Source:
private void finishVerification() { Hashtable<Object, Object> resourcePaths = new Hashtable<Object, Object>(); Enumeration<Object> keys = fExpectedChanges.keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); resourcePaths.put(key, key); } keys = resourcePaths.keys(); while (keys.hasMoreElements()) { IPath resourcePath = (IPath) keys.nextElement(); fMessage.append("Checking expectations for "); fMessage.append(resourcePath); fMessage.append("\n"); ExpectedChange expectedChange = fExpectedChanges.remove(resourcePath); if (expectedChange != null) { recordMissingActualChange(expectedChange.getKind(), expectedChange.getChangeFlags()); } } }

Target:
private void finishVerification() { Hashtable<IPath, IPath> resourcePaths = new Hashtable<IPath, IPath>(); Enumeration<IPath> keys = fExpectedChanges.keys(); while (keys.hasMoreElements()) { IPath key = keys.nextElement(); resourcePaths.put(key, key); } keys = resourcePaths.keys(); while (keys.hasMoreElements()) { IPath resourcePath = keys.nextElement(); fMessage.append("Checking expectations for "); fMessage.append(resourcePath); fMessage.append("\n"); ExpectedChange expectedChange = fExpectedChanges.remove(resourcePath); if (expectedChange != null) { recordMissingActualChange(expectedChange.getKind(), expectedChange.getChangeFlags()); } } }
Source:
public void setQueryExpression(Expression queryExpression) { this.queryExpression = queryExpression; }

Target:
public void setQueryExpression(Expression queryExpression) { Assert.notNull(queryExpression, "queryExpression must not be null."); this.queryExpression = queryExpression; }
Source:
private Map<String, Object> mergeExtensions(final NagiosExtension nagiosExtension) { final Map<String, Object> extensionMap = Maps.newHashMap(); if (nagiosExtension == null) { return Collections.emptyMap(); } extensionMap.put(NAGIOS_EXTENSION_SEVERITY_KEY, nagiosExtension.getSeverity()); extensionMap.put(NAGIOS_EXTENSION_NOTIFY_KEY, nagiosExtension.getNotify()); extensionMap.put(NAGIOS_EXTENSION_MAX_CHECK_ATTEMPTS_KEY, nagiosExtension.getMaxCheckAttempts()); extensionMap.put(NAGIOS_EXTENSION_FRESHNESS_THRESHOLD_KEY, nagiosExtension.getFreshnessThreshold().getStandardSeconds()); return extensionMap; }

Target:
private Map<String, Object> mergeExtensions(final NagiosExtension nagiosExtension) { if (nagiosExtension == null) { return Collections.emptyMap(); } final Map<String, Object> extensionMap = Maps.newHashMap(); extensionMap.put(NAGIOS_EXTENSION_SEVERITY_KEY, nagiosExtension.getSeverity()); extensionMap.put(NAGIOS_EXTENSION_NOTIFY_KEY, nagiosExtension.getNotify()); extensionMap.put(NAGIOS_EXTENSION_MAX_CHECK_ATTEMPTS_KEY, nagiosExtension.getMaxCheckAttempts()); extensionMap.put(NAGIOS_EXTENSION_FRESHNESS_THRESHOLD_KEY, nagiosExtension.getFreshnessThreshold().getStandardSeconds()); return extensionMap; }
Source:
public static @Nonnull <TFacet extends FingerprintFacet> Collection<TFacet> getFacets (@Nonnull String id, @Nonnull Class<TFacet> facetClass) { final Fingerprint fp = ofNoException(id); return (fp != null) ? getFacets(fp, facetClass) : CollectionUtils.EMPTY_COLLECTION; }

Target:
public static @Nonnull <TFacet extends FingerprintFacet> Collection<TFacet> getFacets (@Nonnull String id, @Nonnull Class<TFacet> facetClass) { final Fingerprint fp = ofNoException(id); return (fp != null) ? getFacets(fp, facetClass) : Collections.<TFacet>emptySet(); }
Source:
protected static ClassificationRequest createClassificationRequest(FlowDocument document) { if (document.isInitiator() == null) { return null; } final ClassificationRequest request = new ClassificationRequest(); request.setProtocol(Protocols.getProtocol(document.getProtocol())); request.setLocation(document.getLocation()); if (document.isInitiator()) { request.setIpAddress(document.getDstAddr()); request.setPort(document.getDstPort()); } else { request.setIpAddress(document.getSrcAddr()); request.setPort(document.getSrcPort()); } return request; }

Target:
protected static ClassificationRequest createClassificationRequest(FlowDocument document) { final ClassificationRequest request = new ClassificationRequest(); request.setProtocol(Protocols.getProtocol(document.getProtocol())); request.setLocation(document.getLocation()); if (document.isInitiator()) { request.setIpAddress(document.getDstAddr()); request.setPort(document.getDstPort()); } else { request.setIpAddress(document.getSrcAddr()); request.setPort(document.getSrcPort()); } return request; }
Source:
private void onFingerprintAuthenticated(int userId) { Trace.beginSection("KeyGuardUpdateMonitor#onFingerPrintAuthenticated"); mUserFingerprintAuthenticated.put(userId, true); if (getUserCanSkipBouncerForFingerprint(userId)) { mTrustManager.unlockedByBiometricsForUser(userId); } mFingerprintCancelSignal = null; for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onFingerprintAuthenticated(userId); } } mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_BIOMETRICS_AUTHENTICATION_CONTINUE), BIOMETRICS_CONTINUE_DELAY_MS); mAssistantVisible = false; Trace.endSection(); }

Target:
private void onFingerprintAuthenticated(int userId) { Trace.beginSection("KeyGuardUpdateMonitor#onFingerPrintAuthenticated"); mUserFingerprintAuthenticated.put(userId, true); if (getUserCanSkipBouncerForFingerprint(userId)) { mTrustManager.unlockedByBiometricsForUser(userId, DevicePolicyManager.KEGUARD_BIOMETRIC_TYPE_FINGERPRINT); } mFingerprintCancelSignal = null; for (int i = 0; i < mCallbacks.size(); i++) { KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get(); if (cb != null) { cb.onFingerprintAuthenticated(userId); } } mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_BIOMETRICS_AUTHENTICATION_CONTINUE), BIOMETRICS_CONTINUE_DELAY_MS); mAssistantVisible = false; Trace.endSection(); }
Source:
public void edit(final IscsiStorageModel object) { driver.edit(object); initLists(object); object.getPropertyChangedEvent().addListener((ev, sender, args) -> { String propName = args.propertyName; if (propName.equals("IsValid")) { onIsValidPropertyChange(object); } else if (propName.equals("IsGroupedByTarget")) { updateListByGrouping(object); } }); iscsiTargetToLunView.edit(object); iscsiLunToTargetView.edit(object); targetsToLunTab.addClickHandler(event -> { iscsiLunToTargetView.disableItemsUpdate(); object.setIsGroupedByTarget(true); }); lunToTargetsTab.addClickHandler(event -> { iscsiTargetToLunView.disableItemsUpdate(); object.setIsGroupedByTarget(false); }); dialogTabPanel.switchTab(object.getIsGroupedByTarget() ? targetsToLunTab : lunToTargetsTab); updateListByGrouping(object); if (!object.getContainer().isNewStorage()) { switch (object.getContainer().getStorage().getStatus()) { case Maintenance: mainLabel.setText(constants.storageIscsiRemoveLUNsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsOnMaintenanceLabel()); break; case Active: mainLabel.setText(constants.storageIscsiActionsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsForActiveDomainsLabel()); break; } } object.getPropertyChangedEvent().addListener((ev, sender, args) -> { String propName = args.propertyName; if (propName.equals("SelectedLunWarning")) { String warningText = object.getSelectedLunWarning(); warning.setText(warningText); warning.setVisible(!StringHelper.isNullOrEmpty(warningText)); } }); }

Target:
public void edit(final IscsiStorageModel object) { driver.edit(object); initLists(object); object.getPropertyChangedEvent().addListener((ev, sender, args) -> { String propName = args.propertyName; if (propName.equals("IsValid")) { onIsValidPropertyChange(object); } else if (propName.equals("IsGroupedByTarget")) { updateListByGrouping(object); } }); iscsiTargetToLunView.edit(object); iscsiLunToTargetView.edit(object); targetsToLunTab.addClickHandler(event -> { iscsiLunToTargetView.disableItemsUpdate(); object.setIsGroupedByTarget(true); }); lunToTargetsTab.addClickHandler(event -> { iscsiTargetToLunView.disableItemsUpdate(); object.setIsGroupedByTarget(false); }); dialogTabPanel.switchTab(object.getIsGroupedByTarget() ? targetsToLunTab : lunToTargetsTab); updateListByGrouping(object); if (!object.getContainer().isNewStorage()) { switch (object.getContainer().getStorage().getStatus()) { case Maintenance: mainLabel.setText(constants.storageIscsiRemoveLUNsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsOnMaintenanceLabel()); break; case Active: mainLabel.setText(constants.storageIscsiActionsLabel()); subLabel.setText(constants.storageIscsiAvailableActionsForActiveDomainsLabel()); break; } } object.getPropertyChangedEvent().addListener((ev, sender, args) -> { String propName = args.propertyName; if (propName.equals("SelectedLunWarning")) { String warningText = object.getSelectedLunWarning(); warning.clearMessages(); warning.setType(AlertPanel.Type.WARNING); warning.addMessage(SafeHtmlUtils.fromString(warningText)); warning.setVisible(!StringHelper.isNullOrEmpty(warningText)); } }); }
Source:
public void RestartMaster(String deviceId) { Reader reader = null; logger.debug( "Restart master device id '{}'", deviceId); try { HttpURLConnection httpURLConnection; httpURLConnection = (HttpURLConnection) new URL(API_URL + "device/restart" + "?authToken=" + this.authToken + "&id=" + deviceId) .openConnection(); InputStream inputStream = httpURLConnection.getInputStream(); reader = new InputStreamReader(inputStream, "UTF-8"); JsonObject jsonObject = (JsonObject) jsonParser.parse(reader); String status = jsonObject.get("status").getAsString(); if(!status.equals("ok")){ String error = jsonObject.get("error").getAsString(); logger.error("Unable to restart master device '{}' error '{}'", deviceId, error); } } catch(Exception ex) { logger.error("Error restart master device: '{}'", ex.toString()); } finally { if (reader != null) { try { reader.close(); } catch (IOException ignored) { } } } }

Target:
public void RestartMaster(String deviceId) { Reader reader = null; logger.debug("Restart master device id '{}'", deviceId); try { String url = API_URL + "device/restart" + "?authToken=" + this.authToken + "&id=" + deviceId; HttpURLConnection httpURLConnection; httpURLConnection = (HttpURLConnection) new URL(url) .openConnection(); InputStream inputStream = httpURLConnection.getInputStream(); reader = new InputStreamReader(inputStream, "UTF-8"); JsonObject jsonObject = (JsonObject) jsonParser.parse(reader); String status = jsonObject.get("status").getAsString(); if (!status.equals("ok")) { String error = jsonObject.get("error").getAsString(); logger.error("Unable to restart master device '{}' error '{}'", deviceId, error); } } catch (Exception ex) { logger.error("Error restart master device: '{}'", ex.toString()); } finally { if (reader != null) { try { reader.close(); } catch (IOException ignored) { } } } }
Source:
public void close() throws SQLException { conn.close(); JdbcDataSource ds = new JdbcDataSource(); ds.setURL("jdbc:h2:mem:test"); conn = ds.getConnection(); try { ResultSet rs = conn.getMetaData().getTables(null, null, null, new String[]{"TABLE"}); boolean result = false; while(rs.next()) { result=true; System.out.printf("%s\n", rs.getString("TABLE_NAME")); } assertThat(result, describedAs("connection closed", is(false))); } finally { conn.close(); } }

Target:
public void close() throws SQLException { conn.close(); JdbcDataSource ds = new JdbcDataSource(); ds.setURL("jdbc:h2:mem:test"); try (Connection testConn = ds.getConnection()) { try (ResultSet rs = testConn.getMetaData().getTables(null, null, null, new String[]{"TABLE"})) { boolean result = false; while(rs.next()) { result = true; } assertThat(result, describedAs("connection closed", is(false))); } } }
Source:
public ExternalBeanRef(String modelFieldName, String beanInfo, ModelUsage usage) throws Exception { this.modelFieldName = modelFieldName; this.usage = usage; try { this.beanDefinition = new ExternalBeanDefinition(beanInfo); } catch (Exception e) { throw new Exception("Unable to construct ExternalBeanRef. ", e); } }

Target:
public ExternalBeanRef(String modelFieldName, String beanInfo, ModelUsage usage) throws IllegalArgumentException { this.modelFieldName = modelFieldName; this.usage = usage; try { this.beanDefinition = new ExternalBeanDefinition(beanInfo); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Unable to construct ExternalBeanRef. ", e); } }