auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testrunMultipleActions_ignored_failure_multiple() { ArrayList<VdcActionParametersBase> parameters = new ArrayList<VdcActionParametersBase>(); parameters.add(new VdcActionParametersBase()); testState = null; frontend.runMultipleAction(VdcActionType.AddLocalStorageDomain, parameters, false, mockMultipleActionCallback, null); verify(mockService).runMultipleActions(eq(VdcActionType.AddLocalStorageDomain), eq(parameters), eq(false), eq(false), callbackMultipleActions.capture()); StatusCodeException exception = new StatusCodeException(0, "0 status code"); callbackMultipleActions.getValue().onFailure(exception); verify(mockFrontendFailureEvent, never()).raise(eq(Frontend.class), (FrontendFailureEventArgs) any()); verify(mockMultipleActionCallback, never()).executed(callbackMultipleParam.capture()); verifyAsyncActionStarted(); }

Target:
public void testrunMultipleActions_ignored_failure_multiple() { ArrayList<VdcActionParametersBase> parameters = new ArrayList<VdcActionParametersBase>(); parameters.add(new VdcActionParametersBase()); testState = null; frontend.runMultipleAction(VdcActionType.AddLocalStorageDomain, parameters, false, mockMultipleActionCallback, null); verify(mockService).runMultipleActions(eq(VdcActionType.AddLocalStorageDomain), eq(parameters), eq(false), eq(false), callbackMultipleActions.capture()); StatusCodeException exception = new StatusCodeException(0, "0 status code"); callbackMultipleActions.getValue().onFailure(exception); verify(mockFrontendFailureEvent, never()).raise(eq(Frontend.class), (FrontendFailureEventArgs) any()); verify(mockMultipleActionCallback, never()).executed(callbackMultipleParam.capture()); verifyAsyncActionStartedButNotCompleted(); }
Source:
public static byte[][] splitArray(byte[] source, int chunkSize) { byte[][] newArray = new byte[(int) Math.ceil(source.length / (double) chunkSize)][chunkSize]; int start = 0; for (int i = 0; i < newArray.length; i++) { newArray[i] = Arrays.copyOfRange(source, start, start + chunkSize); start += chunkSize; } return newArray; }

Target:
public static byte[][] splitArray(byte[] source, int chunkSize) { byte[][] newArray = new byte[(source.length / chunkSize) + 1][chunkSize]; int start = 0; for (int i = 0; i < newArray.length; i++) { newArray[i] = Arrays.copyOfRange(source, start, start + chunkSize); start += chunkSize; } return newArray; }
Source:
private boolean entitleGuest(AutobindData data, List<Entitlement> entitlements) throws EntitlementRefusedException { Consumer host; List<String> hostProvidedPools; Consumer consumer = data.getConsumer(); Owner owner = consumer.getOwner(); if (!consumer.hasFact("virt.uuid") || !"true".equalsIgnoreCase(consumer.getFact("virt.is_guest")) || !data.getPossiblePools().isEmpty()) { return true; } host = consumerCurator.getHost(consumer.getFact("virt.uuid"), owner); if (host == null) { return true; } hostProvidedPools = poolCurator.getPoolsProvidedByHost(host, owner); if (hostProvidedPools.isEmpty()) { return true; } data.setPossiblePools(hostProvidedPools); entitlements.addAll(poolManager.entitleByProducts(data)); ComplianceStatus status = complianceRules.getStatus(consumer); if (!status.isCompliant()) { data.setPossiblePools(null); Set<String> remainingProductsToCheck = status.getNonCompliantProducts(); remainingProductsToCheck.addAll(status.getPartiallyCompliantProducts().keySet()); data.setProductIds(remainingProductsToCheck.toArray(new String[remainingProductsToCheck.size()])); return true; } return false; }

Target:
private boolean entitleGuest(AutobindData data, List<Entitlement> entitlements) throws EntitlementRefusedException { Consumer host; List<String> hostProvidedPools; Consumer consumer = data.getConsumer(); Owner owner = consumer.getOwner(); if (!consumer.hasFact("virt.uuid") || !"true".equalsIgnoreCase(consumer.getFact("virt.is_guest")) || (data.getPossiblePools() != null && !data.getPossiblePools().isEmpty())) { return true; } host = consumerCurator.getHost(consumer.getFact("virt.uuid"), owner); if (host == null) { return true; } hostProvidedPools = poolCurator.getPoolsProvidedByHost(host); if (hostProvidedPools.isEmpty()) { return true; } data.setPossiblePools(hostProvidedPools); entitlements.addAll(poolManager.entitleByProducts(data)); ComplianceStatus status; if (data.getOnDate() != null) { status = complianceRules.getStatus(consumer, data.getOnDate()); } else { status = complianceRules.getStatus(consumer); } if (!status.isCompliant()) { data.setPossiblePools(new ArrayList<String>()); Set<String> remainingProductsToCheck = status.getNonCompliantProducts(); remainingProductsToCheck.addAll(status.getPartiallyCompliantProducts().keySet()); data.setProductIds(remainingProductsToCheck.toArray(new String[remainingProductsToCheck.size()])); return true; } return false; }
Source:
protected void checkOSType() { LOGGER.info("Checking Docker container OS type"); String osType = client.infoCmd().exec().getOsType(); if (StringUtils.isBlank(osType)) { LOGGER.warn("Could not determine Docker container OS type"); } else if (!osType.equals("linux")) { LOGGER.warn("{} is currently not supported", osType); throw new InvalidConfigurationException(osType + " containers are currently not supported"); } }

Target:
protected void checkOSType() { LOGGER.debug("Checking Docker OS type for {}", this.getDescription()); String osType = client.infoCmd().exec().getOsType(); if (StringUtils.isBlank(osType)) { LOGGER.warn("Could not determine Docker OS type"); } else if (!osType.equals("linux")) { LOGGER.warn("{} is currently not supported", osType); throw new InvalidConfigurationException(osType + " containers are currently not supported"); } }
Source:
public InputStream getRepositoryArchive(Integer projectId, String sha, String format) throws GitLabApiException { Form formData = new GitLabApiForm().withParam("sha", sha); Response response = getWithAccepts(Response.Status.OK, formData.asMap(), MediaType.MEDIA_TYPE_WILDCARD, "projects", projectId, "repository", "archive".concat(checkFormat(format))); return (response.readEntity(InputStream.class)); }

