auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public static void connect(Socket socket, SocketAddress endpoint, SocketAddress localAddr, int timeout) throws IOException { if (socket == null || endpoint == null || timeout < 0) { throw new IllegalArgumentException("Illegal argument for connect()"); } SocketChannel ch = socket.getChannel(); if (localAddr != null) { Class localClass = localAddr.getClass(); Class remoteClass = endpoint.getClass(); Preconditions.checkArgument(localClass.equals(remoteClass), "Local address %s must be of same family as remote address %s.", localAddr, endpoint); socket.bind(localAddr); } try { if (ch == null) { socket.connect(endpoint, timeout); } else { SocketIOWithTimeout.connect(ch, endpoint, timeout); } <START> LOG.info("endpoint : , timeout : connect successful",endpoint,timeout); <END> } catch (SocketTimeoutException ste) { throw new ConnectTimeoutException(ste.getMessage()); } if (socket.getLocalPort() == socket.getPort() && socket.getLocalAddress().equals(socket.getInetAddress())) { LOG.info("Detected a loopback TCP socket, disconnecting it"); socket.close(); throw new ConnectException( "Localhost targeted connection resulted in a loopback. " + "No daemon is listening on the target port."); } }</code><technical_language>LOG.info("endpoint : , timeout : {}, connected successfully", endpoint, timeout);</technical_language>

Target:
public static void connect(Socket socket, SocketAddress endpoint, SocketAddress localAddr, int timeout) throws IOException { if (socket == null || endpoint == null || timeout < 0) { throw new IllegalArgumentException("Illegal argument for connect()"); } SocketChannel ch = socket.getChannel(); if (localAddr != null) { Class localClass = localAddr.getClass(); Class remoteClass = endpoint.getClass(); Preconditions.checkArgument(localClass.equals(remoteClass), "Local address %s must be of same family as remote address %s.", localAddr, endpoint); socket.bind(localAddr); } try { if (ch == null) { socket.connect(endpoint, timeout); } else { SocketIOWithTimeout.connect(ch, endpoint, timeout); } LOG.info("endpoint : , timeout : connected successful",endpoint,timeout); } catch (SocketTimeoutException ste) { throw new ConnectTimeoutException(ste.getMessage()); } if (socket.getLocalPort() == socket.getPort() && socket.getLocalAddress().equals(socket.getInetAddress())) { LOG.info("Detected a loopback TCP socket, disconnecting it"); socket.close(); throw new ConnectException( "Localhost targeted connection resulted in a loopback. " + "No daemon is listening on the target port."); } }
Source:
<code>public List<Map<String, Object>> getApplications() { try { return appService .getApplications() .stream() .map(this::convertApplicationEntries) .collect(Collectors.toList()); <START> } catch (Exception e) { <END> LOGGER.error("Could not get applications", e); throw new ApplicationServiceBeanException("Could not get applications"); } }</code><technical_language>catch code blocks repetitive, factored out a utility function/lambda</technical_language>

Target:
public List<Map<String, Object>> getApplications() { try { return appService .getApplications() .stream() .filter( app -> !getPluginsForApplication(app.getName()).isEmpty() || !getServices(app.getName()).isEmpty()) .map(this::convertApplicationEntries) .collect(Collectors.toList()); } catch (VirtualMachineError e) { throw e; } catch (Throwable e) { LOGGER.info("Could not retrieve applications", e); throw new ApplicationServiceBeanException("Could not retrieve applications"); } }
Source:
<code>private Object applyUpdateUnsafe(SMRRecord record) { log.trace("Apply[{}] of {}@{} ({})", this, record.getSMRMethod(), Address.isAddress(record.getGlobalAddress()) ? record.getGlobalAddress() : "OPT", record.getSMRArguments()); ICorfuSMRUpcallTarget<T> target = upcallTargetMap.get(record.getSMRMethod()); if (target == null) { throw new RuntimeException("Unknown upcall " + record.getSMRMethod()); } if (!record.isUndoable() || !Address.isAddress(record.getGlobalAddress())) { IUndoRecordFunction<T> undoRecordTarget = undoRecordFunctionMap.get(record.getSMRMethod()); if (undoRecordTarget != null) { record.setUndoRecord(undoRecordTarget .getUndoRecord(object, record.getSMRArguments())); log.trace("Apply[{}] Undo->{}", this, record.getUndoRecord()); } else if (resetSet.contains(record.getSMRMethod())) { record.setUndoRecord(object); object = newObjectFn.get(); log.trace("Apply[{}] Undo->RESET", this); } } <START> <END> if (record.locator != null && record.locator.getGlobalAddress() >= syncTail) { IGarbageIdentifyFunction<T> garbageIdentifyFunction = garbageIdentifyFunctionMap.get(record.getSMRMethod()); if (garbageIdentifyFunction != null) { List<Object> garbage = garbageIdentifyFunction.identify(record.locator, record.getSMRArguments()); } syncTail = record.locator.getGlobalAddress(); } return target.upcall(object, record.getSMRArguments()); }</code><technical_language>this > >=</technical_language>

