auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private Number getImpact() { Score<?> zero = getParentConstraintVerifier().getConstraintStreamScoreDirectorFactory() .getScoreDefinition() .getZeroScore(); if (constraintMatchTotalMap.isEmpty()) { return zero.toLevelNumbers()[0]; } Score<?> totalMatchWeightedScore = constraintMatchTotalMap.values().stream() .map(s -> s.getScore().divide(s.getConstraintWeight())) .reduce(zero, Score::add); List<Number> matchWeightsFound = Arrays.stream(totalMatchWeightedScore.toLevelNumbers()) .distinct() .collect(Collectors.toList()); if (matchWeightsFound.size() != 1) { throw new IllegalStateException("Programming error: only one match weight should have been found (" + matchWeightsFound + ")."); } return matchWeightsFound.get(0); }

Target:
private Number getImpact() { ScoreDefinition scoreDefinition = getParentConstraintVerifier().getConstraintStreamScoreDirectorFactory() .getScoreDefinition(); Score zeroScore = scoreDefinition.getZeroScore(); Number zero = zeroScore.toLevelNumbers()[0]; if (constraintMatchTotalMap.isEmpty()) { return zero; } Score totalMatchWeightedScore = constraintMatchTotalMap.values().stream() .map(matchScore -> scoreDefinition.divideBySanitizedDivisor(matchScore.getScore(), matchScore.getConstraintWeight())) .reduce(zeroScore, Score::add); List<Number> matchWeightsFound = Arrays.stream(totalMatchWeightedScore.toLevelNumbers()) .distinct() .filter(matchWeight -> !Objects.equals(matchWeight, zero)) .collect(Collectors.toList()); if (matchWeightsFound.isEmpty()) { return 0; } else if (matchWeightsFound.size() != 1) { throw new IllegalStateException("Impossible state: expecting at most one match weight," + " but got matchWeightsFound (" + matchWeightsFound + ") instead."); } return matchWeightsFound.get(0); }
Source:
public void testCyclicReferenceWithGroup() { try { new FormParseInit("/xform_tests/group_cyclic_reference.xml"); } catch (XFormParseException e) { String detailMessage = e.getMessage(); assert detailMessage.contains("Shortest Cycle"); int newlineCount = detailMessage.length() - detailMessage.replace("\n", "").length(); assert newlineCount == 3; return; } fail("Cyclical reference did not throw XFormParseException"); }

Target:
public void testCyclicReferenceWithGroup() { try { new FormParseInit("/xform_tests/group_cyclic_reference.xml"); } catch (XFormParseException e) { String detailMessage = e.getMessage(); assertTrue(detailMessage.contains("Shortest Cycle")); int newlineCount = detailMessage.length() - detailMessage.replace("\n", "").length(); assertTrue(newlineCount == 3); return; } fail("Cyclical reference did not throw XFormParseException"); }
Source:
public ShowProgress() { start = last = System.nanoTime(); }

Target:
public ShowProgress() { startNs = lastNs = System.nanoTime(); }
Source:
public void seek( long pos ) throws IOException { long newPageId = pageId( pos ); int newOffset = pageOffset( pos ); if ( isEOF( newPageId, newOffset ) ) { throw newEOFException( String.format( "seek EOF check failed for { pos: %d, pageId: %d, offsetInPage: %d }", pos, newPageId, newOffset ) ); } currentPageId = newPageId; currentPageOffset = newOffset; }

Target:
public void seek( long pos ) throws IOException { long newPageId = pageId( pos ); int newOffset = pageOffset( pos ); if ( isEOF( newPageId, newOffset ) ) { throw newSeekEOFException( pos, newPageId, newOffset ); } currentPageId = newPageId; currentPageOffset = newOffset; }
Source:
private void removeCache(final String alias, final boolean removeFromConfig) { statusTransitioner.checkAvailable(); final CacheHolder cacheHolder = caches.remove(alias); if(cacheHolder != null) { final Cache<?, ?> ehcache = cacheHolder.retrieve(cacheHolder.keyType, cacheHolder.valueType); if(!statusTransitioner.isTransitioning()) { for (CacheManagerListener listener : listeners) { listener.cacheRemoved(alias, ehcache); } } closeCache(alias, ehcache); if (removeFromConfig) { configuration.removeCacheConfiguration(alias); } this.getLogger().info("Cache '{}' is removed from {}.", alias, simpleName); } }

