auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public IAnswerData getAnswer() { return !binding.widgetAnswerText.getText().equals(getContext().getString(R.string.no_date_selected)) ? new DateData(selectedDate.toDate()) : null; }

Target:
public IAnswerData getAnswer() { return binding.dateAnswerText.getText().equals(getContext().getString(R.string.no_date_selected)) ? null : new DateData(selectedDate.toDate()); }
Source:
public void run() { for (int i = 0; i < keyCount; i++) { String key = keys[random.nextInt(keys.length)]; try { map.put(key, createValue(key)); } catch (IOException e) { } } }

Target:
public void run() { long iteration = 0; while (!testContext.isStopped()) { String key = keys[random.nextInt(keys.length)]; map.put(key, createValue(key,random)); iteration++; if (iteration % logFrequency == 0) { LOGGER.info(Thread.currentThread().getName() + " At iteration: " + iteration); } } }
Source:
public static void scheduleNotification(Context context) { AlarmManager alarmManager = (AlarmManager) context.getSystemService(ALARM_SERVICE); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); if (Integer.parseInt(sp.getString("minimumCardsDueForNotification", "1000001")) <= 1000000) return; final Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, sp.getInt("dayOffset", 0)); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); final PendingIntent notificationIntent = PendingIntent.getBroadcast(context, 0, new Intent(context, NotificationReceiver.class), 0); alarmManager.setInexactRepeating( AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, notificationIntent ); }

Target:
public static void scheduleNotification(Context context) { AlarmManager alarmManager = (AlarmManager) context.getSystemService(ALARM_SERVICE); SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(context); if (Integer.parseInt(sp.getString("minimumCardsDueForNotification", "1000001")) <= 1000000) { return; } final Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, sp.getInt("dayOffset", 0)); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); final PendingIntent notificationIntent = PendingIntent.getBroadcast(context, 0, new Intent(context, NotificationReceiver.class), 0); alarmManager.setInexactRepeating( AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, notificationIntent ); }
Source:
public DataValue copy() { return new NullValue(); }

Target:
public NullValue copy() { return new NullValue(); }
Source:
public MediaType getMediaType() { if (TextUtils.isEmpty(mime_type)) { return MediaType.UNKNOWN; } else { if (mime_type.startsWith("audio")) { return MediaType.AUDIO; } else if (mime_type.startsWith("video")) { return MediaType.VIDEO; } else if (mime_type.equals("application/ogg")) { return MediaType.AUDIO; } } return MediaType.UNKNOWN; }

Target:
public MediaType getMediaType() { return MediaType.fromMimeType(mime_type); }
Source:
public void testNoPrioritizedTypes() throws Exception { settings.put("citation.prioritized_types", ""); when(bitstreamFormat1.getMIMEType()).thenReturn("text/richtext"); when(bitstreamFormat2.getMIMEType()).thenReturn("application/msword"); when(bitstreamFormat3.getMIMEType()).thenReturn("application/postscript"); when(bitstream1.getSize()).thenReturn(new Long(100)); when(bitstream2.getSize()).thenReturn(new Long(200)); when(bitstream3.getSize()).thenReturn(new Long(300)); List<Bitstream> toSort = bundle.getBitstreams(); Collections.sort(toSort, new GoogleBitstreamComparator(context, settings)); assertEquals("PS should be first", "bitstream3", toSort.get(0).getName()); assertEquals("RTF second", "bitstream2", toSort.get(1).getName()); assertEquals("Word third", "bitstream1", toSort.get(2).getName()); }

Target:
public void testNoPrioritizedTypes() throws Exception { settings.put("citation.prioritized_types", ""); when(bitstreamFormat1.getMIMEType()).thenReturn("text/richtext"); when(bitstreamFormat2.getMIMEType()).thenReturn("application/msword"); when(bitstreamFormat3.getMIMEType()).thenReturn("application/postscript"); when(bitstream1.getSize()).thenReturn(new Long(100)); when(bitstream2.getSize()).thenReturn(new Long(200)); when(bitstream3.getSize()).thenReturn(new Long(300)); List<Bitstream> toSort = bundle.getBitstreams(); Collections.sort(toSort, new GoogleBitstreamComparator(context, settings)); assertEquals("PS should be first because it is the largest one and there is no type prioritization", "bitstream3", toSort.get(0).getName()); assertEquals("RTF should come second because it is the second largest and there is no type prioritization", "bitstream2", toSort.get(1).getName()); assertEquals("Word has to be last (third) as it is the smallest one and there is no type prioritization", "bitstream1", toSort.get(2).getName()); }
Source:
public Map<Integer, Integer> getGIDsBySampleIds(final Set<Integer> sampleIds) { Map<Integer, Integer> map = new HashMap<>(); List<Object[]> result = this.getSession() .createCriteria(Sample.class, "sample") .createAlias("sample.plant", "plant") .createAlias("plant.experiment", "experiment") .createAlias("experiment.experimentStocks", "experimentStocks") .createAlias("experimentStocks.stock", "stock") .add(Restrictions.in("sampleId", sampleIds)) .setProjection(Projections.projectionList() .add(Projections.property("sample.sampleId")) .add(Projections.property("stock.dbxrefId"))) .list(); for (Object[] row : result) { map.put((Integer) row[0], (Integer) row[1]); } return map; }

Target:
public Map<Integer, Integer> getGIDsBySampleIds(final Set<Integer> sampleIds) { final Map<Integer, Integer> map = new HashMap<>(); final List<Object[]> result = this.getSession() .createCriteria(Sample.class, "sample") .createAlias("sample.plant", "plant") .createAlias("plant.experiment", "experiment") .createAlias("experiment.experimentStocks", "experimentStocks") .createAlias("experimentStocks.stock", "stock") .add(Restrictions.in("sampleId", sampleIds)) .setProjection(Projections.projectionList() .add(Projections.property("sample.sampleId")) .add(Projections.property("stock.dbxrefId"))) .list(); for (final Object[] row : result) { map.put((Integer) row[0], (Integer) row[1]); } return map; }
Source:
private boolean registerNewHost(Guid vdsGroupId, boolean IsPending) { boolean returnValue = true; VdsStatic vds = new VdsStatic(getParameters().getVdsHostName(), "", getStrippedVdsUniqueId(), getParameters().getPort(), vdsGroupId, Guid.Empty, getParameters().getVdsName(), Config.<Boolean> GetValue(ConfigValues.SSLEnabled), getParameters().getVdsType(), "", "", "", "", "", ""); log.debugFormat( "RegisterVdsQuery::Register - Will try now to add VDS from scratch; Name: {0}, Hostname: {1}, Unique: {2}, Port: {3},Subnet mask: {4}, IsPending: {5} with force synchronize", getParameters().getVdsName(), getParameters().getVdsHostName(), getStrippedVdsUniqueId(), getParameters().getPort(), IsPending); AddVdsActionParameters p = new AddVdsActionParameters(vds, ""); p.setAddPending(IsPending); VdcReturnValueBase ret = Backend.getInstance().runInternalAction(VdcActionType.AddVds, p); if (ret == null || !ret.getSucceeded()) { log.errorFormat( "RegisterVdsQuery::Register - Registration failed for VDS - Name: {0}, Hostname: {1}, UniqueID: {2}, Subnet mask: {3}", getParameters().getVdsName(), getParameters().getVdsHostName(), getStrippedVdsUniqueId()); CaptureCommandErrorsToLogger(ret, "RegisterVdsQuery::Register"); error = AuditLogType.VDS_REGISTER_FAILED; returnValue = false; } else { log.infoFormat( "RegisterVdsQuery::Register - Registered a new VDS {3} - Name: {0}, Hostname: {1}, UniqueID: {2}", getParameters().getVdsName(), getParameters().getVdsHostName(), getStrippedVdsUniqueId(), IsPending ? "pending approval" : "automatically approved"); } return returnValue; }

