auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void killAll() throws IOException { try { S3Utils.retryS3Operation( () -> { String bucketName = segmentPusherConfig.getBucket(); String prefix = segmentPusherConfig.getBaseKey(); int maxListingLength = inputDataConfig.getMaxListingLength(); ListObjectsV2Result result; String continuationToken = null; do { <START> log.info("Deleting batch of %d segment files from s3 location [bucket: %s prefix: %s].", <END> maxListingLength, bucketName, prefix ); ListObjectsV2Request request = new ListObjectsV2Request() .withBucketName(bucketName) .withPrefix(prefix) .withContinuationToken(continuationToken) .withMaxKeys(maxListingLength); result = s3Client.listObjectsV2(request); List<S3ObjectSummary> objectSummaries = result.getObjectSummaries(); List<DeleteObjectsRequest.KeyVersion> keyVersionsToDelete = objectSummaries.stream() .map(x -> new DeleteObjectsRequest.KeyVersion(x.getKey())) .collect(Collectors.toList()); DeleteObjectsRequest deleteRequest = new DeleteObjectsRequest(bucketName) .withBucketName(bucketName) .withKeys(keyVersionsToDelete); s3Client.deleteObjects(deleteRequest); continuationToken = result.getNextContinuationToken(); } while (result.isTruncated()); return null; } ); } catch (Exception e) { log.error("Error occurred while deleting segment files from s3. Error: %s", e.getMessage()); throw new IOException(e); } }</code><technical_language>log.info is a bit informative for this operation I think, loop least. If need log anything, I suggest counting number of keys deleted reporting total end of loop, a single message loop indicating a some deletes happen</technical_language>

Target:
public void killAll() throws IOException { log.info("Deleting all segment files from s3 location [bucket: '%s' prefix: '%s']", segmentPusherConfig.getBucket(), segmentPusherConfig.getBaseKey() ); try { S3Utils.deleteObjectsInPath( s3Client, inputDataConfig, segmentPusherConfig.getBucket(), segmentPusherConfig.getBaseKey(), Predicates.alwaysTrue() ); } catch (Exception e) { log.error("Error occurred while deleting segment files from s3. Error: %s", e.getMessage()); throw new IOException(e); } }
Source:
<code><START> private Logger getLogger() { <END> return LoggerFactory.getLogger(LitTemplateDataAnalyzer.class.getName()); }</code><technical_language>static</technical_language>

Target:
private static Logger getLogger() { return LoggerFactory.getLogger(LitTemplateDataAnalyzer.class.getName()); }
Source:
<code>public static long getNewMessageId() { <START> long id = Interpreter.getInstance().getServiceIdentifier(); <END> id = id << 32; id = id + idCounter.getAndIncrement(); return id; }</code><technical_language>Mmh, return (((long) Interpreter.getInstance().getServiceIdentifier()) << 32) | (idCounter.getAndIncrement() & 0xffffffffL);</technical_language>

Target:
public static long getNewMessageId() { long id = Jolie.cellId; id = id << 32; id = id + ID_COUNTER.getAndIncrement(); return id; }
Source:
<code>public Source resolve(String href, String base) throws TransformerException { InputStream stream = ClassPathURIResolver.class.getClassLoader() .getResourceAsStream(rulesDir.concat(File.separator).concat(href)); <START> if (null != stream) { <END> return new StreamSource(stream); } else { if (null != clientUriResolver) { return clientUriResolver.resolve(href, base); } else { return new StreamSource(stream); } } }</code><technical_language>Flip if do X != null style in Camel</technical_language>

Target:
public Source resolve(String href, String base) throws TransformerException { InputStream stream = ClassPathURIResolver.class.getClassLoader() .getResourceAsStream(rulesDir.concat(File.separator).concat(href)); if (stream != null) { return new StreamSource(stream); } else { if (clientUriResolver != null) { return clientUriResolver.resolve(href, base); } else { return new StreamSource(stream); } } }
Source:
<code>public Double getDoubleByHeaderName(String fieldName) { String value = getStringByHeaderName(fieldName); if (value != null) { <START> value = value.replace("<=","").trim(); <END> return Double.parseDouble(value); } else { return null; } }</code><technical_language>Is this operator remove? Otherwise, create a regex do a replaceAll. java // Ignore operators spaces double values private static final Pattern DOUBLE_IGNORE_PATTERN = Pattern.compile("[<>= ]+"); ... = DOUBLE_IGNORE_PATTERN.matcher(value).replaceAll("");</technical_language>

Target:
public Double getDoubleByHeaderName(String fieldName) { String value = getStringByHeaderName(fieldName); if (value != null) { value = DOUBLE_IGNORE_PATTERN.matcher(value).replaceAll(""); return Double.parseDouble(value); } else { return null; } }
Source:
<code>private static boolean checkIfCanAddToParentModules(Property property, boolean checkFilter) { if (property != null) { List<Relation> relations = RelationshipItemBuilder.getInstance().getItemsRelatedTo(property.getId(), property.getVersion(), RelationshipItemBuilder.JOB_RELATION); for (Relation relation : relations) { if (RelationshipItemBuilder.SERVICES_RELATION.equals(relation.getType())) { return false; } } if (property.getItem() != null && property.getItem().getState() != null && property.getItem().getState().isDeleted() && PomIdsHelper.getIfExcludeDeletedItems(property)) { return false; } <START> if (Boolean.getBoolean(SYS_PROP_INCLUDE_REFERENCED_JOBLETS_ONLY)) { <END> Map<Relation, Set<Relation>> allrelations = RelationshipItemBuilder.getInstance() .getCurrentProjectItemsRelations(); boolean found = false; Item item = property.getItem(); if (item != null && item instanceof JobletProcessItem) { for (Set<Relation> relationItems : allrelations.values()) { for (Relation relation : relationItems) { if (property.getId().equals(relation.getId()) && property.getVersion().equals(relation.getVersion())) { found = true; } } } if (!found) { return false; } } } } if (checkFilter) { if (GlobalServiceRegister.getDefault().isServiceRegistered(IFilterService.class)) { IFilterService filterService = (IFilterService) GlobalServiceRegister.getDefault() .getService(IFilterService.class); if (property != null && !filterService.isFilterAccepted(property.getItem(), PomIdsHelper.getPomFilter())) { return false; } } } return true; }</code><technical_language>do plan that? performance for testing only? in fact do default even... bug, is like: user wrong index file right</technical_language>