Target:
public InputStream getRepositoryArchive(Integer projectId, String sha, String format) throws GitLabApiException { format = checkFormat(format); Form formData = new GitLabApiForm().withParam("sha", sha); Response response = getWithAccepts(Response.Status.OK, formData.asMap(), MediaType.MEDIA_TYPE_WILDCARD, "projects", projectId, "repository", "archive", ".", format); return (response.readEntity(InputStream.class)); }
Source:
protected void toLegacyText(StringBuilder builder) { builder.append(this.value); }

Target:
protected void toLegacyText(StringBuilder builder) { builder.append( this.value ); super.toLegacyText( builder ); }
Source:
public URI getUri() { return uri; }

Target:
public URI getUri() { return this.uri; }
Source:
protected Result check() throws Exception { return timeBoundHealthCheck.check(() -> { final Session session = sessionFactory.openSession(); try { final Transaction txn = session.beginTransaction(); try { session.createSQLQuery(validationQuery).list(); txn.commit(); } catch (Exception e) { if (txn.getStatus() == ACTIVE || txn.getStatus() == MARKED_ROLLBACK) { txn.rollback(); } throw e; } } finally { session.close(); } return Result.healthy(); }); }

Target:
protected Result check() throws Exception { return timeBoundHealthCheck.check(() -> { final Session session = sessionFactory.openSession(); try { final Transaction txn = session.beginTransaction(); try { session.createSQLQuery(validationQuery).list(); txn.commit(); } catch (Exception e) { if (txn.getStatus().canRollback()) { txn.rollback(); } throw e; } } finally { session.close(); } return Result.healthy(); }); }
Source:
private void syncLunsForBlockStorageDomains() { Collection<StorageDomain> unSyncedStorageDomains = syncLunsForStorageDomains(storageDomainDao.getAllForStoragePool(getStoragePoolId())); if (!unSyncedStorageDomains.isEmpty()) { String unSyncedStorageDomainsList = unSyncedStorageDomains.stream() .map(StorageDomain::getId) .map(Guid::toString) .collect(Collectors.joining(", ")); addCustomValue("StorageDomainsIds", unSyncedStorageDomainsList); auditLogDirector.log(this, AuditLogType.STORAGE_DOMAINS_COULD_NOT_BE_SYNCED); } }

Target:
private void syncLunsForBlockStorageDomains() { Collection<VDS> hosts = new LinkedList<>(vdsDao.getAllForStoragePoolAndStatus( getStoragePool().getId(), VDSStatus.Up)); if (hosts.isEmpty()) { return; } Collection<StorageDomain> unSyncedStorageDomains = syncLunsForStorageDomains(storageDomainDao.getAllForStoragePool(getStoragePoolId()), hosts); if (!unSyncedStorageDomains.isEmpty()) { String unSyncedStorageDomainsList = unSyncedStorageDomains.stream() .map(StorageDomain::getId) .map(Guid::toString) .collect(Collectors.joining(", ")); addCustomValue("StorageDomainsIds", unSyncedStorageDomainsList); auditLogDirector.log(this, AuditLogType.STORAGE_DOMAINS_COULD_NOT_BE_SYNCED); } }
Source:
public VacationDaysLeft getVacationDaysLeft(Account account, Optional<Account> nextYear) { BigDecimal vacationDays = account.getVacationDays(); BigDecimal remainingVacationDays = account.getRemainingVacationDays(); BigDecimal remainingVacationDaysNotExpiring = account.getRemainingVacationDaysNotExpiring(); BigDecimal daysBeforeApril = getUsedDaysBeforeApril(account); BigDecimal daysAfterApril = getUsedDaysAfterApril(account); return VacationDaysLeft.builder() .withAnnualVacation(vacationDays) .withRemainingVacation(remainingVacationDays) .notExpiring(remainingVacationDaysNotExpiring) .forUsedDaysBeforeApril(daysBeforeApril) .forUsedDaysAfterApril(daysAfterApril) .withVacationDaysUsedNextYear(getRemainingVacationDaysAlreadyUsed(nextYear)) .get(); }

Target:
public VacationDaysLeft getVacationDaysLeft(Account account, Optional<Account> nextYear) { BigDecimal vacationDays = account.getVacationDays(); BigDecimal remainingVacationDays = account.getRemainingVacationDays(); BigDecimal remainingVacationDaysNotExpiring = account.getRemainingVacationDaysNotExpiring(); BigDecimal daysBeforeApril = getUsedDaysBeforeApril(account); BigDecimal daysAfterApril = getUsedDaysAfterApril(account); BigDecimal daysUsedNextYear = getRemainingVacationDaysAlreadyUsed(nextYear); return VacationDaysLeft.builder() .withAnnualVacation(vacationDays) .withRemainingVacation(remainingVacationDays) .notExpiring(remainingVacationDaysNotExpiring) .forUsedDaysBeforeApril(daysBeforeApril) .forUsedDaysAfterApril(daysAfterApril) .withVacationDaysUsedNextYear(daysUsedNextYear) .get(); }
Source:
private static void loadLibrary() throws IOException { String path = LIBTORRENT_OS_LIBRARY_PATH(); InputStream is = BittorrentNotebookRepo.class.getResourceAsStream(path); File temp = File.createTempFile("libjlibtorrent", ".so"); OutputStream os = new FileOutputStream(temp); if (is == null) { throw new FileNotFoundException("File " + path + " was not found inside JAR."); } int readBytes; byte[] buffer = new byte[1024]; try { while ((readBytes = is.read(buffer)) != -1) { os.write(buffer, 0, readBytes); } } finally { os.close(); is.close(); } System.setProperty("jlibtorrent.jni.path", temp.getAbsolutePath()); }

