auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean writeDictionaryRowGroup(Block dictionary, int valueCount, IntBigArray dictionaryIndexes, int maxDirectBytes) { int[][] segments = dictionaryIndexes.getSegments(); for (int i = 0; valueCount > 0 && i < segments.length; i++) { int[] segment = segments[i]; int positionCount = Math.min(valueCount, segment.length); DictionaryBlock dictionaryBlock = new DictionaryBlock(positionCount, dictionary, segment); directColumnWriter.writeBlock(dictionaryBlock); valueCount -= positionCount; if (directColumnWriter.getBufferedBytes() > maxDirectBytes) { directColumnWriter.close(); directColumnWriter.reset(); return false; } } checkState(valueCount == 0); return true; }

Target:
private boolean writeDictionaryRowGroup(Block dictionary, int valueCount, IntBigArray dictionaryIndexes, int maxDirectBytes) { int[][] segments = dictionaryIndexes.getSegments(); for (int i = 0; valueCount > 0 && i < segments.length; i++) { int[] segment = segments[i]; int positionCount = Math.min(valueCount, segment.length); Block block = new DictionaryBlock(positionCount, dictionary, segment); while (block != null) { int chunkPositionCount = block.getPositionCount(); Block chunk = block.getRegion(0, chunkPositionCount); while (chunkPositionCount > 1 && chunk.getLogicalSizeInBytes() > DIRECT_CONVERSION_CHUNK_MAX_LOGICAL_BYTES) { chunkPositionCount /= 2; chunk = chunk.getRegion(0, chunkPositionCount); } directColumnWriter.writeBlock(chunk); if (directColumnWriter.getBufferedBytes() > maxDirectBytes) { return false; } if (chunkPositionCount < block.getPositionCount()) { block = block.getRegion(chunkPositionCount, block.getPositionCount() - chunkPositionCount); } else { block = null; } } valueCount -= positionCount; } checkState(valueCount == 0); return true; }
Source:
public void onFinish(ISuite suite) { try { TestServerUtils.stopServer(); } catch (Exception e) { SeLionLogger.getLogger().info(e.getMessage()); } }

Target:
public void onFinish(ISuite suite) { try { TestServerUtils.stopServer(); } catch (Exception e) { System.err.println(" Unable to stop test server"); } }
Source:
public void writeExternal(ObjectOutput out) throws IOException { out.writeObject(aggregator); out.writeBoolean(eliminatedNulls); out.writeUTF(separator); }

Target:
public void writeExternal(ObjectOutput out) throws IOException { out.writeInt(VERSION); out.writeObject(aggregator); out.writeBoolean(eliminatedNulls); out.writeUTF(separator); }
Source:
private static Optional<RemoteEndpointAwareJdkSSLOptions> sslOptions(CassandraKeyValueServiceConfig config) { if (config.sslConfiguration().isPresent()) { SSLContext sslContext = SslSocketFactories.createSslContext(config.sslConfiguration().get()); return Optional.of(RemoteEndpointAwareJdkSSLOptions.builder() .withSSLContext(sslContext) .build()); } else if (config.ssl().isPresent() && config.ssl().get()) { return Optional.of(RemoteEndpointAwareJdkSSLOptions.builder().build()); } else { return Optional.empty(); } }

Target:
private static Optional<RemoteEndpointAwareJdkSSLOptions> sslOptions(CassandraKeyValueServiceConfig config) { if (config.sslConfiguration().isPresent()) { SSLContext sslContext = SslSocketFactories.createSslContext(config.sslConfiguration().get()); return Optional.of(RemoteEndpointAwareJdkSSLOptions.builder() .withSSLContext(sslContext) .build()); } else if (config.ssl().orElse(false)) { return Optional.of(RemoteEndpointAwareJdkSSLOptions.builder().build()); } return Optional.empty(); }
Source:
public void testExpiration() throws InterruptedException { cache.put(1, "a"); Thread.sleep(300); assertThat(cache.get(1)).isNull(); assertThat(tierStatistics.getExpirations()).isEqualTo(1); }

Target:
public void testExpiration() throws InterruptedException { cache.put(1, "a"); timeSource.advanceTime(TIME_TO_EXPIRATION); assertThat(cache.get(1)).isNull(); assertThat(tierStatistics.getExpirations()).isEqualTo(1); }
Source:
protected void finish() { MetricsFile<BaseDistributionByCycleMetrics, ?> metrics = getMetricsFile(); this.hist.addToMetricsFile(metrics); metrics.write(this.OUTPUT); if (this.hist.isEmpty()) { this.log.warn(new Object[]{"No valid bases found in input file. No plot will be produced."}); } else { int rResult = RExecutor.executeFromClasspath("picard/analysis/baseDistributionByCycle.R", new String[]{this.OUTPUT.getAbsolutePath(), this.CHART_OUTPUT.getAbsolutePath(), this.INPUT.getName(), this.plotSubtitle}); if (rResult != 0) { throw new PicardException("R script nucleotideDistributionByCycle.R failed with return code " + rResult); } } }

