auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void checkPagingOneByOneThroughReferenceBases() throws AvroRemoteException { final String refId = Utils.getValidReferenceId(client); final long sequenceStart = 0L; final long sequenceEnd = 150L; final ListReferenceBasesRequest req = ListReferenceBasesRequest.newBuilder() .setStart(sequenceStart).setEnd(sequenceEnd) .build(); final ListReferenceBasesResponse resp = client.references.getReferenceBases(refId, req); final String expectedSequence = resp.getSequence(); assertThat(expectedSequence).hasSize((int)sequenceEnd); long offset = 0L; for (char expectedChar : expectedSequence.toCharArray()) { final ListReferenceBasesRequest pageReq = ListReferenceBasesRequest.newBuilder() .setStart(offset).setEnd(offset + 1) .build(); final ListReferenceBasesResponse pageResp = client.references.getReferenceBases(refId, pageReq); final String sequence = pageResp.getSequence(); assertThat(sequence).hasSize(1); assertThat(sequence.charAt(0)).isEqualTo(expectedChar); offset = pageResp.getOffset() + 1; } assertThat(offset).isEqualTo(sequenceEnd); }

Target:
public void checkPagingOneByOneThroughReferenceBases() throws AvroRemoteException { final String refId = Utils.getValidReferenceId(client); final long sequenceStart = 2L; final long sequenceEnd = 15L; final ListReferenceBasesRequest req = ListReferenceBasesRequest.newBuilder() .setStart(sequenceStart).setEnd(sequenceEnd) .build(); final ListReferenceBasesResponse resp = client.references.getReferenceBases(refId, req); final String expectedSequence = resp.getSequence(); assertThat(expectedSequence).hasSize((int)(sequenceEnd - sequenceStart)); long offset = sequenceStart; for (char expectedChar : expectedSequence.toCharArray()) { final ListReferenceBasesRequest pageReq = ListReferenceBasesRequest.newBuilder() .setStart(offset).setEnd(offset + 1) .build(); final ListReferenceBasesResponse pageResp = client.references.getReferenceBases(refId, pageReq); final String sequence = pageResp.getSequence(); assertThat(sequence).hasSize(1); assertThat(sequence.charAt(0)).isEqualTo(expectedChar); offset = pageResp.getOffset() + 1; } assertThat(offset).isEqualTo(sequenceEnd); }
Source:
public LogBuilder atTrace() { if (isTraceEnabled()) { return logBuilder.get().setLevel(Level.TRACE); } else { return LogBuilder.INSTANCE; } }

Target:
public LogBuilder atTrace() { return atLevel(Level.TRACE); }
Source:
private void saveMessage(SQLiteDatabase db, Message message) { ContentValues cv = new ContentValues(); cv.put("id", message.id); cv.put("thread_id", message.threadId); cv.put("author_id", message.authorId); cv.put("date", DateConverter.dateToLong(message.date)); cv.put("body", message.rawBody); int status = (message.isNew ? 1 : 0) | (message.isPushed ? 1 : 0) << MessageTable.STATUS_BIT_IS_PUSHED; cv.put("status", status); insertOrUpdate(db, MessageTable.NAME, cv, message.id); }

Target:
private void saveMessage(SQLiteDatabase db, Message message) { ContentValues cv = new ContentValues(); cv.put("id", message.id); cv.put("thread_id", message.threadId); cv.put("author_id", message.authorId); cv.put("date", DateConverter.dateToLong(message.date)); cv.put("body", message.rawBody); int status = (message.isNew ? 1 : 0) << MessageTable.STATUS_BIT_IS_NEW | (message.isPushed ? 1 : 0) << MessageTable.STATUS_BIT_IS_PUSHED; cv.put("status", status); insertOrUpdate(db, MessageTable.NAME, cv, message.id); }
Source:
public void addLabels(String issueId, List<String> labels) { List<String> newLabels = Lists.newArrayList(); Issue existingIssue = service.getIssue(issueId); if(existingIssue.getLabels() != null) newLabels.addAll(existingIssue.getLabels()); boolean changed = false; for(String label : labels) { if(!newLabels.contains(label)) { newLabels.add(label); changed = true; } } if(changed) service.setIssueLabels(issueId, newLabels); }

Target:
public void addLabels(String issueId, List<String> labels) { List<String> newLabels = Lists.newArrayList(); Issue existingIssue = service.getIssue(issueId); if(existingIssue.getLabels() != null) { newLabels.addAll(existingIssue.getLabels()); } boolean changed = false; for(String label : labels) { if(!newLabels.contains(label)) { newLabels.add(label); changed = true; } } if(changed) { service.setIssueLabels(issueId, newLabels); } }
Source:
private static boolean isArgumentCompatible(Type argumentType, Type collectionParameterType) { if (collectionParameterType instanceof JavaType.WildCardType) { return argumentType.isSubtypeOf(collectionParameterType); } return isSubtypeOf(argumentType.erasure(), collectionParameterType.erasure()) || isSubtypeOf(collectionParameterType.erasure(), argumentType.erasure()) || autoboxing(argumentType, collectionParameterType); }

Target:
private static boolean isArgumentCompatible(Type argumentType, Type collectionParameterType) { if (((JavaType) collectionParameterType).isTagged(JavaType.WILDCARD)) { return argumentType.isSubtypeOf(collectionParameterType); } return isSubtypeOf(argumentType.erasure(), collectionParameterType.erasure()) || isSubtypeOf(collectionParameterType.erasure(), argumentType.erasure()) || autoboxing(argumentType, collectionParameterType); }
Source:
public void stop(Duration delayInSeconds) { LOGGER.info("Will stop node in seconds", delayInSeconds.getSeconds()); runAfterDelay(delayInSeconds, () -> { LOGGER.info("Stopping node"); ServerEnv.getServer().stop(); }); }

Target:
public void stop(Duration delayInSeconds) { LOGGER.info("Will stop node in seconds", delayInSeconds.getSeconds()); runAfterDelay(delayInSeconds, () -> { LOGGER.info("Stopping node"); ServerEnv.getServer().stop(ZAP); }); }
Source:
public String eventSchedProcessWaking() { return SCHED_WAKING; }

Target:
public String eventSchedProcessWaking() { return "sched_waking"; }
Source:
private Object getImmediateFieldValue(BundleActivator activator) { try { Field f = activator.getClass() .getField("IMMEDIATE"); return f.get(activator); } catch (Exception e) return null; }