Target:
private static void loadLibrary() throws IOException { String path = LIBTORRENT_OS_LIBRARY_PATH(); if (path == null) { LOG.error("Unknown Operating system"); throw new IOException(); } InputStream is = BittorrentNotebookRepo.class.getResourceAsStream(path); File temp = File.createTempFile("libjlibtorrent", ".so"); OutputStream os = new FileOutputStream(temp); if (is == null) { throw new FileNotFoundException("File " + path + " was not found inside JAR."); } int readBytes; byte[] buffer = new byte[1024]; try { while ((readBytes = is.read(buffer)) != -1) { os.write(buffer, 0, readBytes); } } finally { os.close(); is.close(); } System.setProperty("jlibtorrent.jni.path", temp.getAbsolutePath()); }
Source:
public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; TrashNetworkVspCommand that = (TrashNetworkVspCommand) o; if (_isL3Network != that._isL3Network) return false; if (_isSharedNetwork != that._isSharedNetwork) return false; if (_domainTemplateName != null ? !_domainTemplateName.equals(that._domainTemplateName) : that._domainTemplateName != null) return false; if (_domainUuid != null ? !_domainUuid.equals(that._domainUuid) : that._domainUuid != null) return false; if (_networkUuid != null ? !_networkUuid.equals(that._networkUuid) : that._networkUuid != null) return false; if (_vpcUuid != null ? !_vpcUuid.equals(that._vpcUuid) : that._vpcUuid != null) return false; return true; }

Target:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof TrashNetworkVspCommand)) return false; if (!super.equals(o)) return false; TrashNetworkVspCommand that = (TrashNetworkVspCommand) o; if (_isL3Network != that._isL3Network) return false; if (_isSharedNetwork != that._isSharedNetwork) return false; if (_domainTemplateName != null ? !_domainTemplateName.equals(that._domainTemplateName) : that._domainTemplateName != null) return false; if (_domainUuid != null ? !_domainUuid.equals(that._domainUuid) : that._domainUuid != null) return false; if (_networkUuid != null ? !_networkUuid.equals(that._networkUuid) : that._networkUuid != null) return false; if (_vpcUuid != null ? !_vpcUuid.equals(that._vpcUuid) : that._vpcUuid != null) return false; return true; }
Source:
ILogData read(long address) { if (!runtime.getParameters().isCacheDisabled()) { ILogData data = readCache.getIfPresent(address); if (data == null) { final ILogData loadedVal = fetch(address); data = readCache.asMap().computeIfAbsent(address, (k) -> loadedVal); } return data; } return fetch(address); }

Target:
ILogData read(long address) { if (!runtime.getParameters().isCacheDisabled()) { ILogData data = readCache.getIfPresent(address); if (data == null) { final ILogData loadedVal = fetch(address); return readCache.asMap().computeIfAbsent(address, (k) -> loadedVal); } return data; } return fetch(address); }
Source:
public int compare(final Enum o1, final Enum o2) { final Integer w1 = classWeight(o1); final Integer w2 = classWeight(o2); if (w1 == null && w2 == null) { final String s1 = o1.getClass().getName() + o1.ordinal(); final String s2 = o2.getClass().getName() + o2.ordinal(); return s1.compareTo(s2); } else if (w1 == null) { return 1; } else if (w2 == null) { return -1; } else if (!w1.equals(w2)) { return w1 - w2; } else { return o1.compareTo(o2); } }

Target:
public int compare(final Enum o1, final Enum o2) { final Integer w1 = classWeight(o1); final Integer w2 = classWeight(o2); if (w1 != null && w2 != null && !w1.equals(w2)) { return w1 - w2; } else if (w1 == null && w2 != null) { return 1; } else if (w1 != null && w2 == null) { return -1; } else { final String s1 = o1.getClass().getName() + o1.ordinal(); final String s2 = o2.getClass().getName() + o2.ordinal(); return s1.compareTo(s2); } }
Source:
public ImageWorker(RenderingHints hints) { setRenderingHints(hints); }

Target:
public ImageWorker(RenderingHints hints) { this(); setRenderingHints(hints); }
Source:
@Test public void simpleMultipart() throws Exception { Request request = new Helper() .setMethod("POST") .setHasBody() .setUrl("<LINK_1>") .setPath("/foo/bar/") .addNamedParam("ping", "pong") .addNamedParam("kit", new TypedString("kat")) .setMultipart() .build(); assertThat(request.getMethod()).isEqualTo("POST"); assertThat(request.getHeaders()).isEmpty(); assertThat(request.getUrl()).isEqualTo("<LINK_0>"); MultipartTypedOutput body = (MultipartTypedOutput) request.getBody(); assertThat(body.parts).hasSize(2); Iterator<byte[]> iterator = body.parts.iterator(); String one = new String(iterator.next(), "UTF-8"); assertThat(one.contains("ping")); assertThat(one.contains("pong")); String two = new String(iterator.next(), "UTF-8"); assertThat(two.contains("kit")); assertThat(two.contains("kat")); }

Target:
@Test public void simpleMultipart() throws Exception { Request request = new Helper() .setMethod("POST") .setHasBody() .setUrl("<LINK_1>") .setPath("/foo/bar/") .addNamedParam("ping", "pong") .addNamedParam("kit", new TypedString("kat")) .setMultipart() .build(); assertThat(request.getMethod()).isEqualTo("POST"); assertThat(request.getHeaders()).isEmpty(); assertThat(request.getUrl()).isEqualTo("<LINK_0>"); MultipartTypedOutput body = (MultipartTypedOutput) request.getBody(); assertThat(body.parts).hasSize(2); Iterator<byte[]> iterator = body.parts.iterator(); String one = new String(iterator.next(), "UTF-8"); assertThat(one).contains("ping").contains("pong"); String two = new String(iterator.next(), "UTF-8"); assertThat(two).contains("kit").contains("kat"); }
Source:
void set(Object value) { LATEST_UPDATER.lazySet(this, value); }

Target:
void set(Object value) { latest = value; }
Source:
public void close() throws IOException { objects.remove(this); count.decrementAndGet(); objects.offer(this); }

Target:
public void close() throws IOException { synchronized (this) { boolean removed = queue.remove(this); count.decrementAndGet(); if (removed) { queue.offer(this); } } }
Source:
public void testXMIIDPriorityA2() throws IOException { final Resource left = input.getXMIIDPriorityA2Left(); final Resource right = input.getXMIIDPriorityA2Right(); final IComparisonScope scope = new DefaultComparisonScope(left, right, null); final Comparison comparison = EMFCompare.builder().build().compare(scope); final List<Match> matches = comparison.getMatches(); assertEquals(1, matches.size()); final Match rootMatch = matches.get(0); final List<Match> subMatches = rootMatch.getSubmatches(); assertEquals(4, subMatches.size()); }