Target:
protected void finish() { final MetricsFile<BaseDistributionByCycleMetrics, ?> metrics = getMetricsFile(); hist.addToMetricsFile(metrics); metrics.write(OUTPUT); if (hist.isEmpty()) { log.warn("No valid bases found in input file. No plot will be produced."); } else { final int rResult = RExecutor.executeFromClasspath("picard/analysis/baseDistributionByCycle.R", OUTPUT.getAbsolutePath(), CHART_OUTPUT.getAbsolutePath(), INPUT.getName(), plotSubtitle); if (rResult != 0) { throw new PicardException("R script nucleotideDistributionByCycle.R failed with return code " + rResult); } } }
Source:
private void populateSchemaMigration(Connection connection, long maxMigrationNumber) { try (PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES (?)")) { batchExecute( 0, maxMigrationNumber + 1, preparedStatement, connection, (statement, counter) -> statement.setString(1, String.valueOf(counter))); } catch (SQLException e) { throw new RuntimeException("Failed to insert rows into table SCHEMA_MIGRATIONS", e); } }

Target:
private static void populateSchemaMigration(Connection connection, long maxMigrationNumber) { try (PreparedStatement preparedStatement = connection.prepareStatement("INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES (?)")) { batchExecute( 0, maxMigrationNumber + 1, preparedStatement, connection, (statement, counter) -> statement.setString(1, String.valueOf(counter))); } catch (SQLException e) { throw new RuntimeException("Failed to insert rows into table SCHEMA_MIGRATIONS", e); } }
Source:
public Long getUuid() { return new Long(artifactObject.getArtId()); }

Target:
public Long getUuid() { return Long.valueOf(artifactObject.getArtId()); }
Source:
public void addProperty(String name, Object value) { this.properties.put(name, value); }

Target:
public void addProperty(String name, Object value) { Assert.hasText(name, "'name' must not be null"); this.properties.put(name, value); }
Source:
public void showFetchingError(String s) { if (Network.getConnectivityStatusString(getContext()).equals("Not connected to Internet")) { viewFlipper.setDisplayedChild(2); noClientText.setText(R.string.failed_to_fetch_client_details_account); } else { Toast.makeText(getActivity(), s, Toast.LENGTH_SHORT).show(); } }

Target:
public void showFetchingError(String s) { if (Network.isOnline(getContext())) { viewFlipper.setDisplayedChild(2); noClientText.setText(R.string.failed_to_fetch_client_details_account); } else { Toast.makeText(getActivity(), s, Toast.LENGTH_SHORT).show(); } }
Source:
private void sanitizeInput(final String value) throws SanitizationException { try { CleanResults result = antiSamy.scan(value); List<String>errorMsgList = result.getErrorMessages(); if (CollectionUtils.isNotEmpty(errorMsgList)) { throw new SanitizationException("Malicious code has been detected on the HTTP header"); } } catch (ScanException | PolicyException | SanitizationException ex) { throw new SanitizationException(ex); } }

Target:
private void sanitizeInput(final String value) throws SanitizationException { try { CleanResults result = antiSamy.scan(value); if (CollectionUtils.isNotEmpty(result.getErrorMessages())) { throw new SanitizationException("Malicious code has been detected on the HTTP header"); } } catch (ScanException | PolicyException | SanitizationException ex) { throw new SanitizationException(ex); } }
Source:
public Response buildGraphOverWire ( @PathParam("routerId") String routerId, @QueryParam("preEvict") @DefaultValue("true") boolean preEvict, InputStream input) { if (preEvict) { LOG.debug("Pre-evicting graph with routerId before building new graph", routerId); server.graphService.evictGraph(routerId); } File tempDir = Files.createTempDir(); ZipInputStream zis = new ZipInputStream(input); try { for (ZipEntry entry = zis.getNextEntry(); entry != null; entry = zis.getNextEntry()) { if (entry.isDirectory()) continue; File file = new File(tempDir, entry.getName()); OutputStream os = new FileOutputStream(file); ByteStreams.copy(zis, os); os.close(); } } catch (Exception ex) { return Response.status(Response.Status.BAD_REQUEST).entity("Could not extract zip file: " + ex.getMessage()).build(); } CommandLineParameters params = new CommandLineParameters(); params.build = Lists.newArrayList(); params.build.add(tempDir); GraphBuilderTask graphBuilder = new OTPConfigurator(params).builderFromParameters(); graphBuilder.run(); for (File file : tempDir.listFiles()) { file.delete(); } tempDir.delete(); Graph graph = graphBuilder.getGraph(); graph.index(new DefaultStreetVertexIndexFactory()); server.graphService.registerGraph(routerId, new MemoryGraphSource(routerId, graph)); return Response.status(Status.CREATED).entity(graph.toString() + "\n").build(); }

Target:
public Response buildGraphOverWire ( @PathParam("routerId") String routerId, @QueryParam("preEvict") @DefaultValue("true") boolean preEvict, InputStream input) { if (preEvict) { LOG.debug("Pre-evicting graph with routerId before building new graph", routerId); server.graphService.evictGraph(routerId); } File tempDir = Files.createTempDir(); ZipInputStream zis = new ZipInputStream(input); try { for (ZipEntry entry = zis.getNextEntry(); entry != null; entry = zis.getNextEntry()) { if (entry.isDirectory()) return Response.status(Response.Status.BAD_REQUEST) .entity("ZIP files containing directories are not supported").build(); File file = new File(tempDir, entry.getName()); if (!file.getParentFile().equals(tempDir)) return Response.status(Response.Status.BAD_REQUEST) .entity("ZIP files containing directories are not supported").build(); OutputStream os = new FileOutputStream(file); ByteStreams.copy(zis, os); os.close(); } } catch (Exception ex) { return Response.status(Response.Status.BAD_REQUEST).entity("Could not extract zip file: " + ex.getMessage()).build(); } CommandLineParameters params = new CommandLineParameters(); params.build = Lists.newArrayList(); params.build.add(tempDir); GraphBuilderTask graphBuilder = new OTPConfigurator(params).builderFromParameters(); graphBuilder.run(); for (File file : tempDir.listFiles()) { file.delete(); } tempDir.delete(); Graph graph = graphBuilder.getGraph(); graph.index(new DefaultStreetVertexIndexFactory()); server.graphService.registerGraph(routerId, new MemoryGraphSource(routerId, graph)); return Response.status(Status.CREATED).entity(graph.toString() + "\n").build(); }
Source:
private List<IGraphicalEditPart> cleanSelectedObjects(List<?> selectedObjects) { List<IGraphicalEditPart> result = Lists.newArrayList(); for (Object selectedObject : selectedObjects) { if (selectedObject instanceof IGraphicalEditPart) { if (!(selectedObject instanceof AbstractGeneratedDiagramNameEditPart) || !(selectedObjects.contains(((IGraphicalEditPart) selectedObject).getParent()))) { result.add((IGraphicalEditPart) selectedObject); } } } return result; }

Target:
private List<IGraphicalEditPart> cleanSelectedObjects(List<?> selectedObjects) { List<IGraphicalEditPart> result = Lists.newArrayList(); final Set<Object> selection = new HashSet<Object>(selectedObjects); for (Object selectedObject : selection) { if (selectedObject instanceof IGraphicalEditPart) { if (!(selectedObject instanceof IDiagramNameEditPart) || !(selection.contains(((IGraphicalEditPart) selectedObject).getParent()))) { boolean isLabelOfSelectedParent = (selectedObject instanceof IDiagramNameEditPart) && selection.contains(((IDiagramNameEditPart) selectedObject).getParent()); if (!isLabelOfSelectedParent) { result.add((IGraphicalEditPart) selectedObject); } } } } return result; }
Source:
public ColumnValueSelector<?> makeColumnValueSelector( TimeAndDimsHolder currEntry, IncrementalIndex.DimensionDesc desc ) { final int dimIndex = desc.getIndex(); class IndexerDoubleColumnSelector implements DoubleColumnSelector { @Override public boolean isNull() { if (NullHandling.replaceWithDefault()) { return false; } final Object[] dims = currEntry.get().getDims(); return dimIndex >= dims.length || dims[dimIndex] == null; } @Override public double getDouble() { final Object[] dims = currEntry.get().getDims(); if (dimIndex >= dims.length || dims[dimIndex] == null) { return 0.0; } return (Double) dims[dimIndex]; } @SuppressWarnings("deprecation") @Nullable @Override public Double getObject() { final Object[] dims = currEntry.get().getDims(); if (dimIndex >= dims.length) { return null; } return (Double) dims[dimIndex]; } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { } } return new IndexerDoubleColumnSelector(); }

Target:
public ColumnValueSelector<?> makeColumnValueSelector( TimeAndDimsHolder currEntry, IncrementalIndex.DimensionDesc desc ) { final int dimIndex = desc.getIndex(); class IndexerDoubleColumnSelector implements DoubleColumnSelector { @Override public boolean isNull() { final Object[] dims = currEntry.get().getDims(); return dimIndex >= dims.length || dims[dimIndex] == null; } @Override public double getDouble() { final Object[] dims = currEntry.get().getDims(); if (dimIndex >= dims.length || dims[dimIndex] == null) { assert NullHandling.replaceWithDefault(); return 0.0; } return (Double) dims[dimIndex]; } @SuppressWarnings("deprecation") @Nullable @Override public Double getObject() { final Object[] dims = currEntry.get().getDims(); if (dimIndex >= dims.length) { return null; } return (Double) dims[dimIndex]; } @Override public void inspectRuntimeShape(RuntimeShapeInspector inspector) { } } return new IndexerDoubleColumnSelector(); }
Source:
GHPullRequestReviewBuilder(GHPullRequest pr) { this.pr = pr; this.builder = pr.root.retrieve().method("POST"); }

Target:
GHPullRequestReviewBuilder(GHPullRequest pr) { this.pr = pr; this.builder = pr.root.createRequest(); }
Source:
public String pretrainedUrl(PretrainedType pretrainedType) { if (pretrainedType == PretrainedType.IMAGENET) if (inputShape[1] == 448 && inputShape[2] == 448) return "<LINK_2>"; else return "<LINK_1>"; else return null; }

Target:
public String pretrainedUrl(PretrainedType pretrainedType) { if (pretrainedType == PretrainedType.IMAGENET) if (inputShape[1] == 448 && inputShape[2] == 448) return "<LINK_3>"; else return "<LINK_0>"; else return null; }
Source:
public boolean canDownloadFile(FileMetadata fileMetadata){ if (fileMetadata == null){ return false; } if ((fileMetadata.getId() == null) || (fileMetadata.getDataFile().getId() == null)){ return false; } Long fid = fileMetadata.getId(); boolean isRestrictedFile = fileMetadata.isRestricted(); if (this.fileDownloadPermissionMap.containsKey(fid)){ return this.fileDownloadPermissionMap.get(fid); } if (fileMetadata.getDatasetVersion().isDeaccessioned()) { if (this.doesSessionUserHavePermission(Permission.EditDataset, fileMetadata)) { this.fileDownloadPermissionMap.put(fid, true); return true; } else { this.fileDownloadPermissionMap.put(fid, false); return false; } } if (!isRestrictedFile){ this.fileDownloadPermissionMap.put(fid, true); return true; } if (session.getUser() instanceof GuestUser){ boolean guestHasAccessDueToIpGroup = permissionService.requestOn(dvRequestService.getDataverseRequest(), fileMetadata.getDataFile()).has(Permission.DownloadFile); if (guestHasAccessDueToIpGroup) { this.fileDownloadPermissionMap.put(fid, true); return true; } else { this.fileDownloadPermissionMap.put(fid, false); return false; } } if (this.doesSessionUserHavePermission(Permission.DownloadFile, fileMetadata)){ this.fileDownloadPermissionMap.put(fid, true); return true; } this.fileDownloadPermissionMap.put(fid, false); return false; }

Target:
public boolean canDownloadFile(FileMetadata fileMetadata){ if (fileMetadata == null){ return false; } if ((fileMetadata.getId() == null) || (fileMetadata.getDataFile().getId() == null)){ return false; } Long fid = fileMetadata.getId(); boolean isRestrictedFile = fileMetadata.isRestricted(); if (this.fileDownloadPermissionMap.containsKey(fid)){ return this.fileDownloadPermissionMap.get(fid); } if (fileMetadata.getDatasetVersion().isDeaccessioned()) { if (this.doesSessionUserHavePermission(Permission.EditDataset, fileMetadata)) { this.fileDownloadPermissionMap.put(fid, true); return true; } else { this.fileDownloadPermissionMap.put(fid, false); return false; } } if (!isRestrictedFile){ this.fileDownloadPermissionMap.put(fid, true); return true; } if (permissionService.requestOn(dvRequestService.getDataverseRequest(), fileMetadata.getDataFile()).has(Permission.DownloadFile)) { logger.fine("The DataverseRequest (User plus IP address) has access to download the file."); this.fileDownloadPermissionMap.put(fid, true); return true; } this.fileDownloadPermissionMap.put(fid, false); return false; }
Source:
protected void executeCommand() { boolean removingVmPool = isRemovingVmPool(); if (!removingVmPool) { applyNextRunConfiguration(); boolean removedStatelessSnapshot = detachUsers(); if (!removedStatelessSnapshot && !templateVersionChanged) { removeVmStatelessImages(); } } getQuotaManager().rollbackQuotaByVmId(getVmId()); if (!removingVmPool) { removeStatelessVmUnmanagedDevices(); boolean vmHasDirectPassthroughDevices = releaseUsedHostDevices(); Guid hostId = cleanupVfs(); refreshHostIfNeeded(hostId == null ? (vmHasDirectPassthroughDevices ? getVm().getDedicatedVmForVds() : null) : hostId); } }

Target:
protected void executeCommand() { boolean removingVmPool = isRemovingVmPool(); if (!removingVmPool) { applyNextRunConfiguration(); boolean removedStatelessSnapshot = detachUsers(); if (!removedStatelessSnapshot && !templateVersionChanged) { removeVmStatelessImages(); } } getQuotaManager().rollbackQuotaByVmId(getVmId()); if (!removingVmPool) { removeStatelessVmUnmanagedDevices(); boolean vmHasDirectPassthroughDevices = releaseUsedHostDevices(); Guid hostId = cleanupVfs(); Guid alternativeHostsList = vmHasDirectPassthroughDevices ? getVm().getDedicatedVmForVdsList().get(0) : null; refreshHostIfNeeded(hostId == null ? alternativeHostsList : hostId); } }
Source:
public CodeSystems execute(ServiceProvider context) { final List<CodeSystem> codeSystemList = Lists.newArrayList(); final Repositories repositories = RepositoryRequests.prepareSearch() .all() .build() .execute(context); repositories.forEach(repositoryInfo -> { CodeSystems css = CodeSystemRequests.prepareSearchCodeSystem() .all() .filterByIds(ids) .setFields(fields) .setExpand(expand) .build(repositoryInfo.id()) .getRequest() .execute(context); codeSystemList.addAll(css.getItems()); }); return new CodeSystems(codeSystemList, null, 50, codeSystemList.size()); }

Target:
public CodeSystems execute(ServiceProvider context) { final List<CodeSystem> codeSystemList = Lists.newArrayList(); final Repositories repositories = RepositoryRequests.prepareSearch() .all() .build() .execute(context); repositories.forEach(repositoryInfo -> { CodeSystems css = CodeSystemRequests.prepareSearchCodeSystem() .all() .filterByIds(ids) .setFields(fields) .setExpand(expand) .build(repositoryInfo.id()) .getRequest() .execute(context); codeSystemList.addAll(css.getItems()); }); return new CodeSystems(codeSystemList, null, codeSystemList.size(), codeSystemList.size()); }
Source:
private boolean canFindVmOrTemplate() { boolean retValue = true; if (getParameters().getOperation() == ImageOperation.Copy) { VmTemplate template = getVmTemplateDAO().get(getImage().getvm_guid()); if (template == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); retValue = false; } else { setVmTemplate(template); sharedLockMap = Collections.singletonMap(getImage().getvm_guid(), LockingGroup.TEMPLATE.name()); } } else { List<VM> listVms = getVmsForDiskId(); if (!listVms.isEmpty()) { sharedLockMap = new HashMap<Guid, String>(); for (VM vm : listVms) { sharedLockMap.put(vm.getId(), LockingGroup.VM.name()); } } retValue = true; } return retValue; }

Target:
private boolean canFindVmOrTemplate() { boolean retValue = true; if (getParameters().getOperation() == ImageOperation.Copy) { VmTemplate template = getVmTemplateDAO().get(getImage().getvm_guid()); if (template == null) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_DOES_NOT_EXIST); retValue = false; } else { setVmTemplate(template); sharedLockMap = Collections.singletonMap(getImage().getvm_guid(), LockingGroup.TEMPLATE.name()); } } else { List<VM> listVms = getVmsForDiskId(); if (!listVms.isEmpty()) { sharedLockMap = new HashMap<Guid, String>(); for (VM vm : listVms) { sharedLockMap.put(vm.getId(), LockingGroup.VM.name()); } } } return retValue; }
Source:
private Iterable<Result<Item>> listObjectsV2(ListObjectsArgs args) { return new Iterable<Result<Item>>() { @Override public Iterator<Result<Item>> iterator() { return new ObjectIterator() { protected void populateResult() throws InvalidKeyException, InvalidBucketNameException, IllegalArgumentException, NoSuchAlgorithmException, InsufficientDataException, XmlParserException, ErrorResponseException, InternalException, InvalidResponseException, IOException { String delimiter = "/"; if (args.recursive()) { delimiter = null; } String continuationToken = null; if (this.listBucketResult != null) { continuationToken = listBucketResult.nextContinuationToken(); } this.listBucketResult = null; this.itemIterator = null; this.prefixIterator = null; this.listBucketResult = invokeListObjectsV2( ListObjectsArgs.builder() .bucket(args.bucketName()) .continuationToken(continuationToken) .delimiter(delimiter) .fetchOwner(args.fetchOwner()) .prefix(args.prefix()) .includeUserMetadata(args.includeUserMetadata()) .build()); } }; } }; }

