auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private static void maybeReportIssue( int flagValue, JavaContext context, MethodInvocation node) { if ((flagValue & GET_SIGNATURES_FLAG) != 0) { context.report(ISSUE, context.getLocation(node), "App signatures could potentially be exploited."); } }

Target:
private static void maybeReportIssue( int flagValue, JavaContext context, MethodInvocation node) { if ((flagValue & GET_SIGNATURES_FLAG) != 0) { context.report(ISSUE, node, context.getLocation(node.astArguments().last()), "Reading app signatures from getPackageInfo: The app signatures " + "could be exploited if not validated properly; " + "see issue explanation for details."); } }
Source:
public void channelClosed( Channel channel ) { decrementIdle( channel ); metricsListener.afterClosed( serverAddress( channel ) ); allChannels.remove( channel ); }

Target:
public void channelClosed( Channel channel ) { decrementIdle( channel ); metricsListener.afterClosed( serverAddress( channel ) ); }
Source:
public static String getDiffCommandsForEE(String diffCmds) { if (diffCmds == null || diffCmds.length() == 0) return ""; StringBuilder sb = new StringBuilder(); String[] cmds = diffCmds.split("\n"); boolean skip = false; for (int i = 0; i < cmds.length; i++) { String stmt = cmds[i]; CatalogCmd catCmd = Catalog.parseStmt(stmt); if (catCmd.cmd == 'a' || catCmd.cmd == 'd') { skip = catCmd.isProcedureRelatedCmd() ? true : false; } if (!skip) { sb.append(stmt).append("\n"); } } return sb.toString(); }

Target:
public static String getDiffCommandsForEE(String diffCmds) { if (diffCmds == null || diffCmds.length() == 0) return ""; StringBuilder sb = new StringBuilder(); String[] cmds = diffCmds.split("\n"); boolean skip = false; for (int i = 0; i < cmds.length; i++) { String stmt = cmds[i]; char cmd = Catalog.parseStmtCmd(stmt); if (cmd == 'a' || cmd == 'd') { CatalogCmd catCmd = Catalog.parseStmt(stmt); skip = catCmd.isProcedureRelatedCmd(); } if (!skip) { sb.append(stmt).append("\n"); } } return sb.toString(); }
Source:
public boolean teleportPlayerToServer(final Player p, final String server, final PlayerChangeServerReason reason) throws PlayerStillDeadException { if (transitManager.isPlayerInExitTransit(p.getUniqueId())) { return false; } PlayerChangeServerEvent event = new PlayerChangeServerEvent(reason, p.getUniqueId(), server); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) { return false; } if (combatManager.isCombatTagNPC(p)) { return false; } combatManager.unCombatTag(p); if (p.isInsideVehicle()) { BetterShardsPlugin.getInstance().getLogger().log(Level.INFO, "During BetterShards teleport, removing player {0} from vehicle", p.getUniqueId()); p.getVehicle().eject(); } if (p.isDead() && !delayedTransit.contains(p.getUniqueId())) { throw new PlayerStillDeadException(); } transitManager.addPlayerToExitTransit(p.getUniqueId(), server); MercuryManager.warnOfArrival(p.getUniqueId(), server); CustomWorldNBTStorage st = CustomWorldNBTStorage.getWorldNBTStorage(); st.save(p, st.getInvIdentifier(p.getUniqueId()), true); p.setGameMode(GameMode.SPECTATOR); boolean delayed = delayedTransit.contains(p.getUniqueId()); sendPlayer(p, server, delayed); return true; }

Target:
public boolean teleportPlayerToServer(final Player p, final String server, final PlayerChangeServerReason reason) throws PlayerStillDeadException { if (transitManager.isPlayerInExitTransit(p.getUniqueId())) { return false; } PlayerChangeServerEvent event = new PlayerChangeServerEvent(reason, p.getUniqueId(), server); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) { return false; } if (combatManager.isCombatTagNPC(p)) { return false; } combatManager.unCombatTag(p); if (p.isInsideVehicle()) { BetterShardsPlugin.getInstance().getLogger().log(Level.INFO, "During BetterShards teleport, removing player {0} from vehicle", p.getUniqueId()); p.getVehicle().eject(); } if (p.isDead() && !delayedTransit.contains(p.getUniqueId())) { throw new PlayerStillDeadException(); } transitManager.addPlayerToExitTransit(p.getUniqueId(), server); MercuryManager.warnOfArrival(p.getUniqueId(), server); CustomWorldNBTStorage st = CustomWorldNBTStorage.getWorldNBTStorage(); st.save(p, st.getInvIdentifier(p.getUniqueId()), true); boolean delayed = delayedTransit.contains(p.getUniqueId()); sendPlayer(p, server, delayed); return true; }
Source:
public double getPercentile(final double percentile) { if (percentile <= 0) throw new IllegalArgumentException("Cannot query percentiles of 0 or below"); if (percentile >= 1) throw new IllegalArgumentException("Cannot query percentiles of 1 or above"); values().stream() .filter(b -> b.getValue() < 0) .findFirst() .ifPresent(b -> { throw new IllegalArgumentException("Cannot calculate Percentile when negative counts are present " + "in histogram. Bin " + b.getId() + "=" + b.getValue()); }); final double total = getCount(); if (total == 0) throw new IllegalArgumentException("Cannot calculate percentiles when total is zero."); double sofar = 0; for (Bin<K> bin : values()) { sofar += bin.getValue(); if (sofar / total >= percentile) return bin.getIdValue(); } throw new IllegalStateException("UNPOSSIBLE! Could not find percentile: " + percentile); }

Target:
public double getPercentile(final double percentile) { if (percentile <= 0) throw new IllegalArgumentException("Cannot query percentiles of 0 or below"); if (percentile >= 1) throw new IllegalArgumentException("Cannot query percentiles of 1 or above"); values().stream() .filter(b -> b.getValue() < 0) .findFirst() .ifPresent(b -> { throw new IllegalStateException("Cannot calculate Percentile when negative counts are present " + "in histogram. Bin " + b.getId() + "=" + b.getValue()); }); final double total = getCount(); if (total == 0) throw new IllegalStateException("Cannot calculate percentiles when total is zero."); double soFar = 0; for (Bin<K> bin : values()) { soFar += bin.getValue(); if (soFar / total >= percentile) return bin.getIdValue(); } throw new IllegalStateException("UNPOSSIBLE! Could not find percentile: " + percentile); }
Source:
public String generatePassword(final int length, final List<CharacterRule> rules) { if (length <= 0) { throw new IllegalArgumentException("length must be greater than 0"); } final StringBuilder allChars = new StringBuilder(); final CharBuffer buffer = CharBuffer.allocate(length); if (rules != null) { rules.stream().map((rule) -> { fillRandomCharacters(rule.getValidCharacters(), rule.getNumberOfCharacters(), buffer); return rule; }).forEach((rule) -> { allChars.append(rule.getValidCharacters()); }); } fillRandomCharacters(allChars, length - buffer.position(), buffer); buffer.flip(); randomize(buffer); return buffer.toString(); }