Target:
private static boolean checkIfCanAddToParentModules(Property property, boolean checkFilter) { if (property != null) { List<Relation> relations = RelationshipItemBuilder.getInstance().getItemsRelatedTo(property.getId(), property.getVersion(), RelationshipItemBuilder.JOB_RELATION); for (Relation relation : relations) { if (RelationshipItemBuilder.SERVICES_RELATION.equals(relation.getType())) { return false; } } if (property.getItem() != null && property.getItem().getState() != null && property.getItem().getState().isDeleted() && PomIdsHelper.getIfExcludeDeletedItems(property)) { return false; } } if (checkFilter) { if (GlobalServiceRegister.getDefault().isServiceRegistered(IFilterService.class)) { IFilterService filterService = (IFilterService) GlobalServiceRegister.getDefault() .getService(IFilterService.class); if (property != null && !filterService.isFilterAccepted(property.getItem(), PomIdsHelper.getPomFilter())) { return false; } } } return true; }
Source:
<code>private void refreshIfRequired(Runnable refreshCallback) { <START> synchronized (lock) { <END> if (dirty.get()) { long currentTime = clock.getTime(); if (currentTime - lastRefreshTime > refreshDelta && dirty.compareAndSet(true, false)) { lastRefreshTime = currentTime; refreshCallback.run(); } } } }</code><technical_language>please explain is intention synchronizing lock . Do want dirty stays false while refreshCallback is running</technical_language>

Target:
private void refreshIfRequired(Runnable refreshCallback) { if (dirty.get()){ long currentTime = clock.getTime(); if (currentTime - lastRefreshTime > refreshDelta && dirty.compareAndSet(true, false)){ lastRefreshTime = currentTime; refreshCallback.run(); } } }
Source:
<code>private PDataType getViewIndexType(Cell[] tableKeyValues) { <START> Cell useLongViewIndexKv = tableKeyValues[USE_LONG_VIEW_INDEX]; <END> boolean useLongViewIndex = useLongViewIndexKv != null; return useLongViewIndex ? MetaDataUtil.getViewIndexIdDataType() : MetaDataUtil.getLegacyViewIndexIdDataType(); }</code><technical_language>For existing tables VIEW_INDEX_ID column store index a short while for new tables stored a long. cleaner create a new column stores view index id a long. In QueryServicesConnectionImpl.upgradeSystemTables() set new column based existing value. Finally remove existing VIEW_INDEX_ID in next release. WDYT @JamesRTaylor</technical_language>

Target:
private PDataType getViewIndexType(Cell[] tableKeyValues) { Cell dataTypeKv = tableKeyValues[VIEW_INDEX_ID_DATA_TYPE]; return PDataType.fromTypeId(PInteger.INSTANCE.getCodec() .decodeInt(dataTypeKv.getValueArray(), dataTypeKv.getValueOffset(), SortOrder.getDefault())); }
Source:
<code>protected long calculatePartSize(long length) { long lengthInMB = (long) (length / (1L << 20)) + 1; double fpPartSizeInMB = sqrt(DEFAULT_RATIO * lengthInMB); <START> long partSizeInMB = (long) pow(2, floor(log(fpPartSizeInMB) / log(2)) + 1); END> if (partSizeInMB < 1) return 1; else if (partSizeInMB > MAX_PART_SIZE) return MAX_PART_SIZE; return partSizeInMB; }</code><technical_language>calculate next power of more succinctly: partSizeInMB = Long.highestOneBit(fsPartSizeInMB - 1) << 1;</technical_language>

Target:
protected long calculatePartSize(long length) { long lengthInMB = (long) (length / (1L << 20)) + 1; double fpPartSizeInMB = sqrt(ratio * lengthInMB); long partSizeInMB = Long.highestOneBit((long) fpPartSizeInMB - 1) << 1; if (partSizeInMB < 1) return 1; else if (partSizeInMB > MAX_PART_SIZE) return MAX_PART_SIZE; return partSizeInMB; }
Source:
<code>protected List getContributors(List elements) { List commonAdapters = new ArrayList(); List commonClasses = getCommonClasses(elements, commonAdapters); Class resourceClass = getCommonResourceClass(elements); Class resourceMappingClass = getResourceMappingClass(elements); List contributors = new ArrayList(); if (resourceClass != null) { addAll(contributors, getResourceContributors(resourceClass)); } if (commonClasses != null && !commonClasses.isEmpty()) { for (Object <START> commonClasse : <END> commonClasses) { List results = getObjectContributors((Class) commonClasse); addAll(contributors, results); } } if (resourceMappingClass == null) { resourceMappingClass = LegacyResourceSupport.getResourceMappingClass(); if (resourceMappingClass != null && commonAdapters.contains(resourceMappingClass.getName())) { addAll(contributors, getResourceContributors(resourceMappingClass)); } } else { contributors.addAll(getResourceContributors(resourceMappingClass)); } if (!commonAdapters.isEmpty()) { for (Iterator it = commonAdapters.iterator(); it.hasNext();) { String adapter = (String) it.next(); addAll(contributors, getAdaptableContributors(adapter)); } } contributors = removeDups(contributors); return contributors.isEmpty() ? Collections.EMPTY_LIST : new ArrayList(contributors); }</code><technical_language>rename commonClass</technical_language>