Target:
private Iterable<Result<Item>> listObjectsV2(ListObjectsArgs args) { return new Iterable<Result<Item>>() { @Override public Iterator<Result<Item>> iterator() { return new ObjectIterator() { protected void populateResult() throws InvalidKeyException, InvalidBucketNameException, IllegalArgumentException, NoSuchAlgorithmException, InsufficientDataException, XmlParserException, ErrorResponseException, InternalException, InvalidResponseException, IOException { String delimiter = getDelimiter(args); String continuationToken = null; if (this.listBucketResult != null) { continuationToken = listBucketResult.nextContinuationToken(); } this.listBucketResult = null; this.itemIterator = null; this.prefixIterator = null; this.listBucketResult = invokeListObjectsV2( ListObjectsArgs.builder() .bucket(args.bucket()) .continuationToken(continuationToken) .delimiter(delimiter) .fetchOwner(args.fetchOwner()) .prefix(args.prefix()) .includeUserMetadata(args.includeUserMetadata()) .build()); } }; } }; }
Source:
protected void execStore() { Set<IForm> formsToStore = getOpenFormsField().getValue().stream() .flatMap(a -> a.stream()) .collect(Collectors.toSet()); for (IForm f : formsToStore) { if (isWizardContainerForm(f)) { ((IWizardContainerForm) f).getWizard().doFinish(); } else { f.doOk(); } } m_forms.stream() .filter(f -> !formsToStore.contains(f) && isWizardContainerForm(f)) .map(f -> ((IWizardContainerForm) f).getWizard()) .forEach(IWizard::doSuspend); }