Target:
private Object applyUpdateUnsafe(SMRRecord record) { log.trace("Apply[{}] of {}@{} ({})", this, record.getSMRMethod(), Address.isAddress(record.getGlobalAddress()) ? record.getGlobalAddress() : "OPT", record.getSMRArguments()); ICorfuSMRUpcallTarget<T> target = upcallTargetMap.get(record.getSMRMethod()); if (target == null) { throw new RuntimeException("Unknown upcall " + record.getSMRMethod()); } if (!record.isUndoable() || !Address.isAddress(record.getGlobalAddress())) { IUndoRecordFunction<T> undoRecordTarget = undoRecordFunctionMap.get(record.getSMRMethod()); if (undoRecordTarget != null) { record.setUndoRecord(undoRecordTarget .getUndoRecord(object, record.getSMRArguments())); log.trace("Apply[{}] Undo->{}", this, record.getUndoRecord()); } else if (resetSet.contains(record.getSMRMethod())) { record.setUndoRecord(object); object = newObjectFn.get(); log.trace("Apply[{}] Undo->RESET", this); } } return target.upcall(object, record.getSMRArguments()); }
Source:
<code>public Response createFedoraWebacAcl(@HeaderParam(CONTENT_TYPE) final MediaType requestContentType, final InputStream requestBodyStream) { if (resource().isAcl() || resource().isMemento()) { throw new BadRequestException("ACL resource creation is not allowed for resource " + resource().getId()); } LOGGER.info("PUT acl resource '{}'", externalPath()); final FedoraId aclId = identifierConverter().pathToInternalId(externalPath()).resolve(FCR_ACL); final boolean exists = resourceFactory.doesResourceExist(transaction(), aclId); final MediaType contentType = requestContentType == null ? RDFMediaType.TURTLE_TYPE : valueOf(getSimpleContentType(requestContentType)); if (isRdfContentType(contentType.toString())) { final Model model = httpRdfService.bodyToInternalModel(aclId.getFullId(), requestBodyStream, contentType, identifierConverter()); if (exists) { replacePropertiesService.perform(transaction().getId(), getUserPrincipal(), aclId, model); } else { webacAclService.create(transaction(), aclId, getUserPrincipal(), model); } } else { throw new BadRequestException("Content-Type (" + requestContentType + ") is invalid. Try text/turtle " + "or other RDF compatible type."); } <START> transaction().commit(); <END> final FedoraResource aclResource = getFedoraResource(transaction(), aclId); addCacheControlHeaders(servletResponse, aclResource, transaction()); final URI location = getUri(aclResource); if (!exists) { return created(location).build(); } else { return noContent().location(location).build(); } }</code><technical_language>this commit a potentially "long-running transaction"... irrespective of transaction API</technical_language>

Target:
public Response createFedoraWebacAcl(@HeaderParam(CONTENT_TYPE) final MediaType requestContentType, final InputStream requestBodyStream) { if (resource().isAcl() || resource().isMemento()) { throw new BadRequestException("ACL resource creation is not allowed for resource " + resource().getId()); } LOGGER.info("PUT acl resource '{}'", externalPath()); final FedoraId aclId = identifierConverter().pathToInternalId(externalPath()).resolve(FCR_ACL); final boolean exists = resourceFactory.doesResourceExist(transaction(), aclId); final MediaType contentType = requestContentType == null ? RDFMediaType.TURTLE_TYPE : valueOf(getSimpleContentType(requestContentType)); if (isRdfContentType(contentType.toString())) { final Model model = httpRdfService.bodyToInternalModel(aclId.getFullId(), requestBodyStream, contentType, identifierConverter()); if (exists) { replacePropertiesService.perform(transaction().getId(), getUserPrincipal(), aclId, model); } else { webacAclService.create(transaction(), aclId, getUserPrincipal(), model); } } else { throw new BadRequestException("Content-Type (" + requestContentType + ") is invalid. Try text/turtle " + "or other RDF compatible type."); } transaction().commitIfShortLived(); final FedoraResource aclResource = getFedoraResource(transaction(), aclId); addCacheControlHeaders(servletResponse, aclResource, transaction()); final URI location = getUri(aclResource); if (!exists) { return created(location).build(); } else { return noContent().location(location).build(); } }
Source:
<code>public void hasSameOrderableAs_shouldReturnFalseIfTheConceptsMatchAndEitherOfDrugNonCodedIsNull() throws Exception { <START> DrugOrder order = new DrugOrder(); <END> Concept concept = new Concept(); order.setDrugNonCoded("Chrocine"); DrugOrder otherOrder = new DrugOrder(); otherOrder.setConcept(concept); assertFalse(order.hasSameOrderableAs(otherOrder)); }</code><technical_language>Forgot set set concept this order</technical_language>

Target:
public void hasSameOrderableAs_shouldReturnFalseIfTheConceptsMatchAndEitherOfDrugNonCodedIsNull() throws Exception { DrugOrder order = new DrugOrder(); Concept concept = new Concept(); order.setConcept(concept); order.setDrugNonCoded("Chrocine"); DrugOrder otherOrder = new DrugOrder(); otherOrder.setConcept(concept); assertFalse(order.hasSameOrderableAs(otherOrder)); }
Source:
<code>protected void testSchemaOfSubsystemTemplates() throws Exception { String schemaPath = getSubsystemXsdPath(); <START> Assume.assumeTrue("getSubsystemXsdPath() has been overridden to disable the validation of the subsystem templates", <END> schemaPath != null); String[] templates = getSubsystemTemplatePaths(); Assume.assumeTrue("Override getSubsystemTemplatePaths() to activate the validation of the subsystem templates", templates != null && templates.length > 0); for (String template : templates) { String content = readResource(template); SchemaValidator.validateXML(content, "subsystem", schemaPath, getResolvedProperties()); } }</code><technical_language>I change this assert (and a lines down)</technical_language>

Target:
protected void testSchemaOfSubsystemTemplates() throws Exception { String schemaPath = getSubsystemXsdPath(); Assert.assertTrue("getSubsystemXsdPath() needs to be overridden to enable the validation of the subsystem templates", schemaPath != null); String[] templates = getSubsystemTemplatePaths(); Assert.assertTrue("Override getSubsystemTemplatePaths() to activate the validation of the subsystem templates", templates != null && templates.length > 0); for (String template : templates) { String content = readResource(template); SchemaValidator.validateXML(content, "subsystem", schemaPath, getResolvedProperties()); } }
Source:
<code>public void addTheFetchedPhoto() { waitForElementByElement(fetchedPhoto); <START> clickAndWait(fetchedPhoto); <END> PageObjectLogging.log("addTheFetchedPhoto", "add the fetched photo", true, driver); }</code><technical_language>click element</technical_language>