Target:
protected List getContributors(List elements) { List commonAdapters = new ArrayList(); List commonClasses = getCommonClasses(elements, commonAdapters); Class resourceClass = getCommonResourceClass(elements); Class resourceMappingClass = getResourceMappingClass(elements); List contributors = new ArrayList(); if (resourceClass != null) { addAll(contributors, getResourceContributors(resourceClass)); } if (commonClasses != null && !commonClasses.isEmpty()) { for (Object commonClass : commonClasses) { List results = getObjectContributors((Class) commonClass); addAll(contributors, results); } } if (resourceMappingClass == null) { resourceMappingClass = LegacyResourceSupport.getResourceMappingClass(); if (resourceMappingClass != null && commonAdapters.contains(resourceMappingClass.getName())) { addAll(contributors, getResourceContributors(resourceMappingClass)); } } else { contributors.addAll(getResourceContributors(resourceMappingClass)); } if (!commonAdapters.isEmpty()) { for (Iterator it = commonAdapters.iterator(); it.hasNext();) { String adapter = (String) it.next(); addAll(contributors, getAdaptableContributors(adapter)); } } contributors = removeDups(contributors); return contributors.isEmpty() ? Collections.EMPTY_LIST : new ArrayList(contributors); }
Source:
<code>public byte[] evaluateChallenge(final byte[] challenge) throws SaslException { if (complete) { throw saslPlain.mechMessageAfterComplete().toSaslException(); } complete = true; if (challenge.length > 0) { throw saslPlain.mechInvalidMessageReceived().toSaslException(); } final NameCallback nameCallback = new NameCallback("Login name"); final PasswordCallback passwordCallback = new PasswordCallback("Password", false); try { cbh.handle(new Callback[] { nameCallback, passwordCallback }); } catch (SaslException e) { throw e; } catch (IOException | UnsupportedCallbackException e) { throw saslPlain.mechCallbackHandlerFailedForUnknownReason(e).toSaslException(); } final String name = nameCallback.getName(); if (name == null) { throw saslPlain.mechNoLoginNameGiven().toSaslException(); } final char[] password = passwordCallback.getPassword(); if (password == null) { throw saslPlain.mechNoPasswordGiven().toSaslException(); } try { final ByteStringBuilder b = new ByteStringBuilder(); if (authorizationId != null) { StringPrep.encode(authorizationId, b, StringPrep.PROFILE_SASL_STORED); } b.append((byte) 0); <START> StringPrep.encode(name, b, StringPrep.PROFILE_SASL_STORED); <END> b.append((byte) 0); StringPrep.encode(password, b, this.passwordProfile); return b.toArray(); } catch (IllegalArgumentException ex) { throw saslPlain.mechMalformedFields(ex).toSaslException(); } }</code><technical_language>For consistency, I sense update other usages of StringPrep.PROFILE_SASL_STORED this.passwordProfile update authentication id in test case accordingly</technical_language>

Target:
public byte[] evaluateChallenge(final byte[] challenge) throws SaslException { if (complete) { throw saslPlain.mechMessageAfterComplete().toSaslException(); } complete = true; if (challenge.length > 0) { throw saslPlain.mechInvalidMessageReceived().toSaslException(); } final NameCallback nameCallback = new NameCallback("Login name"); final PasswordCallback passwordCallback = new PasswordCallback("Password", false); try { cbh.handle(new Callback[] { nameCallback, passwordCallback }); } catch (SaslException e) { throw e; } catch (IOException | UnsupportedCallbackException e) { throw saslPlain.mechCallbackHandlerFailedForUnknownReason(e).toSaslException(); } final String name = nameCallback.getName(); if (name == null) { throw saslPlain.mechNoLoginNameGiven().toSaslException(); } final char[] password = passwordCallback.getPassword(); if (password == null) { throw saslPlain.mechNoPasswordGiven().toSaslException(); } try { final ByteStringBuilder b = new ByteStringBuilder(); if (authorizationId != null) { StringPrep.encode(authorizationId, b, this.profile); } b.append((byte) 0); StringPrep.encode(name, b, this.profile); b.append((byte) 0); StringPrep.encode(password, b, this.profile); return b.toArray(); } catch (IllegalArgumentException ex) { throw saslPlain.mechMalformedFields(ex).toSaslException(); } }
Source:
<code>private void killTaskGroupForPartitions(Set<Integer> partitions) { for (Integer partition : partitions) { TaskGroup taskGroup = taskGroups.get(getTaskGroupIdForPartition(partition)); if (taskGroup != null) { <START> for (Map.Entry<String, TaskData> entry : taskGroup.tasks.entrySet()) { <END> String taskId = entry.getKey(); log.info("Reset dataSource[%s] - killing task [%s]", dataSource, taskId); killTask(taskId); } } partitionGroups.remove(getTaskGroupIdForPartition(partition)); taskGroups.remove(getTaskGroupIdForPartition(partition)); } }</code><technical_language>JavaCompatUtils.keySet() need values</technical_language>

Target:
private void killTaskGroupForPartitions(Set<Integer> partitions) { for (Integer partition : partitions) { TaskGroup taskGroup = taskGroups.get(getTaskGroupIdForPartition(partition)); if (taskGroup != null) { for (String taskId : JavaCompatUtils.keySet(taskGroup.tasks)) { log.info("Reset dataSource[%s] - killing task [%s]", dataSource, taskId); killTask(taskId); } } partitionGroups.remove(getTaskGroupIdForPartition(partition)); taskGroups.remove(getTaskGroupIdForPartition(partition)); } }
Source:
<code>public io.confluent.connect.storage.format.RecordWriter getRecordWriter( final HdfsSinkConnectorConfig conf, final String filename ) { return new io.confluent.connect.storage.format.RecordWriter() { final DataFileWriter<Object> writer = new DataFileWriter<>(new GenericDatumWriter<>()); final Path path = new Path(filename); Schema schema = null; <START> public io.confluent.connect.storage.format.RecordWriter init() { <END> writer.setCodec(CodecFactory.fromString(conf.getAvroCodec())); return this; } @Override public void write(SinkRecord record) { if (schema == null) { schema = record.valueSchema(); try { log.info("Opening record writer for: {}", filename); final FSDataOutputStream out = path.getFileSystem(conf.getHadoopConfiguration()) .create(path); org.apache.avro.Schema avroSchema = avroData.fromConnectSchema(schema); writer.create(avroSchema, out); } catch (IOException e) { throw new ConnectException(e); } } log.trace("Sink record: {}", record); Object value = avroData.fromConnectData(schema, record.value()); try { if (value instanceof NonRecordContainer) { writer.append(((NonRecordContainer) value).getValue()); } else { writer.append(value); } } catch (IOException e) { throw new DataException(e); } } @Override public void close() { try { writer.close(); } catch (IOException e) { throw new DataException(e); } } @Override public void commit() }.init(); }</code><technical_language>Turns out setCodec returns instance of object itself. setCodec in place in a chain call instead of adding init. This ok for now. I guess faced need introduce "init" method, time turn class anonymous class add this logic constructor</technical_language>