Target:
private void removeCache(final String alias, final boolean removeFromConfig) { statusTransitioner.checkAvailable(); final CacheHolder cacheHolder = caches.remove(alias); if(cacheHolder != null) { final InternalCache<?, ?> ehcache = cacheHolder.retrieve(cacheHolder.keyType, cacheHolder.valueType); if(!statusTransitioner.isTransitioning()) { for (CacheManagerListener listener : listeners) { listener.cacheRemoved(alias, ehcache); } } closeCache(alias, ehcache); if (removeFromConfig) { configuration.removeCacheConfiguration(alias); } this.getLogger().info("Cache '{}' is removed from {}.", alias, simpleName); } }
Source:
public static String inflateMessage(byte[] data) throws SAMLException { try{ byte[] out = data; int length = data.length; try { Inflater inflater = new Inflater(true); inflater.setInput(data); byte[] xmlMessageBytes = new byte[MAX_INFLATED_SIZE]; int inflatedLength = inflater.inflate(xmlMessageBytes); if (!inflater.finished()) { throw new SAMLException("Out of space allocated for inflated data ("+(MAX_INFLATED_SIZE/1000)+"kb)"); } inflater.end(); out = xmlMessageBytes; length = inflatedLength; } catch (DataFormatException e) { log.warn("inflate SAML message failed - Invalid data format", e); } return new String(out,0,length, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new SAMLException("Data is not in valid encoding format", e); } }

Target:
public static String inflateMessage(byte[] data) throws SAMLException { try{ byte[] out = data; int length = data.length; try { Inflater inflater = new Inflater(true); inflater.setInput(data); byte[] xmlMessageBytes = new byte[MAX_INFLATED_SIZE]; int inflatedLength = inflater.inflate(xmlMessageBytes); if (!inflater.finished()) { throw new SAMLException("Out of space allocated for inflated data ("+(MAX_INFLATED_SIZE/1000)+"kb)"); } inflater.end(); out = xmlMessageBytes; length = inflatedLength; } catch (DataFormatException e) { log.debug("Inflate SAML message failed - Invalid data format", e); } return new String(out,0,length, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new SAMLException("Data is not in valid encoding format", e); } }
Source:
public Response getPageData(@Context HttpHeaders headers, @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @ApiParam(value = "language") String language, @PathParam("sitemapname") @ApiParam(value = "sitemap name") String sitemapname, @PathParam("pageid") @ApiParam(value = "page id") String pageId, @QueryParam("subscriptionid") @ApiParam(value = "subscriptionid", required = false) String subscriptionId) { final Locale locale = LocaleUtil.getLocale(language); logger.debug("Received HTTP GET request at '{}'", uriInfo.getPath()); if (subscriptionId != null) { try { subscriptions.setPageId(subscriptionId, sitemapname, pageId); } catch (IllegalArgumentException e) { return JSONResponse.createErrorResponse(Response.Status.BAD_REQUEST, e.getMessage()); } } boolean timeout = false; if (headers.getRequestHeader("X-Atmosphere-Transport") != null) { timeout = blockUnlessChangeOccurs(sitemapname, pageId); } PageDTO responseObject = getPageBean(sitemapname, pageId, uriInfo.getBaseUriBuilder().build(), locale); responseObject.timeout = timeout; return Response.ok(responseObject).build(); }

Target:
public Response getPageData(@Context HttpHeaders headers, @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) @ApiParam(value = "language") String language, @PathParam("sitemapname") @ApiParam(value = "sitemap name") String sitemapname, @PathParam("pageid") @ApiParam(value = "page id") String pageId, @QueryParam("subscriptionid") @ApiParam(value = "subscriptionid", required = false) String subscriptionId) { final Locale locale = LocaleUtil.getLocale(language); logger.debug("Received HTTP GET request at '{}'", uriInfo.getPath()); if (subscriptionId != null) { try { subscriptions.setPageId(subscriptionId, sitemapname, pageId); } catch (IllegalArgumentException e) { return JSONResponse.createErrorResponse(Response.Status.BAD_REQUEST, e.getMessage()); } } boolean timeout = false; if (headers.getRequestHeader("X-Atmosphere-Transport") != null) { timeout = blockUnlessChangeOccurs(sitemapname, pageId); } PageDTO responseObject = getPageBean(sitemapname, pageId, uriInfo.getBaseUriBuilder().build(), locale, timeout); return Response.ok(responseObject).build(); }
Source:
public Object caseViewpoint(Viewpoint object) { DiagramDescription diagramDescription = DescriptionFactory.eINSTANCE.createDiagramDescription(); diagramDescription.setDefaultLayer(DescriptionFactory.eINSTANCE.createLayer()); newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.VIEWPOINT__OWNED_REPRESENTATIONS, diagramDescription)); newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.VIEWPOINT__OWNED_REPRESENTATIONS, DescriptionFactory.eINSTANCE.createDiagramImportDescription())); newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.VIEWPOINT__OWNED_REPRESENTATION_EXTENSIONS, DescriptionFactory.eINSTANCE.createDiagramExtensionDescription())); return null; }

Target:
public Object caseViewpoint(Viewpoint object) { DiagramDescription diagramDescription = DescriptionFactory.eINSTANCE.createDiagramDescription(); Layer layer = DescriptionFactory.eINSTANCE.createLayer(); layer.setName("Default"); diagramDescription.setDefaultLayer(layer); newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.VIEWPOINT__OWNED_REPRESENTATIONS, diagramDescription)); newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.VIEWPOINT__OWNED_REPRESENTATIONS, DescriptionFactory.eINSTANCE.createDiagramImportDescription())); newChildDescriptors.add(createChildParameter(DescriptionPackage.Literals.VIEWPOINT__OWNED_REPRESENTATION_EXTENSIONS, DescriptionFactory.eINSTANCE.createDiagramExtensionDescription())); return null; }
Source:
public void testSetBrightness() { Settings.System.putIntForUser(mContext.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE, 0, UserHandle.myUserId()); testSetBrightnessWithValue(TEST_BRIGHTNESS_1); testSetBrightnessWithValue(TEST_BRIGHTNESS_2); }

Target:
public void testSetBrightness() { mDevicePolicyManager.setSystemSetting(ADMIN_RECEIVER_COMPONENT, Settings.System.SCREEN_BRIGHTNESS_MODE, "0"); testSetBrightnessWithValue(TEST_BRIGHTNESS_1); testSetBrightnessWithValue(TEST_BRIGHTNESS_2); }
Source:
public TaskBatchExecutionListenerFactoryBean taskBatchExecutionListener(TaskExplorer taskExplorer) { TaskConfigurer taskConfigurer = context.getBean(TaskConfigurer.class); if(taskConfigurer.getTaskDataSource() != null) { return new TaskBatchExecutionListenerFactoryBean( taskConfigurer.getTaskDataSource(), taskExplorer); } else { return new TaskBatchExecutionListenerFactoryBean(null, taskExplorer); } }

Target:
public TaskBatchExecutionListenerFactoryBean taskBatchExecutionListener(TaskExplorer taskExplorer) { TaskConfigurer taskConfigurer = null; if(!context.getBeansOfType(TaskConfigurer.class).isEmpty()) { taskConfigurer = context.getBean(TaskConfigurer.class); } if(taskConfigurer != null && taskConfigurer.getTaskDataSource() != null) { return new TaskBatchExecutionListenerFactoryBean( taskConfigurer.getTaskDataSource(), taskExplorer); } else { return new TaskBatchExecutionListenerFactoryBean(null, taskExplorer); } }
Source:
long estimateSize(Path directoryPath) { final AtomicLong size = new AtomicLong(0); try { Files.walkFileTree(directoryPath, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { size.addAndGet(attrs.size()); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) { log.error("skipped: {}", file, exc); return FileVisitResult.CONTINUE; } }); return size.get(); } catch (IOException ioe) { throw new IllegalStateException(ioe); } }