Target:
public String generatePassword(final int length, final List<CharacterRule> rules) { if (length <= 0) { throw new IllegalArgumentException("length must be greater than 0"); } final StringBuilder allChars = new StringBuilder(); final CharBuffer buffer = CharBuffer.allocate(length); if (rules != null) { for (CharacterRule rule : rules) { fillRandomCharacters(rule.getValidCharacters(), rule.getNumberOfCharacters(), buffer); allChars.append(rule.getValidCharacters()); } } fillRandomCharacters(allChars, length - buffer.position(), buffer); buffer.flip(); randomize(buffer); return buffer.toString(); }
Source:
private Deque<List<String>> wrap(String functionName, List<String> paramNames, int maxLineLength) { Deque<List<String>> paramLines = new ArrayDeque<>(); paramLines.addLast(new ArrayList<>()); int leading = functionName != null ? functionName.length() : 0; int length = leading; for (String paramName : paramNames) { length += paramName.length() + 2; if (length > maxLineLength) { length = leading + paramName.length(); paramLines.addLast(new ArrayList<>()); } paramLines.getLast().add(paramName); } return paramLines; }

Target:
private List<List<String>> wrap(String functionName, List<String> paramNames, int maxLineLength) { List<List<String>> paramLines = new ArrayList<>(); ImmutableList.Builder<String> linesBuilder = new ImmutableList.Builder<String>(); int leading = functionName.length(); int length = leading; int punctuation = 2; for (String paramName : paramNames) { length += paramName.length() + punctuation; if (length > maxLineLength) { paramLines.add(linesBuilder.build()); length = leading + paramName.length(); linesBuilder = new ImmutableList.Builder<String>(); } linesBuilder.add(paramName); } paramLines.add(linesBuilder.build()); return paramLines; }
Source:
private void setPayload(VM vm) { try { org.ovirt.engine.core.common.businessentities.VmPayload payload = getEntity(org.ovirt.engine.core.common.businessentities.VmPayload.class, VdcQueryType.GetVmPayload, new GetVmByVmIdParameters(new Guid(vm.getId())), null, false); if (payload != null) { VmPayload p = getMapper(org.ovirt.engine.core.common.businessentities.VmPayload.class, VmPayload.class) .map(payload, null); VmPayloads payloads = new VmPayloads(); payloads.getVmPayload().add(p); vm.setVmPayloads(payloads); } } catch (Exception ex) { } }

Target:
protected void setPayload(VM vm) { try { org.ovirt.engine.core.common.businessentities.VmPayload payload = getEntity(org.ovirt.engine.core.common.businessentities.VmPayload.class, VdcQueryType.GetVmPayload, new GetVmByVmIdParameters(new Guid(vm.getId())), null, false); if (payload != null) { VmPayload p = getMapper(org.ovirt.engine.core.common.businessentities.VmPayload.class, VmPayload.class) .map(payload, null); VmPayloads payloads = new VmPayloads(); payloads.getVmPayload().add(p); vm.setVmPayloads(payloads); } } catch (WebFaultException ex) { } }
Source:
public void testInsertProperties() { final DataObject dataObject = mock(DataObject.class); final String myImportedClass = "org.MyClass"; when(dataObject.getClassType()).thenReturn(myImportedClass); final DataType existingDt = mock(DataType.class); doReturn(existingDt).when(dataTypeList).findDataTypeByName(myImportedClass); final DataTypeListItem dtListItem = mock(DataTypeListItem.class); final Optional<DataTypeListItem> dtListItemOptional = Optional.of(dtListItem); doReturn(dtListItemOptional).when(dataTypeList).findItem(existingDt); final DataObjectProperty property1 = mock(DataObjectProperty.class); final DataObjectProperty property2 = mock(DataObjectProperty.class); final List<DataObjectProperty> properties = Arrays.asList(property1, property2); when(dataObject.getProperties()).thenReturn(properties); final DataType property1DataType = mock(DataType.class); final DataType property2DataType = mock(DataType.class); doReturn(property1DataType).when(dataTypeList).createNewDataType(property1); doReturn(property2DataType).when(dataTypeList).createNewDataType(property2); dataTypeList.insertProperties(dataObject); verify(dtListItem).insertNestedField(property1DataType); verify(dtListItem).insertNestedField(property2DataType); }