Target:
public io.confluent.connect.storage.format.RecordWriter getRecordWriter( final HdfsSinkConnectorConfig conf, final String filename ) { return new io.confluent.connect.storage.format.RecordWriter() { final DataFileWriter<Object> writer = new DataFileWriter<>(new GenericDatumWriter<>()); final Path path = new Path(filename); Schema schema = null; @Override public void write(SinkRecord record) { if (schema == null) { schema = record.valueSchema(); try { log.info("Opening record writer for: {}", filename); final FSDataOutputStream out = path.getFileSystem(conf.getHadoopConfiguration()) .create(path); org.apache.avro.Schema avroSchema = avroData.fromConnectSchema(schema); writer.setCodec(CodecFactory.fromString(conf.getAvroCodec())); writer.create(avroSchema, out); } catch (IOException e) { throw new ConnectException(e); } } log.trace("Sink record: {}", record); Object value = avroData.fromConnectData(schema, record.value()); try { if (value instanceof NonRecordContainer) { writer.append(((NonRecordContainer) value).getValue()); } else { writer.append(value); } } catch (IOException e) { throw new DataException(e); } } @Override public void close() { try { writer.close(); } catch (IOException e) { throw new DataException(e); } } @Override public void commit() }; }
Source:
<code>@Override public void updateBasicAlerts(final IJob job, final boolean basicAlerts, final boolean basicPages) { @Nullable final Group group = this.groupManager.getGroup(job.getGroup()); if (group == null) { <START> log.info("group was null"); <END> return; } final Set<AbstractJobAlert> alerts = this.jobAlertRunner.getAlertsForJob(job.getId()); BasicAlerts existingBasicAlerts = BasicAlerts.create(alerts, BASIC_ALERT); BasicAlerts existingBasicPages = BasicAlerts.create(alerts, BASIC_PAGE); this.updateBasicAlert( existingBasicAlerts, job, basicAlerts, job.getBasicAlerts(), BASIC_ALERT, group.email, group.webhookURL, job::setBasicAlerts ); this.updateBasicAlert( existingBasicPages, job, basicPages, job.getBasicPages(), BASIC_PAGE, group.pagerEmail, null, job::setBasicPages ); }</code><technical_language>log.warn, include more info in message job id group name. Ideally user some kind of feedback for this, a lot more code want change now</technical_language>

Target:
@Override public void updateBasicAlerts(final IJob job, final boolean basicAlerts, final boolean basicPages) { @Nullable final Group group = this.groupManager.getGroup(job.getGroup()); if (group == null) { log.warn("No group '{}' found for job {}. Unable to create alerts without config.", job.getGroup(), job.getId()); return; } final Set<AbstractJobAlert> alerts = this.jobAlertRunner.getAlertsForJob(job.getId()); BasicAlerts existingBasicAlerts = BasicAlerts.create(alerts, BASIC_ALERT); BasicAlerts existingBasicPages = BasicAlerts.create(alerts, BASIC_PAGE); this.updateBasicAlert( existingBasicAlerts, job, basicAlerts, job.getBasicAlerts(), BASIC_ALERT, group.email, group.webhookURL, job::setBasicAlerts ); this.updateBasicAlert( existingBasicPages, job, basicPages, job.getBasicPages(), BASIC_PAGE, group.pagerEmail, null, job::setBasicPages ); }
Source:
<code>public int countChildren(String path) { checkIfPathContainsShardingKey(path); <START> return countChildren(path); <END> }</code><technical_language>Typo? _rawZkClient.countChildren() Otherwise, a stack overflow :)</technical_language>

Target:
public int countChildren(String path) { checkIfPathContainsShardingKey(path); return _rawZkClient.countChildren(path); }
Source:
<code>public static VDSReturnValue runVdsCommandWithFailover(VDSCommandType vdsCommandType, VdsIdVDSCommandParametersBase params, Guid storagePoolId, CommandBase<?> cmd) { return <START> runVdsCommandWithFailover(vdsCommandType, <END> params, storagePoolId, cmd, true); }</code><technical_language>is "withoutfailover" ? calls runVdsCommand method</technical_language>

Target:
public static VDSReturnValue runVdsCommandWithFailover(VDSCommandType vdsCommandType, VdsIdVDSCommandParametersBase params, Guid storagePoolId, CommandBase<?> cmd) { return runVdsCommand(vdsCommandType, params, storagePoolId, cmd, true); }
Source:
<code>private void sendPongResponse(WebSocketMessage webSocketMessage){ if( webSocketMessage instanceof WebSocketProxyV13.WebSocketMessageV13){ <START> WebSocketProxyV13.WebSocketMessageV13 webSocketMessageV13 = (WebSocketProxyV13.WebSocketMessageV13) webSocketMessage; <END> WebSocketMessageDTO webSocketMessageDTO = webSocketMessageV13.getDTO(); webSocketMessageDTO.readableOpcode = WebSocketMessage.opcode2string(WebSocketMessage.OPCODE_PONG); webSocketMessageDTO.opcode = WebSocketMessage.OPCODE_PONG; webSocketMessageDTO.isOutgoing = true; webSocketMessageDTO.id++; try { sendAndNotify(webSocketMessageDTO, Initiator.MANUAL_REQUEST); } catch (IOException e) { logger.warn(e.getStackTrace().toString()); } }else{ logger.warn("Haven't been supported that WebSocket Version yet"); } }</code><technical_language>necessary type check cast, getDTO is a method WebSocketMessage</technical_language>