Target:
private boolean registerNewHost(Guid vdsGroupId, boolean IsPending) { boolean returnValue = true; VdsStatic vds = new VdsStatic(getParameters().getVdsHostName(), "", getStrippedVdsUniqueId(), getParameters().getPort(), vdsGroupId, Guid.Empty, getParameters().getVdsName(), Config.<Boolean> GetValue(ConfigValues.SSLEnabled), getParameters().getVdsType()); log.debugFormat( "RegisterVdsQuery::Register - Will try now to add VDS from scratch; Name: {0}, Hostname: {1}, Unique: {2}, Port: {3},Subnet mask: {4}, IsPending: {5} with force synchronize", getParameters().getVdsName(), getParameters().getVdsHostName(), getStrippedVdsUniqueId(), getParameters().getPort(), IsPending); AddVdsActionParameters p = new AddVdsActionParameters(vds, ""); p.setAddPending(IsPending); VdcReturnValueBase ret = Backend.getInstance().runInternalAction(VdcActionType.AddVds, p); if (ret == null || !ret.getSucceeded()) { log.errorFormat( "RegisterVdsQuery::Register - Registration failed for VDS - Name: {0}, Hostname: {1}, UniqueID: {2}, Subnet mask: {3}", getParameters().getVdsName(), getParameters().getVdsHostName(), getStrippedVdsUniqueId()); CaptureCommandErrorsToLogger(ret, "RegisterVdsQuery::Register"); error = AuditLogType.VDS_REGISTER_FAILED; returnValue = false; } else { log.infoFormat( "RegisterVdsQuery::Register - Registered a new VDS {3} - Name: {0}, Hostname: {1}, UniqueID: {2}", getParameters().getVdsName(), getParameters().getVdsHostName(), getStrippedVdsUniqueId(), IsPending ? "pending approval" : "automatically approved"); } return returnValue; }
Source:
public static ListPluginRequest createListPluginRequest(JsonObject request, HivePrincipal principal) { ListPluginRequest listPluginRequest = new GsonBuilder().excludeFieldsWithModifiers(Modifier.PROTECTED) .create() .fromJson(request, ListPluginRequest.class); listPluginRequest.setTake(Optional.ofNullable(listPluginRequest.getTake()).orElse(20)); listPluginRequest.setSkip(Optional.ofNullable(listPluginRequest.getSkip()).orElse(DEFAULT_SKIP)); listPluginRequest.setPrincipal(principal); return listPluginRequest; }

Target:
public static ListPluginRequest createListPluginRequest(JsonObject request, HivePrincipal principal) { ListPluginRequest listPluginRequest = new GsonBuilder().excludeFieldsWithModifiers(Modifier.PROTECTED) .create() .fromJson(request, ListPluginRequest.class); listPluginRequest.setTake(Optional.ofNullable(listPluginRequest.getTake()).orElse(DEFAULT_TAKE)); listPluginRequest.setSkip(Optional.ofNullable(listPluginRequest.getSkip()).orElse(DEFAULT_SKIP)); listPluginRequest.setPrincipal(principal); return listPluginRequest; }
Source:
protected void doTest(Location loc) throws Exception { Entity testEntity = app.createAndManageChild(EntitySpec.create(EmptySoftwareProcess.class)); app.start(ImmutableList.of(loc)); EntityTestUtils.assertAttributeEqualsEventually(MutableMap.of("timeout", TIMEOUT_MS), testEntity, Startable.SERVICE_UP, true); SshMachineLocation sshLoc = Locations.findUniqueSshMachineLocation(testEntity.getLocations()).get(); MachineDetails machine = app.getExecutionContext() .submit(BasicMachineDetails.taskForSshMachineLocation(sshLoc)) .getUnchecked(); LOG.info("Found the following at {}: {}", loc, machine); assertNotNull(machine); OsDetails details = machine.getOsDetails(); assertNotNull(details); assertNotNull(details.getArch()); assertNotNull(details.getName()); assertNotNull(details.getVersion()); assertFalse(details.getArch().startsWith("architecture:")); assertFalse(details.getName().startsWith("name:")); assertFalse(details.getVersion().startsWith("version:")); }

Target:
protected void doTest(Location loc) throws Exception { Entity testEntity = app.createAndManageChild(EntitySpec.create(EmptySoftwareProcess.class)); app.start(ImmutableList.of(loc)); EntityTestUtils.assertAttributeEqualsEventually(testEntity, Startable.SERVICE_UP, true); SshMachineLocation sshLoc = Locations.findUniqueSshMachineLocation(testEntity.getLocations()).get(); MachineDetails machine = app.getExecutionContext() .submit(BasicMachineDetails.taskForSshMachineLocation(sshLoc)) .getUnchecked(); LOG.info("Found the following at {}: {}", loc, machine); assertNotNull(machine); OsDetails details = machine.getOsDetails(); assertNotNull(details); assertNotNull(details.getArch()); assertNotNull(details.getName()); assertNotNull(details.getVersion()); assertFalse(details.getArch().startsWith("architecture:")); assertFalse(details.getName().startsWith("name:")); assertFalse(details.getVersion().startsWith("version:")); }
Source:
static UberDocument toUberDocument(final Object object) { if (object == null) { return null; } if (object instanceof UberDocument) { return (UberDocument) object; } if (object instanceof Iterable) { } else if (object instanceof Map) { } throw new IllegalArgumentException("Don't know how to handle type : " + object.getClass()); }