Target:
private Object getImmediateFieldValue(BundleActivator activator) { try { Field f = activator.getClass() .getField("IMMEDIATE"); return f.get(activator); } catch (Exception e) return Boolean.FALSE; }
Source:
public static boolean canShowHistoryFor(final Object object) { if (object instanceof HistoryPageInput) { return true; } if (object instanceof IResource) { return typeOk((IResource) object); } if (object instanceof RepositoryTreeNode) { return SUPPORTED_REPOSITORY_NODE_TYPES.contains(object); } if (object instanceof Path) { return true; } IResource resource = AdapterUtils.adaptToAnyResource(object); if (resource != null && typeOk(resource)) { return true; } return Adapters.adapt(object, Repository.class) != null; }

Target:
public static boolean canShowHistoryFor(final Object object) { if (object instanceof HistoryPageInput) { return true; } if (object instanceof IResource) { return typeOk((IResource) object); } if (object instanceof RepositoryTreeNode) { return SUPPORTED_REPOSITORY_NODE_TYPES .contains(((RepositoryTreeNode) object).getType()); } if (object instanceof Path) { return true; } IResource resource = AdapterUtils.adaptToAnyResource(object); if (resource != null && typeOk(resource)) { return true; } return Adapters.adapt(object, Repository.class) != null; }
Source:
public ResponseEntity<List<Map<String, Object>>> getObservationUnitTableAsJSONArray(@PathVariable final String cropname, @PathVariable final Integer studyId, @PathVariable final Integer datasetId, @RequestBody final ObservationUnitsSearchDTO searchDTO) { Preconditions.checkNotNull(searchDTO, "params cannot be null"); Preconditions.checkNotNull(searchDTO.getFilter(), "filter inside params cannot be null"); Preconditions .checkArgument(!Collections.isEmpty(searchDTO.getFilter().getFilterColumns()), "filterColumns cannot be null or empty"); return new ResponseEntity<>(this.studyDatasetService.getObservationUnitRowsAsListMap(studyId, datasetId, searchDTO), HttpStatus.OK); }

Target:
public ResponseEntity<List<Map<String, Object>>> getObservationUnitTableAsJSONArray(@PathVariable final String cropname, @PathVariable final Integer studyId, @PathVariable final Integer datasetId, @RequestBody final ObservationUnitsSearchDTO searchDTO) { Preconditions.checkNotNull(searchDTO, "params cannot be null"); Preconditions.checkNotNull(searchDTO.getFilter(), "filter inside params cannot be null"); Preconditions .checkArgument(!Collections.isEmpty(searchDTO.getFilterColumns()), "filterColumns cannot be null or empty"); return new ResponseEntity<>(this.studyDatasetService.getObservationUnitRowsAsMapList(studyId, datasetId, searchDTO), HttpStatus.OK); }
Source:
private void handleSignInResponse(int resultCode, Intent data) { if (data != null) { IdpResponse response = IdpResponse.fromResultIntent(data); if (resultCode == ResultCodes.OK) { startActivity(SignedInActivity.createIntent(this, response)); finish(); return; } if (response.getErrorCode() == ErrorCodes.NO_NETWORK) { showSnackbar(R.string.no_internet_connection); return; } if (response.getErrorCode() == ErrorCodes.UNKNOWN_ERROR) { showSnackbar(R.string.unknown_error); return; } } if (resultCode == ResultCodes.CANCELED) { showSnackbar(R.string.sign_in_cancelled); return; } showSnackbar(R.string.unknown_sign_in_response); }

Target:
private void handleSignInResponse(int resultCode, Intent data) { IdpResponse response = IdpResponse.fromResultIntent(data); if (resultCode == ResultCodes.OK) { startActivity(SignedInActivity.createIntent(this, response)); finish(); return; } else { if (response == null) { showSnackbar(R.string.sign_in_cancelled); return; } if (response.getErrorCode() == ErrorCodes.NO_NETWORK) { showSnackbar(R.string.no_internet_connection); return; } if (response.getErrorCode() == ErrorCodes.UNKNOWN_ERROR) { showSnackbar(R.string.unknown_error); return; } } showSnackbar(R.string.unknown_sign_in_response); }
Source:
public boolean updateKFS() { updateAgencies(); updateProposals(); updateAwards(); return false; }

Target:
public boolean updateKFS() { boolean successfullyUpdated = updateAgencies(); successfullyUpdated &= updateProposals(); successfullyUpdated &= updateAwards(); return successfullyUpdated; }
Source:
public static ColumnChunkMetaData get( ColumnPath path, PrimitiveTypeName type, CompressionCodecName codec, EncodingStats encodingStats, Set<Encoding> encodings, Statistics statistics, long firstDataPage, long dictionaryPageOffset, long valueCount, long totalSize, long totalUncompressedSize) { return get(path, new PrimitiveType(Type.Repetition.OPTIONAL, type, ""), codec, encodingStats, encodings, statistics, firstDataPage, dictionaryPageOffset, valueCount, totalSize, totalUncompressedSize); }

Target:
public static ColumnChunkMetaData get( ColumnPath path, PrimitiveTypeName type, CompressionCodecName codec, EncodingStats encodingStats, Set<Encoding> encodings, Statistics statistics, long firstDataPage, long dictionaryPageOffset, long valueCount, long totalSize, long totalUncompressedSize) { return get(path, Types.optional(type).named("fake_type"), codec, encodingStats, encodings, statistics, firstDataPage, dictionaryPageOffset, valueCount, totalSize, totalUncompressedSize); }
Source:
protected void updateExternalVnicProfilesPerTargetCluster() { final Map<Cluster, Set<VnicProfileMappingEntity>> result = new HashMap<>(); getEntities().getItems().stream().forEach( registerVmData -> updateExternalVnicProfilesPerTargetCluster( registerVmData.getEntity().getInterfaces(), registerVmData.getCluster().getSelectedItem(), result)); setExternalVnicProfilesPerTargetCluster(result); }

Target:
protected void updateExternalVnicProfilesPerTargetCluster() { final Map<Cluster, Set<VnicProfileMappingEntity>> result = new HashMap<>(); getEntities().getItems().forEach( registerVmData -> updateExternalVnicProfilesPerTargetCluster( registerVmData.getEntity().getInterfaces(), registerVmData.getCluster().getSelectedItem(), result)); setExternalVnicProfilesPerTargetCluster(result); }
Source:
static Map<String, String> escape(EnvVars envVars) { Map<String, String> m = new TreeMap<String, String>(); for (Map.Entry<String, String> entry : envVars.entrySet()) { m.put(entry.getKey(), entry.getValue().replace("$", "$$")); } return m; }