Target:
static long estimateSize(Path directoryPath) { final AtomicLong size = new AtomicLong(0); try { Files.walkFileTree(directoryPath, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) { size.addAndGet(attrs.size()); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) { log.error("skipped: {}", file, exc); return FileVisitResult.CONTINUE; } }); return size.get(); } catch (IOException ioe) { throw new IllegalStateException(ioe); } }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.log_activity); getSupportActionBar().setDisplayHomeAsUpEnabled(true); if (savedInstanceState != null) { syncthingLog = savedInstanceState.getBoolean("syncthingLog"); } mLog = (TextView) findViewById(R.id.log); mScrollView = (ScrollView) findViewById(R.id.scroller); updateLog(); }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.log_activity); getSupportActionBar().setDisplayHomeAsUpEnabled(true); if (savedInstanceState != null) { mSyncthingLog = savedInstanceState.getBoolean("syncthingLog"); invalidateOptionsMenu(); } mLog = (TextView) findViewById(R.id.log); mScrollView = (ScrollView) findViewById(R.id.scroller); updateLog(); }
Source:
public void setNearClip(float nearClipIn) { nearClip = nearClipIn; }

Target:
public void setNearClip(float nearClipIn) { this.nearClip = nearClipIn; }
Source:
static OperationDefinition getOperationDefinition(String name, AttributeDefinition ... additional) { AttributeDefinition[] atrs = new AttributeDefinition[2 + additional.length]; atrs[0] = SERVER; atrs[1] = BLOCKING; System.arraycopy(additional, 0, atrs, 2, additional.length); return new SimpleOperationDefinitionBuilder(name, HostResolver.getResolver("host.server")) .setParameters(atrs) .setReplyType(ModelType.STRING) .setRuntimeOnly() .withFlag(OperationEntry.Flag.HOST_CONTROLLER_ONLY) .build(); }

Target:
static OperationDefinition getOperationDefinition(String name, AttributeDefinition... additional) { SimpleOperationDefinitionBuilder builder = new SimpleOperationDefinitionBuilder(name, HostResolver.getResolver("host.server")) .setParameters(SERVER, BLOCKING) .setReplyType(ModelType.STRING) .setRuntimeOnly() .withFlag(OperationEntry.Flag.HOST_CONTROLLER_ONLY); for (AttributeDefinition param : additional) { builder.addParameter(param); } return builder.build(); }
Source:
public static DBI create(ConnectionFactory connectionFactory) { DBI dbi = new DBI(connectionFactory); dbi.installPlugins(); return dbi; }

Target:
public static DBI create(ConnectionFactory connectionFactory) { return new DBI(connectionFactory); }
Source:
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { String action = null; Console.Type type = (Console.Type) postParams.get("type"); switch (type) { case NOVNC: case XVPVNC: action = "os-getVNCConsole"; break; case SPICE_HTML5: action = "os-getSPICEConsole"; break; case RDP_HTML5: action = "os-getRDPConsole"; break; default: throw new IllegalArgumentException("Invalid type: " + type); } return bindToRequest(request, (Object) ImmutableMap.of(action, ImmutableSortedMap.copyOf(postParams))); }

Target:
public <R extends HttpRequest> R bindToRequest(R request, Map<String, Object> postParams) { String action; Console.Type type = (Console.Type) postParams.get("type"); switch (type) { case NOVNC: case XVPVNC: action = "os-getVNCConsole"; break; case SPICE_HTML5: action = "os-getSPICEConsole"; break; case RDP_HTML5: action = "os-getRDPConsole"; break; default: throw new IllegalArgumentException("Invalid type: " + type); } return bindToRequest(request, ImmutableMap.of(action, ImmutableSortedMap.copyOf(postParams))); }
Source:
public final void test1() throws InterruptedException { Thread.sleep(5); }

Target:
public final void test1() { }
Source:
public void jobScriptWithJobTypeTest() { System.out.println("JobScriptWithJobTypeTest"); }

Target:
public void jobScriptWithJobTypeTest() { BlockUtils.sleep(1000L); assertTrue(regCenter.isExisted("/" + scriptJobName + "/sharding")); }
Source:
public IndexedFastaSequenceFile(final Path path, final FastaSequenceIndex index) { super(path, index); try (final InputStream stream = IOUtil.maybeBufferInputStream(Files.newInputStream(path))) { if (BlockCompressedInputStream.isValidFile(stream)) { throw new SAMException("Indexed block-compressed FASTA file cannot be handle: " + path); } this.channel = Files.newByteChannel(path); } catch (IOException e) { throw new SAMException("FASTA file should be readable but is not: " + path, e); } }

Target:
public IndexedFastaSequenceFile(final Path path, final FastaSequenceIndex index) { super(path, index); try (final InputStream stream = IOUtil.maybeBufferInputStream(Files.newInputStream(path))) { if (BlockCompressedInputStream.isValidFile(stream)) { throw new SAMException("Indexed block-compressed FASTA file cannot be handled: " + path); } this.channel = Files.newByteChannel(path); } catch (IOException e) { throw new SAMException("FASTA file should be readable but is not: " + path, e); } }
Source:
public void testUnmarshallSubprocessLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateSignalEventCatching emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_OUTGOING_EDGE_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertSignalEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, NON_CANCELLING, ""); assertDataIOSet(emptySubprocessEvent.getDataIOSet(), EMPTY_VALUE); }

Target:
public void testUnmarshallSubprocessLevelEventWithEdgesEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateSignalEventCatching emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_WITH_OUTGOING_EDGE_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertSignalEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, NON_CANCELLING, EMPTY_VALUE); assertDataIOSet(emptySubprocessEvent.getDataIOSet(), EMPTY_VALUE); }
Source:
public void testRebaseWithUnstagedMasterChange() throws Exception { writeTrashFile(FILE1, "file1"); git.add().addFilepattern(FILE1).call(); RevCommit commit = git.commit().setMessage("commit1").call(); createBranch(commit, "refs/heads/topic"); checkoutBranch("refs/heads/topic"); writeTrashFile("file2", "file2"); git.add().addFilepattern("file2").call(); git.commit().setMessage("commit2").call(); checkoutBranch("refs/heads/master"); writeTrashFile(FILE1, "modified file1"); git.add().addFilepattern(FILE1).call(); git.commit().setMessage("commit3").call(); checkoutBranch("refs/heads/topic"); writeTrashFile(FILE1, "unstaged modified file1"); RebaseResult result = git.rebase().setUpstream("refs/heads/master") .call(); assertEquals(result.getStatus(), Status.CONFLICTS); assertEquals(result.getConflicts().size(), 1); assertEquals(result.getConflicts().get(0), FILE1); }