Target:
static UberDocument toUberDocument(final Object object) { if (object == null) { return null; } if (object instanceof UberDocument) { return (UberDocument) object; } throw new IllegalArgumentException("Don't know how to handle type : " + object.getClass()); }
Source:
public void selectMultiFilesByShiftKeyWithCheckMultiselection( String clickItemPath, List<String> selectedItemsPaths) { Actions actions = actionsFactory.createAction(seleniumWebDriver); actions.keyDown(Keys.SHIFT).perform(); selectItem(clickItemPath); waitAllItemsIsSelected(selectedItemsPaths); actions.keyUp(Keys.SHIFT).perform(); }

Target:
public void selectMultiFilesByShiftKeyWithCheckMultiselection( String clickItemPath, List<String> selectedItemsPaths) { Actions actions = actionsFactory.createAction(seleniumWebDriver); actions.keyDown(SHIFT).perform(); selectItem(clickItemPath); waitAllItemsIsSelected(selectedItemsPaths); actions.keyUp(SHIFT).perform(); }
Source:
private boolean updateDataSource(VXQueryCollectionDataSource ds, Mutable<ILogicalExpression> expression) { boolean added = false; ILogicalExpression comparison = null; List<Mutable<ILogicalExpression>> finds = new ArrayList<Mutable<ILogicalExpression>>(); ExpressionToolbox.findAllFunctionExpressions(expression, BuiltinOperators.VALUE.getFunctionIdentifier(), finds); if (finds.size() > 0) { List<ILogicalExpression> listComparison = ExpressionToolbox.getFullArguments(finds.get(finds.size() - 1)); comparison = listComparison.get(0); } byte[] b = new byte[4]; b[0] = (byte) 0xff; b[1] = (byte) 0x00; b[2] = (byte) 0x00; b[3] = (byte) 0x00; for (int i = finds.size(); i > 0; --i) { Byte[] value = ExpressionToolbox.getConstantArgument(finds.get(i - 1), 1); List<ILogicalExpression> values = ExpressionToolbox.getFullArguments(finds.get(i - 1)); ILogicalExpression one = values.get(0); if (one.equals(comparison)) { ds.addValueSeq(ArrayUtils.toObject(b)); } if (values.size() != 0) { ds.addValueSeq(value); added = true; } } return added; }

Target:
private boolean updateDataSource(VXQueryCollectionDataSource ds, Mutable<ILogicalExpression> expression) { boolean added = false; ILogicalExpression comparison = null; List<Mutable<ILogicalExpression>> finds = new ArrayList<Mutable<ILogicalExpression>>(); List<Mutable<ILogicalExpression>> finds2 = new ArrayList<Mutable<ILogicalExpression>>(); List<ILogicalExpression> listComparison = new ArrayList<ILogicalExpression>(); List<ILogicalExpression> listValues = new ArrayList<ILogicalExpression>(); ExpressionToolbox.findAllFunctionExpressions(expression, BuiltinOperators.VALUE.getFunctionIdentifier(), finds); if (finds.size() > 0) { listComparison = ExpressionToolbox.getFullArguments(finds.get(finds.size() - 1)); comparison = listComparison.get(0); } for (int i = finds.size(); i > 0; --i) { listValues.add(ExpressionToolbox.getFullArguments(finds.get(i-1)).get(0)); listValues.add(ExpressionToolbox.getFullArguments(finds.get(i-1)).get(1)); } byte[] b = new byte[4]; b[0] = (byte) 0xff; b[1] = (byte) 0x00; b[2] = (byte) 0x00; b[3] = (byte) 0x00; for (int i = finds.size(); i > 0; --i) { Byte[] value = ExpressionToolbox.getConstantArgument(finds.get(i - 1), 1); List<ILogicalExpression> values = ExpressionToolbox.getFullArguments(finds.get(i - 1)); ILogicalExpression one = values.get(0); if (one.equals(comparison)) { ds.addValueSeq(ArrayUtils.toObject(b)); } if (values.size() != 0) { ds.addValueSeq(value); added = true; } } return added; }
Source:
public void handle(GlowSession session, PlayerUpdateMessage message) { Location original = session.getPlayer().getLocation(); Location newLoc = original.clone(); message.update(newLoc); if (newLoc.distanceSquared(original) > 16 * 16) { return; } if (session.getPlayer().isOnGround() != message.getOnGround()) session.getPlayer().setOnGround(message.getOnGround()); session.getPlayer().setRawLocation(newLoc); }

Target:
public void handle(GlowSession session, PlayerUpdateMessage message) { Location original = session.getPlayer().getLocation(); Location newLoc = original.clone(); message.update(newLoc); if (newLoc.distanceSquared(original) > 16 * 16) { return; } if (session.getPlayer().isOnGround() != message.getOnGround()) { session.getPlayer().setOnGround(message.getOnGround()); } session.getPlayer().setRawLocation(newLoc); }
Source:
public Port getPortToConnectTo() { if (sslEnabledDataCenters.contains(datacenter.getName())) { if (ports.containsKey(PortType.SSL)) { return new Port(ports.get(PortType.SSL), PortType.SSL); } else { throw new IllegalArgumentException("No SSL Port exists for the data node " + hostname + ":" + port); } } return new Port(port, PortType.PLAINTEXT); }

Target:
public Port getPortToConnectTo() { if (sslEnabledDataCenters.contains(datacenter.getName())) { if (ports.containsKey(PortType.SSL)) { return ports.get(PortType.SSL); } else { throw new IllegalStateException("No SSL Port exists for the data node " + hostname + ":" + portNum); } } return ports.get(PortType.PLAINTEXT); }
Source:
public Response shutDown() { log.info("Received shutdown request"); executorService.schedule( new Runnable() { @Override public void run() { lifecycle.stop(); System.exit(-1); } }, 1, TimeUnit.SECONDS ); executorService.shutdown(); return Response.status(Response.Status.ACCEPTED).build(); }