Target:
public void addTheFetchedPhoto() { waitForElementByElement(fetchedPhoto); scrollAndClick(fetchedPhoto); PageObjectLogging.log("addTheFetchedPhoto", "add the fetched photo", true, driver); }
Source:
<code>public ObjectStat statObject(String bucketName, String objectName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException { HttpResponse response = executeHead(bucketName, objectName); ResponseHeader header = response.header(); ObjectStat objectStat = null; <START> if ((header.xamzMetaKey() != null) && (header.xamzMetaIv() != null)) { <END> objectStat = new ObjectStat(bucketName, objectName, header); } else { objectStat = new ObjectStat(bucketName, objectName, header.lastModified(), header.contentLength(), header.etag(), header.contentType()); } return objectStat; }</code><technical_language>merge 'if' 'else' ? support ObjectStat(bucket, object, headers)</technical_language>

Target:
public ObjectStat statObject(String bucketName, String objectName) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException { HttpResponse response = executeHead(bucketName, objectName); ResponseHeader header = response.header(); ObjectStat objectStat = new ObjectStat(bucketName, objectName, header); return objectStat; }
Source:
<code>public String toString() { <START> return "LongFirstAggregatorFactory{" + <END> "name='" + name + '\'' + ", fieldName='" + fieldName + '\'' + '}'; }</code><technical_language>"DoubleLastAggregatorFactory{"</technical_language>

Target:
public String toString() { return "DoubleFirstAggregatorFactory{" + "name='" + name + '\'' + ", fieldName='" + fieldName + '\'' + '}'; }
Source:
<code>private static boolean isLongOrNarrower(Object value) { <START> return (value instanceof Long || value instanceof Short || value instanceof Byte); <END> }</code><technical_language>Integer is excluded? LongOrNarrower integers, it</technical_language>

Target:
private static boolean isLongOrNarrower(Object value) { return (value instanceof Long || isIntegerOrNarrower(value)); }
Source:
<code><START> public void makeBusinessObjectActiveIfApplicable(T xmlObject, R newBusinessObject) { <END> if (newBusinessObject instanceof MutableInactivatable) { ((MutableInactivatable) newBusinessObject).setActive(true); } }</code><technical_language>I want <T extends RassXmlObject, R extends PersistableBusinessObject> function definition caller T R need be. want add this other functions in this class</technical_language>

Target:
public <T extends RassXmlObject, R extends PersistableBusinessObject> void makeBusinessObjectActiveIfApplicable(T xmlObject, R newBusinessObject) { if (newBusinessObject instanceof MutableInactivatable) { ((MutableInactivatable) newBusinessObject).setActive(true); } }
Source:
<code>public Iterator<K> wrapIterator(final Iterator<K> iterator, final boolean includeUncommitted) { return new Iterator<K>() { private K current; private void fetchNext() { while (iterator.hasNext()) { current = iterator.next(); if (includeUncommitted) { return; } if (containsKey(current)) { return; } } current = null; } @Override public boolean hasNext() { if(current == null) { fetchNext(); <START> } <END> return current != null; } @Override public K next() { if(!hasNext()) { throw new NoSuchElementException(); } assert current != null; K result = current; current = null; return result; } @Override public void remove() { throw DataUtils.newUnsupportedOperationException( "Removal is not supported"); } }; }</code><technical_language>this is a hot path, add extra instructions instead of initialinsg current in constructor</technical_language>

Target:
public Iterator<K> wrapIterator(final Iterator<K> iterator, final boolean includeUncommitted) { return new Iterator<K>() { private K current; { fetchNext(); } private void fetchNext() { while (iterator.hasNext()) { current = iterator.next(); if (includeUncommitted) { return; } if (containsKey(current)) { return; } } current = null; } @Override public boolean hasNext() { return current != null; } @Override public K next() { K result = current; fetchNext(); return result; } @Override public void remove() { throw DataUtils.newUnsupportedOperationException( "Removal is not supported"); } }; }
Source:
<code>public boolean equals(byte[] object, ByteBuffer binary) throws ClassNotFoundException, SerializerException { <START> return Arrays.equals(read(binary), object); <END> }</code><technical_language>This equals contract of arrays. (also faster do binary.equals(serialize(object))?)</technical_language>

Target:
public boolean equals(byte[] object, ByteBuffer binary) throws ClassNotFoundException, SerializerException { boolean equals = binary.equals(serialize(object)); binary.position(binary.limit()); return equals; }
Source:
<code>protected ImmutableList<String> _call() { Builder<String> cleaned = new ImmutableList.Builder<String>(); Optional<Ref> ref = command(RefParse.class).setName(Ref.MERGE_HEAD).call(); if (ref.isPresent()) { cleaned.add(Ref.MERGE_HEAD); command(UpdateRef.class).setDelete(true).setName(Ref.MERGE_HEAD).call(); } ref = command(RefParse.class).setName(Ref.ORIG_HEAD).call(); if (ref.isPresent()) { cleaned.add(Ref.ORIG_HEAD); command(UpdateRef.class).setDelete(true).setName(Ref.ORIG_HEAD).call(); } ref = command(RefParse.class).setName(Ref.CHERRY_PICK_HEAD).call(); if (ref.isPresent()) { cleaned.add(Ref.CHERRY_PICK_HEAD); command(UpdateRef.class).setDelete(true).setName(Ref.CHERRY_PICK_HEAD).call(); } BlobStore blobStore = context.blobStore(); <START> Optional<InputStream> blobAsStream = blobStore.getBlobAsStream(MergeOp.MERGE_MSG); <END> if (blobAsStream.isPresent()) { cleaned.add(MergeOp.MERGE_MSG); blobStore.removeBlob(MergeOp.MERGE_MSG); } return cleaned.build(); }</code><technical_language>InputStream is consumed, call utility method Blobs.getBlobAsString() is public static Optional<String> getBlobAsString(BlobStore blobStore, String blobName)</technical_language>

Target:
protected ImmutableList<String> _call() { Builder<String> cleaned = new ImmutableList.Builder<String>(); Optional<Ref> ref = command(RefParse.class).setName(Ref.MERGE_HEAD).call(); if (ref.isPresent()) { cleaned.add(Ref.MERGE_HEAD); command(UpdateRef.class).setDelete(true).setName(Ref.MERGE_HEAD).call(); } ref = command(RefParse.class).setName(Ref.ORIG_HEAD).call(); if (ref.isPresent()) { cleaned.add(Ref.ORIG_HEAD); command(UpdateRef.class).setDelete(true).setName(Ref.ORIG_HEAD).call(); } ref = command(RefParse.class).setName(Ref.CHERRY_PICK_HEAD).call(); if (ref.isPresent()) { cleaned.add(Ref.CHERRY_PICK_HEAD); command(UpdateRef.class).setDelete(true).setName(Ref.CHERRY_PICK_HEAD).call(); } BlobStore blobStore = context.blobStore(); Optional<String> blob = Blobs.getBlobAsString(blobStore, MergeOp.MERGE_MSG); if (blob.isPresent()) { cleaned.add(MergeOp.MERGE_MSG); blobStore.removeBlob(MergeOp.MERGE_MSG); } return cleaned.build(); }
Source:
<code>public boolean equals(Object obj) { <START> if (this == obj) <END> return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; SchemaCompatibilityResult other = (SchemaCompatibilityResult) obj; if (mMessage == null) { if (other.mMessage != null) return false; } else if (!mMessage.equals(other.mMessage)) return false; if (mReaderSubset == null) { if (other.mReaderSubset != null) return false; } else if (!mReaderSubset.equals(other.mReaderSubset)) return false; if (mCompatibility != other.mCompatibility) return false; if (mSchemaIncompatibilityType != other.mSchemaIncompatibilityType) return false; if (mWriterSubset == null) { if (other.mWriterSubset != null) return false; } else if (!mWriterSubset.equals(other.mWriterSubset)) return false; return true; }</code><technical_language>multiple if statements good braces separate out</technical_language>

Target:
public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } SchemaCompatibilityResult other = (SchemaCompatibilityResult) obj; if (mMessage == null) { if (other.mMessage != null) { return false; } } else if (!mMessage.equals(other.mMessage)) { return false; } if (mReaderSubset == null) { if (other.mReaderSubset != null) { return false; } } else if (!mReaderSubset.equals(other.mReaderSubset)) { return false; } if (mCompatibility != other.mCompatibility) { return false; } if (mSchemaIncompatibilityType != other.mSchemaIncompatibilityType) { return false; } if (mWriterSubset == null) { if (other.mWriterSubset != null) { return false; } } else if (!mWriterSubset.equals(other.mWriterSubset)) { return false; } return true; }
Source:
<code>public void onPartitionBecomeInactiveFromStandby(String partitionName) { ReplicaId replica = partitionNameToReplicaId.get(partitionName); if (replica != null) { Store localStore = getStore(replica.getPartitionId()); if (localStore != null) { localStore.setCurrentState(ReplicaState.INACTIVE); logger.info("Store is set to INACTIVE", partitionName); if (!controlCompactionForBlobStore(replica.getPartitionId(), false)) { logger.error("Failed to disable compaction on store {}", partitionName); throw new StateTransitionException("Couldn't disable compaction on replica " + replica.getReplicaPath(), <START> StateTransitionException.TransitionErrorCode.ReplicaOperationFailure); <END> } logger.info("Compaction is successfully disabled on store {}", partitionName); } else { throw new StateTransitionException("Store " + partitionName + " is not started", StateTransitionException.TransitionErrorCode.StoreNotStarted); } } else { throw new StateTransitionException("Replica " + partitionName + " is not found on current node", StateTransitionException.TransitionErrorCode.ReplicaNotFound); } }</code><technical_language>Minor: consider renaming ReplicaOperationFailure of other error codes</technical_language>