Target:
protected static Map<String, String> escape(EnvVars envVars) { Map<String, String> m = new TreeMap<String, String>(); for (Map.Entry<String, String> entry : envVars.entrySet()) { m.put(entry.getKey(), entry.getValue().replace("$", "$$")); } return m; }
Source:
public boolean isVerificationSuccessful(String captchaResponse, String secretKey) { if (secretKey == null) { return true; } else if (captchaResponse == null || captchaResponse.isEmpty()) { return false; } try { String response = getApiResponse(captchaResponse, secretKey); JsonObject responseInJson = JsonUtils.parse(response).getAsJsonObject(); if (responseInJson.has("error-codes")) { JsonArray errorCodes = responseInJson.get("error-codes").getAsJsonArray(); log.warning("Error codes during reCAPTCHA verification: " + errorCodes.toString()); } return Boolean.parseBoolean(responseInJson.get("success").toString()); } catch (Exception e) { log.severe(TeammatesException.toStringWithStackTrace(e)); return false; } }

Target:
public boolean isVerificationSuccessful(String captchaResponse, String secretKey) { if (secretKey == null || secretKey.isEmpty()) { return true; } if (captchaResponse == null || captchaResponse.isEmpty()) { return false; } try { String response = getApiResponse(captchaResponse, secretKey); JsonObject responseInJson = JsonUtils.parse(response).getAsJsonObject(); if (responseInJson.has("error-codes")) { JsonArray errorCodes = responseInJson.get("error-codes").getAsJsonArray(); log.warning("Error codes during reCAPTCHA verification: " + errorCodes.toString()); } return Boolean.parseBoolean(responseInJson.get("success").toString()); } catch (Exception e) { log.severe(TeammatesException.toStringWithStackTrace(e)); return false; } }
Source:
public FirestorePagingOptions<T> build() { return new FirestorePagingOptions<>(mData, mParser, mOwner); }

Target:
public FirestorePagingOptions<T> build() { if (mData == null || mParser == null) { throw new IllegalStateException("Must call setQuery() before calling build()."); } if (mDiffCallback == null) { mDiffCallback = new DefaultSnapshotDiffCallback<T>(mParser); } return new FirestorePagingOptions<>(mData, mParser, mDiffCallback, mOwner); }
Source:
private List<LightRuleMatch> parseAggregatedJson(File inputFile) throws IOException { ObjectMapper mapper = new ObjectMapper(); List<LightRuleMatch> ruleMatches = new ArrayList<>(); int lineCount = 1; for (String line : Files.readAllLines(inputFile.toPath())) { try { JsonNode node = mapper.readTree(line); JsonNode matches = node.get("matches"); for (JsonNode match : matches) { ruleMatches.add(nodeToLightMatch(node.get("title").asText(), match)); } lineCount++; } catch (Exception e) { throw new RuntimeException("Failed to parse line " + lineCount + " of " + inputFile, e); } } return ruleMatches; }

Target:
private List<LightRuleMatch> parseAggregatedJson(File inputFile) throws IOException { ObjectMapper mapper = new ObjectMapper(); List<LightRuleMatch> ruleMatches = new ArrayList<>(); try (BufferedReader br = Files.newBufferedReader(inputFile.toPath())) { String line; while ((line = br.readLine()) != null) { JsonNode node = mapper.readTree(line); JsonNode matches = node.get("matches"); for (JsonNode match : matches) { ruleMatches.add(nodeToLightMatch(node.get("title").asText(), match)); } } } return ruleMatches; }
Source:
public void appendData(DecodedBlockNode[] decodedBlocks, int fixedWidthRowSize, List<Integer> variableWidthChannels, OutputBuffer outputBuffer) { checkArgument(decodedBlocks.length == channelCount, "Unexpected number of blocks"); if (positionCount == 0) { return; } if (channelCount == 0) { bufferedRowCount += positionCount; return; } initializeBlockEncodingBuffers(decodedBlocks); for (int i = 0; i < channelCount; i++) { blockEncodingBuffers[i].setupDecodedBlocksAndPositions(decodedBlocks[i], positions, positionCount); } populateSerializedRowSizes(fixedWidthRowSize, variableWidthChannels); int offset = 0; do { int batchSize = calculateNextBatchSize(fixedWidthRowSize, variableWidthChannels, offset); for (int i = 0; i < channelCount; i++) { blockEncodingBuffers[i].setNextBatch(offset, batchSize); blockEncodingBuffers[i].appendDataInBatch(); } bufferedRowCount += batchSize; offset += batchSize; if (bufferFull) { flush(outputBuffer); bufferFull = false; } } while (offset < positionCount); }

Target:
private void appendData(DecodedBlockNode[] decodedBlocks, int fixedWidthRowSize, List<Integer> variableWidthChannels, OutputBuffer outputBuffer) { if (decodedBlocks.length != channelCount) { throw new IllegalArgumentException(format("Unexpected number of decoded blocks %d. It should be %d.", decodedBlocks.length, channelCount)); } if (positionCount == 0) { return; } if (channelCount == 0) { bufferedRowCount += positionCount; return; } initializeBlockEncodingBuffers(decodedBlocks); for (int i = 0; i < channelCount; i++) { blockEncodingBuffers[i].setupDecodedBlocksAndPositions(decodedBlocks[i], positions, positionCount); } populateSerializedRowSizes(fixedWidthRowSize, variableWidthChannels); int offset = 0; do { int batchSize = calculateNextBatchSize(fixedWidthRowSize, variableWidthChannels, offset); for (int i = 0; i < channelCount; i++) { blockEncodingBuffers[i].setNextBatch(offset, batchSize); blockEncodingBuffers[i].appendDataInBatch(); } bufferedRowCount += batchSize; offset += batchSize; if (bufferFull) { flush(outputBuffer); bufferFull = false; } } while (offset < positionCount); }
Source:
void should_convertToVariableDeletedEvent() { ActivitiVariableEventImpl internalEvent = new ActivitiVariableEventImpl(ActivitiEventType.VARIABLE_CREATED); internalEvent.setVariableName("variableName"); internalEvent.setProcessInstanceId("processInstanceId"); internalEvent.setTaskId("taskId"); VariableType variableType = new BooleanType(); internalEvent.setVariableType(variableType); Object value = mock(Object.class); internalEvent.setVariableValue(value); Optional<VariableDeletedEvent> result = converter.from(internalEvent); assertThat(result).isPresent(); VariableDeletedEvent actualEvent = result.get(); assertThat(actualEvent.getEventType()).isEqualTo(VariableEvents.VARIABLE_DELETED); VariableInstance actualEntity = actualEvent.getEntity(); assertThat(actualEntity.getName()).isEqualTo("variableName"); assertThat(actualEntity.getProcessInstanceId()).isEqualTo("processInstanceId"); assertThat(actualEntity.getTaskId()).isEqualTo("taskId"); assertThat(actualEntity.getType()).isEqualTo("boolean"); Object actualValue = actualEntity.getValue(); assertThat(actualValue).isSameAs(value); }