Target:
public void testRebaseWithUnstagedMasterChange() throws Exception { writeTrashFile(FILE1, "file1"); git.add().addFilepattern(FILE1).call(); RevCommit commit = git.commit().setMessage("commit1").call(); createBranch(commit, "refs/heads/topic"); checkoutBranch("refs/heads/topic"); writeTrashFile("file2", "file2"); git.add().addFilepattern("file2").call(); git.commit().setMessage("commit2").call(); checkoutBranch("refs/heads/master"); writeTrashFile(FILE1, "modified file1"); git.add().addFilepattern(FILE1).call(); git.commit().setMessage("commit3").call(); checkoutBranch("refs/heads/topic"); writeTrashFile(FILE1, "unstaged modified file1"); RebaseResult result = git.rebase().setUpstream("refs/heads/master") .call(); assertEquals(Status.CONFLICTS, result.getStatus()); assertEquals(1, result.getConflicts().size()); assertEquals(FILE1, result.getConflicts().get(0)); }
Source:
protected boolean canDoAction() { boolean returnValue = true; if (getVm().getstatus() == VMStatus.Up) { setVdsId(getVm().getrun_on_vds().getValue()); returnValue = isHotPlugSupported() && isOSSupportingHotPlug(); vmDevice = vmDeviceDao.get(new VmDeviceId(getParameters().getNicId(), getParameters().getVmId())); } if (vmDevice == null) { returnValue = false; addCanDoActionMessage(VdcBllMessages.VM_INTERFACE_NOT_EXIST); } return returnValue; }

Target:
protected boolean canDoAction() { boolean returnValue = true; if (getVm().getstatus() == VMStatus.Up) { setVdsId(getVm().getrun_on_vds().getValue()); vmDevice = getVmDeviceDao().get(new VmDeviceId(getParameters().getNicId(), getParameters().getVmId())); if (vmDevice == null) { returnValue = false; addCanDoActionMessage(VdcBllMessages.VM_INTERFACE_NOT_EXIST); } else { returnValue = isHotPlugSupported() && isOSSupportingHotPlug(); } } return returnValue; }
Source:
private void updateCopyAndMoveCommandAvailability(List<Disk> disks) { boolean isMoveAllowed = true; boolean isCopyAllowed = true; if (disks == null || disks.isEmpty() || disks.get(0).getDiskStorageType() != DiskStorageType.IMAGE) { disableMoveAndCopyCommands(); return; } Guid datacenterId = ((DiskImage) disks.get(0)).getStoragePoolId(); boolean foundTemplateDisk = false; boolean foundVmDisk = false; boolean foundUnattachedDisk = false; for (Disk disk : disks) { if ((!isCopyAllowed && !isMoveAllowed) || disk.getDiskStorageType() != DiskStorageType.IMAGE) { disableMoveAndCopyCommands(); return; } DiskImage diskImage = (DiskImage) disk; if (diskImage.getImageStatus() != ImageStatus.OK || !datacenterId.equals(diskImage.getStoragePoolId()) || diskImage.isOvfStore()) { disableMoveAndCopyCommands(); return; } VmEntityType vmEntityType = disk.getVmEntityType(); if (vmEntityType == null) { foundUnattachedDisk = true; } else if (vmEntityType.isTemplateType()) { foundTemplateDisk = true; } else if (vmEntityType.isVmType()) { foundVmDisk = true; } if (foundTemplateDisk && (foundUnattachedDisk || foundVmDisk)) { isCopyAllowed = false; } if (vmEntityType != null && vmEntityType.isTemplateType()) { isMoveAllowed = false; } } getCopyCommand().setIsExecutionAllowed(isCopyAllowed); getMoveCommand().setIsExecutionAllowed(isMoveAllowed); }

Target:
private void updateCopyAndMoveCommandAvailability(List<Disk> disks) { boolean isCopyAllowed = true; boolean isMoveAllowed = true; if (disks == null || disks.isEmpty() || disks.get(0).getDiskStorageType() != DiskStorageType.IMAGE) { disableMoveAndCopyCommands(); return; } Guid datacenterId = ((DiskImage) disks.get(0)).getStoragePoolId(); boolean foundTemplateDisk = false; boolean foundVmDisk = false; boolean foundUnattachedDisk = false; for (Disk disk : disks) { if ((!isCopyAllowed && !isMoveAllowed) || disk.getDiskStorageType() != DiskStorageType.IMAGE) { disableMoveAndCopyCommands(); return; } DiskImage diskImage = (DiskImage) disk; if (diskImage.getImageStatus() != ImageStatus.OK || !datacenterId.equals(diskImage.getStoragePoolId()) || diskImage.isOvfStore()) { disableMoveAndCopyCommands(); return; } VmEntityType vmEntityType = disk.getVmEntityType(); if (vmEntityType == null) { foundUnattachedDisk = true; } else if (vmEntityType.isTemplateType()) { foundTemplateDisk = true; } else if (vmEntityType.isVmType()) { foundVmDisk = true; } if (foundTemplateDisk && (foundUnattachedDisk || foundVmDisk)) { isCopyAllowed = false; } if (vmEntityType != null && vmEntityType.isTemplateType()) { isMoveAllowed = false; } } getCopyCommand().setIsExecutionAllowed(isCopyAllowed); getMoveCommand().setIsExecutionAllowed(isMoveAllowed); }
Source:
public LabelCanvas draw(Driver driver, Barcodable barcodable) { LabelCanvas label = driver.start(14, 4.666); label.multilineText(10.7, 2.3, 0.5, 8, 2, Stream.of(new Pair<>(FontStyle.REGULAR, barcodable.getAlias()))); label.multilineText(1, 1.375, .8, 18, 2, Stream.of( new Pair<>(FontStyle.BOLD, barcodable.getAlias()))); label.multilineText(1, 3.375, .8, 12, 2, Stream.of( new Pair<>(FontStyle.REGULAR, LimsUtils.formatDate(barcodable.getBarcodeDate())), new Pair<>(FontStyle.REGULAR, unescapeHtml(barcodable.getBarcodeExtraInfo())))); label.barcode2d(6.78, 4, 0.1, barcodable.getAlias()); return label; }