Target:
public void testInsertProperties() { final DataObject dataObject = mock(DataObject.class); final String myImportedClass = "org.MyClass"; final DataType existingDt = mock(DataType.class); final DataTypeListItem dtListItem = mock(DataTypeListItem.class); final Optional<DataTypeListItem> dtListItemOptional = Optional.of(dtListItem); final DataObjectProperty property1 = mock(DataObjectProperty.class); final DataObjectProperty property2 = mock(DataObjectProperty.class); final List<DataObjectProperty> properties = Arrays.asList(property1, property2); final DataType property1DataType = mock(DataType.class); final DataType property2DataType = mock(DataType.class); when(dataObject.getClassType()).thenReturn(myImportedClass); when(dataObject.getProperties()).thenReturn(properties); doReturn(Optional.of(existingDt)).when(dataTypeList).findDataTypeByName(myImportedClass); doReturn(dtListItemOptional).when(dataTypeList).findItem(existingDt); doReturn(property1DataType).when(dataTypeList).createNewDataType(property1); doReturn(property2DataType).when(dataTypeList).createNewDataType(property2); dataTypeList.insertProperties(dataObject); verify(dtListItem).insertNestedField(property1DataType); verify(dtListItem).insertNestedField(property2DataType); }
Source:
protected AbstractWebFailoverTestCase(String deploymentName, TransactionMode mode) { this.deploymentName = deploymentName; this.nonOwnerTask = () -> { if (mode.isTransactional()) { try { Thread.sleep(GRACE_TIME_TO_REPLICATE); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }; }

Target:
protected AbstractWebFailoverTestCase(String deploymentName, TransactionMode mode) { this.deploymentName = deploymentName; this.nonOwnerTask = () -> { if (!mode.isTransactional()) { try { Thread.sleep(GRACE_TIME_TO_REPLICATE); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }; }
Source:
private AsyncTaskManager() { _tasks = new ConcurrentHashMap<Guid, SPMAsyncTask>(); SchedulerUtil scheduler = SchedulerUtilQuartzImpl.getInstance(); scheduler.scheduleAFixedDelayJob(this, "_timer_Elapsed", new Class[]{}, new Object[]{}, Config.<Integer>GetValue(ConfigValues.AsyncTaskPollingRate), Config.<Integer>GetValue(ConfigValues.AsyncTaskPollingRate), TimeUnit.SECONDS); scheduler.scheduleAFixedDelayJob(this, "_cacheTimer_Elapsed", new Class[]{}, new Object[]{}, Config.<Integer>GetValue(ConfigValues.AsyncTaskStatusCacheRefreshRateInSeconds), Config.<Integer>GetValue(ConfigValues.AsyncTaskStatusCacheRefreshRateInSeconds), TimeUnit.SECONDS); _cacheTimeInMinutes = Config.<Integer>GetValue(ConfigValues.AsyncTaskStatusCachingTimeInMinutes); tasksInDbAfterRestart = new ConcurrentHashMap(); Map<Guid, List<AsyncTasks>> rootCommandIdToTasksMap = groupTasksByRootCommandId(DbFacade.getInstance().getAsyncTaskDao().getAll()); for (Guid rootCommandId : rootCommandIdToTasksMap.keySet()) { if (hasTasksWithoutVdsmId(rootCommandIdToTasksMap.get(rootCommandId))) { log.infoFormat("Root Command {0} has tasks without vdsm id.", rootCommandId); handleTasksOfCommandWithEmptyVdsmId(rootCommandIdToTasksMap.get(rootCommandId)); } for (AsyncTasks task : rootCommandIdToTasksMap.get(rootCommandId)) { if (!hasEmptyVdsmId(task)) { tasksInDbAfterRestart.putIfAbsent(task.getStoragePoolId(), new ArrayList<AsyncTasks>()); tasksInDbAfterRestart.get(task.getStoragePoolId()).add(task); } } } }

Target:
private AsyncTaskManager() { _tasks = new ConcurrentHashMap<Guid, SPMAsyncTask>(); SchedulerUtil scheduler = SchedulerUtilQuartzImpl.getInstance(); scheduler.scheduleAFixedDelayJob(this, "_timer_Elapsed", new Class[]{}, new Object[]{}, Config.<Integer>GetValue(ConfigValues.AsyncTaskPollingRate), Config.<Integer>GetValue(ConfigValues.AsyncTaskPollingRate), TimeUnit.SECONDS); scheduler.scheduleAFixedDelayJob(this, "_cacheTimer_Elapsed", new Class[]{}, new Object[]{}, Config.<Integer>GetValue(ConfigValues.AsyncTaskStatusCacheRefreshRateInSeconds), Config.<Integer>GetValue(ConfigValues.AsyncTaskStatusCacheRefreshRateInSeconds), TimeUnit.SECONDS); _cacheTimeInMinutes = Config.<Integer>GetValue(ConfigValues.AsyncTaskStatusCachingTimeInMinutes); tasksInDbAfterRestart = new ConcurrentHashMap(); Map<Guid, List<AsyncTasks>> rootCommandIdToTasksMap = groupTasksByRootCommandId(DbFacade.getInstance().getAsyncTaskDao().getAll()); for (Entry<Guid, List<AsyncTasks>> entry : rootCommandIdToTasksMap.entrySet()) { if (hasTasksWithoutVdsmId(rootCommandIdToTasksMap.get(entry.getKey()))) { log.infoFormat("Root Command {0} has tasks without vdsm id.", entry.getKey()); handleTasksOfCommandWithEmptyVdsmId(rootCommandIdToTasksMap.get(entry.getKey())); } for (AsyncTasks task : entry.getValue()) { if (!hasEmptyVdsmId(task)) { tasksInDbAfterRestart.putIfAbsent(task.getStoragePoolId(), new ArrayList<AsyncTasks>()); tasksInDbAfterRestart.get(task.getStoragePoolId()).add(task); } } } }
Source:
public void makeTestIndexer() throws Exception { final MongoClient client = MockMongoSingleton.getInstance(); indexer = new MongoGeoTemporalIndexer(); conf.setMongoDBName("GEO_TEMPORAL_INDEXER_TEST"); conf.set(MongoDBRdfConfiguration.MONGO_DB_NAME, "GEO_TEMPORAL_INDEXER_TEST"); conf.setMongoClient(client); conf.set(RdfCloudTripleStoreConfiguration.CONF_TBL_PREFIX, "rya_"); indexer.setConf(conf); indexer.init(); }

Target:
public void makeTestIndexer() throws Exception { indexer = new MongoGeoTemporalIndexer(); indexer.setConf(conf); indexer.init(); }
Source:
private String computeLabel(StoragePathAdapter adapter) { String commitId = adapter.getCommitId(); String username = adapter.getUsername(); String computedLabel; if (adapter.isLocal()) { computedLabel = "Local: " + adapter.getStoragePath(); } else { computedLabel = "Remote: " + adapter.getStoragePath(); } if (commitId != null && !"".equals(commitId)) { computedLabel = computedLabel + " " + commitId.substring(0, 7); } if (username != null && !"".equals(username)) { computedLabel = computedLabel + " (" + username + ")"; } return computedLabel; }

Target:
private String computeLabel(StoragePathAdapter adapter) { String commitId = adapter.getCommitId(); String username = adapter.getUsername(); String computedLabel; if (adapter.isLocal()) { computedLabel = "Local: " + adapter.getStoragePath(); } else { computedLabel = adapter.getStoragePath(); } if (commitId != null && !"".equals(commitId)) { computedLabel += " " + commitId.substring(0, 7); } if (username != null && !"".equals(username)) { computedLabel += " (" + username + ")"; } return computedLabel; }
Source:
void handleLostAll() { log.debug("Closing lost active tasks as zombies."); final Iterator<Task> iterator = tasks.values().iterator(); while (iterator.hasNext()) { final Task task = iterator.next(); final Set<TopicPartition> inputPartitions = task.inputPartitions(); if (task.isActive()) { cleanupTask(task); task.closeDirty(); iterator.remove(); try { activeTaskCreator.closeAndRemoveTaskProducerIfNeeded(task.id()); } catch (final RuntimeException e) { log.debug("Error handling lostAll", e); } } for (final TopicPartition inputPartition : inputPartitions) { partitionToTask.remove(inputPartition); } } }

Target:
void handleLostAll() { log.debug("Closing lost active tasks as zombies."); final Iterator<Task> iterator = tasks.values().iterator(); while (iterator.hasNext()) { final Task task = iterator.next(); final Set<TopicPartition> inputPartitions = task.inputPartitions(); if (task.isActive()) { cleanupTask(task); task.closeDirty(); iterator.remove(); try { activeTaskCreator.closeAndRemoveTaskProducerIfNeeded(task.id()); } catch (final RuntimeException e) { log.warn("Error closing task producer for " + task.id() + " while handling lostAll", e); } } for (final TopicPartition inputPartition : inputPartitions) { partitionToTask.remove(inputPartition); } } }
Source:
private void rematchAllNetworksAndRequests() { final long now = SystemClock.elapsedRealtime(); final NetworkAgentInfo oldDefaultNetwork = getDefaultNetwork(); final NetworkAgentInfo[] nais = mNetworkAgentInfos.values().toArray( new NetworkAgentInfo[mNetworkAgentInfos.size()]); Arrays.sort(nais); for (NetworkAgentInfo nai : nais) { rematchNetworkAndRequests(nai, now); } final NetworkAgentInfo newDefaultNetwork = getDefaultNetwork(); updateLegacyTypeTrackerAfterRematch(oldDefaultNetwork, newDefaultNetwork, nais); for (NetworkAgentInfo nai : mNetworkAgentInfos.values()) { if (unneeded(nai, UnneededFor.TEARDOWN)) { if (nai.getLingerExpiry() > 0) { updateLingerState(nai, now); } else { if (DBG) log("Reaping " + nai.name()); teardownUnneededNetwork(nai); } } } }

Target:
private void rematchAllNetworksAndRequests() { final long now = SystemClock.elapsedRealtime(); final NetworkAgentInfo oldDefaultNetwork = getDefaultNetwork(); final NetworkAgentInfo[] nais = mNetworkAgentInfos.values().toArray( new NetworkAgentInfo[mNetworkAgentInfos.size()]); Arrays.sort(nais); for (NetworkAgentInfo nai : nais) { rematchNetworkAndRequests(nai, now); } final NetworkAgentInfo newDefaultNetwork = getDefaultNetwork(); updateLegacyTypeTrackerAndVpnLockdownForRematch(oldDefaultNetwork, newDefaultNetwork, nais); for (NetworkAgentInfo nai : mNetworkAgentInfos.values()) { if (unneeded(nai, UnneededFor.TEARDOWN)) { if (nai.getLingerExpiry() > 0) { updateLingerState(nai, now); } else { if (DBG) log("Reaping " + nai.name()); teardownUnneededNetwork(nai); } } } }
Source:
public void setIncomingHeartbeat(boolean isHeartbeat) { if (isHeartbeat && this.incomingHeartbeat != 0) { this.isIncomingHeartbeat.set(isHeartbeat); } this.isIncomingHeartbeat.set(false); }

Target:
public void setIncomingHeartbeat(boolean isHeartbeat) { if (isHeartbeat && this.incomingHeartbeat != 0) { this.isIncomingHeartbeat.set(isHeartbeat); return; } this.isIncomingHeartbeat.set(false); }
Source:
public void testInvokeJmxOperationNotExposed() throws Exception { try { server.invoke(name, "stop", new Object[]{}, new String[]{}); fail("Method not exposed, invocation should have failed"); } catch (MBeanException mbe) { assertTrue(mbe.getCause() instanceof ServiceNotFoundException); } }

Target:
public void testInvokeJmxOperationNotExposed() throws Exception { Exceptions.expectException(MBeanException.class, ServiceNotFoundException.class, () -> server.invoke(name, "stop", new Object[]{}, new String[]{})); }
Source:
public TextBoxLabel() { super(new EmptyValueRenderer<String>() { @Override public String render(String value) { String renderedText = super.render(value); renderedText = renderedText.replace("&lt;", "<"); return renderedText; } }); }

Target:
public TextBoxLabel() { super(new EmptyValueRenderer<String>() { @Override public String render(String value) { String renderedText = super.render(value); renderedText = SafeHtmlUtils.htmlEscape(renderedText); return renderedText; } }); }
Source:
public ModuleDeploymentProperties() { put(COUNT, "" + 1); }

Target:
public ModuleDeploymentProperties() { map.put(COUNT_KEY, String.valueOf(1)); }
Source:
public static byte[] hexStringToByteArray(String value) { value = value.trim(); if (value.startsWith(HEX_HEADER)) value = value.substring((HEX_HEADER).length()); int len = value.length(); if (len % 2 != 0) { value = "0" + value; len = value.length(); } byte[] data = new byte[len / 2]; for (int i = 0; i < len; i += 2) { data[i / 2] = (byte) ((Character.digit(value.charAt(i), 16) << 4) + Character.digit(value.charAt(i+1), 16)); } return data; }

Target:
public static byte[] hexStringToByteArray(String value) { if (value == null) throw new NullPointerException("Value cannot be null."); value = value.trim(); if (value.startsWith(HEX_HEADER)) value = value.substring((HEX_HEADER).length()); int len = value.length(); if (len % 2 != 0) { value = "0" + value; len = value.length(); } byte[] data = new byte[len / 2]; for (int i = 0; i < len; i += 2) { data[i / 2] = (byte) ((Character.digit(value.charAt(i), 16) << 4) + Character.digit(value.charAt(i+1), 16)); } return data; }
Source:
protected boolean validate() { DiskImage diskImage = diskImageDao.getAncestor(getParameters().getImageId()); if (diskImage.getImageStatus() == ImageStatus.LOCKED) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_DISK_IS_BEING_MIGRATED, ReplacementUtils.createSetVariableString("DiskName", diskImage.getDiskAlias())); } return true; }

Target:
protected boolean validate() { DiskImage diskImage = diskImageDao.getAncestor(getParameters().getImageId()); if (diskImage == null) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_DISK_NOT_EXIST); } if (diskImage.getImageStatus() == ImageStatus.LOCKED) { return failValidation(EngineMessage.ACTION_TYPE_FAILED_DISK_IS_BEING_MIGRATED, ReplacementUtils.createSetVariableString("DiskName", diskImage.getDiskAlias())); } return true; }
Source:
public LeadImagesHandler(PageViewFragment parentFragment, CommunicationBridge bridge, ObservableWebView webview, ViewGroup hidingView) { this.parentFragment = parentFragment; this.webview = webview; this.imageContainer = hidingView; this.bridge = bridge; image1 = (ImageView)imageContainer.findViewById(R.id.page_image_1); pageTitleContainer = imageContainer.findViewById(R.id.page_title_container); pageTitleText = (TextView)imageContainer.findViewById(R.id.page_title_text); webview.addOnScrollChangeListener(this); displayDensity = parentFragment.getResources().getDisplayMetrics().density; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { Point size = new Point(); parentFragment.getActivity().getWindowManager().getDefaultDisplay().getSize(size); displayHeight = (int)(size.y / displayDensity); } else { displayHeight = (int)(parentFragment.getActivity() .getWindowManager().getDefaultDisplay().getHeight() / displayDensity); } hide(); }