Target:
public void testXMIIDPriorityA2() throws IOException { final Resource left = input.getXMIIDPriorityA2Left(); final Resource right = input.getXMIIDPriorityA2Right(); final IComparisonScope scope = new DefaultComparisonScope(left, right, null); final Comparison comparison = EMFCompare.builder().build().compare(scope); final List<Match> matches = comparison.getMatches(); assertEquals(1, matches.size()); final Match rootMatch = matches.get(0); final List<Match> subMatches = rootMatch.getSubmatches(); assertEquals(4, subMatches.size()); for (Match match : subMatches) { EObject leftObject = match.getLeft(); EObject rightObject = match.getRight(); final boolean leftIsNull = leftObject == null && rightObject != null; final boolean rightIsNull = rightObject == null && leftObject != null; assertTrue(leftIsNull || rightIsNull); } }
Source:
public void readBatchFiltersOutNulls() throws IOException { when(mockLog.readRound(anyLong())) .thenAnswer(invocation -> { long sequence = (long) invocation.getArguments()[0]; if (sequence % 2 == 0) { return null; } return valueForRound(sequence).persistToBytes(); }); try (PaxosStateLogBatchReader<PaxosValue> reader = createReader()) { assertThat(reader.readBatch(START_SEQUENCE, BATCH_SIZE)) .isEqualTo(EXPECTED_ROUNDS.stream() .filter(round -> round.sequence() % 2 != 0) .collect(Collectors.toList())); } }

Target:
public void readBatchFiltersOutNulls() throws IOException { Predicate<Long> isOdd = num -> num % 2 != 0; when(mockLog.readRound(anyLong())) .thenAnswer(invocation -> { long sequence = (long) invocation.getArguments()[0]; if (!isOdd.test(sequence)) { return null; } return valueForRound(sequence).persistToBytes(); }); try (PaxosStateLogBatchReader<PaxosValue> reader = createReader()) { assertThat(reader.readBatch(START_SEQUENCE, BATCH_SIZE)) .isEqualTo(EXPECTED_ROUNDS.stream() .filter(round -> isOdd.test(round.sequence())) .collect(Collectors.toList())); } }
Source:
protected void eventHandle(@NonNull ITmfEvent event) { String name = event.getName(); long inc; if (name.equals(fLayout.eventKmemPageAlloc())) { inc = PAGE_SIZE; } else if (name.equals(fLayout.eventKmemPageFree())) { inc = -PAGE_SIZE; } else { return; } try { ITmfStateSystemBuilder ss = checkNotNull(getStateSystemBuilder()); long ts = event.getTimestamp().getValue(); Integer tidField = KernelTidAspect.INSTANCE.resolve(event); String tid; if (tidField == null) { tid = "other"; } else { tid = tidField.toString(); } int tidQuark = ss.getQuarkAbsoluteAndAdd(tid); ITmfStateValue previousMemoryValue = ss.queryOngoingState(tidQuark); if (previousMemoryValue.isNull()) { previousMemoryValue = TmfStateValue.newValueLong(0); } long currentMemoryValue = previousMemoryValue.unboxLong() + inc; ss.modifyAttribute(ts, TmfStateValue.newValueLong(currentMemoryValue), tidQuark); int lowestMemoryQuark = ss.getQuarkRelativeAndAdd(tidQuark, KernelMemoryAnalysisModule.THREAD_LOWEST_MEMORY_VALUE); ITmfStateValue lowestMemoryValue = ss.queryOngoingState(lowestMemoryQuark); if (lowestMemoryValue.isNull()) { lowestMemoryValue = TmfStateValue.newValueLong(0); } if (lowestMemoryValue.unboxLong() > currentMemoryValue) { ss.modifyAttribute(ts, TmfStateValue.newValueLong(currentMemoryValue), lowestMemoryQuark); } } catch (AttributeNotFoundException e) { Activator.getDefault().logError(e.getMessage(), e); } }

Target:
protected void eventHandle(@NonNull ITmfEvent event) { String name = event.getName(); long inc; if (name.equals(fLayout.eventKmemPageAlloc())) { inc = PAGE_SIZE; } else if (name.equals(fLayout.eventKmemPageFree())) { inc = -PAGE_SIZE; } else { return; } try { ITmfStateSystemBuilder ss = checkNotNull(getStateSystemBuilder()); long ts = event.getTimestamp().getValue(); Integer tidField = KernelTidAspect.INSTANCE.resolve(event); String tid; if (tidField == null) { tid = "other"; } else { tid = tidField.toString(); } int tidQuark = ss.getQuarkAbsoluteAndAdd(tid); StateSystemBuilderUtils.incrementAttributeLong(ss, ts, tidQuark, inc); long currentMemoryValue = ss.queryOngoingState(tidQuark).unboxLong(); int lowestMemoryQuark = ss.getQuarkRelativeAndAdd(tidQuark, KernelMemoryAnalysisModule.THREAD_LOWEST_MEMORY_VALUE); ITmfStateValue lowestMemoryValue = ss.queryOngoingState(lowestMemoryQuark); long previousLowest = lowestMemoryValue.isNull() ? 0 : lowestMemoryValue.unboxLong(); if (previousLowest > currentMemoryValue) { ss.modifyAttribute(ts, TmfStateValue.newValueLong(currentMemoryValue), lowestMemoryQuark); } } catch (AttributeNotFoundException e) { Activator.getDefault().logError(e.getMessage(), e); } }
Source:
protected void executeQueryCommand() { if (connect(getParameters().getServerName())) { validateFingerprint(); String glusterServers = executeCommand(); if (StringUtils.isNotEmpty(glusterServers)) { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder; try { File returnXml = new File(System.getProperty("java.io.tmpdir") + "/peers.xml"); FileWriter xmlFileWriter = new FileWriter(returnXml); xmlFileWriter.write(glusterServers); xmlFileWriter.close(); docBuilder = docBuilderFactory.newDocumentBuilder(); Document doc = docBuilder.parse(returnXml); doc.getDocumentElement().normalize(); NodeList listOfPeers = doc.getElementsByTagName(PEER); extractServers(listOfPeers); } catch (ParserConfigurationException e1) { log.errorFormat("There is problem in parsing xml." + e1.getMessage()); throw new RuntimeException(e1); } catch (SAXException e2) { log.errorFormat("Error in parsing xml." + e2.getMessage()); throw new RuntimeException(e2); } catch (IOException e3) { log.errorFormat("There is problem in reading the file." + e3.getMessage()); throw new RuntimeException(e3); } getQueryReturnValue().setReturnValue(getServerFingerPrintMap()); } else { log.error("Could not get the peer list form the host: " + getParameters().getServerName()); } } else { log.error("Could not connect to host: " + getParameters().getServerName()); } }