Target:
public LabelCanvas draw(Driver driver, Barcodable barcodable) { LabelCanvas label = driver.start(8.3, 7.7); label.textClipped(2.4, 7.125, .8, 15, barcodable.getAlias()); if (barcodable.getBarcodeDate() != null) { label.text(0.5, 7.125, .8, LimsUtils.formatDate(barcodable.getBarcodeDate())); } label.barcode2d(1.75, 1.75, 0.125, getBarcode(barcodable)); label.textClipped(0.666, 4.666, .8, 15, unescapeHtml(barcodable.getBarcodeExtraInfo())); return label; }
Source:
private void retrievePreferences() { this.preference = "CHOICE_BEHAVIOR"; this.type = null; IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore(); if (request.getConnectionViewAndElementDescriptor().getSemanticHint().equals(UMLDIElementTypes.MESSAGE_ASYNCH_EDGE.getSemanticHint())) { this.preference = store.getString(CustomMessages.PREF_EXECUTION_SPECIFICATION_ASYNC_MSG); } if (request.getConnectionViewAndElementDescriptor().getSemanticHint().equals(UMLDIElementTypes.MESSAGE_SYNCH_EDGE.getSemanticHint())) { this.preference = store.getString(CustomMessages.PREF_EXECUTION_SPECIFICATION_SYNC_MSG); } if (preference == "CHOICE_BEHAVIOR") { this.type = UMLDIElementTypes.BEHAVIOR_EXECUTION_SPECIFICATION_SHAPE; } if (preference == "CHOICE_ACTION") { this.type = UMLDIElementTypes.ACTION_EXECUTION_SPECIFICATION_SHAPE; } }

Target:
private void retrievePreferences() { this.preference = "CHOICE_BEHAVIOR"; this.type = null; IPreferenceStore store = UMLDiagramEditorPlugin.getInstance().getPreferenceStore(); if (request.getConnectionViewAndElementDescriptor().getSemanticHint().equals(UMLDIElementTypes.MESSAGE_ASYNCH_EDGE.getSemanticHint())) { this.preference = store.getString(CustomMessages.PREF_EXECUTION_SPECIFICATION_ASYNC_MSG); } if (request.getConnectionViewAndElementDescriptor().getSemanticHint().equals(UMLDIElementTypes.MESSAGE_SYNCH_EDGE.getSemanticHint())) { this.preference = store.getString(CustomMessages.PREF_EXECUTION_SPECIFICATION_SYNC_MSG); } if ("CHOICE_BEHAVIOR".equals(preference)) { this.type = UMLDIElementTypes.BEHAVIOR_EXECUTION_SPECIFICATION_SHAPE; } if ("CHOICE_ACTION".equals(preference)) { this.type = UMLDIElementTypes.ACTION_EXECUTION_SPECIFICATION_SHAPE; } }
Source:
private SearchResult parseToSearchResult(@Nonnull final IMAPResponse[] ir) throws ImapAsyncClientException { if (ir.length < 1) { throw new ImapAsyncClientException(FailureType.INVALID_INPUT); } final Response taggedResponse = ir[ir.length - 1]; if (!taggedResponse.isOK()) { throw new ImapAsyncClientException(FailureType.INVALID_INPUT); } final List<Long> v = new ArrayList<Long>(); Long modSeq = null; long num; for (final IMAPResponse sr : ir) { if (sr.keyEquals("SEARCH")) { while ((num = sr.readLong()) != -1) { v.add(Long.valueOf(num)); } if (sr.readByte() == '(') { final String s = sr.readAtom(); if (s.equalsIgnoreCase("MODSEQ")) { modSeq = sr.readLong(); } } } } return new SearchResult(v, modSeq); }

Target:
private SearchResult parseToSearchResult(@Nonnull final IMAPResponse[] ir) throws ImapAsyncClientException { if (ir.length < 1) { throw new ImapAsyncClientException(FailureType.INVALID_INPUT); } final Response taggedResponse = ir[ir.length - 1]; if (!taggedResponse.isOK()) { throw new ImapAsyncClientException(FailureType.INVALID_INPUT); } final List<Long> v = new ArrayList<Long>(); Long modSeq = null; long num; for (final IMAPResponse sr : ir) { if (sr.keyEquals("SEARCH")) { while ((num = sr.readLong()) != -1) { v.add(num); } if (sr.readByte() == '(') { final String s = sr.readAtom(); if (s.equalsIgnoreCase("MODSEQ")) { modSeq = sr.readLong(); } } } } return new SearchResult(v, modSeq); }
Source:
public EngineDialog(Shell parentShell) { super(parentShell, ENGINE_DIALOG_HEADER, null, "", INFORMATION, new String[] {webkitOption, xulrunnerOption}, 0); message = "Do you prefer to have good JSF support (use xulrunner) or HTML5 support (use webkit)?"; }

Target:
public EngineDialog(Shell parentShell) { super(parentShell, ENGINE_DIALOG_HEADER, null, "", INFORMATION, new String[] {webkitOption, xulrunnerOption}, webkitIsUsed ? 0 : 1); message = Messages.EngineDialog_MESSAGE; }
Source:
@Override public String toString() { List<Object> extra = effectiveExtra(); StringBuilder result = new StringBuilder(); result.append(value.getClass().getSimpleName()).append('=').append(value); result.setCharAt(0, Character.toLowerCase(result.charAt(0))); if (type != 3) { String flagsString = SamplingFlags.toString(value.flags); if (!flagsString.isEmpty()) result.append(", samplingFlags=").append(flagsString); } if (!extra.isEmpty()) result.append(", extra=").append(extra); return result.insert(0, "Extracted{").append('}').toString(); }