Target:
public void onPartitionBecomeInactiveFromStandby(String partitionName) { ReplicaId replica = partitionNameToReplicaId.get(partitionName); if (replica != null) { Store localStore = getStore(replica.getPartitionId()); if (localStore != null) { localStore.setCurrentState(ReplicaState.INACTIVE); logger.info("Store is set to INACTIVE", partitionName); if (!controlCompactionForBlobStore(replica.getPartitionId(), false)) { logger.error("Failed to disable compaction on store {}", partitionName); throw new StateTransitionException("Couldn't disable compaction on replica " + replica.getReplicaPath(), ReplicaNotFound); } logger.info("Compaction is successfully disabled on store {}", partitionName); } else { throw new StateTransitionException("Store " + partitionName + " is not started", StoreNotStarted); } } else { throw new StateTransitionException("Replica " + partitionName + " is not found on current node", ReplicaNotFound); } }
Source:
<code>public void checkAccess(Path path, AccessMode... accessModes) throws IOException { if (accessModes != null && accessModes.length != 0) { throw logger.logThrowableAsError( new AccessDeniedException("The access cannot be determined.")); } AzurePath.ensureFileSystemOpen(path); try { readAttributes(path, BasicFileAttributes.class); } catch(IOException e) { if (e.getCause() != null && e.getCause() instanceof BlobStorageException <START> && BlobErrorCode.BLOB_NOT_FOUND.equals(((BlobStorageException) e.getCause()).getErrorCode())) { <END> throw logger.logThrowableAsError(new NoSuchFileException(path.toString())); } else { throw e; } } }</code><technical_language>this ContainerNotFound</technical_language>

Target:
public void checkAccess(Path path, AccessMode... accessModes) throws IOException { if (accessModes != null && accessModes.length != 0) { throw LoggingUtility.logError(logger, new AccessDeniedException("The access cannot be determined.")); } AzurePath.ensureFileSystemOpen(path); if (path instanceof AzurePath && ((AzurePath) path).isRoot()) { return; } try { readAttributes(path, BasicFileAttributes.class); } catch (IOException e) { Throwable cause = e.getCause(); if (cause instanceof BlobStorageException && BlobErrorCode.BLOB_NOT_FOUND.equals(((BlobStorageException) cause).getErrorCode())) { throw LoggingUtility.logError(logger, new NoSuchFileException(path.toString())); } else { throw LoggingUtility.logError(logger, e); } } }
Source:
<code>public void recordImageCopyTime(Stack stack, long startMillis) { String[] tags = {MetricTag.TENANT.name(), Optional.ofNullable(stack.getTenant()).map(Tenant::getName).orElse("NA"), MetricTag.CLOUD_PROVIDER.name(), Optional.ofNullable(stack.cloudPlatform()).orElse("NA"), MetricTag.REGION.name(), Optional.ofNullable(stack.getRegion()).orElse("NA")}; long millispassed = System.currentTimeMillis() - startMillis; <START> LOGGER.debug("Image copy duration report: ms", System.currentTimeMillis() - startMillis); <END> recordTimer(millispassed, MetricType.STACK_IMAGE_COPY, tags); }</code><technical_language>line is calculation</technical_language>