Target:
private void sendPongResponse(WebSocketMessage webSocketMessage){ WebSocketMessageDTO webSocketMessageDTO = webSocketMessage.getDTO(); webSocketMessageDTO.readableOpcode = WebSocketMessage.opcode2string(WebSocketMessage.OPCODE_PONG); webSocketMessageDTO.opcode = WebSocketMessage.OPCODE_PONG; webSocketMessageDTO.isOutgoing = !webSocketMessageDTO.isOutgoing; webSocketMessageDTO.hasChanged = true; try { sendAndNotify(webSocketMessageDTO, Initiator.MANUAL_REQUEST); } catch (IOException e) { logger.warn("Failed to send Pong response:", e); } }
Source:
<code>public Uri getTakePhotoUri() { File file; if (Config.ONLY_INTERNAL_STORAGE) { file = new File(mXmppConnectionService.getCacheDir().getAbsolutePath(), "Camera/IMG_" + this.IMAGE_DATE_FORMAT.format(new Date()) + ".jpg"); } else { file = new File(getTakePhotoPath() + "IMG_" + this.IMAGE_DATE_FORMAT.format(new Date()) + ".jpg"); } file.getParentFile().mkdirs(); <START> if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { <END> return FileProvider.getUriForFile(mXmppConnectionService, CONVERSATIONS_FILE_PROVIDER, file); } else { return Uri.fromFile(file); } }</code><technical_language>this read if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N || Config.ONLY_INTERNAL_STORAGE) { work if flag is set pre M androids</technical_language>

Target:
public Uri getTakePhotoUri() { File file; if (Config.ONLY_INTERNAL_STORAGE) { file = new File(mXmppConnectionService.getCacheDir().getAbsolutePath(), "Camera/IMG_" + this.IMAGE_DATE_FORMAT.format(new Date()) + ".jpg"); } else { file = new File(getTakePhotoPath() + "IMG_" + this.IMAGE_DATE_FORMAT.format(new Date()) + ".jpg"); } file.getParentFile().mkdirs(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N || Config.ONLY_INTERNAL_STORAGE) { return FileProvider.getUriForFile(mXmppConnectionService, CONVERSATIONS_FILE_PROVIDER, file); } else { return Uri.fromFile(file); } }
Source:
<code>void handleRepeatedInvocation() { cancelFutures(); List<ICompletionProposal> computedProposals= Collections.synchronizedList(new ArrayList<>()); fFutures= buildCompletionFuturesOrJobs(fInvocationOffset); List<CompletableFuture<Void>> populateFutures= new ArrayList<>(fFutures.size()); for (CompletableFuture<List<ICompletionProposal>> future : fFutures) { populateFutures.add(future.thenAccept(proposals -> computedProposals.addAll(proposals))); } ComputingProposal computingProposal= new ComputingProposal(fInvocationOffset, fFutures.size()); computedProposals.add(0, computingProposal); fComputedProposals= computedProposals; setProposals(fComputedProposals, false); Set<CompletableFuture<Void>> remaining= Collections.synchronizedSet(new HashSet<>(populateFutures)); for (CompletableFuture<Void> populateFuture : populateFutures) { populateFuture.thenRun(() -> { remaining.removeIf(CompletableFuture::isDone); computingProposal.setRemaining(remaining.size()); if (remaining.isEmpty()) { computedProposals.remove(computingProposal); } List<ICompletionProposal> newProposals= new ArrayList<>(computedProposals); fComputedProposals= newProposals; Display.getDefault().asyncExec(() -> { setProposals(newProposals, false); displayProposals(); }); }); } <START> displayProposals(); <END> }</code><technical_language>is room for a major factorization showProposals here. it? identify a reason preferring duplication here</technical_language>

Target:
void handleRepeatedInvocation() { cancelFutures(); fFutures= buildCompletionFuturesOrJobs(fInvocationOffset); runFutures(fInvocationOffset, null, false, false, false); }
Source:
<code>private final void update(String userInput) { List<String> confirmedKeywords = getConfirmedKeywords(userInput); for (String confirmedKeyword : confirmedKeywords) { <START> updateAssignedLabels(Optional.ofNullable(TurboLabel.getMatchedLabels(allLabels, confirmedKeyword).get(0))); <END> } Optional<String> keywordInProgess = getKeywordInProgress(userInput); if (keywordInProgess.isPresent()) { updateMatchedLabels(keywordInProgess.get()); updateSuggestionIndex(keywordInProgess.get(), matchedLabels); } }</code><technical_language>Is a need for ofNullable? nulls in list</technical_language>

Target:
private final void update(String userInput) { List<String> confirmedKeywords = getConfirmedKeywords(userInput); for (String confirmedKeyword : confirmedKeywords) { TurboLabel.getMatchedLabels(allLabels, confirmedKeyword) .stream().findFirst().ifPresent(this::updateAssignedLabels); } Optional<String> keywordInProgess = getKeywordInProgress(userInput); if (keywordInProgess.isPresent()) { updateMatchedLabels(keywordInProgess.get()); updateSuggestionIndex(keywordInProgess.get(), matchedLabels); } }
Source:
<code>public void testInsertUnpartitioned() { String tableName = "test_basic_statistics_unpartitioned_insert_presto"; onPresto().executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); onPresto().executeQuery(format("" + "CREATE TABLE %s (" + " n_nationkey bigint, " + " n_regionkey bigint, " + " n_name varchar(25), " + <START> " n_comment varchar(152)" + <END> ")", tableName)); try { BasicStatistics statisticsEmpty = getBasicStatisticsForTable(onHive(), tableName); assertThatStatisticsArePresent(statisticsEmpty); assertThatStatisticsAreZero(statisticsEmpty); insertNationData(onPresto(), tableName); BasicStatistics statisticsFirstInsert = getBasicStatisticsForTable(onHive(), tableName); assertThatStatisticsArePresent(statisticsFirstInsert); assertThatStatisticsAreNonZero(statisticsFirstInsert); assertThat(statisticsFirstInsert.getNumRows().getAsLong()).isEqualTo(25); insertNationData(onPresto(), tableName); BasicStatistics statisticsSecondInsert = getBasicStatisticsForTable(onHive(), tableName); assertThatStatisticsArePresent(statisticsSecondInsert); assertThatStatisticsAreNonZero(statisticsSecondInsert); assertThatStatisticsValuesHaveIncreased(statisticsFirstInsert, statisticsSecondInsert); assertThat(statisticsSecondInsert.getNumRows().getAsLong()).isEqualTo(50); assertThat(statisticsSecondInsert.getNumPartitions().getAsLong()).isEqualTo(0); } finally { onPresto().executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); } }</code><technical_language>is onPresto(). needed? simple io.prestodb.tempto.query.QueryExecutor.query</technical_language>

Target:
public void testInsertUnpartitioned() { String tableName = "test_basic_statistics_unpartitioned_insert_presto"; onPresto().executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); onPresto().executeQuery(format("" + "CREATE TABLE %s (" + " n_nationkey bigint, " + " n_regionkey bigint, " + " n_name varchar(25), " + " n_comment varchar(152)" + ")", tableName)); try { BasicStatistics statisticsEmpty = getBasicStatisticsForTable(onHive(), tableName); assertThatStatisticsAreZero(statisticsEmpty); insertNationData(onPresto(), tableName); BasicStatistics statisticsFirstInsert = getBasicStatisticsForTable(onHive(), tableName); assertThatStatisticsAreNonZero(statisticsFirstInsert); assertThat(statisticsFirstInsert.getNumRows().getAsLong()).isEqualTo(25); insertNationData(onPresto(), tableName); BasicStatistics statisticsSecondInsert = getBasicStatisticsForTable(onHive(), tableName); assertThatStatisticsAreNonZero(statisticsSecondInsert); assertThatStatisticsValuesHaveIncreased(statisticsFirstInsert, statisticsSecondInsert); assertThat(statisticsSecondInsert.getNumRows().getAsLong()).isEqualTo(50); } finally { onPresto().executeQuery(format("DROP TABLE IF EXISTS %s", tableName)); } }
Source:
<code>public OpenApiResource(@JaxrsResource Set<Object> jaxrsResources) { <START> this.jaxrsResources = jaxrsResources; <END> }</code><technical_language>requireNonNull(jaxrsResources, "jaxrsResouces is null")</technical_language>