Target:
void should_convertToVariableDeletedEvent() { ActivitiVariableEventImpl internalEvent = new ActivitiVariableEventImpl(ActivitiEventType.VARIABLE_DELETED); internalEvent.setVariableName("variableName"); internalEvent.setProcessInstanceId("processInstanceId"); internalEvent.setTaskId("taskId"); VariableType variableType = new BooleanType(); internalEvent.setVariableType(variableType); Object value = mock(Object.class); internalEvent.setVariableValue(value); Optional<VariableDeletedEvent> result = converter.from(internalEvent); assertThat(result).isPresent(); VariableDeletedEvent actualEvent = result.get(); assertThat(actualEvent.getEventType()).isEqualTo(VariableEvents.VARIABLE_DELETED); VariableInstance actualEntity = actualEvent.getEntity(); assertThat(actualEntity.getName()).isEqualTo("variableName"); assertThat(actualEntity.getProcessInstanceId()).isEqualTo("processInstanceId"); assertThat(actualEntity.getTaskId()).isEqualTo("taskId"); assertThat(actualEntity.getType()).isEqualTo("boolean"); Object actualValue = actualEntity.getValue(); assertThat(actualValue).isSameAs(value); }
Source:
protected void endSuccessfully() { if (getParameters().isShouldTeardown()) { Guid hostForExecution = vdsCommandsHelper.getHostForExecution(getParameters().getStoragePoolId()); if (!executeWithHost(hostForExecution, host -> imagesHandler.teardownImage( getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getImageGroupId(), getParameters().getImageId(), host).getSucceeded())) { log.warn("Failed to tear down image '{}/{}'", getParameters().getImageGroupId(), getParameters().getImageId()); } } getReturnValue().setEndActionTryAgain(false); setSucceeded(true); }

Target:
protected void endSuccessfully() { if (getParameters().isShouldTeardown()) { Guid hostForExecution = vdsCommandsHelper.getHostForExecution(getParameters().getStoragePoolId()); if (!executeWithHost(hostForExecution, host -> imagesHandler.teardownImage( getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), getParameters().getImageGroupId(), getParameters().getImageId(), host).getSucceeded())) { log.warn("Failed to tear down image '{}/{}'", getParameters().getImageGroupId(), getParameters().getImageId()); getReturnValue().setEndActionTryAgain(false); } } setSucceeded(true); }
Source:
public ValidationResult validateStorageExistForMemoryDisks(List<Snapshot> snapshots, boolean allowPartial, Map<Guid, String> failedDisksToImport) { for (Snapshot snap : snapshots) { if (StringUtils.isNotEmpty(snap.getMemoryVolume())) { List<Guid> guids = GuidUtils.getGuidListFromString(snap.getMemoryVolume()); StorageDomain sd = getStorageDomainDao().getForStoragePool(guids.get(0), params.getStoragePoolId()); ValidationResult result = new StorageDomainValidator(sd).isDomainExistAndActive(); if (!result.isValid()) { log.error("Storage Domain '{}', could not be found for disks: '{}','{}' in snapshot '{}'", guids.get(0), guids.get(2), guids.get(4), snap.getDescription()); if (!allowPartial) { return result; } failedDisksToImport.putIfAbsent(guids.get(2), snap.getDescription() + "(memory disk)"); } } } return ValidationResult.VALID; }

Target:
public ValidationResult validateStorageExistForMemoryDisks(List<Snapshot> snapshots, boolean allowPartial, Map<Guid, String> failedDisksToImport) { for (Snapshot snap : snapshots) { if (StringUtils.isNotEmpty(snap.getMemoryVolume())) { List<Guid> guids = Guid.createGuidListFromString(snap.getMemoryVolume()); StorageDomain sd = getStorageDomainDao().getForStoragePool(guids.get(0), params.getStoragePoolId()); ValidationResult result = new StorageDomainValidator(sd).isDomainExistAndActive(); if (!result.isValid()) { log.error("Storage Domain '{}', could not be found for memory disks: '{}','{}' in snapshot '{}' (id: '{}')", guids.get(0), guids.get(2), guids.get(4), snap.getDescription(), snap.getId()); if (!allowPartial) { return result; } failedDisksToImport.putIfAbsent(guids.get(2), snap.getDescription() + "(memory disk)"); } } } return ValidationResult.VALID; }
Source:
private Dimension getLabelsDimension() { Dimension labelDimension = new Dimension(-1, -1); labelDimension.width = Math.max(labelDimension.width, nameLabel != null ? nameLabel.getPreferredSize().width : -1); labelDimension.width = Math.max(labelDimension.width, taggedLabel != null ? taggedLabel.getPreferredSize().width : -1); labelDimension.width = Math.max(labelDimension.width, stereotypesLabel != null ? stereotypesLabel.getPreferredSize().width : -1); labelDimension.width = Math.max(labelDimension.width, stereotypePropertiesInBraceContent != null ? stereotypePropertiesInBraceContent.getPreferredSize().width : -1); labelDimension.width = Math.max(labelDimension.width, qualifiedLabel != null ? qualifiedLabel.getPreferredSize().width : -1); ResizableCompartmentFigure firstCompartment = FigureUtils.findChildFigureInstance(this, ResizableCompartmentFigure.class); if (firstCompartment != null) { labelDimension.height = firstCompartment.getBounds().y - getBounds().y; } return labelDimension; }