Target:
public void recordImageCopyTime(Stack stack, long startMillis) { String[] tags = {MetricTag.TENANT.name(), Optional.ofNullable(stack.getTenant()).map(Tenant::getName).orElse("NA"), MetricTag.CLOUD_PROVIDER.name(), Optional.ofNullable(stack.cloudPlatform()).orElse("NA"), MetricTag.REGION.name(), Optional.ofNullable(stack.getRegion()).orElse("NA")}; long millispassed = System.currentTimeMillis() - startMillis; LOGGER.debug("Image copy duration report: ms", millispassed); recordTimer(millispassed, MetricType.STACK_IMAGE_COPY, tags); }
Source:
<code>public void initializeMetaCollection(Configuration configuration) throws CatalogException { Admin admin = configuration.getAdmin(); admin.setPassword(CatalogAuthenticationManager.cypherPassword(admin.getPassword())); Metadata metadata = new Metadata().setIdCounter(configuration.getCatalog().getOffset()).setVersion(VERSION); Document metadataObject = getMongoDBDocument(metadata, "Metadata"); metadataObject.put(PRIVATE_ID, MongoDBAdaptorFactory.METADATA_OBJECT_ID); Document adminDocument = getMongoDBDocument(admin, "Admin"); <START> adminDocument.put("algorithm", "HS256"); <END> adminDocument.put("secretKey", "222"); metadataObject.put("admin", adminDocument); metaCollection.insert(metadataObject, null); }</code><technical_language>check algorithm secretKey provided in configuration, hardcode fields</technical_language>

Target:
public void initializeMetaCollection(Configuration configuration) throws CatalogException { Admin admin = configuration.getAdmin(); admin.setPassword(CatalogAuthenticationManager.cypherPassword(admin.getPassword())); Metadata metadata = new Metadata().setIdCounter(configuration.getCatalog().getOffset()).setVersion(VERSION); Document metadataObject = getMongoDBDocument(metadata, "Metadata"); metadataObject.put(PRIVATE_ID, MongoDBAdaptorFactory.METADATA_OBJECT_ID); Document adminDocument = getMongoDBDocument(admin, "Admin"); metadataObject.put("admin", adminDocument); metaCollection.insert(metadataObject, null); }
Source:
<code>public Response archiveBranch(long branchUuid) { BranchReadable branch = getBranchById(branchUuid); boolean modified = false; BranchArchivedState currentState = branch.getArchiveState(); if (BranchArchivedState.UNARCHIVED == currentState) { Callable<?> op = getBranchOps().archiveUnarchiveBranch(branch, ArchiveOperation.ARCHIVE); executeCallable(op); <START> modified = true; <END> activityLog.createEntry(BRANCH_OPERATION_TYPEID, ActivityLog.INITIAL_STATUS, String.format("Branch Operation Archive Branch {branchUUID: %s accountId: %s serverId: %s clientId: %s}", branchUuid, accountId, serverId, clientId)); } return asResponse(modified); }</code><technical_language>try/catch</technical_language>

Target:
public Response archiveBranch(long branchUuid) { BranchReadable branch = getBranchById(branchUuid); boolean modified = false; BranchArchivedState currentState = branch.getArchiveState(); if (BranchArchivedState.UNARCHIVED == currentState) { Callable<?> op = getBranchOps().archiveUnarchiveBranch(branch, ArchiveOperation.ARCHIVE); executeCallable(op); modified = true; try { activityLog.createEntry(BRANCH_OPERATION_TYPEID, ActivityLog.INITIAL_STATUS, String.format("Branch Operation Archive Branch {branchUUID: %s accountId: %s serverId: %s clientId: %s}", branchUuid, RestUtil.getAccountId(httpHeaders), RestUtil.getServerId(httpHeaders), RestUtil.getClientId(httpHeaders))); } catch (OseeCoreException ex) { OseeLog.log(ActivityLog.class, OseeLevel.SEVERE_POPUP, ex); } } return asResponse(modified); }
Source:
<code>public Response approve(Action action) { if (action.isSetCluster() && (action.getCluster().isSetId() || action.getCluster().isSetName())) { update(setCluster(get(), action.getCluster())); } validateEnums(Action.class, action); ApproveVdsParameters params = new ApproveVdsParameters(guid); params = (ApproveVdsParameters) getMapper (Action.class, VdsOperationActionParameters.class).map(action, (VdsOperationActionParameters) params); <START> <END> if (action.isSetSsh() && action.getSsh().isSetAuthenticationMethod()) { if (action.getSsh().getAuthenticationMethod() == VdsOperationActionParameters.AuthenticationMethod.Password.toString()) { params.setAuthMethod(VdsOperationActionParameters.AuthenticationMethod.Password); if (action.isSetRootPassword()) { params.setRootPassword(action.getRootPassword()); } else if (action.getSsh().isSetUser()) { params.setPassword(action.getSsh().getUser().getPassword()); } } else { params.setAuthMethod(VdsOperationActionParameters.AuthenticationMethod.PublicKey); } } else { params.setAuthMethod(VdsOperationActionParameters.AuthenticationMethod.PublicKey); } return doAction(VdcActionType.ApproveVds, params, action); }</code><technical_language>create authentication method varialbe, set end of this section. (rather else clauses)</technical_language>

Target:
public Response approve(Action action) { if (action.isSetCluster() && (action.getCluster().isSetId() || action.getCluster().isSetName())) { update(setCluster(get(), action.getCluster())); } validateEnums(Action.class, action); ApproveVdsParameters params = new ApproveVdsParameters(guid); params = (ApproveVdsParameters) getMapper (Action.class, VdsOperationActionParameters.class).map(action, (VdsOperationActionParameters) params); VdsOperationActionParameters.AuthenticationMethod authMethod = VdsOperationActionParameters.AuthenticationMethod.PublicKey; if (action.isSetSsh() && action.getSsh().isSetAuthenticationMethod()) { if (action.getSsh().getAuthenticationMethod().equals( VdsOperationActionParameters.AuthenticationMethod.Password.toString())) { authMethod = VdsOperationActionParameters.AuthenticationMethod.Password; if (action.isSetRootPassword()) { params.setRootPassword(action.getRootPassword()); } else if (action.getSsh().isSetUser()) { params.setPassword(action.getSsh().getUser().getPassword()); } } } params.setAuthMethod(authMethod); return doAction(VdcActionType.ApproveVds, params, action); }
Source:
<code>public static String demangleVmName(String name) { if (name == null) { return null; } <START> return name.replaceAll("_[0-9]+_g\\$", ""); <END> }</code><technical_language>I this pattern work string, while want works for suffix of string, is enforced. enforce it, "_[0-9]+_g\$$" "_[0-9]+_g\$\z" similar</technical_language>