Target:
public LeadImagesHandler(PageViewFragment parentFragment, CommunicationBridge bridge, ObservableWebView webview, ViewGroup hidingView) { this.parentFragment = parentFragment; this.imageContainer = hidingView; this.bridge = bridge; image1 = (ImageView)imageContainer.findViewById(R.id.page_image_1); pageTitleContainer = imageContainer.findViewById(R.id.page_title_container); pageTitleText = (TextView)imageContainer.findViewById(R.id.page_title_text); webview.addOnScrollChangeListener(this); displayDensity = parentFragment.getResources().getDisplayMetrics().density; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) { Point size = new Point(); parentFragment.getActivity().getWindowManager().getDefaultDisplay().getSize(size); displayHeight = (int)(size.y / displayDensity); } else { displayHeight = (int)(parentFragment.getActivity() .getWindowManager().getDefaultDisplay().getHeight() / displayDensity); } hide(); }
Source:
public void visitToken(DetailAST ast) { if (!skipAnnotationArgs(ast) && !skipAnnotationDefaults(ast) && !isInIgnoreList(ast) && (!ignoreHashCodeMethod || !isInHashCodeMethod(ast))) { final DetailAST constantDefAST = findContainingConstantDef(ast); if (constantDefAST == null) { if (!ignoreFieldDeclaration || !isFieldDeclaration(ast)) { reportMagicNumber(ast); } } else { final boolean found = isMagicNumberExists(ast, constantDefAST); if (found) { reportMagicNumber(ast); } } } }