Target:
protected void executeQueryCommand() { if (connect(getParameters().getServerName())) { validateFingerprint(); String glusterServers = executeCommand(); if (StringUtils.isNotEmpty(glusterServers)) { DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder; try { docBuilder = docBuilderFactory.newDocumentBuilder(); InputSource is= new InputSource(new StringReader(glusterServers)); Document doc = docBuilder.parse(is); doc.getDocumentElement().normalize(); NodeList listOfPeers = doc.getElementsByTagName(PEER); extractServers(listOfPeers); } catch (ParserConfigurationException e1) { log.errorFormat("There is problem in parsing xml." + e1.getMessage()); throw new RuntimeException(e1); } catch (SAXException e2) { log.errorFormat("Error in parsing xml." + e2.getMessage()); throw new RuntimeException(e2); } catch (IOException e3) { log.errorFormat("There is problem in reading the file." + e3.getMessage()); throw new RuntimeException(e3); } getQueryReturnValue().setReturnValue(getServerFingerPrintMap()); } else { log.error("Could not get the peer list form the host: " + getParameters().getServerName()); } } else { log.error("Could not connect to host: " + getParameters().getServerName()); } }
Source:
public void setInput(Object input) { if (input instanceof SMAEditor) { this.editor = (SMAEditor) input; if (getTreeViewer() != null) { if (editor != null && getTreeViewer() != null && getTreeViewer().getTree() != null && Widgets.isAccessible(getTreeViewer().getTree())) { getTreeViewer().setInput(editor); IAtsStateDefinition stateDef = WorkflowManager.getCurrentAtsWorkPage((editor).getAwa()).getStateDefinition(); StructuredSelection newSelection = new StructuredSelection(Arrays.asList(stateDef)); getTreeViewer().expandToLevel((editor).getAwa(), 2); getTreeViewer().expandToLevel(stateDef, 1); getTreeViewer().setSelection(newSelection); } } } }

Target:
public void setInput(Object input) { if (input instanceof SMAEditor) { this.editor = (SMAEditor) input; if (getTreeViewer() != null) { if (editor != null && getTreeViewer().getTree() != null && Widgets.isAccessible(getTreeViewer().getTree())) { getTreeViewer().setInput(editor); IAtsStateDefinition stateDef = WorkflowManager.getCurrentAtsWorkPage((editor).getAwa()).getStateDefinition(); StructuredSelection newSelection = new StructuredSelection(Arrays.asList(stateDef)); getTreeViewer().expandToLevel((editor).getAwa(), 2); getTreeViewer().expandToLevel(stateDef, 1); getTreeViewer().setSelection(newSelection); } } } }
Source:
private Map<String, String> getProcessVariables(JBPMProcessModel model) { Map<String, String> variables = new HashMap<>(); final List<ModelProperty> properties = model.getProcessFormModel().getProperties(); for (ModelProperty property : properties) { variables.put(property.getName(), property.getTypeInfo().getClassName()); } return variables; }

Target:
private Map<String, String> getProcessVariables(JBPMProcessModel model) { return model.getProcessFormModel().getProperties().stream().collect(Collectors.toMap( ModelProperty::getName, p -> p.getTypeInfo().getClassName() )); }
Source:
public void pageSelected(final int pageNumber) { if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath(), false)); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); }

Target:
public void pageSelected(final int pageNumber) { if (pageNumber == 1 && !isSelected) { GAV gav = newContainerFormPresenter.getCurrentGAV(); JarListPageRequest request = new JarListPageRequest(0, Integer.MAX_VALUE, null, Arrays.asList("jar"), null, false); m2RepoService.call(response -> { List<JarListPageRow> jarListPageRowList = ((PageResponse<JarListPageRow>) response).getPageRowList(); Optional<JarListPageRow> optionalJarListPageRow = jarListPageRowList.stream().filter(jarListPageRow -> jarListPageRow.getGav().equals(gav)) .sorted(Comparator.comparing(JarListPageRow::getLastModified).reversed()).findFirst(); if (optionalJarListPageRow.isPresent()) { if (optionalJarListPageRow.get().getPath() != null && !optionalJarListPageRow.get().getPath().isEmpty()) { dependencyPathSelectedEvent.fire(new DependencyPathSelectedEvent(this, optionalJarListPageRow.get().getPath())); } } else { notification.fire(new NotificationEvent(newContainerFormPresenter.getView().getNewContainerGAVNotExist(gav.toString()), NotificationEvent.NotificationType.ERROR)); } }).listArtifacts(request); } super.pageSelected(pageNumber); }
Source:
public static void setUp() throws InterruptedException, TimeoutException, IOException { final String defaultWebModule = "default-web-module"; operations.add(HTTP_SERVER_ADDRESS).assertSuccess(); operations.add(HOST_ADDRESS, Values.of(defaultWebModule, "defaultWebModule-" + RandomStringUtils .randomAlphanumeric(6))).assertSuccess(); operations.add(HOST_TBR_ADDRESS, Values.of(defaultWebModule, "defaultWebModule-tbr-" + RandomStringUtils .randomAlphanumeric(6))).assertSuccess(); administration.reloadIfRequired(); operations.add(GZIP_PAGE_FILTER_ADDRESS).assertSuccess(); operations.add(ERROR_PAGE_FILTER_ADDRESS, Values.of("code", 404)).assertSuccess(); operations.add(HOST_ADDRESS.and("filter-ref", ERROR_PAGE_FILTER_NAME)).assertSuccess(); operations.add(REWRITE_FILTER_ADDRESS, Values.of("target", "foo")).assertSuccess(); operations.add(HOST_ADDRESS.and("filter-ref", REWRITE_FILTER_NAME)).assertSuccess(); operations.add(REQUEST_LIMIT_FILTER_ADDRESS, Values.of("max-concurrent-requests", 42)).assertSuccess(); operations.add(HOST_ADDRESS.and("filter-ref", REQUEST_LIMIT_FILTER_NAME)).assertSuccess(); administration.reloadIfRequired(); }