Target:
protected void execStore() { Set<IForm> formsToStore = getOpenFormsField().getValue().stream() .flatMap(Collection::stream) .collect(Collectors.toSet()); for (IForm f : formsToStore) { if (isWizardContainerForm(f)) { ((IWizardContainerForm) f).getWizard().doFinish(); } else { f.doOk(); } } m_forms.stream() .filter(f -> !formsToStore.contains(f) && isWizardContainerForm(f)) .map(f -> ((IWizardContainerForm) f).getWizard()) .forEach(this::closeWizard); }
Source:
public void canLowerKey() { final TreeMap<String, Integer> unit = TreeMap.ofEntries(aaron, carter, john, nancy, simon); assertThat(unit.lowerKey("john")).isEqualTo(Option.of("carter")); assertThat(unit.lowerKey("eddie")).isEqualTo(Option.of("carter")); assertThat(unit.lowerKey("aaa")).isEqualTo(Option.none()); }

Target:
public void canLowerKey() { final TreeMap<Integer, Integer> unit = TreeMap.ofEntries(one, three, five, seven, nine); assertThat(unit.lowerKey(5)).isEqualTo(Option.of(3)); assertThat(unit.lowerKey(4)).isEqualTo(Option.of(3)); assertThat(unit.lowerKey(0)).isEqualTo(Option.none()); }
Source:
private List<PyExpressionTree> getConditionsToCompare(PyIfStatementTree ifStatement) { List<PyExpressionTree> conditions = new ArrayList<>(Collections.singletonList(ifStatement.condition())); conditions.addAll(ifStatement.elifBranches().stream().map(PyIfStatementTree::condition).collect(Collectors.toList())); PyElseStatementTree elseStatement = ifStatement.elseBranch(); if (elseStatement != null) { lookForElseIfs(conditions, elseStatement); } return conditions; }