Target:
public void visitToken(DetailAST ast) { if (shouldTestAnnotationArgs(ast) && shouldTestAnnotationDefaults(ast) && !isInIgnoreList(ast) && (!ignoreHashCodeMethod || !isInHashCodeMethod(ast))) { final DetailAST constantDefAST = findContainingConstantDef(ast); if (constantDefAST == null) { if (!ignoreFieldDeclaration || !isFieldDeclaration(ast)) { reportMagicNumber(ast); } } else { final boolean found = isMagicNumberExists(ast, constantDefAST); if (found) { reportMagicNumber(ast); } } } }
Source:
private void setupToolBar() { CreateNewAboAction newAboAction = new CreateNewAboAction(Daten.getInstance().getListeAbo()); JavaFxUtils.invokeInFxThreadAndWait(() -> { toolBar = new FXAboToolBar(); toolBar.btnOn.setOnAction(e -> SwingUtilities.invokeLater(() -> aboEinAus(true))); toolBar.btnOff.setOnAction(e -> SwingUtilities.invokeLater(() -> aboEinAus(false))); toolBar.btnDelete.setOnAction(e -> SwingUtilities.invokeLater(this::aboLoeschen)); toolBar.btnEdit.setOnAction(e -> SwingUtilities.invokeLater(this::editAbo)); toolBar.btnNewAbo.setOnAction(e -> SwingUtilities.invokeLater(() -> newAboAction.actionPerformed(null))); toolBar.cbSender.setOnAction(e -> SwingUtilities.invokeLater(this::tabelleLaden)); toolBarPanel.setScene(new Scene(toolBar)); }); }

Target:
private void setupToolBar() { JavaFxUtils.invokeInFxThreadAndWait(() -> { toolBar = new FXAboToolBar(); toolBar.btnOn.setOnAction(e -> SwingUtilities.invokeLater(() -> aboEinAus(true))); toolBar.btnOff.setOnAction(e -> SwingUtilities.invokeLater(() -> aboEinAus(false))); toolBar.btnDelete.setOnAction(e -> SwingUtilities.invokeLater(this::aboLoeschen)); toolBar.btnEdit.setOnAction(e -> SwingUtilities.invokeLater(this::editAbo)); CreateNewAboAction newAboAction = new CreateNewAboAction(Daten.getInstance().getListeAbo()); toolBar.btnNewAbo.setOnAction(e -> SwingUtilities.invokeLater(() -> newAboAction.actionPerformed(null))); toolBar.cbSender.setOnAction(e -> SwingUtilities.invokeLater(this::tabelleLaden)); toolBarPanel.setScene(new Scene(toolBar)); }); }
Source:
private void removeImages() { for (final DiskImage source : getSourceImages()) { DiskImage dest = getDiskImageDao().getAllSnapshotsForParent(source.getImageId()).get(0); if (getSnapshotActionType() == VdcActionType.RemoveSnapshotSingleDisk) { VdcReturnValueBase vdcReturnValue = runInternalActionWithTasksContext( getSnapshotActionType(), buildRemoveSnapshotSingleDiskParameters(source, dest)); if (vdcReturnValue != null && vdcReturnValue.getInternalVdsmTaskIdList() != null) { getReturnValue().getVdsmTaskIdList().addAll(vdcReturnValue.getInternalVdsmTaskIdList()); } } else { TaskManagerUtil.executeAsyncCommand( getSnapshotActionType(), buildRemoveSnapshotSingleDiskParameters(source, dest), getContext()); } List<Guid> quotasToRemoveFromCache = new ArrayList<Guid>(); quotasToRemoveFromCache.add(source.getQuotaId()); quotasToRemoveFromCache.add(dest.getQuotaId()); QuotaManager.getInstance().removeQuotaFromCache(getStoragePoolId(), quotasToRemoveFromCache); } }

Target:
private void removeImages() { for (final DiskImage source : getSourceImages()) { DiskImage dest = getDiskImageDao().getAllSnapshotsForParent(source.getImageId()).get(0); if (getSnapshotActionType() == VdcActionType.RemoveSnapshotSingleDisk) { VdcReturnValueBase vdcReturnValue = runInternalActionWithTasksContext( getSnapshotActionType(), buildRemoveSnapshotSingleDiskParameters(source, dest)); if (vdcReturnValue != null && vdcReturnValue.getInternalVdsmTaskIdList() != null) { getReturnValue().getVdsmTaskIdList().addAll(vdcReturnValue.getInternalVdsmTaskIdList()); } } else { TaskManagerUtil.executeAsyncCommand( getSnapshotActionType(), buildRemoveSnapshotSingleDiskParameters(source, dest), cloneContextAndDetachFromParent()); } List<Guid> quotasToRemoveFromCache = new ArrayList<Guid>(); quotasToRemoveFromCache.add(source.getQuotaId()); quotasToRemoveFromCache.add(dest.getQuotaId()); QuotaManager.getInstance().removeQuotaFromCache(getStoragePoolId(), quotasToRemoveFromCache); } }
Source:
public long estimatedInMemorySize() { return INSTANCE_SIZE + getRequiredBytesForSerialization(); }