Target:
public OpenApiResource(@JaxrsResource Set<Object> jaxrsResources) { this.jaxrsResources = requireNonNull(jaxrsResources, "jaxrsResources is null"); }
Source:
<code>public void onActivityPaused(final Activity activity) { mPaused = true; if (check != null) { mHandler.removeCallbacks(check); } mCurrentActivity = null; mHandler.postDelayed(check = new Runnable(){ @Override public void run() { if (mIsForeground && mPaused) { mIsForeground = false; try { double sessionLength = System.currentTimeMillis() - sStartSessionTime; if (sessionLength >= mConfig.getMinimumSessionDuration() && sessionLength < mConfig.getSessionTimeoutDuration()) { NumberFormat nf = NumberFormat.getNumberInstance(Locale.ENGLISH); nf.setMaximumFractionDigits(1); String sessionLengthString = nf.format((System.currentTimeMillis() - sStartSessionTime) / 1000); JSONObject sessionProperties = new JSONObject(); sessionProperties.put(AutomaticEvents.SESSION_LENGTH, sessionLengthString); <START> if (mMpInstance.getPeople().isIdentified()) { <END> mMpInstance.getPeople().increment(AutomaticEvents.TOTAL_SESSIONS, 1); mMpInstance.getPeople().increment(AutomaticEvents.TOTAL_SESSIONS_LENGTH, sessionLength / 1000); } mMpInstance.track(AutomaticEvents.SESSION, sessionProperties, true); } } catch (JSONException e) { e.printStackTrace(); } mMpInstance.onBackground(); } } }, CHECK_DELAY); }</code><technical_language>need check this. if user is identified, updates queued in disk flushed identify() is called :)</technical_language>

Target:
public void onActivityPaused(final Activity activity) { mPaused = true; if (check != null) { mHandler.removeCallbacks(check); } mCurrentActivity = null; mHandler.postDelayed(check = new Runnable(){ @Override public void run() { if (mIsForeground && mPaused) { mIsForeground = false; try { double sessionLength = System.currentTimeMillis() - sStartSessionTime; if (sessionLength >= mConfig.getMinimumSessionDuration() && sessionLength < mConfig.getSessionTimeoutDuration()) { NumberFormat nf = NumberFormat.getNumberInstance(Locale.ENGLISH); nf.setMaximumFractionDigits(1); String sessionLengthString = nf.format((System.currentTimeMillis() - sStartSessionTime) / 1000); JSONObject sessionProperties = new JSONObject(); sessionProperties.put(AutomaticEvents.SESSION_LENGTH, sessionLengthString); mMpInstance.getPeople().increment(AutomaticEvents.TOTAL_SESSIONS, 1); mMpInstance.getPeople().increment(AutomaticEvents.TOTAL_SESSIONS_LENGTH, sessionLength / 1000); mMpInstance.track(AutomaticEvents.SESSION, sessionProperties, true); } } catch (JSONException e) { e.printStackTrace(); } mMpInstance.onBackground(); } } }, CHECK_DELAY); }
Source:
<code>public void return_null_if_file_doesnt_exist() { ComponentDto project = db.components().insertMainBranch(); ComponentDto mergeBranch = db.components().insertProjectBranch(project, b -> b.setKey("mergeBranch")); ComponentDto branch1 = db.components().insertProjectBranch(project, b -> b.setKey("branch1")); ComponentDto mergeBranchFile = ComponentTesting.newFileDto(mergeBranch, null, "file").setUuid("mergeFile"); <START> ComponentDto file = ComponentTesting.newFileDto(branch1, null, "file").setUuid("file1"); <END> db.components().insertComponents(mergeBranchFile, file); when(branch.getMergeBranchUuid()).thenReturn(Optional.of(mergeBranch.uuid())); assertThat(underTest.getUuid("doesnt exist")).isNull(); }</code><technical_language>files useful in this test case</technical_language>

Target:
public void return_null_if_file_doesnt_exist() { when(branch.getMergeBranchUuid()).thenReturn(Optional.of(mergeBranch.uuid())); assertThat(underTest.getUuid("doesnt exist")).isNull(); }
Source:
<code>public void testGetRuleListWith404() throws InterruptedException { server.enqueue(response404()); List<FirewallRule> list = firewallApi().list("datacenter-id", "server-id", "nic-id", new DepthOptions().depth(1)); assertTrue(list.isEmpty()); assertEquals(server.getRequestCount(), 1); assertSent(server, "GET", "/datacenters/datacenter-id/servers/server-id/nics/nic-id/firewallrules?depth=1"); <START> } <END></code><technical_language>Change name reflect this tests "withDepth" method. - missing a test verifies list depth 404</technical_language>

Target:
public void testGetRuleListWith404() throws InterruptedException { server.enqueue(response404()); List<FirewallRule> list = firewallApi().list("datacenter-id", "server-id", "nic-id"); assertTrue(list.isEmpty()); assertEquals(server.getRequestCount(), 1); assertSent(server, "GET", "/datacenters/datacenter-id/servers/server-id/nics/nic-id/firewallrules"); }
Source:
<code>public static String getGerritJarPluginName(File srcFile) throws IOException { <START> JarFile jarFile = new JarFile(srcFile); try { return jarFile.getManifest().getMainAttributes() .getValue("Gerrit-PluginName"); } finally { jarFile.close(); } <END> }</code><technical_language>This is a new code, mved it, consider Java7 try-with-resources statement: try (JarFile jarFile = new JarFile(srcFile)) { return jarFile.getManifest().getMainAttributes() .getValue("Gerrit-PluginName"); }</technical_language>

Target:
public static String getGerritJarPluginName(File srcFile) throws IOException { try (JarFile jarFile = new JarFile(srcFile)) { return jarFile.getManifest().getMainAttributes() .getValue("Gerrit-PluginName"); } }
Source:
<code>private void fullTest(int size, int[] fuzz, String distributionName) { PerformanceMeter pMinsertion = perf.createPerformanceMeter(distributionName + " Insertion: " + fName); <START> PerformanceMeter pMiterateStart = perf.createPerformanceMeter(distributionName + " Iterate sorted by start: " + fName); <END> PerformanceMeter pMiterateEnd = perf.createPerformanceMeter(distributionName + " Iterate sorted by end: " + fName); PerformanceMeter pMiterateDuration = perf.createPerformanceMeter(distributionName + " Iterate sorted by length: " + fName); for (int i = 0; i < DEFAULT_LOOP_COUNT; i++) { fSegStore.clear(); pMinsertion.start(); populate(size, fuzz, fSegStore, getSegmentStoreSize()); pMiterateStart.start(); sortedIterate(fSegStore, SegmentComparators.INTERVAL_START_COMPARATOR); pMiterateStart.stop(); pMiterateEnd.start(); sortedIterate(fSegStore, SegmentComparators.INTERVAL_END_COMPARATOR); pMiterateEnd.stop(); pMiterateDuration.start(); sortedIterate(fSegStore, SegmentComparators.INTERVAL_LENGTH_COMPARATOR); pMiterateDuration.stop(); } pMinsertion.commit(); pMiterateStart.commit(); pMiterateEnd.commit(); pMiterateDuration.commit(); }</code><technical_language>Missing default iterator, sorted</technical_language>