Target:
private Dimension getLabelsDimension() { Dimension labelDimension = new Dimension(-1, -1); if (null != nameLabel && labelDimension.width < nameLabel.getPreferredSize().width) { labelDimension.width = nameLabel.getPreferredSize().width; } if (null != taggedLabel && labelDimension.width < taggedLabel.getPreferredSize().width) { labelDimension.width = taggedLabel.getPreferredSize().width; } if (null != stereotypesLabel && labelDimension.width < stereotypesLabel.getPreferredSize().width) { labelDimension.width = stereotypesLabel.getPreferredSize().width; } if (null != stereotypePropertiesInBraceContent && labelDimension.width < stereotypePropertiesInBraceContent.getPreferredSize().width) { labelDimension.width = stereotypePropertiesInBraceContent.getPreferredSize().width; } if (null != qualifiedLabel && labelDimension.width < qualifiedLabel.getPreferredSize().width) { labelDimension.width = qualifiedLabel.getPreferredSize().width; } ResizableCompartmentFigure firstCompartment = FigureUtils.findChildFigureInstance(this, ResizableCompartmentFigure.class); if (null != firstCompartment) { labelDimension.height = firstCompartment.getBounds().y - getBounds().y; } return labelDimension; }
Source:
public boolean equals(Object obj) { if (this == obj) { return true; } else if (obj == null) { return false; } else if (!getClass().equals(obj.getClass())) { return false; } PreSharedKeyIdentity other = (PreSharedKeyIdentity) obj; if (name == null) { if (other.name != null) { return false; } } else if (!name.equals(other.name)) { return false; } return true; }

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } else if (obj == null) { return false; } else if (getClass() != obj.getClass()) { return false; } PreSharedKeyIdentity other = (PreSharedKeyIdentity) obj; if (name == null) { if (other.name != null) { return false; } } else if (!name.equals(other.name)) { return false; } return true; }
Source:
private ChangeDetail submitRest(PatchSet.Id id, IProgressMonitor monitor) throws GerritException { final String uri = "/a/changes/" + id.getParentKey().get() + "/revisions/" + id.get() + "/submit"; try { JsonEntity entity = new JsonEntity() { @Override public String getContent() { SubmitInput reviewInput = new SubmitInput(true); return reviewInput.toJson(); } }; String response = client.execute(client.new JsonRequest(uri, entity) { @Override public void handleError(HttpMethodBase method) throws GerritException { if (method.getStatusCode() == HttpURLConnection.HTTP_FORBIDDEN && "submit not permitted\n".equals(getResponseBodyAsString(method))) { throw new GerritException("Cannot submit change"); } } private String getResponseBodyAsString(HttpMethodBase method) { try { return method.getResponseBodyAsString(); } catch (IOException e) { return null; } } }, monitor); SubmitInfo.fromJson(response); return getChangeDetail(id.get(), monitor); } catch (IOException e) { throw new GerritException(e); } }

Target:
private ChangeDetail submitRest(PatchSet.Id id, IProgressMonitor monitor) throws GerritException { final String uri = "/a/changes/" + id.getParentKey().get() + "/revisions/" + id.get() + "/submit"; execute(uri, new SubmitInput(true), SubmitInfo.class, new ErrorHandler() { @Override public void handleError(HttpMethodBase method) throws GerritException { if (method.getStatusCode() == HttpURLConnection.HTTP_FORBIDDEN && "submit not permitted\n".equals(getResponseBodyAsString(method))) { throw new GerritException("Cannot submit change"); } } private String getResponseBodyAsString(HttpMethodBase method) { try { return method.getResponseBodyAsString(); } catch (IOException e) { return null; } } }, monitor); return getChangeDetail(id.get(), monitor); }
Source:
public boolean handleMessage(Message message) { if (realm.sharedGroupManager != null) { QueryUpdateTask.Result result; switch (message.what) { case LOCAL_COMMIT: case REALM_CHANGED: realmChanged(); break; case COMPLETED_ASYNC_REALM_RESULTS: result = (QueryUpdateTask.Result) message.obj; completedAsyncRealmResults(result); break; case COMPLETED_ASYNC_REALM_OBJECT: result = (QueryUpdateTask.Result) message.obj; completedAsyncRealmObject(result); break; case COMPLETED_UPDATE_ASYNC_QUERIES: result = (QueryUpdateTask.Result) message.obj; completedAsyncQueriesUpdate(result); break; case REALM_ASYNC_BACKGROUND_EXCEPTION: throw (Error) message.obj; default: throw new IllegalArgumentException("Unknown message: " + message.what); } } return true; }

Target:
public boolean handleMessage(Message message) { if (realm.sharedGroupManager != null) { QueryUpdateTask.Result result; switch (message.what) { case LOCAL_COMMIT: case REALM_CHANGED: realmChanged(message.what == LOCAL_COMMIT); break; case COMPLETED_ASYNC_REALM_RESULTS: result = (QueryUpdateTask.Result) message.obj; completedAsyncRealmResults(result); break; case COMPLETED_ASYNC_REALM_OBJECT: result = (QueryUpdateTask.Result) message.obj; completedAsyncRealmObject(result); break; case COMPLETED_UPDATE_ASYNC_QUERIES: result = (QueryUpdateTask.Result) message.obj; completedAsyncQueriesUpdate(result); break; case REALM_ASYNC_BACKGROUND_EXCEPTION: throw (Error) message.obj; default: throw new IllegalArgumentException("Unknown message: " + message.what); } } return true; }
Source:
public void testGraphCommandUndoWithRows() { relation.getRow().add(new List()); relation.getRow().get(0).getExpression().add(new LiteralExpression()); ((LiteralExpression) relation.getRow().get(0).getExpression().get(0)).setText("value"); makeCommand(); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce)); assertEquals(1, relation.getColumn().size()); assertEquals(1, relation.getRow().size()); assertEquals(1, relation.getRow().get(0).getExpression().size()); assertEquals("value", ((LiteralExpression) relation.getRow().get(0).getExpression().get(0)).getText()); }