Target:
public long estimatedInMemorySize() { return INSTANCE_SIZE + indices.length * (SizeOf.SIZE_OF_INT + SizeOf.SIZE_OF_DOUBLE + SizeOf.SIZE_OF_LONG); }
Source:
private void makeResultBudget(int numRows) { int bytesSoFar = 0; double selectivity = 1; int totalAsk = 0; if (targetResultBytes == OrcRecordReader.UNLIMITED_BUDGET || (ariaFlags & AriaFlags.noReaderBudget) != 0) { for (int i = 0; i < sortedStreamReaders.length; i++) { StreamReader reader = sortedStreamReaders[i]; if (reader.getChannel() != -1) { reader.setResultSizeBudget(OrcRecordReader.UNLIMITED_BUDGET); } } return; } for (int i = 0; i < sortedStreamReaders.length; i++) { StreamReader reader = sortedStreamReaders[i]; bytesSoFar += reader.getResultSizeInBytes(); Filter filter = reader.getFilter(); int channel = reader.getChannel(); if (filter != null) { selectivity *= filter.getSelectivity(); } if (channel != -1) { int avgSize = reader.getAverageResultSize(); readerBudget[i] = Math.max(8000, (int) (numRows * selectivity * avgSize)); totalAsk += readerBudget[i]; if (i < filterFunctionOrder.length && filterFunctionOrder[i] != null) { for (FilterFunction function : filterFunctionOrder[i]) { selectivity *= function.getSelectivity(); } } } else { readerBudget[i] = 0; } } if (totalAsk == 0) { return; } long available = targetResultBytes - bytesSoFar; if (available < 10000) { available = 10000; } double grantedFraction = (double) available / totalAsk; for (int i = 0; i < sortedStreamReaders.length; i++) { StreamReader reader = sortedStreamReaders[i]; if (reader.getChannel() != -1) { long budget = (int) (readerBudget[i] * grantedFraction); reader.setResultSizeBudget(budget * BUDGET_HARD_LIMIT_MULTIPLIER); } } }

Target:
private void makeResultBudget(int numRows) { if (targetResultBytes == UNLIMITED_BUDGET || (ariaFlags & AriaFlags.noReaderBudget) != 0) { for (int i = 0; i < sortedStreamReaders.length; i++) { StreamReader reader = sortedStreamReaders[i]; if (reader.getChannel() != -1) { reader.setResultSizeBudget(UNLIMITED_BUDGET); } } return; } long bytesSoFar = 0; double selectivity = 1; long totalAsk = 0; for (int i = 0; i < sortedStreamReaders.length; i++) { StreamReader reader = sortedStreamReaders[i]; bytesSoFar += reader.getResultSizeInBytes(); Filter filter = reader.getFilter(); if (filter != null) { selectivity *= filter.getSelectivity(); } if (reader.getChannel() != -1) { readerBudget[i] = Math.max(MIN_READER_BUDGET, (long) (numRows * selectivity * reader.getAverageResultSize())); totalAsk += readerBudget[i]; if (i < filterFunctionOrder.length && filterFunctionOrder[i] != null) { for (FilterFunction function : filterFunctionOrder[i]) { selectivity *= function.getSelectivity(); } } } else { readerBudget[i] = 0; } } if (totalAsk == 0) { return; } long available = targetResultBytes - bytesSoFar; if (available < MIN_READER_BUDGET) { available = MIN_READER_BUDGET * sortedStreamReaders.length; } double grantedFraction = available < totalAsk ? (double) available / totalAsk : 1.0; for (int i = 0; i < sortedStreamReaders.length; i++) { StreamReader reader = sortedStreamReaders[i]; if (reader.getChannel() != -1) { reader.setResultSizeBudget((long) (readerBudget[i] * grantedFraction) * BUDGET_HARD_LIMIT_MULTIPLIER); } } }
Source:
protected Iterator<Size> getSizeIterator(AccumuloClient client, String tablename, Text start, Text end) throws MergeException { Table.ID tableId; TabletsMetadata tablets; try { ClientContext context = new ClientContext(client.info()); tableId = Tables.getTableId(context, tablename); tablets = TabletsMetadata.builder().scanMetadataTable() .overRange(new KeyExtent(tableId, end, start).toMetadataRange()).fetchFiles().fetchPrev() .build(context); } catch (Exception e) { throw new MergeException(e); } return tablets.stream().map(tm -> { long size = tm.getFilesMap().values().stream().mapToLong(DataFileValue::getSize).sum(); return new Size(tm.getExtent(), size); }).iterator(); }

Target:
protected Iterator<Size> getSizeIterator(AccumuloClient client, String tablename, Text start, Text end) throws MergeException { Table.ID tableId; TabletsMetadata tablets; try { ClientContext context = new ClientContext(client); tableId = Tables.getTableId(context, tablename); tablets = TabletsMetadata.builder().scanMetadataTable() .overRange(new KeyExtent(tableId, end, start).toMetadataRange()).fetchFiles().fetchPrev() .build(context); } catch (Exception e) { throw new MergeException(e); } return tablets.stream().map(tm -> { long size = tm.getFilesMap().values().stream().mapToLong(DataFileValue::getSize).sum(); return new Size(tm.getExtent(), size); }).iterator(); }
Source:
public void define(WebService.NewController controller) { WebService.NewAction action = controller.createAction(ACTION_CREATE) .setPost(true) .setDescription("Create a Webhook.<br>" + "Requires the global, organization or project permission.") .setSince("7.1") .setResponseExample(getClass().getResource("example-webhook-create.json")) .setHandler(this); action.createParam(NAME_PARAM) .setRequired(true) .setMaximumLength(NAME_PARAM_MAXIMUM_LENGTH) .setDescription("The name of the webhook to create") .setExampleValue(NAME_WEBHOOK_EXAMPLE_001); action.createParam(URL_PARAM) .setRequired(true) .setMaximumLength(URL_PARAM_MAXIMUM_LENGTH) .setDescription("The url to be called by the webhook") .setExampleValue(URL_WEBHOOK_EXAMPLE_001); action.createParam(PROJECT_KEY_PARAM) .setRequired(false) .setMaximumLength(PROJECT_KEY_PARAM_MAXIMUN_LENGTH) .setDescription("The key of the project that will own the webhook") .setExampleValue(KEY_PROJECT_EXAMPLE_001); action.createParam(ORGANIZATION_KEY_PARAM) .setInternal(true) .setRequired(false) .setMaximumLength(ORGANIZATION_KEY_PARAM_MAXIMUM_LENGTH) .setDescription("The key of the organization that will own the webhook") .setExampleValue(KEY_ORG_EXAMPLE_001); }