Target:
public Response shutDown() { log.info("Received shutdown request"); executorService.schedule( new Runnable() { @Override public void run() { System.exit(0); } }, 1, TimeUnit.SECONDS ); executorService.shutdown(); return Response.status(Response.Status.ACCEPTED).build(); }
Source:
public Action[] getActions(boolean context) { List<Action> actionsList = new ArrayList<>(); actionsList.addAll(Arrays.asList(super.getActions(true))); actionsList.add(new ViewContextAction(NbBundle.getMessage(this.getClass(), "LocalFileNode.viewFileInDir.text"), this.content)); actionsList.add(null); actionsList.add(new NewWindowViewAction( NbBundle.getMessage(this.getClass(), "LocalFileNode.getActions.viewInNewWin.text"), this)); actionsList.add(new ExternalViewerAction( NbBundle.getMessage(this.getClass(), "LocalFileNode.getActions.openInExtViewer.text"), this)); actionsList.add(null); actionsList.add(ExtractAction.getInstance()); actionsList.add(new HashSearchAction( NbBundle.getMessage(this.getClass(), "LocalFileNode.getActions.searchFilesSameMd5.text"), this)); actionsList.add(null); actionsList.add(AddContentTagAction.getInstance()); final Collection<AbstractFile> selectedFilesList = new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class)); if (selectedFilesList.size() == 1) { actionsList.add(DeleteFileContentTagAction.getInstance()); } actionsList.addAll(ContextMenuExtensionPoint.getActions()); if (FileTypeExtensions.getArchiveExtensions().contains("." + this.content.getNameExtension().toLowerCase())) { try { if (this.content.getArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_DETECTED).size() > 0) { actionsList.add(new ExtractArchiveWithPasswordAction(this.getContent())); } } catch (TskCoreException ex) { } } return actionsList.toArray(new Action[0]); }

Target:
public Action[] getActions(boolean context) { List<Action> actionsList = new ArrayList<>(); actionsList.addAll(Arrays.asList(super.getActions(true))); actionsList.add(new ViewContextAction(NbBundle.getMessage(this.getClass(), "LocalFileNode.viewFileInDir.text"), this.content)); actionsList.add(null); actionsList.add(new NewWindowViewAction( NbBundle.getMessage(this.getClass(), "LocalFileNode.getActions.viewInNewWin.text"), this)); actionsList.add(new ExternalViewerAction( NbBundle.getMessage(this.getClass(), "LocalFileNode.getActions.openInExtViewer.text"), this)); actionsList.add(null); actionsList.add(ExtractAction.getInstance()); actionsList.add(new HashSearchAction( NbBundle.getMessage(this.getClass(), "LocalFileNode.getActions.searchFilesSameMd5.text"), this)); actionsList.add(null); actionsList.add(AddContentTagAction.getInstance()); final Collection<AbstractFile> selectedFilesList = new HashSet<>(Utilities.actionsGlobalContext().lookupAll(AbstractFile.class)); if (selectedFilesList.size() == 1) { actionsList.add(DeleteFileContentTagAction.getInstance()); } actionsList.addAll(ContextMenuExtensionPoint.getActions()); if (FileTypeExtensions.getArchiveExtensions().contains("." + this.content.getNameExtension().toLowerCase())) { try { if (this.content.getArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_DETECTED).size() > 0) { actionsList.add(new ExtractArchiveWithPasswordAction(this.getContent())); } } catch (TskCoreException ex) { logger.log(Level.WARNING, "Unable to add unzip with password action to context menus", ex); } } return actionsList.toArray(new Action[0]); }
Source:
public JavaParserTypeSolver(File srcDir) { if (!srcDir.exists() || !srcDir.isDirectory()) { throw new IllegalStateException("SrcDir does not exist or is not a directory: " + srcDir.getAbsolutePath()); } this.srcDir = srcDir; javaParser = new JavaParser( new ParserConfiguration() .setLanguageLevel(BLEEDING_EDGE) .setAttributeComments(false) .setStoreTokens(false)); }

Target:
public JavaParserTypeSolver(File srcDir) { this(srcDir.toPath()); }
Source:
public void testBaseOutput() throws IOException { String[] args = new String[] { "I=" + TEST_INPUT_VCF1, "O=" + TEST_OUTPUT, "G=" + TEST_GENOTYPES_VCF1, "H=" + SUBSETTED_HAPLOTYPE_DATABASE_FOR_TESTING }; Assert.assertEquals(runPicardCommandLine(args), 0); Assert.assertEquals(checkResult( new File(TEST_OUTPUT + ".fingerprinting_summary_metrics"), new File(TEST_OUTPUT + ".fingerprinting_detail_metrics")), true); }

Target:
public void testBaseOutput() { String[] args = new String[]{ "I=" + TEST_INPUT_VCF1, "O=" + TEST_OUTPUT, "G=" + TEST_GENOTYPES_VCF1, "H=" + SUBSETTED_HAPLOTYPE_DATABASE_FOR_TESTING }; Assert.assertEquals(runPicardCommandLine(args), 0); Assert.assertTrue(MetricsFile.areMetricsEqual(new File(TEST_OUTPUT + ".fingerprinting_summary_metrics"), RESULT_EXAMPLE_SUMMARY)); Assert.assertTrue(MetricsFile.areMetricsEqual(new File(TEST_OUTPUT + ".fingerprinting_detail_metrics"), RESULT_EXAMPLE_DETAIL)); }
Source:
public void stop() { if (stopped.compareAndSet(false, true)) { try { metadataConsumer.close(); } catch (Exception e) { LOG.warn("metadataConsumer.close for system " + systemName + " failed with exception.", e); } } if (adminClientForDelete != null) { try { adminClientForDelete.close(); } catch (Exception e) { LOG.warn("AdminClient.close() for system " + systemName + " failed with exception.", e); } } if (adminClient != null) { adminClient.close(); } }

Target:
public void stop() { if (stopped.compareAndSet(false, true)) { try { metadataConsumer.close(); } catch (Exception e) { LOG.warn("metadataConsumer.close for system " + systemName + " failed with exception.", e); } } if (adminClientForDelete != null) { try { adminClientForDelete.close(); } catch (Exception e) { LOG.warn("AdminClient.close() for system failed with exception {}.", systemName, e); } } if (adminClient != null) { adminClient.close(); } }
Source:
@Test public void checkAbilityToStartServiceUsingCapabilitiesAndFlags() throws Exception { File app = new File(ROOT_TEST_PATH, "ApiDemos-debug.apk"); File chrome = new File(new File(ROOT_TEST_PATH, "pagefactory_tests"), "chromedriver.exe"); DesiredCapabilities caps = new DesiredCapabilities(); caps.setCapability(PLATFORM_NAME, "Android"); caps.setCapability(FULL_RESET, true); caps.setCapability(NEW_COMMAND_TIMEOUT, 60); caps.setCapability(APP_PACKAGE, "io.appium.android.apis"); caps.setCapability(APP_ACTIVITY, ".view.WebView1"); caps.setCapability(APP, app.getAbsolutePath()); caps.setCapability(CHROMEDRIVER_EXECUTABLE, chrome.getAbsolutePath()); service = new AppiumServiceBuilder() .withArgument(CALLBACK_ADDRESS, testIP) .withArgument(SESSION_OVERRIDE) .withArgument(PRE_LAUNCH) .withCapabilities(caps).build(); service.start(); assertTrue(service.isRunning()); }