Target:
private void fullTest(int size, int[] fuzz, String distributionName) { PerformanceMeter pMinsertion = fPerf.createPerformanceMeter(distributionName + " Insertion: " + fName); PerformanceMeter pMiterateStart = fPerf.createPerformanceMeter(distributionName + " Iterate sorted by start: " + fName); PerformanceMeter pMiterateEnd = fPerf.createPerformanceMeter(distributionName + " Iterate sorted by end: " + fName); PerformanceMeter pMiterateDuration = fPerf.createPerformanceMeter(distributionName + " Iterate sorted by length: " + fName); for (int i = 0; i < DEFAULT_LOOP_COUNT; i++) { fSegStore.clear(); pMinsertion.start(); populate(size, fuzz, fSegStore, 0, getSegmentStoreSize()); pMinsertion.stop(); pMiterateStart.start(); sortedIterate(fSegStore, SegmentComparators.INTERVAL_START_COMPARATOR); pMiterateStart.stop(); pMiterateEnd.start(); sortedIterate(fSegStore, SegmentComparators.INTERVAL_END_COMPARATOR); pMiterateEnd.stop(); pMiterateDuration.start(); sortedIterate(fSegStore, SegmentComparators.INTERVAL_LENGTH_COMPARATOR); pMiterateDuration.stop(); } pMinsertion.commit(); pMiterateStart.commit(); pMiterateEnd.commit(); pMiterateDuration.commit(); }
Source:
<code>public void connectionChanged(RemoteConnectionChangeEvent event) { IRemoteConnection connection = event.getConnection(); if (connection.getConnectionType().getId().equals(getTypeId())) { switch (event.getType()) { case RemoteConnectionChangeEvent.CONNECTION_ADDED: targetManager.addLaunchTarget(getTypeId(), connection.getName()); break; case RemoteConnectionChangeEvent.CONNECTION_REMOVED: ILaunchTarget target = targetManager.getLaunchTarget(getTypeId(), connection.getName()); if (target != null) { targetManager.removeLaunchTarget(target); } break; case RemoteConnectionChangeEvent.CONNECTION_RENAMED: if (connection instanceof IRemoteConnectionWorkingCopy) { IRemoteConnectionWorkingCopy wc = (IRemoteConnectionWorkingCopy) connection; IRemoteConnection original = ((IRemoteConnectionWorkingCopy) connection).getOriginal(); target = targetManager.getLaunchTarget(getTypeId(), original.getName()); if (target != null ) { targetManager.removeLaunchTarget(target); <START> targetManager.addLaunchTarget(getTypeId(), wc.getName()); <END> } } break; } } }</code><technical_language>if (old) target is null adding a new</technical_language>

Target:
public void connectionChanged(RemoteConnectionChangeEvent event) { IRemoteConnection connection = event.getConnection(); if (connection.getConnectionType().getId().equals(getTypeId())) { switch (event.getType()) { case RemoteConnectionChangeEvent.CONNECTION_ADDED: targetManager.addLaunchTarget(getTypeId(), connection.getName()); break; case RemoteConnectionChangeEvent.CONNECTION_REMOVED: ILaunchTarget target = targetManager.getLaunchTarget(getTypeId(), connection.getName()); if (target != null) { targetManager.removeLaunchTarget(target); } break; case RemoteConnectionChangeEvent.CONNECTION_RENAMED: if (connection instanceof IRemoteConnectionWorkingCopy) { IRemoteConnectionWorkingCopy wc = (IRemoteConnectionWorkingCopy) connection; IRemoteConnection original = ((IRemoteConnectionWorkingCopy) connection).getOriginal(); target = targetManager.getLaunchTarget(getTypeId(), original.getName()); if (target != null ) { targetManager.removeLaunchTarget(target); } targetManager.addLaunchTarget(getTypeId(), wc.getName()); } break; } } }
Source:
<code>private VM getVmForNonShareableDiskImage(DiskImage disk) { if (!disk.isShareable()) { List<VM> vms = getVmDAO().getVmsListForDisk(disk.getId()); <START> if (vms != null && !vms.isEmpty()) { <END> return vms.get(0); } } return null; }</code><technical_language>"vms != null is redundent - DAO ensures return empty list if vms</technical_language>

Target:
private VM getVmForNonShareableDiskImage(DiskImage disk) { if (!disk.isShareable()) { List<VM> vms = getVmDAO().getVmsListForDisk(disk.getId()); if (!vms.isEmpty()) { return vms.get(0); } } return null; }
Source:
<code>public DataSet<ExecRow> write() throws StandardException{ Configuration conf=new Configuration(HConfiguration.unwrapDelegate()); ByteDataOutput bdo=new ByteDataOutput(); Job job; String encoded; try{ bdo.writeObject(exportFunction); encoded=Base64.encodeBase64String(bdo.toByteArray()); conf.set("exportFunction",encoded); job=Job.getInstance(conf); }catch(IOException e){ throw new RuntimeException(e); } job.setOutputKeyClass(Void.class); job.setOutputValueClass(ExecRow.class); job.setOutputFormatClass(SparkDataSet.EOutputFormat.class); job.getConfiguration().set("mapred.output.dir",directory); SparkContext context = rdd.context(); <START> List<Long> recordsWrittenByTasks = Lists.newArrayList(); <END> context.addSparkListener(new SparkListener() { @Override public void onTaskEnd(SparkListenerTaskEnd taskEnd) { synchronized (this) { recordsWrittenByTasks.add(taskEnd.taskMetrics().outputMetrics().recordsWritten()); } } }); rdd.keyBy(new NullFunction<V>()) .setName(String.format("Export Directory: %s", directory)) .saveAsNewAPIHadoopDataset(job.getConfiguration()); long writtenRows=0; for (Long count:recordsWrittenByTasks) { writtenRows += count; } ValueRow valueRow=new ValueRow(2); valueRow.setColumn(1,new SQLLongint(writtenRows)); valueRow.setColumn(2,new SQLInteger(0)); return new SparkDataSet<>(SpliceSpark.getContext().parallelize(Collections.singletonList(valueRow), 1)); }</code><technical_language>I cleaner AtomicLong synchronize() anything</technical_language>