Target:
public static void setUp() throws InterruptedException, TimeoutException, IOException { final String defaultWebModule = "default-web-module"; operations.add(HTTP_SERVER_ADDRESS).assertSuccess(); operations.add(HOST_ADDRESS, Values.of(defaultWebModule, "defaultWebModule-" + RandomStringUtils .randomAlphanumeric(6))).assertSuccess(); operations.add(HOST_TBR_ADDRESS, Values.of(defaultWebModule, "defaultWebModule-tbr-" + RandomStringUtils .randomAlphanumeric(6))).assertSuccess(); administration.reloadIfRequired(); operations.add(GZIP_PAGE_FILTER_ADDRESS).assertSuccess(); operations.batch(new Batch() .add(ERROR_PAGE_FILTER_ADDRESS, Values.of("code", 404)) .add(HOST_ADDRESS.and("filter-ref", ERROR_PAGE_FILTER_ADDRESS.getLastPairValue()))).assertSuccess(); operations.batch(new Batch() .add(REWRITE_FILTER_ADDRESS, Values.of("target", "foo")) .add(HOST_ADDRESS.and("filter-ref", REWRITE_FILTER_ADDRESS.getLastPairValue()))).assertSuccess(); operations.batch(new Batch() .add(REQUEST_LIMIT_FILTER_ADDRESS, Values.of("max-concurrent-requests", 42)) .add(HOST_ADDRESS.and("filter-ref", REQUEST_LIMIT_FILTER_ADDRESS.getLastPairValue()))).assertSuccess(); administration.reloadIfRequired(); }
Source:
protected String getDescription() { return null; }

Target:
protected String getDescription() { return "test implementation"; }
Source:
public void toMapFromMap() { Map<String, FormField<?>> inputMap = new HashMap<String, FormField<?>>() { { put("key", new FormField<>(null, null, null, null, 0)); } }; Map<String, FormField<?>> actualList = new FormField<>(null, null, null, new FieldValue(FieldValueType.MAP).setFormFieldMap(inputMap), 0).getValue().asMap(); assertEquals(inputMap, actualList); }

Target:
public void toMapFromMap() { Map<String, FormField> inputMap = new HashMap<String, FormField>() { { put("key", new FormField(null, null, null, null, 0)); } }; Map<String, FormField> actualMap = new FormField(null, null, null, new FieldValue(inputMap, FieldValueType.MAP), 0).getValue().asMap(); assertEquals(inputMap, actualMap); }
Source:
public Builder signedHeaders(List<String> signedHeaders) { this.signedHeaders = new ArrayList<>(signedHeaders); return this; }

Target:
public Builder signedHeaders(List<String> signedHeaders) { if (signedHeaders == null) { this.signedHeaders = Collections.emptyList(); } else { this.signedHeaders = new ArrayList<>(signedHeaders); } return this; }
Source:
public DelegatingResourceDescription getRepresentationDescription(Representation rep) { DelegatingResourceDescription delegatingResourceDescription = new DelegatingResourceDescription(); delegatingResourceDescription.addProperty("fulfillerStatus"); delegatingResourceDescription.addProperty("fulfillerComment"); delegatingResourceDescription.addProperty("uuid"); delegatingResourceDescription.addLink("full", ".?v=" + RestConstants.REPRESENTATION_FULL); delegatingResourceDescription.addSelfLink(); return delegatingResourceDescription; }

Target:
public DelegatingResourceDescription getRepresentationDescription(Representation rep) { DelegatingResourceDescription delegatingResourceDescription = new DelegatingResourceDescription(); delegatingResourceDescription.addProperty("fulfillerStatus"); delegatingResourceDescription.addProperty("fulfillerComment"); return delegatingResourceDescription; }
Source:
protected static DataBundle loadDataBundle(String pathToJsonFileParam) { String pathToJsonFile = (pathToJsonFileParam.startsWith("/") ? TestProperties.TEST_DATA_FOLDER : "") + pathToJsonFileParam; try { String jsonString = FileHelper.readFile(pathToJsonFile); return Utils.getTeammatesGson().fromJson(jsonString, DataBundle.class); } catch (FileNotFoundException e) { throw new RuntimeException(e); } }

Target:
protected static DataBundle loadDataBundle(String pathToJsonFileParam) { try { String pathToJsonFile = (pathToJsonFileParam.startsWith("/") ? TestProperties.TEST_DATA_FOLDER : "") + pathToJsonFileParam; String jsonString = FileHelper.readFile(pathToJsonFile); return Utils.getTeammatesGson().fromJson(jsonString, DataBundle.class); } catch (FileNotFoundException e) { throw new RuntimeException(e); } }
Source:
private Long createAttachedChain(ByteBuffer readKeyBuffer, int hash, Iterator<Element> iterator) { Long address = createAttachedChain(readKeyBuffer, hash, iterator.next().getPayload()); if (address == null) { return null; } if (iterator.hasNext()) { try (AttachedInternalChain chain = new AttachedInternalChain(address)) { while (iterator.hasNext()) { if (!chain.append(iterator.next().getPayload())) { chain.free(); return null; } } } } return address; }

Target:
private Long createAttachedChain(ByteBuffer readKeyBuffer, int hash, Iterator<Element> iterator) { Long address = createAttachedChain(readKeyBuffer, hash, iterator.next().getPayload()); if (address == null) { return null; } if (iterator.hasNext()) { try (AttachedInternalChain chain = new AttachedInternalChain(address)) { do { if (!chain.append(iterator.next().getPayload())) { chain.free(); return null; } } while (iterator.hasNext()); } } return address; }
Source:
public PP_ComponentGenerator getByProductId(@NonNull final ProductId productId) { final I_PP_ComponentGenerator po = queryBL.createQueryBuilder(I_PP_ComponentGenerator.class) .addOnlyActiveRecordsFilter() .addEqualsFilter(I_PP_ComponentGenerator.COLUMNNAME_M_Product_ID, productId) .create() .first(); if (po == null) { return null; } final List<I_PP_ComponentGenerator_Param> paramsPO = queryBL.createQueryBuilder(I_PP_ComponentGenerator_Param.class) .addOnlyActiveRecordsFilter() .addEqualsFilter(I_PP_ComponentGenerator_Param.COLUMNNAME_PP_ComponentGenerator_ID, po.getPP_ComponentGenerator_ID()) .create() .list(); final ImmutableMap<String, String> params = paramsPO.stream() .map(param -> GuavaCollectors.entry(param.getName(), param.getValue())) .collect(GuavaCollectors.toImmutableMap()); return PP_ComponentGenerator.builder() .javaClassId(JavaClassId.ofRepoId(po.getAD_JavaClass_ID())) .params(ComponentGeneratorParam.of(params)) .build(); }