Target:
@Test public void checkAbilityToStartServiceUsingCapabilitiesAndFlags() throws Exception { File app = ROOT_TEST_PATH.resolve("ApiDemos-debug.apk").toFile(); File chrome = ROOT_TEST_PATH.resolve("pagefactory_tests").resolve("chromedriver.exe").toFile(); DesiredCapabilities caps = new DesiredCapabilities(); caps.setCapability(PLATFORM_NAME, "Android"); caps.setCapability(FULL_RESET, true); caps.setCapability(NEW_COMMAND_TIMEOUT, 60); caps.setCapability(APP_PACKAGE, "io.appium.android.apis"); caps.setCapability(APP_ACTIVITY, ".view.WebView1"); caps.setCapability(APP, app.getAbsolutePath()); caps.setCapability(CHROMEDRIVER_EXECUTABLE, chrome.getAbsolutePath()); service = new AppiumServiceBuilder() .withArgument(CALLBACK_ADDRESS, testIP) .withArgument(SESSION_OVERRIDE) .withArgument(PRE_LAUNCH) .withCapabilities(caps).build(); service.start(); assertTrue(service.isRunning()); }
Source:
protected void requestDatacenterToCreateWaitingVms(Datacenter datacenter) { int requestedVms = 0; for (final Vm vm : getVmWaitingList()) { if (!vmsToDatacentersMap.containsKey(vm) && !vmCreationRequestsMap.containsKey(vm)) { println(String.format( "%.2f: %s: Trying to Create %s in %s", getSimulation().clock(), getName(), vm, datacenter.getName())); sendNow(datacenter.getId(), CloudSimTags.VM_CREATE_ACK, vm); vmCreationRequestsMap.put(vm, datacenter); requestedVms++; } } datacenterRequestedList.add(datacenter); this.vmCreationRequests += requestedVms; }

Target:
protected void requestDatacenterToCreateWaitingVms(Datacenter datacenter) { int requestedVms = 0; for (final Vm vm :vmWaitingList) { if (!vmsToDatacentersMap.containsKey(vm) && !vmCreationRequestsMap.containsKey(vm)) { println(String.format( "%.2f: %s: Trying to Create %s in %s", getSimulation().clock(), getName(), vm, datacenter.getName())); sendNow(datacenter.getId(), CloudSimTags.VM_CREATE_ACK, vm); vmCreationRequestsMap.put(vm, datacenter); requestedVms++; } } datacenterRequestedList.add(datacenter); this.vmCreationRequests += requestedVms; }
Source:
public void handleFromRemoteSite(String origin, XSiteReplicateCommand command, Reply reply, DeliverOrder order) { if (trace) { log.tracef("Handling command %s from remote site %s", command, origin); } BackupReceiver receiver = backupReceiverRepository.getBackupReceiver(origin, command.getCacheName().toString()); if (order.preserveOrder()) { runXSiteReplicateCommand(command, receiver, reply); } else { remoteCommandsExecutor.execute(() -> runXSiteReplicateCommand(command, receiver, reply)); } }