Target:
private List<PyExpressionTree> getConditionsToCompare(PyIfStatementTree ifStatement) { List<PyExpressionTree> conditions = new ArrayList<>(); conditions.add(ifStatement.condition()); conditions.addAll(ifStatement.elifBranches().stream().map(PyIfStatementTree::condition).collect(Collectors.toList())); PyElseStatementTree elseStatement = ifStatement.elseBranch(); if (elseStatement != null) { lookForElseIfs(conditions, elseStatement); } return conditions; }
Source:
public static int nextAvailablePort(int port) { checkArgument(port >= MIN_PORT_NUMBER && port <= MAX_PORT_NUMBER, "requested port %s is outside the valid range of %s to %s", port, MIN_PORT_NUMBER, MAX_PORT_NUMBER); int originalPort = port; while (!isPortAvailable(port) && port <= MAX_PORT_NUMBER) port++; if (port >= MAX_PORT_NUMBER) throw new RuntimeException("attempt to find a free port at or above " + originalPort); return port; }

Target:
public static int nextAvailablePort(int port) { checkArgument(port >= MIN_PORT_NUMBER && port <= MAX_PORT_NUMBER, "requested port %s is outside the valid range of %s to %s", port, MIN_PORT_NUMBER, MAX_PORT_NUMBER); int originalPort = port; while (!isPortAvailable(port) && port <= MAX_PORT_NUMBER) port++; if (port > MAX_PORT_NUMBER) throw new RuntimeException("unable to find a free port at or above " + originalPort); return port; }
Source:
public SSHClient getSSHClient() { Long timeout = TimeUnit.SECONDS.toMillis(Config.<Integer> GetValue(ConfigValues.ConnectToServerTimeoutInSeconds)); EngineSSHClient sshclient = new EngineSSHClient(); sshclient.setVds(getParameters().getvds()); sshclient.setHardTimeout(timeout); sshclient.setSoftTimeout(timeout); if (getParameters().getAuthMethod() == AuthenticationMethod.PublicKey) { sshclient.useDefaultKeyPair(); } else { sshclient.setPassword(getParameters().getPassword()); } return sshclient; }

Target:
public EngineSSHClient getSSHClient() throws Exception { Long timeout = TimeUnit.SECONDS.toMillis(Config.<Integer> GetValue(ConfigValues.ConnectToServerTimeoutInSeconds)); EngineSSHClient sshclient = new EngineSSHClient(); sshclient.setVds(getParameters().getvds()); sshclient.setHardTimeout(timeout); sshclient.setSoftTimeout(timeout); switch (getParameters().getAuthMethod()) { case PublicKey: sshclient.useDefaultKeyPair(); break; case Password: sshclient.setPassword(getParameters().getPassword()); break; default: throw new Exception("Invalid authentication method value was sent to AddVdsCommand"); } return sshclient; }
Source:
public Response getSkinResource(@PathParam("path") String path) { try { ScriptFile file = getModule().getSkinResource("/resources/" + path); if (file != null) { long lastModified = file.lastModified(); ResponseBuilder resp = Response.ok(file.getFile()) .lastModified(new Date(lastModified)) .header("Cache-Control", "public") .header("Server", "Nuxeo/WebEngine-1.0"); String mimeType = ctx.getEngine().getMimeType(file.getExtension()); if (mimeType == null) { mimeType = "text/plain"; } resp.type(mimeType); return resp.build(); } } catch (IOException e) { throw new NuxeoException("Failed to get resource file: " + path, e); } return Response.status(404).build(); }

Target:
public Response getSkinResource(@PathParam("path") String path) { try { ScriptFile file = getModule().getSkinResource("/resources/" + path); if (file != null) { long lastModified = file.lastModified(); ResponseBuilder resp = Response.ok(file.getFile()) .lastModified(new Date(lastModified)) .header("Cache-Control", "public") .header("Server", "Nuxeo/WebEngine-1.0"); String mimeType = ctx.getEngine().getMimeType(file.getExtension()); if (mimeType == null) { mimeType = "text/plain"; } resp.type(mimeType); return resp.build(); } } catch (IOException e) { throw new NuxeoException("Failed to get resource file: " + path, e); } return Response.status(SC_NOT_FOUND).build(); }
Source:
public <R, E extends Exception> R execute(ExceptionFunction<T, R, E> function) throws E { Lock lock = this.lock.readLock(); lock.lock(); try { T value = this.value; return (value != null) ? function.apply(value) : null; } finally { lock.unlock(); } }

Target:
public synchronized <R, E extends Exception> R execute(ExceptionFunction<T, R, E> function) throws E { return (this.value != null) ? function.apply(this.value) : null; }
Source:
public boolean isGeneratedPathSameAsOriginal() { Optional<Path> newDir = databaseContext.getFirstExistingFileDir(filePreferences); Optional<Path> currentDir = linkedFile.findIn(databaseContext, filePreferences); BiPredicate<Path, Path> equality = Files::isSameFile; return OptionalUtil.equals(newDir, currentDir, equality); }