Target:
public void testGraphCommandUndoWithRows() { relation.getRow().add(new List()); final LiteralExpression literalExpression = new LiteralExpression(); literalExpression.setText(VALUE); relation.getRow().get(0).getExpression().add(literalExpression); makeCommand(); final Command<GraphCommandExecutionContext, RuleViolation> c = command.newGraphCommand(handler); assertEquals(GraphCommandResultBuilder.SUCCESS, c.execute(gce)); assertEquals(GraphCommandResultBuilder.SUCCESS, c.undo(gce)); assertEquals(1, relation.getColumn().size()); assertEquals(1, relation.getRow().size()); assertEquals(1, relation.getRow().get(0).getExpression().size()); assertEquals(VALUE, ((LiteralExpression) relation.getRow().get(0).getExpression().get(0)).getText()); }
Source:
public CompositeByteBuf discardReadComponents() { ensureAccessible(); final int readerIndex = readerIndex(); if (readerIndex == 0) { return this; } int writerIndex = writerIndex(); if (readerIndex == writerIndex && writerIndex == capacity()) { for (int i = 0, size = componentCount; i < size; i++) { components[i].free(); } lastAccessed = null; clearComps(); setIndex(0, 0); adjustMarkers(readerIndex); return this; } int firstComponentId = 0; Component c = null; for (int size = componentCount; firstComponentId < size; firstComponentId ++) { c = components[firstComponentId]; if (c.endOffset > readerIndex) { break; } c.free(); } if (firstComponentId == 0) { return this; } Component la = lastAccessed; if (la != null && la.endOffset < readerIndex) { lastAccessed = null; } removeCompRange(0, firstComponentId); int offset = c.offset; updateComponentOffsets(0); setIndex(readerIndex - offset, writerIndex - offset); adjustMarkers(offset); return this; }

Target:
public CompositeByteBuf discardReadComponents() { ensureAccessible(); final int readerIndex = readerIndex(); if (readerIndex == 0) { return this; } int writerIndex = writerIndex(); if (readerIndex == writerIndex && writerIndex == capacity()) { for (int i = 0, size = componentCount; i < size; i++) { components[i].free(); } lastAccessed = null; clearComps(); setIndex(0, 0); adjustMarkers(readerIndex); return this; } int firstComponentId = 0; Component c = null; for (int size = componentCount; firstComponentId < size; firstComponentId++) { c = components[firstComponentId]; if (c.endOffset > readerIndex) { break; } c.free(); } if (firstComponentId == 0) { return this; } Component la = lastAccessed; if (la != null && la.endOffset <= readerIndex) { lastAccessed = null; } removeCompRange(0, firstComponentId); int offset = c.offset; updateComponentOffsets(0); setIndex(readerIndex - offset, writerIndex - offset); adjustMarkers(offset); return this; }
Source:
public Properties trackCreateAccountClicked() { try{ VideoEvent vEvent = new VideoEvent(); vEvent.properties.putValue(Keys.NAME, Values.CREATE_ACCOUNT_CLICK); vEvent.setAppNameContext(); tracker.track(Keys.CREATE_ACCOUNT_CLICKED, vEvent.properties); return vEvent.properties; }catch(Exception e){ logger.error(e); } return null; }

Target:
public Properties trackCreateAccountClicked() { try{ SegmentAnalyticsEvent aEvent = new SegmentAnalyticsEvent(); aEvent.properties.putValue(Keys.NAME, Values.CREATE_ACCOUNT_CLICK); aEvent.setAppNameContext(); tracker.track(Keys.CREATE_ACCOUNT_CLICKED, aEvent.properties); return aEvent.properties; }catch(Exception e){ logger.error(e); } return null; }
Source:
private void combineFiles() throws Exception { final File parentDirectory = dstfile.getParentFile(); if (parentDirectory == null || parentDirectory.exists()) { truncateDestinationFileIfNecessary(); } else { if (!parentDirectory.mkdirs()) { throw new AmazonClientException("Unable to create directory in the path" + parentDirectory.getAbsolutePath()); } } for (Future<File> f : futureFiles) { File partFile = f.get(); ServiceUtils.appendFile(partFile, dstfile); download.updatePersistableTransfer(++lastFullyMergedPartNumber); try { if (!partFile.delete()) { LOG.warn("The file " + partFile.getAbsolutePath() + " could not be deleted."); } } catch (SecurityException exception) { LOG.warn("SecurityException denied delete access to file " + partFile.getAbsolutePath()); } } }

Target:
private void combineFiles() throws Exception { if (!ServiceUtils.createParentDirectoryIfNecessary(dstfile)) { truncateDestinationFileIfNecessary(); } for (Future<File> f : futureFiles) { File partFile = f.get(); ServiceUtils.appendFile(partFile, dstfile); download.updatePersistableTransfer(++lastFullyMergedPartNumber); try { if (!partFile.delete()) { LOG.warn("The file " + partFile.getAbsolutePath() + " could not be deleted."); } } catch (SecurityException exception) { LOG.warn("SecurityException denied delete access to file " + partFile.getAbsolutePath()); } } }
Source:
private void validateKeys(final byte[] encryptionKey, final byte[] authenticationKey) throws FunctionalException { if (this.checkEmptyKey(encryptionKey)) { LOGGER.error("The encryption key is empty"); throw new FunctionalException(FunctionalExceptionType.INVALID_KEY, ComponentType.PROTOCOL_DLMS); } if (this.checkEmptyKey(authenticationKey)) { LOGGER.error("The authentication key is empty"); throw new FunctionalException(FunctionalExceptionType.INVALID_KEY, ComponentType.PROTOCOL_DLMS); } if (this.checkLenghtKey(encryptionKey)) { LOGGER.error("The encryption key has an invalid length"); throw new FunctionalException(FunctionalExceptionType.INVALID_KEY_FORMAT, ComponentType.PROTOCOL_DLMS); } if (this.checkLenghtKey(authenticationKey)) { LOGGER.error("The authentication key has an invalid length"); throw new FunctionalException(FunctionalExceptionType.INVALID_KEY_FORMAT, ComponentType.PROTOCOL_DLMS); } }

Target:
private void validateKeys(final byte[] encryptionKey, final byte[] authenticationKey) throws FunctionalException { if (this.checkEmptyKey(encryptionKey)) { this.throwFunctionalException("The encryption key is empty", FunctionalExceptionType.INVALID_DLMS_KEY_ENCRYPTION); } if (this.checkEmptyKey(authenticationKey)) { this.throwFunctionalException("The authentication key is empty", FunctionalExceptionType.INVALID_DLMS_KEY_ENCRYPTION); } if (this.checkLenghtKey(encryptionKey)) { this.throwFunctionalException("The encryption key has an invalid length", FunctionalExceptionType.INVALID_DLMS_KEY_FORMAT); } if (this.checkLenghtKey(authenticationKey)) { this.throwFunctionalException("The authentication key has an invalid length", FunctionalExceptionType.INVALID_DLMS_KEY_FORMAT); } }
Source:
public boolean isHostedEngineDirectLunDisk() { return disk.getDiskStorageType() == DiskStorageType.LUN && StorageConstants.HOSTED_ENGINE_LUN_DISK_ALIAS.equals(disk.getDiskAlias()); }