Target:
public Optional<ComponentGenerator> getByProductId(@NonNull final ProductId productId) { return Optional.ofNullable(cache.getOrLoad(0, this::loadAllGeneratorsAndParams).get(productId)); }
Source:
public void multiRequestMixedReduced() throws IOException { init(); ViewMultipleRequest<String, Object> multi = db.getViewRequestBuilder("example", "by_tag") .newMultipleRequest(Key.Type.STRING, Object.class) .reduce(false).keys("java") .add() .reduce(true) .add() .build(); List<ViewResponse<String, Object>> responses = multi.getViewResponses(); assertEquals(2, responses.size(), "There should be 2 respones for 2 requests"); List<String> javaTagKeys = responses.get(0).getKeys(); assertEquals(1, javaTagKeys.size(), "There should be 1 java tag result"); assertEquals("java", javaTagKeys.get(0), "The key should be java"); List<Object> allTagsReduced = responses.get(1).getValues(); assertEquals(1, allTagsReduced.size(), "There should be 1 reduced result"); assertEquals(4, ((Number) allTagsReduced.get(0)).intValue(), "The result should be 4"); }

Target:
public void multiRequestMixedReduced() throws IOException { init(); ViewMultipleRequest<String, Object> multi = db.getViewRequestBuilder("example", "by_tag") .newMultipleRequest(Key.Type.STRING, Object.class) .reduce(false).keys("java") .add() .reduce(true) .add() .build(); List<ViewResponse<String, Object>> responses = multi.getViewResponses(); assertEquals(2, responses.size(), "There should be 2 responses for 2 requests"); List<String> javaTagKeys = responses.get(0).getKeys(); assertEquals(1, javaTagKeys.size(), "There should be 1 java tag result"); assertEquals("java", javaTagKeys.get(0), "The key should be java"); List<Object> allTagsReduced = responses.get(1).getValues(); assertEquals(1, allTagsReduced.size(), "There should be 1 reduced result"); assertEquals(4, ((Number) allTagsReduced.get(0)).intValue(), "The result should be 4"); }
Source:
public void testSetupDiEnumDeviceInfo(){ HANDLE hDevInfoSet = setupApi.SetupDiGetClassDevs(GUID_DEVINTERFACE_COMPORT, null, null, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE); assertTrue("For this test we need a valid HANDLE!",hDevInfoSet != INVALID_HANDLE_VALUE); SP_DEVINFO_DATA devInfo = new SP_DEVINFO_DATA(); boolean succeed = setupApi.SetupDiEnumDeviceInfo(hDevInfoSet, 0, devInfo); if (!succeed) assertTrue(getLastError()==ERROR_NO_MORE_ITEMS); else assertTrue(succeed); }

Target:
public void testSetupDiEnumDeviceInfo() { HANDLE hDevInfoSet = setupApi.SetupDiGetClassDevs(GUID_DEVINTERFACE_COMPORT, null, null, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE); boolean succeed = setupApi.SetupDiEnumDeviceInfo(hDevInfoSet, FIRST_MEMBER, devInfo); if (!succeed) assertTrue(getLastError() == ERROR_NO_MORE_ITEMS); }
Source:
private ReentrantLock getLockForKey(Object key) { return locks.computeIfAbsent(key, (k) -> new ReentrantLock()); }

Target:
private ReentrantLock getLockForKey(Object key) { return locks.computeIfAbsent(key, k -> new ReentrantLock()); }
Source:
public String getIPAddress() { if (json.has(NETWORK_SETTINGS) && !json.isNull(NETWORK_SETTINGS)) { JSONObject networkSettings = json.getJSONObject(NETWORK_SETTINGS); if (!networkSettings.isNull(PORTS)) { return networkSettings.getString(IP); } } return null; }

Target:
public String getIPAddress() { if (json.has(NETWORK_SETTINGS) && !json.isNull(NETWORK_SETTINGS)) { JSONObject networkSettings = json.getJSONObject(NETWORK_SETTINGS); if (!networkSettings.isNull(IP)) { return networkSettings.getString(IP); } } return null; }
Source:
public static <T> Hits<T> create(List<Hit<T>> hits) { return new AutoValue_Hits<>(hits); }

Target:
public static <T> Hits<T> create(List<Hit<T>> hits) { return new AutoValue_Hits<>(ImmutableList.copyOf(hits)); }
Source:
private SearchResultGroup[] getGroupedMatches() { final Map<IResource, List<SearchMatch>> grouped= new HashMap<>(); List<SearchMatch> matches= null; IResource resource= null; SearchMatch match= null; for (final Iterator<?> iterator= getSearchMatches().iterator(); iterator.hasNext();) { match= (SearchMatch) iterator.next(); resource= match.getResource(); if (!grouped.containsKey(resource)) grouped.put(resource, new ArrayList<SearchMatch>(4)); matches= grouped.get(resource); matches.add(match); } if (fBinary) { final Collection<IResource> collection= getCollector().getBinaryResources(); grouped.keySet().removeAll(collection); } final SearchResultGroup[] result= new SearchResultGroup[grouped.size()]; int index= 0; for (final List<SearchMatch> searchMatches : grouped.values()) { result[index++]= new SearchResultGroup(resource, searchMatches.toArray(new SearchMatch[searchMatches.size()])); } return result; }

Target:
private SearchResultGroup[] getGroupedMatches() { final Map<IResource, List<SearchMatch>> grouped= new HashMap<>(); List<SearchMatch> matches= null; IResource resource= null; SearchMatch match= null; for (final Iterator<?> iterator= getSearchMatches().iterator(); iterator.hasNext();) { match= (SearchMatch) iterator.next(); resource= match.getResource(); if (!grouped.containsKey(resource)) grouped.put(resource, new ArrayList<SearchMatch>(4)); matches= grouped.get(resource); matches.add(match); } if (fBinary) { final Collection<IResource> collection= getCollector().getBinaryResources(); for (final Iterator<IResource> iterator= grouped.keySet().iterator(); iterator.hasNext();) { resource= iterator.next(); if (collection.contains(resource)) iterator.remove(); } } final SearchResultGroup[] result= new SearchResultGroup[grouped.size()]; int index= 0; for (final Iterator<IResource> iterator= grouped.keySet().iterator(); iterator.hasNext();) { resource= iterator.next(); matches= grouped.get(resource); result[index++]= new SearchResultGroup(resource, matches.toArray(new SearchMatch[matches.size()])); } return result; }
Source:
public static MetricName parse(String regName) { int firstDot = regName.indexOf(SEPARATOR); if (firstDot == -1) return new MetricName(null, regName); String grp = regName.substring(0, firstDot); String beanName = regName.substring(firstDot + 1); return new MetricName(grp, beanName); }