Target:
public boolean isGeneratedPathSameAsOriginal() { Optional<Path> newDir = databaseContext.getFirstExistingFileDir(filePreferences); Optional<Path> currentDir = linkedFile.findIn(databaseContext, filePreferences); BiPredicate<Path, Path> equality = (fileA, fileB) -> { try { return Files.isSameFile(fileA, fileB); } catch (IOException e) { return false; } }; return OptionalUtil.equals(newDir, currentDir, equality); }
Source:
public SaslClient createSaslClient(final String[] mechanisms, final String authorizationId, final String protocol, final String serverName, Map<String, ?> props, final CallbackHandler cbh) throws SaslException { Assert.checkNotNullParam("cbh", cbh); if (props == null) props = Collections.emptyMap(); if (PlainSasl.isMatched(props, false)) for (String mechanism : mechanisms) { if (SaslMechanismInformation.Names.PLAIN.equals(mechanism)) { boolean skipNormalization = "true".equals(props.get(WildFlySasl.SKIP_NORMALIZATION)); return new PlainSaslClient(authorizationId, cbh, skipNormalization); } } return null; }

Target:
public SaslClient createSaslClient(final String[] mechanisms, final String authorizationId, final String protocol, final String serverName, Map<String, ?> props, final CallbackHandler cbh) throws SaslException { Assert.checkNotNullParam("cbh", cbh); if (props == null) props = Collections.emptyMap(); if (PlainSasl.isMatched(props, false)) for (String mechanism : mechanisms) { if (SaslMechanismInformation.Names.PLAIN.equals(mechanism)) { boolean skipNormalization; if (props.containsKey(WildFlySasl.SKIP_NORMALIZATION)) { skipNormalization = Boolean.parseBoolean((String) props.get(WildFlySasl.SKIP_NORMALIZATION)); } else { skipNormalization = false; } return new PlainSaslClient(authorizationId, cbh, skipNormalization); } } return null; }
Source:
public CryptoOperationFragment() { CryptoOperationHelper.Callback callback = new CryptoOperationHelper.Callback<T, S>() { @Override public T createOperationInput() { return CryptoOperationFragment.this.createOperationInput(); } @Override public void onCryptoOperationSuccess(S result) { CryptoOperationFragment.this.onCryptoOperationSuccess(result); } @Override public void onCryptoOperationCancelled() { CryptoOperationFragment.this.onCryptoOperationCancelled(); } @Override public void onCryptoOperationError(S result) { CryptoOperationFragment.this.onCryptoOperationError(result); } @Override public boolean onCryptoSetProgress(String msg, int progress, int max) { return CryptoOperationFragment.this.onCryptoSetProgress(msg, progress, max); } }; mOperationHelper = new CryptoOperationHelper<>(this, callback); }

Target:
public CryptoOperationFragment() { mOperationHelper = new CryptoOperationHelper<>(this, this); }
Source:
public void should_find_books() { populator.forServer(hostIp, 0) .withDatabase("travel-sample") .usingDataSet("/airlines.json") .execute(); CouchbaseCluster couchbaseCluster = CouchbaseCluster.create(hostIp); final Bucket books = couchbaseCluster.openBucket("travel-sample"); final JsonDocument vueling = books.get("airline_1"); final JsonObject vuelingObject = vueling.content(); assertThat(vuelingObject.getString("name")).isEqualTo("Vueling Airlines"); }

Target:
public void should_find_books() { populator.forServer(hostIp, 0) .withDatabase("travel-sample") .usingDataSet("airlines.json") .execute(); CouchbaseCluster couchbaseCluster = CouchbaseCluster.create(hostIp); final Bucket books = couchbaseCluster.openBucket("travel-sample"); final JsonDocument vueling = books.get("airline_1"); final JsonObject vuelingObject = vueling.content(); assertThat(vuelingObject.getString("name")).isEqualTo("Vueling Airlines"); }
Source:
public void testPredicateAccessCache() throws Exception { final Ignite ignite0 = startGrid(0); CacheConfiguration<String, String> cacheCfg = new CacheConfiguration<>(); cacheCfg.setName("testCache"); cacheCfg.setAtomicityMode(ATOMIC); cacheCfg.setCacheMode(REPLICATED); cacheCfg.setWriteSynchronizationMode(FULL_SYNC); IgniteCache<String, String> cache = ignite0.getOrCreateCache(cacheCfg); cache.put(ignite0.cluster().localNode().id().toString(), "val"); latch = new CountDownLatch(1); final ClusterGroup grp = ignite0.cluster().forPredicate((IgnitePredicate<ClusterNode>) node -> { System.out.println("Predicated started [thread=" + Thread.currentThread().getName() + ']'); latch.countDown(); try { Thread.sleep(3000); } catch (InterruptedException ignore) { } System.out.println("Call contains key [thread=" + Thread.currentThread().getName() + ']'); boolean ret = Ignition.localIgnite().cache("testCache").containsKey(node.id().toString()); System.out.println("After contains key [ret=" + ret + ", thread=" + Thread.currentThread().getName() + ']'); return ret; }); IgniteInternalFuture<?> fut = GridTestUtils.runAsync(new Callable<Void>() { @Override public Void call() throws Exception { info("Start deploy service."); ignite0.services(grp).deployNodeSingleton("testService", new TestService()); info("Service deployed."); return null; } }, "deploy-thread"); latch.await(); startGrid(1); fut.get(); }