Target:
public static String demangleVmName(String name) { if (name == null) { return null; } return name.replaceAll("_[0-9]+_g\\$$", ""); }
Source:
<code>private double logLikelihoodPoisson(@Nonnull CoverageModelCopyRatioEmissionData emissionData, <START> double copyRatio) { <END> final double multBias = FastMath.exp(emissionData.getMu()); final double readDepth = emissionData.getCopyRatioCallingMetadata().getSampleCoverageDepth(); final double poissonMean = readDepth * copyRatio * multBias + emissionData.getPoissonAdditiveNoise(); return new PoissonDistribution(null, poissonMean, PoissonDistribution.DEFAULT_EPSILON, PoissonDistribution.DEFAULT_MAX_ITERATIONS).logProbability(emissionData.getReadCount()); }</code><technical_language>final and, IMO, need a new line</technical_language>

Target:
private double logLikelihoodPoisson(@Nonnull CoverageModelCopyRatioEmissionData emissionData, double copyRatio) { final double multBias = FastMath.exp(emissionData.getMu()); final double readDepth = emissionData.getCopyRatioCallingMetadata().getSampleCoverageDepth(); final double err = emissionData.getMappingErrorProbability(); final double poissonMean = readDepth * ((1 - err) * copyRatio * multBias + err); return new PoissonDistribution(null, poissonMean, PoissonDistribution.DEFAULT_EPSILON, PoissonDistribution.DEFAULT_MAX_ITERATIONS).logProbability(emissionData.getReadCount()); }
Source:
<code><START> public Double getScore() {return score;} <END></code><technical_language>linebreak style is inconsistent</technical_language>

Target:
public double getScore() { return score; }
Source:
<code>public Function<Definition, Definition> defaultSteps() { DefinitionTransformer resolveStrict = DefinitionTransformer.from(new ResolveStrict(kompileOptions)::resolve, "resolving strict and seqstrict attributes"); DefinitionTransformer resolveContexts = DefinitionTransformer.from(new ResolveContexts(kompileOptions)::resolve, "resolving context sentences"); DefinitionTransformer resolveHeatCoolAttribute = DefinitionTransformer.fromSentenceTransformer(new ResolveHeatCoolAttribute()::resolve, "resolving heat and cool attributes"); DefinitionTransformer resolveAnonVars = DefinitionTransformer.fromSentenceTransformer(new ResolveAnonVar()::resolve, "resolving \"_\" vars"); DefinitionTransformer resolveSemanticCasts = <START> DefinitionTransformer.fromSentenceTransformer(new ResolveSemanticCasts(kompileOptions.experimental.kore)::resolve, "resolving semantic casts"); <END> DefinitionTransformer generateSortPredicateSyntax = DefinitionTransformer.from(new GenerateSortPredicateSyntax()::gen, "adding sort predicate productions"); return def -> func(this::resolveIOStreams) .andThen(resolveStrict) .andThen(resolveAnonVars) .andThen(resolveContexts) .andThen(resolveHeatCoolAttribute) .andThen(resolveSemanticCasts) .andThen(generateSortPredicateSyntax) .andThen(func(this::resolveFreshConstants)) .andThen(func(this::addImplicitComputationCellTransformer)) .andThen(func(this::concretizeTransformer)) .andThen(func(this::addSemanticsModule)) .andThen(func(this::addProgramModule)) .apply(def); }</code><technical_language>this true. intended</technical_language>

Target:
public Function<Definition, Definition> defaultSteps() { DefinitionTransformer resolveStrict = DefinitionTransformer.from(new ResolveStrict(kompileOptions)::resolve, "resolving strict and seqstrict attributes"); DefinitionTransformer resolveContexts = DefinitionTransformer.from(new ResolveContexts(kompileOptions)::resolve, "resolving context sentences"); DefinitionTransformer resolveHeatCoolAttribute = DefinitionTransformer.fromSentenceTransformer(new ResolveHeatCoolAttribute()::resolve, "resolving heat and cool attributes"); DefinitionTransformer resolveAnonVars = DefinitionTransformer.fromSentenceTransformer(new ResolveAnonVar()::resolve, "resolving \"_\" vars"); DefinitionTransformer resolveSemanticCasts = DefinitionTransformer.fromSentenceTransformer(new ResolveSemanticCasts(kompileOptions.backend.equals(Backends.JAVA))::resolve, "resolving semantic casts"); DefinitionTransformer generateSortPredicateSyntax = DefinitionTransformer.from(new GenerateSortPredicateSyntax()::gen, "adding sort predicate productions"); return def -> func(this::resolveIOStreams) .andThen(resolveStrict) .andThen(resolveAnonVars) .andThen(resolveContexts) .andThen(resolveHeatCoolAttribute) .andThen(resolveSemanticCasts) .andThen(generateSortPredicateSyntax) .andThen(func(this::resolveFreshConstants)) .andThen(func(this::addImplicitComputationCellTransformer)) .andThen(func(this::concretizeTransformer)) .andThen(func(this::addSemanticsModule)) .andThen(func(this::addProgramModule)) .apply(def); }
Source:
<code><START> protected boolean <END> isJavaCodeMiningEnabled() { return ((ISourceViewerExtension5) getSourceViewer()).hasCodeMiningProviders(); }</code><technical_language>Yes, remove then</technical_language>

Target:
boolean isJavaCodeMiningEnabled() { return ((ISourceViewerExtension5) getSourceViewer()).hasCodeMiningProviders(); }
Source:
<code>public UniprotProxySequenceReader(String accession, CompoundSet<C> compoundSet) throws CompoundNotFoundException, IOException { if (!UP_AC_PATTERN.matcher(accession.toUpperCase()).matches()) { throw new CompoundNotFoundException("Accession provided " + accession + " doesn't comply with the uniprot acession pattern."); } <START> setCompoundSet(compoundSet); <END> uniprotDoc = this.getUniprotXML(accession); String seq = this.getSequence(uniprotDoc); setContents(seq); }</code><technical_language>CompoundNotFoundException intended for cases a symbol in a sequence (nucleotide aminoacid) is recognised. a exception for this case? do people think</technical_language>