Target:
@Override public String toString() { List<Object> extra = effectiveExtra(); StringBuilder result = new StringBuilder("Extracted{"); String valueClass = value.getClass().getSimpleName(); result.append(Character.toLowerCase(valueClass.charAt(0))); result.append(valueClass, 1, valueClass.length()).append('=').append(value); if (type != 3) { String flagsString = SamplingFlags.toString(value.flags); if (!flagsString.isEmpty()) result.append(", samplingFlags=").append(flagsString); } if (!extra.isEmpty()) result.append(", extra=").append(extra); return result.append('}').toString(); }
Source:
private static boolean paramsMatch(Class<?>[] types, Object[] params) { if (params.length != types.length) { return false; } for (int i = 0; i < params.length; i++) { if (!types[i].isInstance(params[i])) { return false; } } return true; }

Target:
private static boolean paramsMatch(Class<?>[] types, Object[] params) { if (params.length != types.length) { return false; } for (int i = 0; i < params.length; i++) { if (params[i] == null) { if (types[i].isPrimitive()) { return false; } } else if ((!types[i].isPrimitive() && !types[i].isInstance(params[i])) || (types[i].isPrimitive() && !types[i].equals(Primitives.primitiveTypeOf(params[i].getClass())))) { return false; } } return true; }
Source:
public void setProperties(Map<String, String> map) throws Exception { synchronized (this) { configuration = Converter.cnv(PomConfiguration.class, map); if (configuration.name() == null) throw new IllegalArgumentException("Must get a name"); this.name = configuration.name(); if (configuration.pom() != null) { pomFiles = Strings.split(configuration.pom()) .stream() .map(part -> { File f = IO.getFile(part); return f.isFile() ? f.toURI() : URI.create(part); }) .collect(toList()); if (pomFiles.isEmpty()) { status("Pom is neither a file nor a revision " + configuration.pom()); } } else if (configuration.revision() != null) { revisions = Strings.split(configuration.revision()) .stream() .map(Revision::valueOf) .filter(Objects::nonNull) .collect(toList()); if (revisions.isEmpty()) { status("Revision is neither a file nor a revision " + configuration.revision()); } } else if (configuration.query() != null) { this.query = configuration.query(); this.queryUrl = configuration.queryUrl("<LINK_0>"); } else { status("Neither pom, revision nor query property are set"); } inited = false; } }

Target:
public void setProperties(Map<String, String> map) throws Exception { configuration = Converter.cnv(PomConfiguration.class, map); }
Source:
public boolean serializeField( JsonSerializerInternal serializer, Object parent, FieldAccess fieldAccess, CharBuf builder) { Field field = fieldAccess.getField(); String name = field.getName(); boolean shouldManuallySerialize = (name.equals("value") || name.equals("defaultValue")) && field.getType().equals(String.class); if (!shouldManuallySerialize) { return false; } String fieldValue = null; try { fieldValue = (String) field.get(parent); } catch (IllegalAccessException e) { throw new UncheckedIllegalAccessException( "Access denied for field 'value' on FilterLeafNode", e); } if (fieldValue == null) { return false; } builder.addJsonFieldName(name); Integer i = Ints.tryParse(fieldValue); if (i != null) { builder.addInt(i); return true; } Double d = Doubles.tryParse(fieldValue); if (d != null) { builder.addDouble(d); return true; } if (fieldValue.equalsIgnoreCase("true")) { builder.addBoolean(true); return true; } if (fieldValue.equalsIgnoreCase("false")) { builder.addBoolean(false); return true; } builder.addQuoted(fieldValue); return true; }

Target:
public boolean serializeField( JsonSerializerInternal serializer, Object parent, FieldAccess fieldAccess, CharBuf builder) { Field field = fieldAccess.getField(); String name = field.getName(); boolean shouldManuallySerialize = ("value".equals(name) || "defaultValue".equals(name)) && field.getType().equals(String.class); if (!shouldManuallySerialize) { LOGGER.trace("Special serialization is not needed for field '{}'", name); return false; } String fieldValue = null; try { fieldValue = (String) field.get(parent); } catch (IllegalAccessException e) { throw new UncheckedIllegalAccessException( "Access denied for field 'value' on FilterLeafNode", e); } if (fieldValue == null) { LOGGER.debug("Field '{}' held a null value, no special serialization needed", name); return false; } builder.addJsonFieldName(name); Integer i = Ints.tryParse(fieldValue); if (i != null) { LOGGER.debug("Found Integer '{}' on field '{}', serializing appropriately", i, name); builder.addInt(i); return true; } Double d = Doubles.tryParse(fieldValue); if (d != null) { LOGGER.debug("Found Double '{}' on field '{}', serializing appropriately", d, name); builder.addDouble(d); return true; } if (fieldValue.equalsIgnoreCase("true")) { LOGGER.debug("Found Boolean '{}' on field '{}', serializing appropriately", fieldValue, name); builder.addBoolean(true); return true; } if (fieldValue.equalsIgnoreCase("false")) { LOGGER.debug("Found Boolean '{}' on field '{}', serializing appropriately", fieldValue, name); builder.addBoolean(false); return true; } LOGGER.debug("Found String '{}' on field '{}', serializing appropriately", fieldValue, name); builder.addQuoted(fieldValue); return true; }
Source:
public static Props fromJSONString(String json) { try { Map<String, String> obj = (Map<String, String>) JSONUtils.parseJSONFromString(json); Props props = new Props(null, obj); return props; } catch (IOException e) { logger.error("Encountered error during parsing project properties json."); e.printStackTrace(); return null; } }

Target:
public static Props fromJSONString(String json) { try { Map<String, String> obj = (Map<String, String>) JSONUtils.parseJSONFromString(json); Props props = new Props(null, obj); return props; } catch (IOException e) { logger.error("Encountered error during parsing project properties json. ", e); return null; } }
Source:
public static void afterClass() throws InterruptedException, TimeoutException, IOException, OperationException { operations.removeIfExists(FORMATTER_ADDRESS); administration.reloadIfRequired(); operations.removeIfExists(FORMATTER_ADDRESS_TO_BE_REMOVED); administration.reloadIfRequired(); }