Target:
public static MetricName parse(String regName) { int firstDot = regName.indexOf('.'); if (firstDot == -1) return new MetricName(null, regName); String grp = regName.substring(0, firstDot); String beanName = regName.substring(firstDot + 1); return new MetricName(grp, beanName); }
Source:
public List<String> getLines(Channel channel) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(getInputStream(channel))); List<String> lines = new ArrayList<String>(); String line; while ((line = reader.readLine()) != null) { lines.add(line); } return lines; }

Target:
public List<String> getLines(Channel channel) throws IOException { BufferedReader reader = new BufferedReader(new InputStreamReader(getInputStream(channel))); List<String> lines = new ArrayList<String>(); String line = null; while ((line = reader.readLine()) != null) { lines.add(line); } return lines; }
Source:
public synchronized @Nonnull SingleTokenStats updateUsageForId(@Nonnull String tokenUuid) { if(areStatsDisabled()){ return new SingleTokenStats(tokenUuid); } SingleTokenStats stats = tokenStats.stream() .filter(s -> s.tokenUuid.equals(tokenUuid)) .findFirst() .orElse(null); if (stats == null) { stats = new SingleTokenStats(tokenUuid); tokenStats.add(stats); } stats.notifyUse(); save(); return stats; }

Target:
public synchronized @Nonnull SingleTokenStats updateUsageForId(@Nonnull String tokenUuid) { if(areStatsDisabled()){ return new SingleTokenStats(tokenUuid); } SingleTokenStats stats = findById(tokenUuid) .orElseGet(() -> { SingleTokenStats result = new SingleTokenStats(tokenUuid); tokenStats.add(result); return result; }); stats.notifyUse(); save(); return stats; }
Source:
public ServiceMetricEvent.Builder makeMetricBuilder(SegmentMetadataQuery query) { int numMinutes = 0; for (Interval interval : query.getIntervals()) { numMinutes += Minutes.minutesIn(interval).getMinutes(); } return new ServiceMetricEvent.Builder() .setUser2(query.getDataSource().getMetricName()) .setUser4(query.getType()) .setUser5(Joiner.on(",").join(query.getIntervals())) .setUser6(String.valueOf(query.hasFilters())) .setUser9(Minutes.minutes(numMinutes).toString()); }

Target:
public ServiceMetricEvent.Builder makeMetricBuilder(SegmentMetadataQuery query) { int numMinutes = 0; for (Interval interval : query.getIntervals()) { numMinutes += Minutes.minutesIn(interval).getMinutes(); } return new ServiceMetricEvent.Builder() .setUser2(DataSourceUtil.getMetricName(query.getDataSource())) .setUser4(query.getType()) .setUser5(Joiner.on(",").join(query.getIntervals())) .setUser6(String.valueOf(query.hasFilters())) .setUser9(Minutes.minutes(numMinutes).toString()); }
Source:
public CreateXmlResourcePanel(@NotNull Module module, @NotNull ResourceType resourceType, @Nullable String predefinedName, @Nullable String predefinedValue, boolean chooseName, @Nullable VirtualFile defaultFile) { this(module, resourceType, defaultFile); if (chooseName) { predefinedName = ResourceHelper.prependResourcePrefix(module, predefinedName); } if (predefinedName != null && predefinedName.length() > 0) { if (chooseName) { myNameLabel.setVisible(true); myNameField.setVisible(true); } myNameField.setText(predefinedName); } else { myNameLabel.setVisible(true); myNameField.setVisible(true); } if (predefinedValue != null && predefinedValue.length() > 0) { myValueField.setText(predefinedValue); } else { myValueLabel.setVisible(true); myValueField.setVisible(true); } }

Target:
public CreateXmlResourcePanel(@NotNull Module module, @NotNull ResourceType resourceType, @Nullable String predefinedName, @Nullable String predefinedValue, boolean chooseName, @Nullable VirtualFile defaultFile) { this(module, resourceType, defaultFile); if (chooseName) { predefinedName = ResourceHelper.prependResourcePrefix(module, predefinedName); } if (!StringUtil.isEmpty(predefinedName)) { if (chooseName) { myNameLabel.setVisible(true); myNameField.setVisible(true); } myNameField.setText(predefinedName); } else { myNameLabel.setVisible(true); myNameField.setVisible(true); } if (!StringUtil.isEmpty(predefinedValue)) { myValueField.setText(predefinedValue); } else { myValueLabel.setVisible(true); myValueField.setVisible(true); } }
Source:
public Retention getObjectRetention(String bucketName, String objectName, String versionId) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, XmlParserException { Map<String, String> queryParamMap = new HashMap<>(); queryParamMap.put("retention", ""); if (versionId != null && !versionId.isEmpty()) { queryParamMap.put("versionId", versionId); } Response response = null; Retention retention = new Retention(); try { response = executeGet(bucketName, objectName, null, queryParamMap); ResponseBody body = response.body(); retention = Xml.unmarshal(Retention.class, body.charStream()); } catch (ErrorResponseException e) { if (e.errorResponse().errorCode() == ErrorCode.NO_SUCH_OBJECT_LOCK_CONFIGURATION) { throw e; } } finally { if (response != null) { response.body().close(); } } return retention; }

Target:
public Retention getObjectRetention(String bucketName, String objectName, String versionId) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, XmlParserException { Map<String, String> queryParamMap = new HashMap<>(); queryParamMap.put("retention", ""); if (versionId != null && !versionId.isEmpty()) { queryParamMap.put("versionId", versionId); } try (Response response = executeGet(bucketName, objectName, null, queryParamMap)) { Retention retention = Xml.unmarshal(Retention.class, response.body().charStream()); return retention; } catch (ErrorResponseException e) { if (e.errorResponse().errorCode() != ErrorCode.NO_SUCH_OBJECT_LOCK_CONFIGURATION) { throw e; } } return null; }