Target:
public void testPredicateAccessCache() throws Exception { final IgniteEx ignite0 = startGrid(0); CacheConfiguration<String, String> cacheCfg = new CacheConfiguration<>(); cacheCfg.setName("testCache"); cacheCfg.setAtomicityMode(ATOMIC); cacheCfg.setCacheMode(REPLICATED); cacheCfg.setWriteSynchronizationMode(FULL_SYNC); IgniteCache<String, String> cache = ignite0.getOrCreateCache(cacheCfg); if (ignite0.context().service() instanceof IgniteServiceProcessor) cache.put(ignite0.cluster().localNode().id().toString(), "val"); latch = new CountDownLatch(1); final ClusterGroup grp = ignite0.cluster().forPredicate((IgnitePredicate<ClusterNode>)node -> { System.out.println("Predicated started [thread=" + Thread.currentThread().getName() + ']'); latch.countDown(); try { Thread.sleep(3000); } catch (InterruptedException ignore) { } System.out.println("Call contains key [thread=" + Thread.currentThread().getName() + ']'); boolean ret = Ignition.localIgnite().cache("testCache").containsKey(node.id().toString()); System.out.println("After contains key [ret=" + ret + ", thread=" + Thread.currentThread().getName() + ']'); return ret; }); IgniteInternalFuture<?> fut = GridTestUtils.runAsync(new Callable<Void>() { @Override public Void call() throws Exception { info("Start deploy service."); ignite0.services(grp).deployNodeSingleton("testService", new TestService()); info("Service deployed."); return null; } }, "deploy-thread"); latch.await(); startGrid(1); fut.get(); }
Source:
public MassMothballDialog(Frame parent, Unit[] units, Campaign campaign, boolean activate) { super(parent, "Mass Mothball/Activate"); setLocationRelativeTo(parent); sortUnitsByType(units); this.campaign = campaign; contentPanel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = 3; gbc.gridx = 0; gbc.gridy = 0; gbc.ipadx = 4; gbc.ipady = 4; gbc.insets = new Insets(2, 2, 2, 2); gbc.weightx = 3; JLabel instructionLabel = new JLabel(); instructionLabel.setBorder(new LineBorder(Color.BLUE)); instructionLabel.setText("<html>Choose the techs to carry out " + (activate ? "activation" : "mothballing") + " operations on the displayed units. <br/>" + "A * indicates that the tech is currently maintaining units.</html>"); contentPanel.add(instructionLabel, gbc); gbc.weightx = 1; gbc.gridy++; addTableHeaders(gbc); for (int unitType : unitsByType.keySet()) { gbc.gridy++; addUnitTypePanel(unitType, gbc); } gbc.gridy++; addExecuteButton(activate, gbc); scrollPane.setViewportView(contentPanel); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setMaximumSize(new Dimension(600, 600)); scrollPane.setPreferredSize(new Dimension(600, 600)); getContentPane().add(scrollPane); this.setResizable(true); this.pack(); this.validate(); setUserPreferences(); }

Target:
public MassMothballDialog(Frame parent, Unit[] units, Campaign campaign, boolean activate) { super(parent, "Mass Mothball/Activate"); setLocationRelativeTo(parent); sortUnitsByType(units); this.campaign = campaign; this.activating = activate; contentPanel.setLayout(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = 3; gbc.gridx = 0; gbc.gridy = 0; gbc.ipadx = 4; gbc.ipady = 4; gbc.insets = new Insets(2, 2, 2, 2); gbc.weightx = 3; JLabel instructionLabel = new JLabel(); instructionLabel.setBorder(new LineBorder(Color.BLUE)); instructionLabel.setText("<html>Choose the techs to carry out " + (activating ? "activation" : "mothballing") + " operations on the displayed units. <br/>" + "A * indicates that the tech is currently maintaining units.</html>"); contentPanel.add(instructionLabel, gbc); gbc.weightx = 1; gbc.gridy++; addTableHeaders(gbc); for (int unitType : unitsByType.keySet()) { gbc.gridy++; addUnitTypePanel(unitType, gbc); } gbc.gridy++; addExecuteButton(activating, gbc); JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportView(contentPanel); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setMaximumSize(new Dimension(600, 600)); scrollPane.setPreferredSize(new Dimension(600, 600)); getContentPane().add(scrollPane); this.setResizable(true); this.pack(); this.validate(); setUserPreferences(); }
Source:
private void validate(@Nullable Schema inputSchema) { if (!Strings.isNullOrEmpty(suffix)) { new SimpleDateFormat(suffix); } if (!Strings.isNullOrEmpty(fileSystemProperties)) { new Gson().fromJson(fileSystemProperties, new TypeToken<Map<String, String>>() { }.getType()); } if (!isText() && !isAvro() && !isParquet()) { throw new IllegalArgumentException(String.format("Invalid format '%s. Must be 'text', 'avro', or 'parquet'.", format)); } getFSProperties(); Schema schema = getSchema(inputSchema); if ((isAvro() || isParquet()) && schema == null) { throw new IllegalArgumentException( String.format("Format '%s' cannot be used without a schema. Please set the schema property.", format)); } }

Target:
private void validate(@Nullable Schema inputSchema) { if (!Strings.isNullOrEmpty(suffix)) { new SimpleDateFormat(suffix); } if (!Strings.isNullOrEmpty(fileSystemProperties)) { new Gson().fromJson(fileSystemProperties, new TypeToken<Map<String, String>>() { }.getType()); } if (!isText() && !isAvro() && !isParquet()) { throw new IllegalArgumentException(String.format("Invalid format '%s. Must be 'text', 'avro', or 'parquet'.", format)); } getFSProperties(); if (!containsMacro("schema")) { Schema schema = getSchema(inputSchema); if ((isAvro() || isParquet()) && schema == null) { throw new IllegalArgumentException( String.format("Format '%s' cannot be used without a schema. Please set the schema property.", format)); } } }
Source:
void postConstruct(MApplication application) { IExtensionPoint point = extensionRegistry.getExtensionPoint("org.eclipse.ui.perspectives"); for (IConfigurationElement element : point.getConfigurationElements()) { String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID); descriptors.put(id, new PerspectiveDescriptor(id, element)); } List<MUIElement> snippets = application.getSnippets(); for (MUIElement snippet : snippets) { if (snippet instanceof MPerspective) { MPerspective perspective = (MPerspective) snippet; String id = perspective.getElementId(); PerspectiveDescriptor existingDescriptor = descriptors.get(id); if (existingDescriptor == null) { createDescriptor(perspective); } else { existingDescriptor.setHasCustomDefinition(true); } } } IEclipseContext childContext = context.createChild(); childContext.set(PerspectiveRegistry.class, this); ContextInjectionFactory.make(ImportExportPespectiveHandler.class, childContext); }