Target:
public void handleFromRemoteSite(String origin, XSiteReplicateCommand command, Reply reply, DeliverOrder order) { if (trace) { log.tracef("Handling command %s from remote site %s", command, origin); } BackupReceiver receiver = backupReceiverRepository.getBackupReceiver(origin, command.getCacheName().toString()); if (order.preserveOrder()) { runXSiteReplicableCommand(command, receiver, reply); } else { remoteCommandsExecutor.execute(() -> runXSiteReplicableCommand(command, receiver, reply)); } }
Source:
public static Slice castFromVarcharToIpPrefix(@SqlType("varchar(x)") Slice slice) { byte[] address; int subnetSize; String string = slice.toStringUtf8(); if (!string.contains("/")) { throw new PrestoException(INVALID_CAST_ARGUMENT, "Cannot cast value to IPPREFIX: " + slice.toStringUtf8()); } String[] parts = string.split("/"); try { address = InetAddresses.forString(parts[0]).getAddress(); } catch (IllegalArgumentException e) { throw new PrestoException(INVALID_CAST_ARGUMENT, "Cannot cast value to IPPREFIX: " + slice.toStringUtf8()); } subnetSize = Integer.parseInt(parts[1]); byte[] bytes = new byte[IPPREFIX.getFixedSize()]; if (address.length == 4) { if (subnetSize < 0 || 32 < subnetSize) { throw new PrestoException(INVALID_CAST_ARGUMENT, "Cannot cast value to IPPREFIX: " + slice.toStringUtf8()); } for (int i = 0; i < 4; i++) { address[3 - i] &= -0x1 << min(max((32 - subnetSize) - 8 * i, 0), 8); } bytes[10] = (byte) 0xff; bytes[11] = (byte) 0xff; arraycopy(address, 0, bytes, 12, 4); bytes[IPPREFIX.getFixedSize() - 1] = (byte) subnetSize; } else if (address.length == 16) { if (subnetSize < 0 || 128 < subnetSize) { throw new PrestoException(INVALID_CAST_ARGUMENT, "Cannot cast value to IPPREFIX: " + slice.toStringUtf8()); } for (int i = 0; i < 16; i++) { address[15 - i] &= (byte) -0x1 << min(max((128 - subnetSize) - 8 * i, 0), 8); } arraycopy(address, 0, bytes, 0, 16); bytes[IPPREFIX.getFixedSize() - 1] = (byte) subnetSize; } else { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Invalid InetAddrss length: " + address.length); } return wrappedBuffer(bytes); }

Target:
public static Slice castFromVarcharToIpPrefix(@SqlType("varchar(x)") Slice slice) { byte[] address; int subnetSize; String string = slice.toStringUtf8(); if (!string.contains("/")) { throw new PrestoException(INVALID_CAST_ARGUMENT, "Cannot cast value to IPPREFIX: " + slice.toStringUtf8()); } String[] parts = string.split("/"); try { address = InetAddresses.forString(parts[0]).getAddress(); } catch (IllegalArgumentException e) { throw new PrestoException(INVALID_CAST_ARGUMENT, "Cannot cast value to IPPREFIX: " + slice.toStringUtf8()); } subnetSize = Integer.parseInt(parts[1]); byte[] bytes = new byte[IPPREFIX.getFixedSize()]; if (address.length == 4) { if (subnetSize < 0 || 32 < subnetSize) { throw new PrestoException(INVALID_CAST_ARGUMENT, "Cannot cast value to IPPREFIX: " + slice.toStringUtf8()); } for (int i = 0; i < 4; i++) { address[3 - i] &= -0x1 << min(max((32 - subnetSize) - 8 * i, 0), 8); } bytes[10] = (byte) 0xff; bytes[11] = (byte) 0xff; arraycopy(address, 0, bytes, 12, 4); bytes[IPPREFIX.getFixedSize() - 1] = (byte) subnetSize; } else if (address.length == 16) { if (subnetSize < 0 || 128 < subnetSize) { throw new PrestoException(INVALID_CAST_ARGUMENT, "Cannot cast value to IPPREFIX: " + slice.toStringUtf8()); } for (int i = 0; i < 16; i++) { address[15 - i] &= (byte) -0x1 << min(max((128 - subnetSize) - 8 * i, 0), 8); } arraycopy(address, 0, bytes, 0, 16); bytes[IPPREFIX.getFixedSize() - 1] = (byte) subnetSize; } else { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Invalid InetAddress length: " + address.length); } return wrappedBuffer(bytes); }
Source:
CheckAndSetResult<SequenceAndBound> checkAndSetCoordinationValue( Optional<SequenceAndBound> oldValue, SequenceAndBound newValue) { CheckAndSetRequest request = new CheckAndSetRequest.Builder() .table(AtlasDbConstants.COORDINATION_TABLE) .cell(getCoordinationValueCell()) .oldValue(oldValue.map(this::serializeSequenceAndBound)) .newValue(serializeSequenceAndBound(newValue)) .build(); try { kvs.checkAndSet(request); return ImmutableCheckAndSetResult.of(true, ImmutableList.of(newValue)); } catch (CheckAndSetException e) { if (e.getActualValues() != null) { return ImmutableCheckAndSetResult.of(false, e.getActualValues() .stream() .map(this::deserializeSequenceAndBound) .collect(Collectors.toList())); } else { return getMostRecentValueAndBound(oldValue, newValue); } } }

Target:
CheckAndSetResult<SequenceAndBound> checkAndSetCoordinationValue( Optional<SequenceAndBound> oldValue, SequenceAndBound newValue) { CheckAndSetRequest request = new CheckAndSetRequest.Builder() .table(AtlasDbConstants.COORDINATION_TABLE) .cell(getCoordinationValueCell()) .oldValue(oldValue.map(this::serializeSequenceAndBound)) .newValue(serializeSequenceAndBound(newValue)) .build(); try { kvs.checkAndSet(request); return ImmutableCheckAndSetResult.of(true, ImmutableList.of(newValue)); } catch (CheckAndSetException e) { if (e.getActualValues() != null) { return ImmutableCheckAndSetResult.of(false, e.getActualValues() .stream() .map(this::deserializeSequenceAndBound) .collect(Collectors.toList())); } return getFailedResultWithMostRecentValueAndBound(oldValue, newValue); } }
Source:
private static boolean enableTracing(AbstractManagedChannelImplBuilder<?> builder) { if (setEnableTracingMethodNotFound == null) { try { setEnableTracingMethod = AbstractManagedChannelImplBuilder.class.getMethod("setEnableTracing", boolean.class); setEnableTracingMethodNotFound = false; } catch (Exception e) { setEnableTracingMethodNotFound = true; } } if (builder != null && setEnableTracingMethod != null) { try { setEnableTracingMethod.invoke(builder, true); return true; } catch (Exception e) { LOG.warn("Could not enable tracing", e); } } return false; }

Target:
private static void enableTracing(AbstractManagedChannelImplBuilder<?> builder) { try { Method setEnableTracingMethod = AbstractManagedChannelImplBuilder.class.getMethod("setEnableTracing", boolean.class); if (setEnableTracingMethod != null) { try { setEnableTracingMethod.invoke(builder, true); } catch (Exception e) { LOG.warn("Could not enable tracing", e); } } } catch (NoSuchMethodException | SecurityException e1) { return; } }
Source:
abstract PdlBuilder newline() throws IOException; abstract PdlBuilder indent() throws IOException; abstract PdlBuilder increaseIndent(); abstract PdlBuilder decreaseIndent(); abstract boolean writeDoc(String doc) throws IOException; PdlBuilder writeProperties(List<String> prefix, Map<String, Object> properties) throws IOException { for (Map.Entry<String, Object> entry : properties.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); ArrayList<String> pathParts = new ArrayList<>(prefix); pathParts.add(key); if (value instanceof DataMap) { DataMap dm = (DataMap) value; if (!dm.isEmpty() && dm.size() == 1) { writeProperties(pathParts, dm); } else if (!pathParts.isEmpty()) { writeProperty(pathParts, dm); } } else if (Boolean.TRUE.equals(value)) { indent().write("@").writePath(pathParts).newline(); } else { writeProperty(pathParts, value); } } return this; }

Target:
abstract PdlBuilder newline() throws IOException; abstract PdlBuilder indent() throws IOException; abstract PdlBuilder increaseIndent(); abstract PdlBuilder decreaseIndent(); abstract boolean writeDoc(String doc) throws IOException; PdlBuilder writeProperties(List<String> prefix, Map<String, Object> properties) throws IOException { for (Map.Entry<String, Object> entry : properties.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); ArrayList<String> pathParts = new ArrayList<>(prefix); pathParts.add(key); if (value instanceof DataMap) { DataMap dm = (DataMap) value; if (dm.size() == 1) { writeProperties(pathParts, dm); } else { writeProperty(pathParts, dm); } } else if (Boolean.TRUE.equals(value)) { indent().write("@").writePath(pathParts).newline(); } else { writeProperty(pathParts, value); } } return this; }
Source:
private void initMigrationPolicies() { AsyncQuery aQuery = new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { migrationPolicies = (List<MigrationPolicy>) returnValue; } }); aQuery.converterCallback = new IAsyncConverter() { @Override public Object convert(Object returnValue, AsyncQuery asyncQuery) { if (returnValue == null) { return new ArrayList<MigrationPolicy>(); } Collections.sort((List<MigrationPolicy>) returnValue, new Comparator<MigrationPolicy>() { @Override public int compare(MigrationPolicy m1, MigrationPolicy m2) { if (NoMigrationPolicy.ID.equals(m1.getId())) { return -1; } return m1.getName().compareTo(m2.getName()); } }); return returnValue; } }; Frontend.getInstance().runQuery(VdcQueryType.GetAllMigrationPolicies, new VdcQueryParametersBase(), aQuery); initCpuMap(); }