Target:
private boolean isHostedEngineDirectLunDisk() { return disk.getDiskStorageType() == DiskStorageType.LUN && StorageConstants.HOSTED_ENGINE_LUN_DISK_ALIAS.equals(disk.getDiskAlias()); }
Source:
public ImmutableSortedMap<String, ImmutableList<SpeciesSummary>> getSpeciesSummaryGroupedByKingdom(int limit) { return popularSpeciesInfos.get().stream() .collect(groupingBy(SpeciesSummary::getKingdom)) .entrySet().stream() .collect(toImmutableSortedMap( new ArbitraryStringComparator("animals", "plants", "fungi", "protists"), entry -> entry.getKey(), entry -> entry.getValue().stream().limit(limit).collect(toImmutableList()))); }

Target:
public ImmutableMap<String, ImmutableList<SpeciesSummary>> getSpeciesSummaryGroupedByKingdom(int limit) { return popularSpeciesInfos.get().stream() .collect(groupingBy(SpeciesSummary::getKingdom)) .entrySet().stream() .collect(toImmutableMap( Map.Entry::getKey, entry -> entry.getValue().stream().limit(limit).collect(toImmutableList()))); }
Source:
public void createControl(Composite parent) { composite = new Composite(parent, SWT.NULL); composite.setLayout(new GridLayout()); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); Text pageText = new Text(composite, SWT.CENTER); pageText.setBounds(composite.getBounds()); pageText.setText("Operation that stores project WizardPage"); pageText.setVisible(true); }

Target:
public void createControl(Composite parent) { composite = new Composite(parent, SWT.NULL); composite.setLayout(new GridLayout()); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); Text pageText = new Text(composite, SWT.CENTER); pageText.setBounds(composite.getBounds()); pageText.setText("WizardPage with operation that gets a reference to the created project"); pageText.setVisible(true); }
Source:
public Stream<InputSplit> createSplits(InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec) throws IOException { if (firehoseFactory.isSplittable()) { return ((FiniteFirehoseFactory) firehoseFactory).getSplits(splitHintSpec); } else { throw new UnsupportedOperationException(); } }

Target:
public Stream<InputSplit> createSplits(InputFormat inputFormat, @Nullable SplitHintSpec splitHintSpec) throws IOException { if (firehoseFactory.isSplittable()) { return firehoseFactory.getSplits(splitHintSpec); } else { throw new UnsupportedOperationException(); } }
Source:
public <T> Pair<Long, T> remove(final String dataType, final Long id) { final String operationId = Long.toString(operationIdCounter.getAndIncrement()); final LongKeyOperation<T> operation = new LongKeyOperation<>(Optional.<String>empty(), operationId, DataOpType.REMOVE, dataType, id, Optional.<T>empty()); executeOperation(operation); final T outputData = operation.getOutputData().get(id); return outputData == null ? null : new Pair<>(id, outputData); }

Target:
public <V> Pair<Long, V> remove(final String dataType, final Long id) { final String operationId = Long.toString(operationIdCounter.getAndIncrement()); final LongKeyOperation<V> operation = new LongKeyOperation<>(Optional.<String>empty(), operationId, DataOpType.REMOVE, dataType, id, Optional.<V>empty()); executeOperation(operation); final V outputData = operation.getOutputData().get(id); return outputData == null ? null : new Pair<>(id, outputData); }
Source:
public static void query( AsyncCallback<JsArray<ChangeList>> callback, EnumSet<ListChangesOption> options, String... queries) { assert queries.length >= 2; RestApi call = new RestApi(URI); for (String q : queries) { call.addParameterRaw("q", KeyUtil.encode(q)); } EnumSet<ListChangesOption> o = EnumSet.of(ListChangesOption.LABELS); o.add(ListChangesOption.DETAILED_ACCOUNTS); o.addAll(options); addOptions(call, o); call.get(callback); }

Target:
public static void query( AsyncCallback<JsArray<ChangeList>> callback, EnumSet<ListChangesOption> options, String... queries) { assert queries.length >= 2; RestApi call = new RestApi(URI); for (String q : queries) { call.addParameterRaw("q", KeyUtil.encode(q)); } OPTIONS.addAll(options); addOptions(call, OPTIONS); call.get(callback); }
Source:
private boolean isUsedByOwner(HypervisorIdDTO hypervisor, Owner owner) { if (hypervisor == null) { return false; } return consumerCurator.getHypervisorsBulk( Collections.singletonList(hypervisor.getHypervisorId()), owner.getOwnerId()) .list() .size() > 0; }

Target:
private boolean isUsedByOwner(HypervisorIdDTO hypervisor, Owner owner) { if (hypervisor == null) { return false; } return consumerCurator.getHypervisor(hypervisor.getHypervisorId(), owner) != null; }
Source:
private String connectorCancelChargePathFor(String paymentId, String accountId) { return CONNECTOR_CANCEL_CHARGE_PATH.replace("{accountId}", accountId).replace("{chargeId}", paymentId); }

Target:
private String connectorCancelChargePathFor(String paymentId, String accountId) { return String.format(CONNECTOR_CANCEL_CHARGE_PATH, accountId, paymentId); }
Source:
protected void postSaveAction(Guid networkGuid, boolean succeeded) { if (succeeded) { if ((Boolean) getIsVmNetwork().getEntity()) { performProfilesActions(networkGuid); } else { stopProgress(); cancel(); } } stopProgress(); }

Target:
protected void postSaveAction(Guid networkGuid, boolean succeeded) { if (succeeded) { if ((Boolean) getIsVmNetwork().getEntity()) { performProfilesActions(networkGuid); stopProgress(); } else { stopProgress(); cancel(); } } }
Source:
public void validate_shouldPassValidationIfAllFieldsAreCorrect() throws Exception { Order order = new Order(); Encounter encounter = new Encounter(); order.setConcept(Context.getConceptService().getConcept(88)); order.setOrderer(Context.getProviderService().getProvider(1)); Patient patient = Context.getPatientService().getPatient(2); encounter.setPatient(patient); order.setPatient(patient); Calendar cal = Calendar.getInstance(); cal.set(Calendar.DAY_OF_MONTH, cal.get(Calendar.DAY_OF_MONTH) - 1); order.setStartDate(cal.getTime()); order.setDateStopped(new Date()); order.setAutoExpireDate(new Date()); order.setCareSetting(new CareSetting()); order.setEncounter(encounter); order.setUrgency(Order.Urgency.ROUTINE); order.setAction(Order.Action.NEW); order.setOrderType(Context.getOrderService().getOrderTypeByName("Test order")); Errors errors = new BindException(order, "order"); new OrderValidator().validate(order, errors); Assert.assertFalse(errors.hasErrors()); }