Target:
void postConstruct(MApplication application) { IExtensionPoint point = extensionRegistry.getExtensionPoint("org.eclipse.ui.perspectives"); for (IConfigurationElement element : point.getConfigurationElements()) { String id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID); descriptors.put(id, new PerspectiveDescriptor(id, element)); } List<MUIElement> snippets = application.getSnippets(); for (MUIElement snippet : snippets) { if (snippet instanceof MPerspective) { MPerspective perspective = (MPerspective) snippet; String id = perspective.getElementId(); PerspectiveDescriptor existingDescriptor = descriptors.get(id); if (existingDescriptor == null) { createDescriptor(perspective); } else { existingDescriptor.setHasCustomDefinition(true); } } } impExpHandlerContext = context.createChild(); impExpHandlerContext.set(PerspectiveRegistry.class, this); ContextInjectionFactory.make(ImportExportPespectiveHandler.class, impExpHandlerContext); }
Source:
private ConnectorSplit createSplit(BucketShards bucketShards) { if (bucketShards.getBucketNumber().isPresent()) { return createBucketSplit(bucketShards.getBucketNumber().getAsInt(), bucketShards.getShards()); } verify(bucketShards.getShards().size() == 1, "wrong shard count for non-bucketed table"); ShardNodes shard = getOnlyElement(bucketShards.getShards()); UUID shardId = shard.getShardUuid(); Optional<UUID> deltaShardUuid = shard.getDeltaShardUuid(); Set<String> nodeIds = shard.getNodeIdentifiers(); List<HostAddress> addresses = getAddressesForNodes(nodesById, nodeIds); if (addresses.isEmpty()) { if (!backupAvailable) { throw new PrestoException(RAPTOR_NO_HOST_FOR_SHARD, format("No host for shard %s found: %s", shardId, nodeIds)); } Set<Node> availableNodes = nodeSupplier.getWorkerNodes(); if (availableNodes.isEmpty()) { throw new PrestoException(NO_NODES_AVAILABLE, "No nodes available to run query"); } Node node = selectRandom(availableNodes); shardManager.replaceShardAssignment(tableId, shardId, deltaShardUuid.isPresent() ? Optional.empty() : deltaShardUuid, node.getNodeIdentifier(), true); addresses = ImmutableList.of(node.getHostAndPort()); } return new RaptorSplit( connectorId, shardId, deltaShardUuid.isPresent() ? ImmutableMap.of(shardId, deltaShardUuid.get()) : ImmutableMap.of(), tableSupportsDeltaDelete, addresses, effectivePredicate, transactionId, columnTypes); }

Target:
private ConnectorSplit createSplit(BucketShards bucketShards) { if (bucketShards.getBucketNumber().isPresent()) { return createBucketSplit(bucketShards.getBucketNumber().getAsInt(), bucketShards.getShards()); } verify(bucketShards.getShards().size() == 1, "wrong shard count for non-bucketed table"); ShardNodes shard = getOnlyElement(bucketShards.getShards()); UUID shardUuid = shard.getShardUuid(); Optional<UUID> deltaShardUuid = shard.getDeltaShardUuid(); Set<String> nodeIds = shard.getNodeIdentifiers(); List<HostAddress> addresses = getAddressesForNodes(nodesById, nodeIds); if (addresses.isEmpty()) { if (!backupAvailable) { throw new PrestoException(RAPTOR_NO_HOST_FOR_SHARD, format("No host for shard %s found: %s", shardUuid, nodeIds)); } Set<Node> availableNodes = nodeSupplier.getWorkerNodes(); if (availableNodes.isEmpty()) { throw new PrestoException(NO_NODES_AVAILABLE, "No nodes available to run query"); } Node node = selectRandom(availableNodes); shardManager.replaceShardAssignment(tableId, shardUuid, deltaShardUuid.isPresent() ? Optional.empty() : deltaShardUuid, node.getNodeIdentifier(), true); addresses = ImmutableList.of(node.getHostAndPort()); } return new RaptorSplit( connectorId, shardUuid, deltaShardUuid.isPresent() ? ImmutableMap.of(shardUuid, deltaShardUuid.get()) : ImmutableMap.of(), tableSupportsDeltaDelete, addresses, effectivePredicate, transactionId, columnTypes); }
Source:
public static boolean shouldLog(ScanResult scanResult) { if (SSIDBlockList.isOptOut(scanResult)) { Log.w(LOG_TAG, "Blocked opt-out SSID"); return false; } if (BSSIDBlockList.contains(scanResult)) { Log.w(LOG_TAG, "Blocked BSSID: " + scanResult); return false; } if (SSIDBlockList.contains(scanResult)) { Log.w(LOG_TAG, "Blocked SSID: " + scanResult); return false; } return true; }

Target:
public static boolean shouldLog(ScanResult scanResult) { if (SSIDBlockList.isOptOut(scanResult)) { Log.d(LOG_TAG, "Blocked opt-out SSID"); return false; } if (BSSIDBlockList.contains(scanResult)) { Log.w(LOG_TAG, "Blocked BSSID: " + scanResult); return false; } if (SSIDBlockList.contains(scanResult)) { Log.w(LOG_TAG, "Blocked SSID: " + scanResult); return false; } return true; }
Source:
protected boolean registerLibvirtSecrets(List<LibvirtSecret> libvirtSecrets, boolean clearUnusedSecrets) { VDSReturnValue returnValue = runVdsCommand( VDSCommandType.RegisterLibvirtSecrets, new RegisterLibvirtSecretsVDSParameters(getVdsId(), libvirtSecrets, clearUnusedSecrets)); if (!returnValue.getSucceeded()) { auditLogDirector.log(new AuditLogableBase(getVdsId()), AuditLogType.FAILED_TO_REGISTER_LIBVIRT_SECRET_ON_VDS); log.error("Failed to register libvirt secret on vds {}.", getVds().getName()); return false; } return true; }

Target:
protected boolean registerLibvirtSecrets(List<LibvirtSecret> libvirtSecrets, boolean clearUnusedSecrets) { VDSReturnValue returnValue = runVdsCommand( VDSCommandType.RegisterLibvirtSecrets, new RegisterLibvirtSecretsVDSParameters(getVdsId(), libvirtSecrets, clearUnusedSecrets)); try { runVdsCommand( VDSCommandType.RegisterLibvirtSecrets, new RegisterLibvirtSecretsVDSParameters(getVdsId(), libvirtSecrets, clearUnusedSecrets)); } catch (RuntimeException e) { auditLogDirector.log(new AuditLogableBase(getVdsId()), AuditLogType.FAILED_TO_REGISTER_LIBVIRT_SECRET_ON_VDS); log.error("Failed to register libvirt secret on vds {}. Error: {}", getVds().getName(), e.getMessage()); return false; } if (!returnValue.getSucceeded()) { auditLogDirector.log(new AuditLogableBase(getVdsId()), AuditLogType.FAILED_TO_REGISTER_LIBVIRT_SECRET_ON_VDS); log.error("Failed to register libvirt secret on vds {}.", getVds().getName()); return false; } return true; }