Target:
private void initMigrationPolicies() { AsyncQuery aQuery = new AsyncQuery(this, new INewAsyncCallback() { @Override public void onSuccess(Object model, Object returnValue) { migrationPolicies = (List<MigrationPolicy>) returnValue; } }); aQuery.converterCallback = new IAsyncConverter() { @Override public Object convert(Object returnValue, AsyncQuery asyncQuery) { if (returnValue == null) { return new ArrayList<MigrationPolicy>(); } Collections.sort((List<MigrationPolicy>) returnValue, new Comparator<MigrationPolicy>() { @Override public int compare(MigrationPolicy m1, MigrationPolicy m2) { if (NoMigrationPolicy.ID.equals(m1.getId())) { return -1; } return m1.getName().compareTo(m2.getName()); } }); return returnValue; } }; Frontend.getInstance().runQuery(VdcQueryType.GetAllMigrationPolicies, new VdcQueryParametersBase(), aQuery); }
Source:
public void testGetFlooders() throws Exception { final EventType eventType = NakadiTestUtils.createEventType(); blacklist(eventType.getName(), BlacklistService.Type.CONSUMER_ET); try { TestUtils.waitFor( () -> given() .contentType(ContentType.JSON) .get(BLACKLIST_URL) .then() .statusCode(HttpStatus.SC_OK) .body("consumers.event_types", hasItems(eventType.getName())), 1000, 200); } finally { whitelist(eventType.getName(), BlacklistService.Type.CONSUMER_ET); } }

Target:
public void testGetFlooders() throws Exception { final EventType eventType = NakadiTestUtils.createEventType(); blacklist(eventType.getName(), BlacklistService.Type.CONSUMER_ET); TestUtils.waitFor( () -> given() .contentType(ContentType.JSON) .get(BLACKLIST_URL) .then() .statusCode(HttpStatus.SC_OK) .body("consumers.event_types", hasItems(eventType.getName())), 1000, 200); }
Source:
public IdToken idTokenWithAudience(String targetAudience, List<IdTokenProvider.Option> options) throws IOException { GenericUrl documentURL = new GenericUrl(getIdentityDocumentUrl()); if (options != null) { if (options.contains(IdTokenProvider.Option.FORMAT_FULL)) documentURL.set("format", "full"); if (options.contains(IdTokenProvider.Option.LICENSES_TRUE)) documentURL.set("license","TRUE"); } documentURL.set("audience", targetAudience); HttpResponse response = null; response = getMetadataResponse(documentURL.toString()); InputStream content = response.getContent(); if (content == null) { throw new IOException("Empty content from metadata token server request."); } String rawToken = response.parseAsString(); JsonWebSignature jws = JsonWebSignature.parse(OAuth2Utils.JSON_FACTORY, rawToken); return new IdToken(rawToken, jws); }

Target:
public IdToken idTokenWithAudience(String targetAudience, List<IdTokenProvider.Option> options) throws IOException { GenericUrl documentUrl = new GenericUrl(getIdentityDocumentUrl()); if (options != null) { if (options.contains(IdTokenProvider.Option.FORMAT_FULL)) { documentUrl.set("format", "full"); } if (options.contains(IdTokenProvider.Option.LICENSES_TRUE)) { documentUrl.set("format", "full"); documentUrl.set("license", "TRUE"); } } documentUrl.set("audience", targetAudience); HttpResponse response = getMetadataResponse(documentUrl.toString()); InputStream content = response.getContent(); if (content == null) { throw new IOException("Empty content from metadata token server request."); } String rawToken = response.parseAsString(); return IdToken.create(rawToken); }
Source:
public void registerFilesToLongleaf(Resource resc) { Set<Resource> rescTypes = resc.listProperties(RDF.type).toList().stream() .map(Statement::getResource).collect(toSet()); if (rescTypes.contains(Cdr.FileObject)) { String checksum = resc.getProperty(CdrDeposit.md5sum).getString(); if (resc.hasProperty(CdrDeposit.storageUri)) { registerFile(resc.getProperty(CdrDeposit.storageUri).getString().replace("file:", ""), resc.getURI(), checksum); } else if (resc.hasProperty(CdrDeposit.descriptiveStorageUri)) { registerFile(resc.getProperty(CdrDeposit.descriptiveStorageUri).getString(), resc.getURI(), checksum); } else { log.info("File does not have storageUri or descriptiveStorageUri properties", resc.getURI()); } } NodeIterator iterator = getChildIterator(resc); if (iterator == null) { return; } try { while (iterator.hasNext()) { Resource childResc = (Resource) iterator.next(); registerFilesToLongleaf(childResc); } } finally { iterator.close(); } }

Target:
public void registerFilesToLongleaf(Resource resc) { PID objPid = PIDs.get(resc.toString()); BinaryObject premisBin = repoObjLoader.getBinaryObject(DatastreamPids.getMdEventsPid(objPid)); URI premisStorageUri = premisBin.getContentUri(); if (premisStorageUri != null) { registerFile(premisStorageUri, null); } StmtIterator statementIterator = resc.listProperties(); try { while (statementIterator.hasNext()) { Statement currentStatement = statementIterator.nextStatement(); if (currentStatement.getPredicate().toString().matches(".*Uri")) { URI storageUri = URI.create(currentStatement.getString()); if (currentStatement.getString().matches(".*original_file")) { String checksum = resc.getProperty(CdrDeposit.md5sum).getString(); registerFile(storageUri, checksum); } else { registerFile(storageUri, null); } } } } finally { statementIterator.close(); } NodeIterator nodeIterator = getChildIterator(resc); if (nodeIterator == null) { return; } try { while (nodeIterator.hasNext()) { Resource childResc = (Resource) nodeIterator.next(); registerFilesToLongleaf(childResc); } } finally { nodeIterator.close(); } }
Source:
private ITmfStateValue getEventField(ITmfEvent event, String fieldName) { ITmfStateValue value = TmfStateValue.nullValue(); final ITmfEventField content = event.getContent(); if (fieldName.equals(TmfXmlStrings.CPU)) { value = TmfStateValue.newValueInt(Integer.valueOf(event.getSource())); } else { if (content.getField(fieldName) == null) { return value; } Object field = content.getField(fieldName).getValue(); if (field instanceof String) { String fieldString = (String) field; value = TmfStateValue.newValueString(fieldString); if (fForcedType == ValueForcedType.VALUE_TYPE_INT) { value = TmfStateValue.newValueInt(Integer.parseInt(fieldString)); } else if (fForcedType == ValueForcedType.VALUE_TYPE_LONG) { value = TmfStateValue.newValueLong(Long.parseLong(fieldString)); } } else if (field instanceof Long) { Long fieldLong = (Long) field; value = TmfStateValue.newValueLong(fieldLong); if (fForcedType == ValueForcedType.VALUE_TYPE_INT) { value = TmfStateValue.newValueInt(fieldLong.intValue()); } else if (fForcedType == ValueForcedType.VALUE_TYPE_STRING) { value = TmfStateValue.newValueString(fieldLong.toString()); } } else if (field instanceof Integer) { Integer fieldInterger = (Integer) field; value = TmfStateValue.newValueInt(fieldInterger); if (fForcedType == ValueForcedType.VALUE_TYPE_LONG) { value = TmfStateValue.newValueLong(fieldInterger.longValue()); } else if (fForcedType == ValueForcedType.VALUE_TYPE_STRING) { value = TmfStateValue.newValueString(fieldInterger.toString()); } } } return value; }