Target:
public void validate_shouldPassValidationIfAllFieldsAreCorrect() throws Exception { Order order = new Order(); Encounter encounter = new Encounter(); order.setConcept(Context.getConceptService().getConcept(88)); order.setOrderer(Context.getProviderService().getProvider(1)); Patient patient = Context.getPatientService().getPatient(2); encounter.setPatient(patient); order.setPatient(patient); Calendar cal = Calendar.getInstance(); cal.set(Calendar.DAY_OF_MONTH, cal.get(Calendar.DAY_OF_MONTH) - 1); order.setStartDate(cal.getTime()); order.setDateStopped(new Date()); order.setAutoExpireDate(new Date()); order.setCareSetting(new CareSetting()); order.setEncounter(encounter); order.setUrgency(Order.Urgency.ROUTINE); order.setAction(Order.Action.NEW); order.setOrderType(Context.getOrderService().getOrderTypeByName("Drug order")); Errors errors = new BindException(order, "order"); new OrderValidator().validate(order, errors); Assert.assertFalse(errors.hasErrors()); }
Source:
protected boolean writeFilesToDisk( Bundle bundle, String bundleSource, File to ) { InputStream in = null; OutputStream out = null; try { Enumeration<URL> fileUrls = bundle.findEntries( bundleSource, null, true ); if ( fileUrls == null || !fileUrls.hasMoreElements() ) { return false; } while ( fileUrls.hasMoreElements() ) { URL url = fileUrls.nextElement(); String endPath = url.getFile(); File outFile = new File( to.getAbsolutePath() + endPath.replace( ManagedResourceProvider.MANAGED_RESOURCES_DIR, "" ) ); String fileName = endPath.replaceAll( ".+\\/", "" ); if ( !outFile.exists() ) { if ( !fileName.isEmpty() ) { copyStream( url, outFile.getAbsolutePath() ); } else { outFile.mkdir(); } } } } catch ( FileNotFoundException e ) { e.printStackTrace(); return false; } catch ( IOException e ) { e.printStackTrace(); return false; } finally { try { if ( in != null ) { in.close(); } } catch ( IOException e ) { e.printStackTrace(); } try { if ( out != null ) { out.close(); } } catch ( IOException e ) { e.printStackTrace(); } } return true; }

Target:
protected boolean writeFilesToDisk( Bundle bundle, String bundleSource, File to ) { InputStream in = null; OutputStream out = null; try { Enumeration<URL> fileUrls = bundle.findEntries( bundleSource, null, true ); if ( fileUrls == null || !fileUrls.hasMoreElements() ) { return false; } while ( fileUrls.hasMoreElements() ) { URL url = fileUrls.nextElement(); Path outPath = Paths .get( to.getPath(), url.getFile().replace( ManagedResourceProvider.MANAGED_RESOURCES_DIR, "" ) ); File outFile = outPath.toFile(); String fileName = outPath.getFileName().toString(); if ( !outFile.exists() ) { if ( fileName.matches( ".+\\..+" ) ) { copyStream( url, outFile.getAbsolutePath() ); } else { outFile.mkdir(); } } } } catch ( FileNotFoundException e ) { logger.error( e.getMessage() ); return false; } catch ( IOException e ) { logger.error( e.getMessage() ); return false; } finally { try { if ( in != null ) { in.close(); } } catch ( IOException e ) { logger.error( e.getMessage() ); } try { if ( out != null ) { out.close(); } } catch ( IOException e ) { logger.error( e.getMessage() ); } } return true; }
Source:
static <T> List<T> tabulate(int n, Function<? super Integer, ? extends T> f) { Objects.requireNonNull(f, "f is null"); int nOrZero = java.lang.Math.max(n, 0); @SuppressWarnings("unchecked") T[] elements = (T[]) new Object[nOrZero]; for (int i = 0; i < n; i++) { elements[i] = f.apply(i); } return List.of(elements); }

Target:
static <T> List<T> tabulate(int n, Function<? super Integer, ? extends T> f) { Objects.requireNonNull(f, "f is null"); n = n < 0 ? 0 : n; @SuppressWarnings("unchecked") T[] elements = (T[]) new Object[n]; for (int i = 0; i < n; i++) { elements[i] = f.apply(i); } return List.of(elements); }
Source:
private void writeOutUsersDotPropertiesFile(File userPropertiesFile) { try { Properties usersDotProperties = new Properties(userPropertiesFile); if (!usersDotProperties.isEmpty()) { String oldHostValue = usersDotProperties.getProperty(oldHostName); if (oldHostValue != null) { String newInternalHost = System.getProperty(SystemBaseUrl.INTERNAL_HOST); String newDataManager = newInternalHost + "-" + DATA_MANAGER; String newHostValue = oldHostValue.replaceAll(LOCALHOST_DATA_MANAGER, newDataManager); usersDotProperties.remove(oldHostName); usersDotProperties.setProperty(newInternalHost, newHostValue); usersDotProperties.save(); } } } catch (IOException e) { LOGGER.warn("Exception while writing to users.properties file.", e); } }

Target:
private void writeOutUsersDotPropertiesFile(File userPropertiesFile) { try { Properties usersDotProperties = new Properties(userPropertiesFile); if (!usersDotProperties.isEmpty()) { String oldHostValue = usersDotProperties.getProperty(oldHostName); if (oldHostValue != null) { String newInternalHost = System.getProperty(SystemBaseUrl.INTERNAL_HOST); String newHostValue = oldHostValue.replaceAll( LOCALHOST_DATA_MANAGER, String.format("%s-%s", newInternalHost, DATA_MANAGER)); usersDotProperties.remove(oldHostName); usersDotProperties.setProperty(newInternalHost, newHostValue); usersDotProperties.save(); } } } catch (IOException e) { LOGGER.warn("Exception while writing to users.properties file.", e); } }