Target:
public static void afterClass() throws InterruptedException, TimeoutException, IOException, OperationException { operations.removeIfExists(FORMATTER_ADDRESS); operations.removeIfExists(FORMATTER_ADDRESS_TO_BE_REMOVED); administration.reloadIfRequired(); }
Source:
protected void filter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws Exception { try { response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin")); response.setHeader("Access-Control-Allow-Credentials", "true"); response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); response.setHeader("Access-Control-Max-Age", "3600"); response.setHeader("Access-Control-Allow-Headers", "Content-Type, Accept, X-Requested-With, remember-me"); } catch (Exception e) { log.error("Specified Origin '{}' is not allowed: {}", request.getHeader("Origin"), e.getMessage(), e); } chain.doFilter(request, response); }

Target:
protected void filter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws Exception { try { if (request.getHeader(ORIGIN) != null) { originRequestAuthorizer.assertAuthorized(request, response); boolean preFlight = isPreFlight(request); if (preFlight && !Strings.hasText(request.getHeader(ACCESS_CONTROL_REQUEST_METHOD))) { response.setStatus(HttpServletResponse.SC_FORBIDDEN); return; } response.setHeader(ACCESS_CONTROL_ALLOW_ORIGIN, request.getHeader(ORIGIN)); response.setHeader(ACCESS_CONTROL_ALLOW_CREDENTIALS, "true"); response.setHeader(ACCESS_CONTROL_ALLOW_METHODS, "POST, GET, OPTIONS, DELETE"); response.setHeader(ACCESS_CONTROL_MAX_AGE, "3600"); response.setHeader(ACCESS_CONTROL_ALLOW_HEADERS, "Content-Type, Accept, X-Requested-With, remember-me"); if (!preFlight) { chain.doFilter(request, response); } } } catch (RuntimeException e) { log.error("Specified Origin '{}' is not allowed: {}", request.getHeader("Origin"), e.getMessage(), e); response.setStatus(HttpServletResponse.SC_FORBIDDEN); } }
Source:
public boolean equals( Object obj ) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; ValueReference other = (ValueReference)obj; if (owningNodeUuid == null) { if (other.owningNodeUuid != null) return false; } else if (!owningNodeUuid.equals(other.owningNodeUuid)) return false; if (workspaceName == null) { if (other.workspaceName != null) return false; } else if (!workspaceName.equals(other.workspaceName)) return false; return true; }

Target:
public boolean equals( Object obj ) { if (this == obj) return true; if (obj instanceof ValueReference) { ValueReference other = (ValueReference)obj; return ObjectUtil.isEqualWithNulls(this.owningNodeUuid, other.owningNodeUuid) && ObjectUtil.isEqualWithNulls(this.workspaceName, other.workspaceName); } return false; }
Source:
private static C_Type createType(final String type, final boolean isArray, final ImmutableSet<String> enumNames) { final String ds3TypeName = StructHelper.getDs3TypeName(type); if (enumNames.contains(ds3TypeName)) { return new PrimitiveType(ds3TypeName, isArray); } switch (type) { case "java.lang.Boolean": case "boolean": return new PrimitiveType("ds3_bool", isArray); case "java.lang.Double": case "java.lang.Long": case "double": case "long": return new PrimitiveType("uint64_t", isArray); case "java.lang.Integer": case "int": return new PrimitiveType("int", isArray); case "java.lang.String": case "java.util.Date": case "java.util.UUID": return new FreeableType("ds3_str", isArray); default: return new FreeableType(StructHelper.getResponseTypeName(type), isArray); } }

Target:
private static C_Type createType(final String type, final boolean isArray, final ImmutableSet<String> enumNames) { final String ds3TypeName = StructHelper.getDs3TypeName(type); if (enumNames.contains(ds3TypeName)) { return new PrimitiveType(ds3TypeName, isArray); } switch (type) { case "java.lang.Boolean": case "boolean": return new PrimitiveType("ds3_bool", isArray); case "java.lang.Integer": case "int": return new PrimitiveType("int", isArray); case "java.lang.Long": case "long": return new PrimitiveType("uint64_t", isArray); case "java.lang.Double": case "double": return new PrimitiveType("float", isArray); case "java.lang.Object": case "java.lang.String": case "java.util.Date": case "java.util.UUID": return new FreeableType("ds3_str", isArray); default: return new FreeableType(StructHelper.getResponseTypeName(type), isArray); } }
Source:
private long getCachedEndIndex(Path path) { Long endIndexForFile = endIndexMap.get(path); if (endIndexForFile == null) { try { final long bufferSectionSize = 1024; long bufferSectionEnd = path.getFileSystem(conf).getFileStatus(path).getLen(); long bufferSectionStart = Math.max(0, bufferSectionEnd - bufferSectionSize); Queue<Long> lineEndBuffer = new ArrayDeque<Long>(headerCount + 1); FSDataInputStream fis = path.getFileSystem(conf).open(path); fis.seek(bufferSectionStart); while (bufferSectionEnd > bufferSectionStart) { fis.seek(bufferSectionStart); long pos = fis.getPos(); while (pos < bufferSectionEnd) { fis.readLine(); pos = fis.getPos(); if (pos <= bufferSectionEnd) { if (lineEndBuffer.size() > footerCount) { lineEndBuffer.poll(); } lineEndBuffer.add(pos); } } if (lineEndBuffer.size() > footerCount) { break; } else { bufferSectionEnd = bufferSectionStart; bufferSectionStart = Math.max(0, bufferSectionEnd - bufferSectionSize); } } if (lineEndBuffer.size() > footerCount) { endIndexForFile = lineEndBuffer.poll(); } else { endIndexForFile = -1L; } } catch (IOException e) { endIndexForFile = -1L; } endIndexMap.put(path, endIndexForFile); } return endIndexForFile - 1; }

Target:
private long getCachedEndIndex(Path path) throws IOException { Long endIndexForFile = endIndexMap.get(path); if (endIndexForFile == null) { final long bufferSectionSize = 5 * 1024; FileSystem fileSystem = path.getFileSystem(conf); long endOfFile = fileSystem.getFileStatus(path).getLen(); if (footerCount == 0) { endIndexForFile = endOfFile; } else { long bufferSectionEnd = endOfFile; long bufferSectionStart = Math.max(0, bufferSectionEnd - bufferSectionSize); LineBuffer buffer = new LineBuffer(footerCount + 1); FSDataInputStream fis = null; try { fis = fileSystem.open(path); while (bufferSectionEnd > bufferSectionStart) { fis.seek(bufferSectionStart); long pos = fis.getPos(); while (pos < bufferSectionEnd) { if (fis.readLine() == null) { break; } pos = fis.getPos(); buffer.consume(pos, bufferSectionEnd); } if (buffer.getRemainingLineCount() == 0) { break; } else { bufferSectionEnd = bufferSectionStart; bufferSectionStart = Math.max(0, bufferSectionEnd - bufferSectionSize); } } if (buffer.getRemainingLineCount() == 0) { endIndexForFile = buffer.getFirstLineStart() - 1; } else { endIndexForFile = Long.MIN_VALUE; } } finally { if (fis != null) { fis.close(); } } } endIndexMap.put(path, endIndexForFile); } return endIndexForFile; }
Source:
private static Schema.Type stringToFieldType(String typeString) { if (typeString == null || typeString.isEmpty()) { return null; } String type = typeString.toLowerCase(Locale.ENGLISH); if (type.equals("long")) { return Schema.Type.LONG; } else if (type.equals("double")) { return Schema.Type.DOUBLE; } else if (type.equals("float")) { return Schema.Type.FLOAT; } else if (type.equals("string")) { return Schema.Type.STRING; } return null; }

Target:
private static Schema.Type stringToFieldType(String typeString) { if (typeString == null || typeString.isEmpty()) { return null; } String type = typeString.toLowerCase(Locale.ENGLISH); if (type.equals("long")) { return Schema.Type.LONG; } else if (type.equals("int")) { return Schema.Type.INT; } else if (type.equals("double")) { return Schema.Type.DOUBLE; } else if (type.equals("float")) { return Schema.Type.FLOAT; } else if (type.equals("string")) { return Schema.Type.STRING; } else if (type.equals("boolean")) { return Schema.Type.BOOLEAN; } return null; }
Source:
public void testOpenSSL() throws IOException { assumeTrue(NativeCodeLoader.buildSupportsOpenssl()); OpenSSLSocketFactory.initializeDefaultFactory( OpenSSLSocketFactory.SSLChannelMode.OpenSSL); assertTrue(OpenSSLSocketFactory.getDefaultFactory() .getProviderName().contains("openssl")); }

Target:
public void testOpenSSL() throws IOException { assumeTrue(NativeCodeLoader.buildSupportsOpenssl()); OpenSSLSocketFactory.initializeDefaultFactory( OpenSSLSocketFactory.SSLChannelMode.OpenSSL); assertThat(OpenSSLSocketFactory.getDefaultFactory() .getProviderName()).contains("openssl"); }
Source:
protected void ensureUserListIsUsed() { users = users == null ? new ArrayList<>() : new ArrayList<>(users); if (user != null && !users.contains(user)) { users.add(user); } else if (email != null && users.isEmpty()) { users.add(NuxeoPrincipal.computeTransientUsername(email)); } }

Target:
protected void ensureUserListIsUsed() { users = users == null ? new ArrayList<>() : new ArrayList<>(users); if (user != null && !users.contains(user)) { users.add(user); } else if (email != null && users.isEmpty()) { users.add(computeTransientUsername(email)); } }
Source:
public Response add(Host host) { validateEnums(Host.class, host); validateParameters(host, "name", "address", "rootPassword"); VdsStatic staticHost = getMapper(Host.class, VdsStatic.class).map(host, null); staticHost.setVdsGroupId(getClusterId(host)); AddVdsActionParameters addParams = new AddVdsActionParameters(staticHost, host.getRootPassword()); if (host.isSetOverrideIptables()) { addParams.setOverrideFirewall(host.isOverrideIptables()); } if (host.isSetRebootAfterInstallation()) { addParams.setRebootAfterInstallation(host.isRebootAfterInstallation()); } if (host.isSetSsh()) { if (host.getSsh().isSetUser()) { if (host.getSsh().getUser().isSetPassword()) { addParams.setPassword(host.getSsh().getUser().getPassword()); } } if (host.getSsh().isSetPort()) { addParams.getvds().setSshPort(host.getSsh().getPort().intValue()); } else { if (addParams.getvds().getSshPort() == 0) { addParams.getvds().setSshPort(DEFAULT_SSH_PORT); } } if (host.getSsh().isSetFingerprint()) { addParams.getvds().setSshKeyFingerprint(host.getSsh().getFingerprint()); } } return performCreate(VdcActionType.AddVds, addParams, new QueryIdResolver<Guid>(VdcQueryType.GetVdsByVdsId, IdQueryParameters.class)); }

Target:
public Response add(Host host) { validateEnums(Host.class, host); validateParameters(host, "name", "address", "rootPassword"); VdsStatic staticHost = getMapper(Host.class, VdsStatic.class).map(host, null); staticHost.setVdsGroupId(getClusterId(host)); AddVdsActionParameters addParams = new AddVdsActionParameters(staticHost, host.getRootPassword()); if (host.isSetOverrideIptables()) { addParams.setOverrideFirewall(host.isOverrideIptables()); } if (host.isSetRebootAfterInstallation()) { addParams.setRebootAfterInstallation(host.isRebootAfterInstallation()); } if (host.isSetSsh()) { if (host.getSsh().isSetUser()) { if (host.getSsh().getUser().isSetPassword()) { addParams.setPassword(host.getSsh().getUser().getPassword()); } } if (host.getSsh().isSetPort()) { addParams.getvds().setSshPort(host.getSsh().getPort().intValue()); } if (host.getSsh().isSetFingerprint()) { addParams.getvds().setSshKeyFingerprint(host.getSsh().getFingerprint()); } } return performCreate(VdcActionType.AddVds, addParams, new QueryIdResolver<Guid>(VdcQueryType.GetVdsByVdsId, IdQueryParameters.class)); }