Target:
public void define(WebService.NewController controller) { WebService.NewAction action = controller.createAction(ACTION_CREATE) .setPost(true) .setDescription("Create a Webhook.<br>" + "Requires 'Administer' permission on the specified project, or global 'Administer' permission.") .setSince("7.1") .setResponseExample(getClass().getResource("example-webhook-create.json")) .setHandler(this); action.createParam(NAME_PARAM) .setRequired(true) .setMaximumLength(NAME_PARAM_MAXIMUM_LENGTH) .setDescription("Name displayed in the administration console of webhooks") .setExampleValue(NAME_WEBHOOK_EXAMPLE_001); action.createParam(URL_PARAM) .setRequired(true) .setMaximumLength(URL_PARAM_MAXIMUM_LENGTH) .setDescription("Server endpoint that will receive the webhook payload, for example 'http://my_server/foo'." + " If HTTP Basic authentication is used, HTTPS is recommended to avoid man in the middle attacks." + " Example: 'https://myLogin:myPassword@my_server/foo'") .setExampleValue(URL_WEBHOOK_EXAMPLE_001); action.createParam(PROJECT_KEY_PARAM) .setRequired(false) .setMaximumLength(PROJECT_KEY_PARAM_MAXIMUN_LENGTH) .setDescription("The key of the project that will own the webhook") .setExampleValue(KEY_PROJECT_EXAMPLE_001); action.createParam(ORGANIZATION_KEY_PARAM) .setInternal(true) .setRequired(false) .setMaximumLength(ORGANIZATION_KEY_PARAM_MAXIMUM_LENGTH) .setDescription("The key of the organization that will own the webhook") .setExampleValue(KEY_ORG_EXAMPLE_001); }
Source:
public void testSplitProcedureMetrics() { HELPER.assertGauge(MetricsMasterProcSource.NUM_SPLIT_PROCEDURE_REQUEST_NAME, 32, masterProcSource); HELPER.assertGauge(MetricsMasterProcSource.NUM_SPLIT_PROCEDURE_SUCCESS_NAME, 24, masterProcSource); HELPER.assertGauge("SplitProcedureTime_max", 2082, masterProcSource); HELPER.assertGauge("SplitProcedureTime_min", 2082, masterProcSource); }

Target:
public void testSplitProcedureMetrics() { HELPER .assertGauge(MetricsMasterProcSource.NUM_SPLIT_PROCEDURE_REQUEST_NAME, 32, masterProcSource); HELPER .assertGauge(MetricsMasterProcSource.NUM_SPLIT_PROCEDURE_SUCCESS_NAME, 24, masterProcSource); HELPER.assertGauge("SplitProcedureTime_max", 3011, masterProcSource); HELPER.assertGauge("SplitProcedureTime_min", 2082, masterProcSource); }
Source:
public ChatClient createChatClient() { String endpoint = "https://<RESOURCE_NAME>.communcationservices.azure.com"; NettyAsyncHttpClientBuilder httpClientBuilder = new NettyAsyncHttpClientBuilder(); HttpClient httpClient = httpClientBuilder.build(); String accessKey = "SECRET"; CommunicationUserCredential credential = new CommunicationUserCredential(accessKey); final ChatClientBuilder builder = new ChatClientBuilder(); builder.endpoint(endpoint) .credential(credential) .httpClient(httpClient); ChatClient chatClient = builder.buildClient(); return chatClient; }

Target:
public ChatClient createChatClient() { String endpoint = "https://<RESOURCE_NAME>.communcationservices.azure.com"; NettyAsyncHttpClientBuilder httpClientBuilder = new NettyAsyncHttpClientBuilder(); HttpClient httpClient = httpClientBuilder.build(); String token = "SECRET"; CommunicationUserCredential credential = new CommunicationUserCredential(token); final ChatClientBuilder builder = new ChatClientBuilder(); builder.endpoint(endpoint) .credential(credential) .httpClient(httpClient); ChatClient chatClient = builder.buildClient(); return chatClient; }
Source:
public long hash(Object value) { ByteBuffer plain = null; if (value instanceof Binary) { return hashFunction.hashBytes(((Binary) value).getBytes()).asLong(); } if (value instanceof Integer) { plain = ByteBuffer.allocate(Integer.SIZE/Byte.SIZE); plain.order(ByteOrder.LITTLE_ENDIAN).putInt(((Integer)value).intValue()); } else if (value instanceof Long) { plain = ByteBuffer.allocate(Long.SIZE/Byte.SIZE); plain.order(ByteOrder.LITTLE_ENDIAN).putLong(((Long)value).longValue()); } else if (value instanceof Float) { plain = ByteBuffer.allocate(Float.SIZE/Byte.SIZE); plain.order(ByteOrder.LITTLE_ENDIAN).putFloat(((Float)value).floatValue()); } else if (value instanceof Double) { plain = ByteBuffer.allocate(Double.SIZE/ Byte.SIZE); plain.order(ByteOrder.LITTLE_ENDIAN).putDouble(((Double)value).doubleValue()); } else { throw new RuntimeException("Parquet Bloom filter: Not supported type"); } return hashFunction.hashBytes(plain.array()).asLong(); }

Target:
public long hash(Object value) { ByteBuffer plain; if (value instanceof Binary) { return hashFunction.hashBytes(((Binary) value).getBytes()).asLong(); } if (value instanceof Integer) { plain = ByteBuffer.allocate(Integer.SIZE/Byte.SIZE); plain.order(ByteOrder.LITTLE_ENDIAN).putInt(((Integer)value).intValue()); } else if (value instanceof Long) { plain = ByteBuffer.allocate(Long.SIZE/Byte.SIZE); plain.order(ByteOrder.LITTLE_ENDIAN).putLong(((Long)value).longValue()); } else if (value instanceof Float) { plain = ByteBuffer.allocate(Float.SIZE/Byte.SIZE); plain.order(ByteOrder.LITTLE_ENDIAN).putFloat(((Float)value).floatValue()); } else if (value instanceof Double) { plain = ByteBuffer.allocate(Double.SIZE/ Byte.SIZE); plain.order(ByteOrder.LITTLE_ENDIAN).putDouble(((Double)value).doubleValue()); } else { throw new RuntimeException("Parquet Bloom filter: Not supported type"); } return hashFunction.hashBytes(plain.array()).asLong(); }
Source:
private List<String> buildKeywordSuggestions() { return asList( "in", "or", "and", "between", "if", "then", "else", "for", "return" ); }

Target:
private List<String> buildKeywordSuggestions() { return asList( "for", "return", "if", "then", "else", "some", "every", "satisfies", "instance", "of", "in", "function", "external", "or", "and", "between", "not", "null", "true", "false" ); }
Source:
public static synchronized String getEncryptionKey(String name) { final String keyString = getUniqueId(name); if (CACHED_ENCRYPTION_KEYS.get(keyString) == null) { generateEncryptionKey(keyString); } return CACHED_ENCRYPTION_KEYS.get(keyString); }

Target:
public static synchronized String getEncryptionKey(String name) { if (CACHED_ENCRYPTION_KEYS.get(name) == null) { generateEncryptionKey(name); } return CACHED_ENCRYPTION_KEYS.get(name); }
Source:
Package getPackage(){ return mPackage; }

Target:
Package getPackage() { return pkg; }
Source:
Attribute(String name, ModelType type, CapabilityReferenceRecorder reference) { this.definition = new SimpleAttributeDefinitionBuilder(name, type, true) .setCapabilityReference(reference) .setFlags(Flag.RESTART_RESOURCE_SERVICES) .build(); }