Target:
public UniprotProxySequenceReader(String accession, CompoundSet<C> compoundSet) throws CompoundNotFoundException, IOException { if (!UP_AC_PATTERN.matcher(accession.toUpperCase()).matches()) { throw new IllegalArgumentException("Accession provided " + accession + " doesn't comply with the uniprot acession pattern."); } setCompoundSet(compoundSet); uniprotDoc = this.getUniprotXML(accession); String seq = this.getSequence(uniprotDoc); setContents(seq); }
Source:
<code><START> public boolean isLastConnectionForDomain(StorageDomain storageDomain) { <END> List<StorageServerConnections> connectionsForDomain = getAllConnectionsForDomain(storageDomain.getId()); if (connectionsForDomain.size() == 1 && isConnectionAttachedToDomain(connectionsForDomain)) { return true; } return false; }</code><technical_language>validators supposed return booleans, ValidationResults</technical_language>

Target:
public boolean isLastConnectionForDomain(StorageDomain storageDomain) { List<StorageServerConnections> connectionsForDomain = getAllConnectionsForDomain(storageDomain.getId()); if (connectionsForDomain.size() == 1 && isAnyConnectionAttachedToDomain(connectionsForDomain)) { return true; } return false; }
Source:
<code>public void setEntries(ISourceContainer[] entries) { fEntries.clear(); for (ISourceContainer <START> entrie : <END> entries) { if(entrie != null) { fEntries.add(entrie); } } if (getInput() == null) { setInput(fEntries); if(!fEntries.isEmpty() && fEntries.get(0)!=null) { setSelection(new StructuredSelection(fEntries.get(0))); } } else { refresh(); } fPanel.setDirty(true); fPanel.updateLaunchConfigurationDialog(); }</code><technical_language>rename entry</technical_language>

Target:
public void setEntries(ISourceContainer[] entries) { fEntries.clear(); for (ISourceContainer entry : entries) { if(entry != null) { fEntries.add(entry); } } if (getInput() == null) { setInput(fEntries); if(!fEntries.isEmpty() && fEntries.get(0)!=null) { setSelection(new StructuredSelection(fEntries.get(0))); } } else { refresh(); } fPanel.setDirty(true); fPanel.updateLaunchConfigurationDialog(); }
Source:
<code>public void onMessage(final String message) { <START> synchronized (_isProxied) { <END> if (_isProxied.get()) { _originatorOut.write(message); } else { _destinationMessageQueue.add(message); } } }</code><technical_language>here. firing messages ProxyConnection actor for write originator</technical_language>

Target:
public void onMessage(final String message) { ProxyConnection.this.getSelf().tell(new DestinationMessage(message), ProxyConnection.this.getSelf()); }
Source:
<code>public void refreshNotationStructure() { if (hostView != null) { removeUnappliedStereotypes(hostView); if <START> (stereoList.size() <END> != 0) { refreshStereotypeStructure(); } } }</code><technical_language>List#isEmpty()</technical_language>

Target:
public void refreshNotationStructure() { if (hostView != null) { removeUnappliedStereotypes(hostView); if (!stereotypeList.isEmpty()) { refreshStereotypeStructure(); } } }
Source:
<code>private static InstanceDiscoveryMetadata processSingleJsonArray(final JSONObject jsonObject) throws JSONException { final String preferredNetwork = jsonObject.getString(PREFERRED_NETWORK); final String preferredCache = jsonObject.getString(PREFERRED_CACHE); final JSONArray aliasArray = jsonObject.getJSONArray(ALIASES); final List<String> aliases = new ArrayList<>(); for (int i = 0; i < aliasArray.length(); i++) { <START> aliases.add((String) aliasArray.get(i)); <END> } return new InstanceDiscoveryMetadata(preferredNetwork, preferredCache, aliases); }</code><technical_language>this changed aliasArray.getString</technical_language>

Target:
private static InstanceDiscoveryMetadata processSingleJsonArray(final JSONObject jsonObject) throws JSONException { final String preferredNetwork = jsonObject.getString(PREFERRED_NETWORK); final String preferredCache = jsonObject.getString(PREFERRED_CACHE); final JSONArray aliasArray = jsonObject.getJSONArray(ALIASES); final List<String> aliases = new ArrayList<>(); for (int i = 0; i < aliasArray.length(); i++) { aliases.add(aliasArray.getString(i)); } return new InstanceDiscoveryMetadata(preferredNetwork, preferredCache, aliases); }
Source:
<code>public String getTimelineLogV2() { if (logV2.isPresent()) { return logV2.get().toProtobufBase64(); } <START> else { <END> return ""; } }</code><technical_language>else necessary</technical_language>