Target:
private ITmfStateValue getEventField(ITmfEvent event, String fieldName) { ITmfStateValue value = TmfStateValue.nullValue(); final ITmfEventField content = event.getContent(); if (fieldName.equals(TmfXmlStrings.CPU)) { value = TmfStateValue.newValueInt(Integer.valueOf(event.getSource())); } else { if (content.getField(fieldName) == null) { return value; } Object field = content.getField(fieldName).getValue(); if (field instanceof String) { String fieldString = (String) field; switch (fForcedType) { case INT: value = TmfStateValue.newValueInt(Integer.parseInt(fieldString)); break; case LONG: value = TmfStateValue.newValueLong(Long.parseLong(fieldString)); break; case NULL: case STRING: default: value = TmfStateValue.newValueString(fieldString); break; } } else if (field instanceof Long) { Long fieldLong = (Long) field; switch (fForcedType) { case INT: value = TmfStateValue.newValueInt(fieldLong.intValue()); break; case STRING: value = TmfStateValue.newValueString(fieldLong.toString()); break; case LONG: case NULL: default: value = TmfStateValue.newValueLong(fieldLong); break; } } else if (field instanceof Integer) { Integer fieldInterger = (Integer) field; switch (fForcedType) { case LONG: value = TmfStateValue.newValueLong(fieldInterger.longValue()); break; case STRING: value = TmfStateValue.newValueString(fieldInterger.toString()); break; case INT: case NULL: default: break; } } } return value; }
Source:
public void incrementChildCount() { this.childCount++; }

Target:
public void incrementChildCount() { childCount++; }
Source:
public static Configuration testConfiguration() { if (configuration == null) { configuration = createTestConfiguration(); } return configuration; }

Target:
public static synchronized Configuration testConfiguration() { if (configuration == null) { configuration = createTestConfiguration(); } return configuration; }
Source:
public boolean isMonitoringNeeded(VDS vds) { boolean retVal = false; for ( MonitoringStrategy monitoringStrategy : strategies ) { retVal = retVal || monitoringStrategy.isMonitoringNeeded(vds); if (retVal) { break; } } return retVal; }

Target:
public boolean isMonitoringNeeded(VDS vds) { for ( MonitoringStrategy monitoringStrategy : strategies ) { if (monitoringStrategy.isMonitoringNeeded(vds)) { return true; } } return false; }
Source:
protected boolean executeAnalysis(final IProgressMonitor monitor) { Object parameter = null; parameter = getParameter(PARAM_TEST); if (!(parameter instanceof Integer)) { throw new RuntimeException("The parameter should be set"); } int integer = ((Integer) parameter).intValue(); fOutput = integer; if (integer == 0) { return false; } else if (integer == 999) { while (!monitor.isCanceled()) { try { Thread.sleep(0); } catch (InterruptedException e) { break; } } return !monitor.isCanceled(); } return true; }

Target:
protected boolean executeAnalysis(final IProgressMonitor monitor) { Object parameter = getParameter(PARAM_TEST); if (!(parameter instanceof Integer)) { throw new RuntimeException("The parameter should be set"); } int integer = ((Integer) parameter).intValue(); fOutput = integer; if (integer == 0) { return false; } else if (integer == 999) { while (!monitor.isCanceled()) { try { Thread.sleep(0); } catch (InterruptedException e) { break; } } return !monitor.isCanceled(); } return true; }
Source:
private void addAddress(Map<String, Object> map, String address) { if (getParameters().getDisk().getDiskInterface() != DiskInterface.VirtIO_SCSI) { if (StringUtils.isNotBlank(address)) { map.put("address", XmlRpcStringUtils.string2Map(address)); } } else { Map<VmDevice, Integer> vmDeviceUnitMap = VmInfoBuilder.getVmDeviceUnitMapForVirtioScsiDisks(getParameters().getVm()); int availableUnit = VmInfoBuilder.getAvailableUnitForVirtioScsiDisk(vmDeviceUnitMap); if (!StringUtils.isEmpty(address)) { Map<String, String> addressMap = XmlRpcStringUtils.string2Map(address); int unit = Integer.valueOf(addressMap.get(VdsProperties.Unit)); if (!vmDeviceUnitMap.containsValue(unit)) { map.put(VdsProperties.Address, XmlRpcStringUtils.string2Map(address)); } else { map.put(VdsProperties.Address, VmInfoBuilder.createAddressForVirtioScsiDisk(availableUnit)); } } else { map.put(VdsProperties.Address, VmInfoBuilder.createAddressForVirtioScsiDisk(availableUnit)); } } }

Target:
private void addAddress(Map<String, Object> map, String address) { if (getParameters().getDisk().getDiskInterface() != DiskInterface.VirtIO_SCSI) { if (StringUtils.isNotBlank(address)) { map.put("address", XmlRpcStringUtils.string2Map(address)); } } else { Map<VmDevice, Integer> vmDeviceUnitMap = VmInfoBuilder.getVmDeviceUnitMapForVirtioScsiDisks(getParameters().getVm()); int availableUnit = VmInfoBuilder.getAvailableUnitForVirtioScsiDisk(vmDeviceUnitMap); if (StringUtils.isNotBlank(address)) { Map<String, String> addressMap = XmlRpcStringUtils.string2Map(address); int unit = Integer.valueOf(addressMap.get(VdsProperties.Unit)); if (!vmDeviceUnitMap.containsValue(unit)) { map.put(VdsProperties.Address, addressMap); } else { map.put(VdsProperties.Address, VmInfoBuilder.createAddressForVirtioScsiDisk(availableUnit)); } } else { map.put(VdsProperties.Address, VmInfoBuilder.createAddressForVirtioScsiDisk(availableUnit)); } } }