Target:
Attribute(String name, ModelType type, CapabilityReferenceRecorder reference) { this.definition = new SimpleAttributeDefinitionBuilder(name, type) .setCapabilityReference(reference) .setFlags(Flag.RESTART_RESOURCE_SERVICES) .build(); }
Source:
protected AvailabilityZone(String name, ZoneState zoneState) { this.name = name; this.state = zoneState; }

Target:
protected AvailabilityZone(String name, ZoneState zoneState) { this.name = checkNotNull(name); this.state = checkNotNull(zoneState); }
Source:
protected void deserialize(JsonObject src, K builder, JsonDeserializationContext context) { for (JsonElement item : src.getAsJsonArray(MEMBER_ITEMS)) { T deserializedItem = deserializeItem(item, context); if (!(deserializedItem instanceof Undefined)) { builder.addItem(deserializedItem); } } builder.setLabel(getString(src, MEMBER_LABEL)); }

Target:
protected void deserialize(JsonObject src, K builder, JsonDeserializationContext context) { for (JsonElement item : src.getAsJsonArray(MEMBER_ITEMS)) { T deserializedItem = deserializeItem(item, context); if (deserializedItem != null) { builder.addItem(deserializedItem); } } builder.setLabel(getString(src, MEMBER_LABEL)); }
Source:
public static SPMAsyncTask construct(CommandCoordinator coco, AsyncTaskCreationInfo creationInfo) { AsyncTasks asyncTask = coco.getByVdsmTaskId(creationInfo.getVdsmTaskId()); if (asyncTask == null || asyncTask.getActionParameters() == null) { asyncTask = new AsyncTasks(AsyncTaskResultEnum.success, AsyncTaskStatusEnum.running, creationInfo.getVdsmTaskId(), creationInfo.getStepId(), creationInfo.getStoragePoolID(), creationInfo.getTaskType(), getCommandEntity(coco, asyncTask == null ? Guid.newGuid() : asyncTask.getRootCommandId(), VdcActionType.Unknown, new VdcActionParametersBase()), getCommandEntity(coco, asyncTask == null ? Guid.newGuid() : asyncTask.getRootCommandId(), VdcActionType.Unknown, new VdcActionParametersBase())); creationInfo.setTaskType(AsyncTaskType.unknown); } AsyncTaskParameters asyncTaskParams = new AsyncTaskParameters(creationInfo, asyncTask); return construct(coco, creationInfo.getTaskType(), asyncTaskParams, true); }

Target:
public static SPMAsyncTask construct(CommandCoordinator coco, AsyncTaskCreationInfo creationInfo) { AsyncTask asyncTask = coco.getByVdsmTaskId(creationInfo.getVdsmTaskId()); if (asyncTask == null || asyncTask.getActionParameters() == null) { asyncTask = new AsyncTask(AsyncTaskResultEnum.success, AsyncTaskStatusEnum.running, creationInfo.getVdsmTaskId(), creationInfo.getStepId(), creationInfo.getStoragePoolID(), creationInfo.getTaskType(), getCommandEntity(coco, asyncTask == null ? Guid.newGuid() : asyncTask.getRootCommandId(), VdcActionType.Unknown, new VdcActionParametersBase()), getCommandEntity(coco, asyncTask == null ? Guid.newGuid() : asyncTask.getCommandId(), VdcActionType.Unknown, new VdcActionParametersBase())); creationInfo.setTaskType(AsyncTaskType.unknown); } AsyncTaskParameters asyncTaskParams = new AsyncTaskParameters(creationInfo, asyncTask); return construct(coco, creationInfo.getTaskType(), asyncTaskParams, true); }
Source:
private void waitForAuditToComplete() throws Exception { Auditor auditor = getAuditorBookiesAuditor(); if (auditor != null) { Future<?> task = auditor.getAuditTask(); if (task != null) { task.get(5, TimeUnit.SECONDS); } } }

Target:
private void waitForAuditToComplete() throws Exception { long endTime = System.currentTimeMillis() + 5_000; while (System.currentTimeMillis() < endTime) { Auditor auditor = getAuditorBookiesAuditor(); if (auditor != null) { Future<?> task = auditor.submitAuditTask(); task.get(5, TimeUnit.SECONDS); return; } Thread.sleep(100); } throw new TimeoutException("Could not find an audit within 5 seconds"); }
Source:
private RetryPolicyTemplate createRetryPolicyTemplate(CoreEvent event) { Integer maxRetries = (Integer) expressionManager.evaluate(this.maxRetries, DataType.NUMBER, NULL_BINDING_CONTEXT, event).getValue(); Integer millisBetweenRetries = (Integer) expressionManager.evaluate(this.millisBetweenRetries, DataType.NUMBER, NULL_BINDING_CONTEXT, event).getValue(); return this.policyTemplatesCache.get(new Pair<>(millisBetweenRetries, maxRetries)); }

Target:
private RetryPolicyTemplate createRetryPolicyTemplate(CoreEvent event) { ExpressionManagerSession session = expressionManager.openSession(getLocation(), event, NULL_BINDING_CONTEXT); Integer maxRetries = (Integer) session.evaluate(this.maxRetries, DataType.NUMBER).getValue(); Integer millisBetweenRetries = (Integer) session.evaluate(this.millisBetweenRetries, DataType.NUMBER).getValue(); return this.policyTemplatesCache.get(new Pair<>(millisBetweenRetries, maxRetries)); }
Source:
private static File findMainDescriptor( List<String> roots ) { for ( String root : roots ) { File descriptorFile = new File( root, "module-info.java" ).getAbsoluteFile(); if ( descriptorFile.exists() ) { return descriptorFile; } } return null; }

Target:
private static File findMainDescriptor( List<String> roots ) throws MavenReportException { for ( String root : roots ) { File descriptorFile = new File( root, "module-info.java" ).getAbsoluteFile(); if ( descriptorFile.exists() ) { if ( !descriptorFile.isFile() ) { throw new MavenReportException( descriptorFile + " is not a regular file" ); } return descriptorFile; } } return null; }
Source:
public List<ExpressionTree> expressions() { return ImmutableList.copyOf(Iterables.filter(elements, input -> input != null ? !input.is(Kind.HEREDOC_STRING_CHARACTERS) : false)); }

Target:
public List<ExpressionTree> expressions() { return ImmutableList.copyOf(Iterables.filter(elements, input -> !input.is(Kind.HEREDOC_STRING_CHARACTERS))); }
Source:
public String getResourceAsString(String resourceName) { byte[] data = getResource(resourceName); if (data != null) { return new String(data); } return null; }

Target:
public String getResourceAsString(String resourceName) { byte[] data = getResource(resourceName); if (data != null) { try { return new String(data, "UTF-8"); } catch(Exception e) { log.error("getResourceAsString threw", e); } } return null; }