Target:
public String getTimelineLogV2() { if (logV2.isPresent()) { return logV2.get().toProtobufBase64(); } return ""; }
Source:
<code>public boolean checkValidTopology (TTopologyTemplate topologyTemplate) { Map<TNodeTemplate, Set<TNodeTemplate>> transitiveAndDirectSuccessors = computeTransitiveClosure(topologyTemplate); for (TNodeTemplate node : getNodeTemplatesWithoutIncomingHostedOnRelationships(topologyTemplate)) { if (!ModelUtilities.getTargetLabel(node).isPresent()) { return false; } } for (TNodeTemplate node : transitiveAndDirectSuccessors.keySet()) { if (!transitiveAndDirectSuccessors.get(node).isEmpty()) { for (TNodeTemplate successor : transitiveAndDirectSuccessors.get(node)) { if (ModelUtilities.getTargetLabel(successor).isPresent() && ModelUtilities.getTargetLabel(node).isPresent() <START> && !ModelUtilities.getTargetLabel(node).get().toLowerCase().equals(ModelUtilities.getTargetLabel(successor).get().toLowerCase())) { <END> return false; } } } } return true; }</code><technical_language>Is [equalsIgnoreCase](<LINK_0></technical_language>

Target:
public boolean checkValidTopology (TTopologyTemplate topologyTemplate) { Map<TNodeTemplate, Set<TNodeTemplate>> transitiveAndDirectSuccessors = computeTransitiveClosure(topologyTemplate); for (TNodeTemplate node : getNodeTemplatesWithoutIncomingHostedOnRelationships(topologyTemplate)) { if (!ModelUtilities.getTargetLabel(node).isPresent()) { return false; } } for (TNodeTemplate node : transitiveAndDirectSuccessors.keySet()) { if (!transitiveAndDirectSuccessors.get(node).isEmpty()) { for (TNodeTemplate successor : transitiveAndDirectSuccessors.get(node)) { if (ModelUtilities.getTargetLabel(successor).isPresent() && ModelUtilities.getTargetLabel(node).isPresent() && !ModelUtilities.getTargetLabel(node).get().equalsIgnoreCase(ModelUtilities.getTargetLabel(successor).get())) { return false; } } } } return true; }
Source:
<code>public static void copyObject_test7() throws Exception { System.out.println("Test: copyObject(String bucketName, String objectName, String destBucketName," + " String destObjectName, CopyConditions copyConditions) with modified after" + " condition (Negative Case)"); String bucketName = getRandomName(); String secondBucketName = getRandomName(); String fileName = createFile(3 * MB); client.makeBucket(bucketName); client.makeBucket(secondBucketName); client.putObject(bucketName, fileName, fileName); CopyConditions copyConditions = new CopyConditions(); DateTime dateRepresentation = new DateTime(2015, Calendar.MAY, 3, 10, 10); copyConditions.setUnmodified(dateRepresentation); ErrorResponseException expectedException = null; try { client.copyObject(bucketName, fileName, secondBucketName, copyConditions); } catch (ErrorResponseException e) { expectedException = e; } if (expectedException == null || !expectedException.errorResponse().code().equals("PreconditionFailed")) { throw new Exception("[FAILED] copyObject_test7(): copying should fail with unsatisified precondition."); } <START> client.removeObject(bucketName, fileName); <END> client.removeObject(secondBucketName, fileName); client.removeBucket(bucketName); client.removeBucket(secondBucketName); }</code><technical_language>is object copied, remove client.removeObject(secondBucketName, fileName);. below. failure</technical_language>

Target:
public static void copyObject_test7() throws Exception { System.out.println("Test: copyObject(String bucketName, String objectName, String destBucketName," + "CopyConditions copyConditions) with modified after" + " condition (Negative Case)"); String filename = createFile(3 * MB); client.putObject(bucketName, filename, filename); Files.delete(Paths.get(filename)); String destBucketName = getRandomName(); client.makeBucket(destBucketName); CopyConditions copyConditions = new CopyConditions(); DateTime dateRepresentation = new DateTime(2015, Calendar.MAY, 3, 10, 10); copyConditions.setUnmodified(dateRepresentation); try { client.copyObject(bucketName, filename, destBucketName, copyConditions); } catch (ErrorResponseException e) { if (!e.errorResponse().code().equals("PreconditionFailed")) { throw e; } } client.removeObject(bucketName, filename); client.removeBucket(destBucketName); }
Source:
<code>private void setSupportedResolutions() { if (ExtensionVersion.getRuntimeVersion().compareTo(Version.VERSION_1_1) < 0) { <START> Log.d(TAG, "getSupportedResolution interface is available after vendor library " <END> + "version 1.1."); return; } List<Pair<Integer, Size[]>> supportedResolutions = null; try { supportedResolutions = mImpl.getSupportedResolutions(); } catch (NoSuchMethodError e) { Log.e(TAG, "getSupportedResolution interface is not implemented in vendor library."); } if (supportedResolutions != null) { mBuilder.setSupportedResolutions(supportedResolutions); } }</code><technical_language>Lets add debug messages. If start this for of new methods log is overfilled debug messages hard parse</technical_language>

Target:
private void setSupportedResolutions() { if (ExtensionVersion.getRuntimeVersion().compareTo(Version.VERSION_1_1) < 0) { return; } List<Pair<Integer, Size[]>> supportedResolutions = null; try { supportedResolutions = mImpl.getSupportedResolutions(); } catch (NoSuchMethodError e) { Log.e(TAG, "getSupportedResolution interface is not implemented in vendor library."); } if (supportedResolutions != null) { mBuilder.setSupportedResolutions(supportedResolutions); } }
Source:
<code>public void checkDiskError() throws IOException { Set<FsVolumeSpi> unhealthyVolumes; try { unhealthyVolumes = volumeChecker.checkAllVolumes(data); LOG.info("checkDiskError got failed volumes - {}", unhealthyVolumes.size(), unhealthyVolumes); <START> lastDiskErrorCheck = Time.monotonicNow(); <END> } catch (InterruptedException e) { LOG.error("Interruped while running disk check", e); throw new IOException("Interrupted while running disk check", e); } handleVolumeFailures(unhealthyVolumes); }</code><technical_language>this timer.monotonicNow();</technical_language>

Target:
public void checkDiskError() throws IOException { Set<FsVolumeSpi> unhealthyVolumes; try { unhealthyVolumes = volumeChecker.checkAllVolumes(data); lastDiskErrorCheck = Time.monotonicNow(); } catch (InterruptedException e) { LOG.error("Interruped while running disk check", e); throw new IOException("Interrupted while running disk check", e); } if (unhealthyVolumes.size() > 0) { LOG.warn("checkDiskError got failed volumes - {}", unhealthyVolumes.size(), unhealthyVolumes); handleVolumeFailures(unhealthyVolumes); } else { LOG.debug("checkDiskError encountered no failures"); } }
Source:
<code>public static synchronized @Nullable SegmentStoreScatterDataProvider <START> create(ITmfTrace <END> trace, @Nullable ISegmentStoreProvider provider) { if (provider == null) { return null; } SegmentStoreScatterDataProvider dataProvider = PROVIDER_MAP.get(provider); if (dataProvider != null) { return dataProvider; } if (provider instanceof IAnalysisModule) { ((IAnalysisModule) provider).schedule(); dataProvider = new SegmentStoreScatterDataProvider(trace, provider); PROVIDER_MAP.put(provider, dataProvider); } return null; }</code><technical_language>rename smth getOrCreate</technical_language>

Target:
public static synchronized @Nullable SegmentStoreScatterDataProvider create(ITmfTrace trace, @Nullable ISegmentStoreProvider provider) { if (provider == null) { return null; } SegmentStoreScatterDataProvider dataProvider = PROVIDER_MAP.get(provider); if (dataProvider != null) { return dataProvider; } dataProvider = new SegmentStoreScatterDataProvider(trace, provider); PROVIDER_MAP.put(provider, dataProvider); if (provider instanceof IAnalysisModule) { ((IAnalysisModule) provider).schedule(); } return dataProvider; }