Target:
public DataSet<ExecRow> write() throws StandardException{ long start = System.currentTimeMillis(); Configuration conf=new Configuration(HConfiguration.unwrapDelegate()); ByteDataOutput bdo=new ByteDataOutput(); Job job; String encoded; try{ bdo.writeObject(exportFunction); encoded=Base64.encodeBase64String(bdo.toByteArray()); conf.set("exportFunction",encoded); job=Job.getInstance(conf); }catch(IOException e){ throw new RuntimeException(e); } job.setOutputKeyClass(Void.class); job.setOutputValueClass(ExecRow.class); job.setOutputFormatClass(SparkDataSet.EOutputFormat.class); job.getConfiguration().set("mapred.output.dir",directory); SparkContext context = rdd.context(); AtomicLong writtenRows = new AtomicLong(0); context.addSparkListener(new SparkListener() { @Override public void onTaskEnd(SparkListenerTaskEnd taskEnd) { writtenRows.getAndAdd(taskEnd.taskMetrics().outputMetrics().recordsWritten()); } }); rdd.keyBy(new NullFunction<V>()) .setName(String.format("Export Directory: %s", directory)) .saveAsNewAPIHadoopDataset(job.getConfiguration()); long end = System.currentTimeMillis(); ValueRow valueRow=new ValueRow(2); valueRow.setColumn(1,new SQLLongint(writtenRows.get())); valueRow.setColumn(2,new SQLLongint(end-start)); return new SparkDataSet<>(SpliceSpark.getContext().parallelize(Collections.singletonList(valueRow), 1)); }
Source:
<code>public boolean onCreateOptionsMenu(Menu menu) { if (CommCareApplication.instance().isConsumerApp()) { <START> return super.onPrepareOptionsMenu(menu); <END> } super.onCreateOptionsMenu(menu); menu.add(0, FormEntryConstants.MENU_SAVE, 0, StringUtils.getStringRobust(this, R.string.save_all_answers)) .setIcon(android.R.drawable.ic_menu_save); menu.add(0, FormEntryConstants.MENU_HIERARCHY_VIEW, 0, StringUtils.getStringRobust(this, R.string.view_hierarchy)) .setIcon(R.drawable.ic_menu_goto); menu.add(0, FormEntryConstants.MENU_LANGUAGES, 0, StringUtils.getStringRobust(this, R.string.change_language)) .setIcon(R.drawable.ic_menu_start_conversation); menu.add(0, FormEntryConstants.MENU_PREFERENCES, 0, StringUtils.getStringRobust(this, R.string.form_entry_settings)) .setIcon(android.R.drawable.ic_menu_preferences); return true; }</code><technical_language>this onCreate moved</technical_language>

Target:
public boolean onCreateOptionsMenu(Menu menu) { if (CommCareApplication.instance().isConsumerApp()) { return super.onCreateOptionsMenu(menu); } super.onCreateOptionsMenu(menu); menu.add(0, FormEntryConstants.MENU_SAVE, 0, StringUtils.getStringRobust(this, R.string.save_all_answers)) .setIcon(android.R.drawable.ic_menu_save); menu.add(0, FormEntryConstants.MENU_HIERARCHY_VIEW, 0, StringUtils.getStringRobust(this, R.string.view_hierarchy)) .setIcon(R.drawable.ic_menu_goto); menu.add(0, FormEntryConstants.MENU_LANGUAGES, 0, StringUtils.getStringRobust(this, R.string.change_language)) .setIcon(R.drawable.ic_menu_start_conversation); menu.add(0, FormEntryConstants.MENU_PREFERENCES, 0, StringUtils.getStringRobust(this, R.string.form_entry_settings)) .setIcon(android.R.drawable.ic_menu_preferences); return true; }
Source:
<code>private CloseableHttpClient createClientBuilder(URI uri) { ArtifactoryHttpClient artifactoryHttpClient = new ArtifactoryHttpClient(); artifactoryHttpClient.hostFromUrl(uri.toString()); if (StringUtils.isEmpty(accessToken)) { artifactoryHttpClient.authentication(username, password); } if (this.proxy != null) { HttpBuilderBase.ProxyConfigBuilder proxyConfigBuilder = artifactoryHttpClient.proxy(this.proxy.getHost(), this.proxy.getPort()); if (this.proxy.getUser() != null) { proxyConfigBuilder.authentication(this.proxy.getUser(), this.proxy.getPassword()); } } artifactoryHttpClient.userAgent(userAgent); if (connectionTimeout != null) { artifactoryHttpClient.connectionTimeout(connectionTimeout); } if (socketTimeout != null) { artifactoryHttpClient.socketTimeout(socketTimeout); } if (sslContextBuilder != null) { artifactoryHttpClient.sslContextBuilder(sslContextBuilder); } else { artifactoryHttpClient.trustSelfSignCert(!ignoreSSLIssues); } <START> if (requestInterceptorList != null) { <END> for (HttpRequestInterceptor httpRequestInterceptor :requestInterceptorList) { artifactoryHttpClient.addInterceptorLast(httpRequestInterceptor); } } return artifactoryHttpClient.build(); }</code><technical_language>This if is redundant</technical_language>

Target:
private CloseableHttpClient createClientBuilder(URI uri) { ArtifactoryHttpClient artifactoryHttpClient = new ArtifactoryHttpClient(); artifactoryHttpClient.hostFromUrl(uri.toString()); if (StringUtils.isEmpty(accessToken)) { artifactoryHttpClient.authentication(username, password); } if (this.proxy != null) { HttpBuilderBase.ProxyConfigBuilder proxyConfigBuilder = artifactoryHttpClient.proxy(this.proxy.getHost(), this.proxy.getPort()); if (this.proxy.getUser() != null) { proxyConfigBuilder.authentication(this.proxy.getUser(), this.proxy.getPassword()); } } artifactoryHttpClient.userAgent(userAgent); if (connectionTimeout != null) { artifactoryHttpClient.connectionTimeout(connectionTimeout); } if (socketTimeout != null) { artifactoryHttpClient.socketTimeout(socketTimeout); } if (sslContextBuilder != null) { artifactoryHttpClient.sslContextBuilder(sslContextBuilder); } else { artifactoryHttpClient.trustSelfSignCert(!ignoreSSLIssues); } for (HttpRequestInterceptor httpRequestInterceptor : requestInterceptorList) { artifactoryHttpClient.addInterceptorLast(httpRequestInterceptor); } return artifactoryHttpClient.build(); }