auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>static ReplicationSourceInterface create(Configuration conf, String queueId, WALFactory walFactory) throws IOException { if (ReplicationSourceManager.META_REGION_REPLICA_REPLICATION_SOURCE.equals(queueId)) { <START> return new HBaseMetaNoQueueStoreReplicationSource(walFactory == null? <END> null: walFactory.getMetaProvider()); } ReplicationQueueInfo replicationQueueInfo = new ReplicationQueueInfo(queueId); boolean queueRecovered = replicationQueueInfo.isQueueRecovered(); String defaultReplicationSourceImpl = null; Class<?> c = null; WALProvider walProvider = walFactory == null? null: walFactory.getWALProvider(); try { defaultReplicationSourceImpl = queueRecovered? RecoveredReplicationSource.class.getCanonicalName(): ReplicationSource.class.getCanonicalName(); c = Class.forName(conf.get("replication.replicationsource.implementation", defaultReplicationSourceImpl)); return c.asSubclass(ReplicationSourceInterface.class).getDeclaredConstructor(). newInstance(walProvider); } catch (Exception e) { LOG.warn("Configured replication class failed construction, defaulting to {}", c.getName(), defaultReplicationSourceImpl, e); return queueRecovered? new RecoveredReplicationSource(walProvider): new ReplicationSource(walProvider); } }</code><technical_language>walFactory null? if is null, is of creating replication source here</technical_language>

Target:
static ReplicationSourceInterface create(Configuration conf, String queueId, WALFactory walFactory) throws IOException { if (ReplicationSourceManager.META_REGION_REPLICA_REPLICATION_SOURCE.equals(queueId)) { return new HBaseMetaNoQueueStoreReplicationSource(walFactory.getMetaProvider()); } ReplicationQueueInfo replicationQueueInfo = new ReplicationQueueInfo(queueId); boolean queueRecovered = replicationQueueInfo.isQueueRecovered(); String defaultReplicationSourceImpl = null; Class<?> c = null; try { defaultReplicationSourceImpl = queueRecovered? RecoveredReplicationSource.class.getCanonicalName(): ReplicationSource.class.getCanonicalName(); c = Class.forName(conf.get("replication.replicationsource.implementation", defaultReplicationSourceImpl)); return c.asSubclass(ReplicationSourceInterface.class).getDeclaredConstructor().newInstance(); } catch (Exception e) { LOG.warn("Configured replication class failed construction, defaulting to {}", c != null? c.getName(): "null", defaultReplicationSourceImpl, e); WALProvider walProvider = walFactory == null? null: walFactory.getWALProvider(); return queueRecovered? new RecoveredReplicationSource(walProvider): new ReplicationSource(walProvider); } }
Source:
<code>private void clickTextboxAndCheck(int textboxIndex) { click(jq("@textbox").eq(textboxIndex)); waitResponse(); <START> Assert.assertTrue("scrollbar position and view position should stay in sync.", <END> jq(".z-listbox-header").scrollLeft() == jq(".z-listbox-body").scrollLeft() && jq(".z-listbox-body").scrollLeft() == jq(".z-frozen-inner").scrollLeft()); }</code><technical_language>2 assertEquals</technical_language>

Target:
private void clickTextboxAndCheck(int textboxIndex) { click(jq("@textbox").eq(textboxIndex)); waitResponse(); Assert.assertEquals("head and body should stay sync.", jq(".z-listbox-header").scrollLeft(), jq(".z-listbox-body").scrollLeft()); Assert.assertEquals("scrollbar position and view position should stay sync.", jq(".z-listbox-body").scrollLeft(), jq(".z-frozen-inner").scrollLeft()); }
Source:
<code>public static int findInColumnSortList(ColumnSortList sortList, AbstractTextColumn<?> column) { if (sortList == null || column == null) { return -1; } for (int i = 0; i < sortList.size(); i++) { ColumnSortList.ColumnSortInfo sortInfo = sortList.get(i); if <START> (column == sortInfo.getColumn()) { <END> return i; } } return -1; }</code><technical_language>Smells a bug. equals</technical_language>

Target:
public static int findInColumnSortList(ColumnSortList sortList, AbstractTextColumn<?> column) { if (sortList == null || column == null) { return -1; } for (int i = 0; i < sortList.size(); i++) { ColumnSortList.ColumnSortInfo sortInfo = sortList.get(i); if (column.equals(sortInfo.getColumn())) { return i; } } return -1; }
Source:
<code>public void verifyImageRemoval() { StoragePool pool = getStoragePoolDao().get(getParameters().getStoragePoolId()); if (pool.getStatus() != StoragePoolStatus.Up || pool.getSpmVdsId() == null) { <START> log.info("Waiting on SPM availability to confirm image removal"); <END> setSucceeded(true); return; } List<Guid> failedGuids = getFailedVolumeIds(pool.getSpmVdsId()); if (failedGuids.isEmpty()) { log.info("Requested images were successfully removed"); setCommandStatus(CommandStatus.SUCCEEDED); persistCommand(getParameters().getParentCommand()); } else { log.error("The following images were not removed: {}", failedGuids); setCommandStatus(CommandStatus.FAILED); } setSucceeded(true); }</code><technical_language>block canDo? if DC is due issues.. do SPM available</technical_language>

Target:
public void verifyImageRemoval() { StoragePool pool = getStoragePoolDao().get(getParameters().getStoragePoolId()); if (pool.getStatus() != StoragePoolStatus.Up || pool.getSpmVdsId() == null) { log.info("Waiting on SPM availability to confirm image removal (timeout is minutes)", LIFETIME); setSucceeded(true); return; } List<Guid> failedGuids = getFailedVolumeIds(pool.getSpmVdsId()); if (failedGuids.isEmpty()) { log.info("Requested images were successfully removed"); setCommandStatus(CommandStatus.SUCCEEDED); persistCommand(getParameters().getParentCommand()); } else { log.error("The following images were not removed: {}", failedGuids); setCommandStatus(CommandStatus.FAILED); } setSucceeded(true); }
Source:
<code>public WebSocketKieServerControllerImpl() { this.marshaller = MarshallerFactory.getMarshaller(MarshallingFormat.JSON, this.getClass().getClassLoader()); this.client = new KieServerMessageHandlerWebSocketClient((WebSocketClient client) -> { try { KieServerSetup kieServerSetup = new KieServerSetup(); CountDownLatch waitLatch = new CountDownLatch(1); ((KieServerMessageHandlerWebSocketClient) client).sendTextWithInternalHandler(serialize(serverInfo), <START> new KieServerSetupMessageHandler(this.context, waitLatch, kieServerSetup)); <END> boolean received = waitLatch.await(10, TimeUnit.SECONDS); if (received && kieServerSetup.getContainers() != null) { return; } } catch (Exception e) { logger.warn("Error when trying to reconnect to Web Socket server - {}", e.getMessage()); } }); }</code><technical_language>@elguardian I skip setup handler in return return new CommandScriptMessageHandler(context) is a handler in place capable of handling future requests</technical_language>

Target:
public WebSocketKieServerControllerImpl() { this.marshaller = MarshallerFactory.getMarshaller(MarshallingFormat.JSON, this.getClass().getClassLoader()); this.client = new KieServerMessageHandlerWebSocketClient((WebSocketClient client) -> { try { ((KieServerMessageHandlerWebSocketClient) client).sendTextWithInternalHandler(serialize(serverInfo), new WebSocketKieServerControllerReconnectHandler(context)); } catch (IOException e) { logger.warn("Error when trying to reconnect to Web Socket server - {}", e.getMessage()); } }); }
Source:
<code>private TransactionalRequestResult beginCompletingTransaction(TransactionResult transactionResult) { if (!newPartitionsInTransaction.isEmpty()) enqueueRequest(addPartitionsToTransactionHandler()); if (shouldBumpEpoch()) { <START> return initializeTransactions(); <END> } else { EndTxnRequest.Builder builder = new EndTxnRequest.Builder( new EndTxnRequestData() .setTransactionalId(transactionalId) .setProducerId(producerIdAndEpoch.producerId) .setProducerEpoch(producerIdAndEpoch.epoch) .setCommitted(transactionResult.id)); EndTxnHandler handler = new EndTxnHandler(builder); enqueueRequest(handler); return handler.result; } }</code><technical_language>useful a debug log message this happens. info if convince is rare enough</technical_language>

Target:
private TransactionalRequestResult beginCompletingTransaction(TransactionResult transactionResult) { if (!newPartitionsInTransaction.isEmpty()) enqueueRequest(addPartitionsToTransactionHandler()); if (!(lastError instanceof InvalidPidMappingException)) { EndTxnRequest.Builder builder = new EndTxnRequest.Builder( new EndTxnRequestData() .setTransactionalId(transactionalId) .setProducerId(producerIdAndEpoch.producerId) .setProducerEpoch(producerIdAndEpoch.epoch) .setCommitted(transactionResult.id)); EndTxnHandler handler = new EndTxnHandler(builder); enqueueRequest(handler); if (!shouldBumpEpoch()) { return handler.result; } } return initializeTransactions(this.producerIdAndEpoch); }
Source:
<code><START> public Method getMethod() { <END> return javaMethod; }</code><technical_language>of need public</technical_language>

Target:
Method getMethod() { return javaMethod; }
Source:
<code>private void openMainMenu() { userMenuLink.click(); info("Clicked main menu"); try { Thread.sleep(500); } catch (InterruptedException e) if (!isDropdownOpened()) { info("Couldn't open main menu. Trying again."); <START> openMainMenu(); <END> } }</code><technical_language>This hang forever</technical_language>

Target:
private void openMainMenu() { userMenuLink.click(); info("Clicked main menu"); if (!mainPage.isDropdownMenuOpened()) { userMenuLink.click(); info("Clicked main menu"); if (!mainPage.isDropdownMenuOpened()) { throw new NoSuchElementException("Tried to open main menu 2 times without any success"); } } }
Source:
<code>public Map<Integer, List<TradeOfferGenerator>> getTradeOffers(final Career career) { checkNotNull(career, "career"); checkArgument(career instanceof SpongeCareer, "Unsupported Career: %s (%s)", career.getClass().getName()); final Profession profession = checkNotNull(career.getProfession(), "profession"); checkArgument(profession instanceof SpongeProfession, "Unsupported Profession: %s (%s)", profession.getName(), profession.getClass() .getName()); final SpongeCareer spongeCareer = (SpongeCareer) career; final SpongeProfession spongeProfession = (SpongeProfession) profession; final int careerType = spongeCareer.type; final int professionType = spongeProfession.type; final ITradeList[][][][] defaultTrades = EntityVillager.DEFAULT_TRADE_LIST_MAP; if (defaultTrades == null || defaultTrades.length <= professionType) { throw new IllegalStateException("Could not find valid entry in default trade offer generators"); } final ITradeList[][][] professionTrades = defaultTrades[professionType]; if (professionTrades == null || professionTrades.length <= careerType) { throw new IllegalStateException("Could not find valid entry in profession trade offer generators " + profession.getName()); } final ITradeList[][] careerTrades = professionTrades[careerType - 1]; if (careerTrades == null) { throw new IllegalStateException("Could not find valid entry in career trade offer generators " + career.getName()); } final ImmutableMap.Builder<Integer, List<TradeOfferGenerator>> result = ImmutableMap.builder(); for (int level = 1; level < careerTrades.length + 1; level++) { final ITradeList[] levelTrades = careerTrades[level - 1]; if (levelTrades == null || levelTrades.length == 0) { continue; } final ImmutableList.Builder<TradeOfferGenerator> offers = ImmutableList.builder(); for (final Object trade : levelTrades) { offers.add((TradeOfferGenerator) trade); } <START> result.put(level, offers.build()); <END> } return result.build(); }</code><technical_language>shift level instead</technical_language>

Target:
public Map<Integer, List<TradeOfferGenerator>> getTradeOffers(final Career career) { final ITradeList[][] careerTrades = getFor(career); final ImmutableMap.Builder<Integer, List<TradeOfferGenerator>> result = ImmutableMap.builder(); for (int level = 0; level < careerTrades.length; level++) { final ITradeList[] levelTrades = careerTrades[level]; if (levelTrades == null || levelTrades.length == 0) { continue; } final ImmutableList.Builder<TradeOfferGenerator> offers = ImmutableList.builder(); for (final Object trade : levelTrades) { offers.add((TradeOfferGenerator) trade); } result.put(level + 1, offers.build()); } return result.build(); }
Source:
<code>private static Set<String> convertToString(Set<Object> collection, CommandParameter parameter) { Set<String> result = Sets.newHashSetWithExpectedSize(collection.size()); <START> result.addAll(collection.stream().map(parameter::convertToString).collect(Collectors.toList())); <END> return result; }</code><technical_language>set collector directly</technical_language>

Target:
private static Set<String> convertToString(Set<Object> collection, CommandParameter parameter) { return collection.stream().map(parameter::convertToString).collect(Collectors.toCollection(HashSet::new)); }
Source:
<code>public OutRequest(@NotNull SubChannel subChannel, @NotNull Request request) { <START> if (subChannel == null) { <END> throw new NullPointerException("`subChannel` cannot be null"); } if (request == null) { throw new NullPointerException("`request` cannot be null"); } this.subChannel = subChannel; this.request = request; this.future = TFuture.<V>create(request.getArgScheme()); this.retryLimit = request.getRetryLimit(); }</code><technical_language>need for manual checks</technical_language>

Target:
public OutRequest(@NotNull SubChannel subChannel, @NotNull Request request) { this.subChannel = subChannel; this.request = request; this.future = TFuture.<V>create(request.getArgScheme()); this.retryLimit = request.getRetryLimit(); }
Source:
<code>protected Collection<Event> analyzePosition(Position position) { Device device = Context.getIdentityManager().getDeviceById(position.getDeviceId()); if (device == null || !Context.getIdentityManager().isLatestPosition(position)) { return null; } double maintenanceInterval = Context.getDeviceManager() <START> .lookupServerDouble(device.getId(), ATTRIBUTE_MAINTENANCE_INTERVAL, 0); <END> if (maintenanceInterval == 0) { return null; } double maintenanceStart = Context.getDeviceManager() .lookupServerDouble(device.getId(), ATTRIBUTE_MAINTENANCE_START, 0); Collection<Event> events = new ArrayList<>(); double oldTotalDistance = 0.0; double newTotalDistance = 0.0; Position lastPosition = Context.getIdentityManager().getLastPosition(position.getDeviceId()); if (lastPosition != null && lastPosition.getAttributes().containsKey(Position.KEY_TOTAL_DISTANCE)) { oldTotalDistance = ((Number) lastPosition.getAttributes().get(Position.KEY_TOTAL_DISTANCE)).doubleValue(); } if (position.getAttributes().containsKey(Position.KEY_TOTAL_DISTANCE)) { newTotalDistance = ((Number) position.getAttributes().get(Position.KEY_TOTAL_DISTANCE)).doubleValue(); } oldTotalDistance -= maintenanceStart; newTotalDistance -= maintenanceStart; if ((long) (oldTotalDistance / maintenanceInterval) < (long) (newTotalDistance / maintenanceInterval)) { events.add(new Event(Event.TYPE_MAINTENANCE_NEED, position.getDeviceId(), position.getId())); } return events; }</code><technical_language>related this future, set of "lookup" methods? pass parameter it? Do remember decided sets</technical_language>

Target:
protected Collection<Event> analyzePosition(Position position) { Device device = Context.getIdentityManager().getDeviceById(position.getDeviceId()); if (device == null || !Context.getIdentityManager().isLatestPosition(position)) { return null; } double maintenanceInterval = Context.getDeviceManager() .lookupServerDouble(device.getId(), ATTRIBUTE_MAINTENANCE_INTERVAL, 0); if (maintenanceInterval == 0) { return null; } double maintenanceStart = Context.getDeviceManager() .lookupServerDouble(device.getId(), ATTRIBUTE_MAINTENANCE_START, 0); Collection<Event> events = new ArrayList<>(); double oldTotalDistance = 0.0; double newTotalDistance = 0.0; Position lastPosition = Context.getIdentityManager().getLastPosition(position.getDeviceId()); if (lastPosition != null && lastPosition.getAttributes().containsKey(Position.KEY_TOTAL_DISTANCE)) { oldTotalDistance = ((Number) lastPosition.getAttributes().get(Position.KEY_TOTAL_DISTANCE)).doubleValue(); } if (position.getAttributes().containsKey(Position.KEY_TOTAL_DISTANCE)) { newTotalDistance = ((Number) position.getAttributes().get(Position.KEY_TOTAL_DISTANCE)).doubleValue(); } oldTotalDistance -= maintenanceStart; newTotalDistance -= maintenanceStart; if ((long) (oldTotalDistance / maintenanceInterval) < (long) (newTotalDistance / maintenanceInterval)) { events.add(new Event(Event.TYPE_MAINTENANCE_NEEDED, position.getDeviceId(), position.getId())); } return events; }
Source:
<code>private static boolean validateYearByAdult(String idCard){ <START> System.out.print(Integer.parseInt(sdf.format(new Date())) - Integer.parseInt(idCard.substring(6,10))); <END> if((Integer.parseInt(sdf.format(new Date())) - Integer.parseInt(idCard.substring(6,10)) >= 18)){ return true; } return false; }</code><technical_language>System.out???</technical_language>

Target:
private static boolean validateYearByAdult(String idCard){ if(((Integer.parseInt(sdf.format(new Date())) - Integer.parseInt(idCard.substring(6,14))) / 10000 >= 18)){ return true; } return false; }
Source:
<code>public void getNumberOfResults() { TestSubscriber<Changes> changesTestSubscriber = new TestSubscriber<Changes>(); storIOContentResolver .observeChangesOfUri(TestItem.CONTENT_URI) <START> .take(1) <END> .subscribe(changesTestSubscriber); for (int i = 0; i < 8; ++i) { TestItem testItemToInsert = TestItem.create(null, "value"); contentResolver.insert(TestItem.CONTENT_URI, testItemToInsert.toContentValues()); } Integer numberOfResults = storIOContentResolver .get() .numberOfResults() .withQuery(Query.builder() .uri(TestItem.CONTENT_URI) .build()) .prepare() .executeAsBlocking(); assertThat(numberOfResults).isEqualTo(8); changesTestSubscriber.awaitTerminalEvent(60, SECONDS); changesTestSubscriber.assertNoErrors(); changesTestSubscriber.assertValue(Changes.newInstance(TestItem.CONTENT_URI)); }</code><technical_language>8 changes inserting 8 items separately ContentProvider throws 8 notifications. problem of tests flakiness :)</technical_language>

Target:
public void getNumberOfResults() { TestSubscriber<Changes> changesTestSubscriber = new TestSubscriber<Changes>(); storIOContentResolver .observeChangesOfUri(TestItem.CONTENT_URI) .take(1) .subscribe(changesTestSubscriber); final int testItemsQuantity = 8; ContentValues[] contentValues = new ContentValues[testItemsQuantity]; for (int i = 0; i < testItemsQuantity; ++i) { TestItem testItemToInsert = TestItem.create(null, "value"); contentValues[i] = testItemToInsert.toContentValues(); } contentResolver.bulkInsert(TestItem.CONTENT_URI, contentValues); Integer numberOfResults = storIOContentResolver .get() .numberOfResults() .withQuery(Query.builder() .uri(TestItem.CONTENT_URI) .build()) .prepare() .executeAsBlocking(); assertThat(numberOfResults).isEqualTo(testItemsQuantity); changesTestSubscriber.awaitTerminalEvent(60, SECONDS); changesTestSubscriber.assertNoErrors(); changesTestSubscriber.assertValue(Changes.newInstance(TestItem.CONTENT_URI)); }
Source:
<code>public List<List<ChangeInfo>> formatList2(List<List<ChangeData>> in) throws OrmException { accountLoader = accountLoaderFactory.create(has(DETAILED_ACCOUNTS)); List<List<ChangeInfo>> res = Lists.newArrayListWithCapacity(in.size()); for (List<ChangeData> changes : in) { ChangeData.ensureChangeLoaded(db, changes); if (has(ALL_REVISIONS)) { <START> ChangeData.ensureAllPatchSetsLoaded(db, changes); <END> } else { ChangeData.ensureCurrentPatchSetLoaded(db, changes); } ChangeData.ensureCurrentApprovalsLoaded(db, changes); res.add(toChangeInfo(changes)); } accountLoader.fill(); return res; }</code><technical_language>This is fine optimization I actual bug. This works a workaround for formatList2 case ensures cd.patches(db) is called cd.currentPatchSet(db). intent of API too-smart-for-its-own-good caching able call cd.patches(db) cd.currentPatchSet(db) in order work</technical_language>

Target:
public List<List<ChangeInfo>> formatList2(List<List<ChangeData>> in) throws OrmException { accountLoader = accountLoaderFactory.create(has(DETAILED_ACCOUNTS)); List<List<ChangeInfo>> res = Lists.newArrayListWithCapacity(in.size()); for (List<ChangeData> changes : in) { ChangeData.ensureChangeLoaded(db, changes); ChangeData.ensureCurrentPatchSetLoaded(db, changes); ChangeData.ensureCurrentApprovalsLoaded(db, changes); res.add(toChangeInfo(changes)); } accountLoader.fill(); return res; }
Source:
<code>private String getApiPath(ApiDefinition apiDefinition, String objectId, String relatedEntityId) { if (apiDefinition == null) { throw new IllegalArgumentException("Api definition cannot be null"); } String urlPath = apiDefinition.getEndPoint(); if (apiDefinition.isObjectIdNeeded()) { if (objectId == null || objectId.trim().isEmpty()) { throw new IllegalArgumentException("Object ID cannot be null or empty"); } urlPath = urlPath + "/" + objectId; } String relatedEntity = apiDefinition.getRelatedEntity(); if (relatedEntity != null && relatedEntity.length() > 0) { urlPath = urlPath + "/" + relatedEntity; <START> if (relatedEntityId != null && relatedEntityId.length() > 0) { <END> urlPath = urlPath + "/" + relatedEntityId; } } return mambuAPIService.createUrl(urlPath); }</code><technical_language>Instead of .length() > 0 !relatedEntityId.isEmpty()</technical_language>

Target:
private String getApiPath(ApiDefinition apiDefinition, String objectId, String relatedEntityId) { if (apiDefinition == null) { throw new IllegalArgumentException("Api definition cannot be null"); } String urlPath = apiDefinition.getEndPoint(); if (apiDefinition.isObjectIdNeeded()) { if (objectId == null || objectId.trim().isEmpty()) { throw new IllegalArgumentException("Object ID cannot be null or empty"); } urlPath = urlPath + "/" + objectId; } String relatedEntity = apiDefinition.getRelatedEntity(); if (relatedEntity != null && !relatedEntity.isEmpty()) { urlPath = urlPath + "/" + relatedEntity; if (relatedEntityId != null && relatedEntityId.length() > 0) { urlPath = urlPath + "/" + relatedEntityId; } } return mambuAPIService.createUrl(urlPath); }
Source:
<code>protected TemplateEngine computeCompletionEngine(JavaContentAssistInvocationContext context) { ICompilationUnit unit= context.getCompilationUnit(); if (unit == null) { return null; } IJavaProject javaProject= unit.getJavaProject(); if (javaProject == null) { return null; } if <START> (context.getTextSelection().getLength() <END> > 0) { return null; } CompletionContext coreContext= context.getCoreContext(); if (coreContext != null) { int tokenLocation= coreContext.getTokenLocation(); int tokenStart= coreContext.getTokenStart(); int tokenKind= coreContext.getTokenKind(); if ((tokenLocation == 0 && tokenStart > -1) || ((tokenLocation & CompletionContext.TL_MEMBER_START) != 0 && tokenKind == CompletionContext.TOKEN_KIND_NAME && tokenStart > -1) || (tokenLocation == 0 && isAfterTrigger(context.getDocument(), context.getInvocationOffset()))) { analyzeCoreContext(context, coreContext); return postfixCompletionTemplateEngine; } } return null; }</code><technical_language>Needs a null check for return value</technical_language>

Target:
protected TemplateEngine computeCompletionEngine(JavaContentAssistInvocationContext context) { ICompilationUnit unit= context.getCompilationUnit(); if (unit == null) { return null; } IJavaProject javaProject= unit.getJavaProject(); if (javaProject == null) { return null; } ITextSelection textSelection= context.getTextSelection(); if (textSelection != null && textSelection.getLength() > 0) { return null; } CompletionContext coreContext= context.getCoreContext(); if (coreContext != null) { int tokenLocation= coreContext.getTokenLocation(); int tokenStart= coreContext.getTokenStart(); int tokenKind= coreContext.getTokenKind(); if ((tokenLocation == 0 && tokenStart > -1) || ((tokenLocation & CompletionContext.TL_MEMBER_START) != 0 && tokenKind == CompletionContext.TOKEN_KIND_NAME && tokenStart > -1) || (tokenLocation == 0 && isAfterTrigger(context.getDocument(), context.getInvocationOffset()))) { analyzeCoreContext(context, coreContext); return postfixCompletionTemplateEngine; } } return null; }
Source:
<code>AsyncTask download( final String fileURL, final String destinationPath, final ProgressBar progressBar ) { return new AsyncTask<Void, Integer, File>() { @Override protected File doInBackground( Void... voids ) { <START> isCancelled(); <END> return downloading( fileURL, destinationPath, new ProgressCallback() { @Override public void onProgress( double percent ) { publishProgress( (int) percent ); } } ); } @Override protected void onProgressUpdate( Integer... values ) { super.onProgressUpdate( values ); progressBar.setProgress( values[ 0 ] ); } }; }</code><technical_language>is this call needed here</technical_language>

Target:
AsyncTask download( final String fileURL, final String destinationPath, final ProgressBar progressBar ) { return new AsyncTask<Void, Double, File>() { @Override protected File doInBackground( Void... voids ) { return downloading( fileURL, destinationPath, new ProgressCallback() { @Override public void onProgress( double percent ) { publishProgress( percent ); } } ); } @Override protected void onProgressUpdate( Double... values ) { super.onProgressUpdate( values ); progressBar.setProgress( values[ 0 ].intValue() ); } }; }
Source:
<code>public void onNext(T t) { Publisher<? extends R> p; try { p = Objects.requireNonNull(mapper.apply(t), "The mapper returned a null Publisher"); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); s.cancel(); onError(ex); return; } InnerQueuedSubscriber<R> inner = new InnerQueuedSubscriber<R>(this, prefetch); if (!cancelled) { subscribers.offer(inner); <START> if (!cancelled) { <END> p.subscribe(inner); if (cancelled) { inner.cancel(); } } else { drainAndCancel(); } } }</code><technical_language>nit: invert drainAndCancel easier read harder some mistake refactoring</technical_language>

Target:
public void onNext(T t) { Publisher<? extends R> p; try { p = Objects.requireNonNull(mapper.apply(t), "The mapper returned a null Publisher"); } catch (Throwable ex) { Exceptions.throwIfFatal(ex); s.cancel(); onError(ex); return; } InnerQueuedSubscriber<R> inner = new InnerQueuedSubscriber<R>(this, prefetch); if (cancelled) { return; } subscribers.offer(inner); if (cancelled) { return; } p.subscribe(inner); if (cancelled) { inner.cancel(); drainAndCancel(); } }
Source:
<code>protected boolean canDoAction() { <START> if(super.canDoAction()) { <END> StorageServerConnections paramConnection = getParameters().getStorageServerConnection(); if (paramConnection.getstorage_type() == StorageType.NFS && !new NfsMountPointConstraint().isValid(paramConnection.getconnection(), null)) { return failCanDoAction(VdcBllMessages.VALIDATION_STORAGE_CONNECTION_INVALID); } if (paramConnection.getstorage_type() == StorageType.POSIXFS && (StringUtils.isEmpty(paramConnection.getVfsType()))) { return failCanDoAction(VdcBllMessages.VALIDATION_STORAGE_CONNECTION_EMPTY_VFSTYPE); } if (getParameters().getVdsId().equals(Guid.Empty)) { if (!InitializeVds()) { return false; } } else if (getVds() == null) { return failCanDoAction(VdcBllMessages.VDS_INVALID_SERVER_ID); } else if (getVds().getStatus() != VDSStatus.Up) { return failCanDoAction(VdcBllMessages.VDS_ADD_STORAGE_SERVER_STATUS_MUST_BE_UP); } return true; } return false; }</code><technical_language>Consider negative condition here, return false super CDA return false. formatter if condition (add space if call super)</technical_language>

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } StorageServerConnections paramConnection = getParameters().getStorageServerConnection(); if (paramConnection.getstorage_type() == StorageType.NFS && !new NfsMountPointConstraint().isValid(paramConnection.getconnection(), null)) { return failCanDoAction(VdcBllMessages.VALIDATION_STORAGE_CONNECTION_INVALID); } if (paramConnection.getstorage_type() == StorageType.POSIXFS && (StringUtils.isEmpty(paramConnection.getVfsType()))) { return failCanDoAction(VdcBllMessages.VALIDATION_STORAGE_CONNECTION_EMPTY_VFSTYPE); } if (getParameters().getVdsId().equals(Guid.Empty)) { if (!InitializeVds()) { return false; } } else if (getVds() == null) { return failCanDoAction(VdcBllMessages.VDS_INVALID_SERVER_ID); } else if (getVds().getStatus() != VDSStatus.Up) { return failCanDoAction(VdcBllMessages.VDS_ADD_STORAGE_SERVER_STATUS_MUST_BE_UP); } return true; }
Source:
<code>protected void run() throws UnloggedFailure { if (names != null && !names.isEmpty()) { try { loader.enablePlugins(Sets.newHashSet(names)); } catch (PluginInstallException e) { e.printStackTrace(stderr); <START> throw die("plugin failed to install"); <END> } } }</code><technical_language>s/install/enable/ (since is install command)</technical_language>

Target:
protected void run() throws UnloggedFailure { if (names != null && !names.isEmpty()) { try { loader.enablePlugins(Sets.newHashSet(names)); } catch (PluginInstallException e) { e.printStackTrace(stderr); throw die("plugin failed to enable"); } } }
Source:
<code>public Map<String, String> getConfiguration() { Map<String, String> configMap = new HashMap<>(); try { TenantConfigDTO[] tenantConfigDTOs = stub.getConfiguration(); for (int i = 0; i < tenantConfigDTOs.length; i++) { <START> TenantConfigDTO tenantConfigDTO = tenantConfigDTOs[i]; <END> configMap.put(tenantConfigDTO.getProperty(), tenantConfigDTO.getPropertyValue()); } } catch (RemoteException e) { log.error("Error occurred when retrieving configuration details", e); } return configMap; }</code><technical_language>for-each loop instead of for loop</technical_language>

Target:
public Map<String, String> getConfiguration() { Map<String, String> configMap = new HashMap<>(); try { TenantConfigDTO[] tenantConfigDTOs = stub.getConfiguration(); for (TenantConfigDTO tenantConfigDTO : tenantConfigDTOs) { configMap.put(tenantConfigDTO.getProperty(), tenantConfigDTO.getPropertyValue()); } } catch (RemoteException e) { log.error("Error occurred when retrieving configuration details", e); } return configMap; }
Source:
<code>private SelectConditionStep<Record> schemaQuery(long accountId, String role) { return create() .select() .from(DYNAMIC_SCHEMA).leftOuterJoin(DYNAMIC_SCHEMA_ROLE) .on(DYNAMIC_SCHEMA_ROLE.DYNAMIC_SCHEMA_ID.eq(DYNAMIC_SCHEMA.ID)) .where(DYNAMIC_SCHEMA.ACCOUNT_ID.eq(accountId) .and(DYNAMIC_SCHEMA_ROLE.ROLE.eq(role)) <START> .and(DYNAMIC_SCHEMA.STATE.ne(CommonStatesConstants.PURGED))) <END> .or(DYNAMIC_SCHEMA.ACCOUNT_ID.eq(accountId) .and(DYNAMIC_SCHEMA.STATE.ne(CommonStatesConstants.PURGED))) .or(DYNAMIC_SCHEMA_ROLE.ROLE.eq(role) .and(DYNAMIC_SCHEMA.STATE.ne(CommonStatesConstants.PURGED))); }</code><technical_language>typically do REMOVED.isNotNull() for this type of check...any explicit reason checking purged considering removed</technical_language>

Target:
private SelectConditionStep<Record> schemaQuery(long accountId, String role) { return create() .select() .from(DYNAMIC_SCHEMA).leftOuterJoin(DYNAMIC_SCHEMA_ROLE) .on(DYNAMIC_SCHEMA_ROLE.DYNAMIC_SCHEMA_ID.eq(DYNAMIC_SCHEMA.ID)) .where(DYNAMIC_SCHEMA.ACCOUNT_ID.eq(accountId) .and(DYNAMIC_SCHEMA_ROLE.ROLE.eq(role)) .and(DYNAMIC_SCHEMA.STATE.ne(CommonStatesConstants.PURGED))) .or(DYNAMIC_SCHEMA.ACCOUNT_ID.eq(accountId) .and(DYNAMIC_SCHEMA_ROLE.ROLE.isNull()) .and(DYNAMIC_SCHEMA.STATE.ne(CommonStatesConstants.PURGED))) .or(DYNAMIC_SCHEMA_ROLE.ROLE.eq(role) .and(DYNAMIC_SCHEMA.ACCOUNT_ID.isNull()) .and(DYNAMIC_SCHEMA.STATE.ne(CommonStatesConstants.PURGED))); }
Source:
<code>public void getAllTicketsWithTransportZero() { Ticket ticketWithoutPickup = ticketService.requestTicketOfType(TEST_TICKET, Collections.singletonList(CH_MEMBER_OPTION)); ticketWithoutPickup.setValid(true); testEntityManager.persist(ticketWithoutPickup); Collection<Ticket> tickets = ticketService.getAllTicketsWithTransport(); <START> assertEquals(tickets, Collections.emptyList()); <END> }</code><technical_language>A size assert is sufficient here</technical_language>

Target:
public void getAllTicketsWithTransportZero() { Ticket ticketWithoutPickup = ticketService.requestTicketOfType(TEST_TICKET, Collections.singletonList(CH_MEMBER_OPTION)); ticketWithoutPickup.setValid(true); testEntityManager.persist(ticketWithoutPickup); Collection<Ticket> tickets = ticketService.getAllTicketsWithTransport(); assertThat(tickets).isEmpty(); }
Source:
<code>private void realTimeImpl$adjustForRealTimeGrowingUp(final EntityAgeable self, final int age) { if (((WorldBridge) this.world).bridge$isFake()) { this.setGrowingAge(age); return; } final int diff = (int) ((RealTimeTrackingBridge) this.world).realTimeBridge$getRealTimeTicks() - 1; <START> final int new_age = age - (int) Math.signum(age) * diff; <END> this.setGrowingAge((age ^ new_age) < 0 ? 0 : new_age); }</code><technical_language>do this is confusing read, this a simple if statement - like: java if (age > 0) { this.setGrowingAge(Math.max(0, age - diff)); } else { this.setGrowingAge(Math.min(0, age + diff)); } a lot clearer happening. a branch bypasses completely if diff = 0</technical_language>

Target:
private void realTimeImpl$adjustForRealTimeGrowingUp(final EntityAgeable self, final int age) { if (((WorldBridge) this.world).bridge$isFake()) { this.setGrowingAge(age); return; } final int diff = (int) ((RealTimeTrackingBridge) this.world).realTimeBridge$getRealTimeTicks() - 1; if (diff == 0) { this.setGrowingAge(age); } else if (age > 0) { this.setGrowingAge(Math.max(0, age - diff)); } else { this.setGrowingAge(Math.min(0, age + diff)); } }
Source:
<code>public void fromData(DataInput in, DeserializationContext context) throws IOException, ClassNotFoundException { super.fromData(in, context); this.bucketId = (int) InternalDataSerializer.readSignedVL(in); this.callbackArg = DataSerializer.readObject(in); this.regionEvent = DataSerializer.readObject(in); <START> } <END></code><technical_language>This method returns false. Is intentional? Also, if this method throw exceptions, catch ForceReattemptException doLocalClear() other thrown calling here</technical_language>

Target:
public void fromData(DataInput in, DeserializationContext context) throws IOException, ClassNotFoundException { super.fromData(in, context); this.bucketId = (int) InternalDataSerializer.readSignedVL(in); this.regionEvent = DataSerializer.readObject(in); }
Source:
<code>public static void registerBrixUnstructuredMixin(Workspace workspace) { String cnd = "[brix:unstructured] mixin" + " - * (undefined) multiple " + " - * (undefined) " + " + * (nt:base) sns version "; NodeTypeManager manager = null; try { manager = workspace.getNodeTypeManager(); if (manager.hasNodeType("brix:unstructured") == false) { CndImporter.registerNodeTypes(new StringReader(cnd), workspace.getSession()); } } catch (Exception e) { <START> e.printStackTrace(); <END> } }</code><technical_language>do</technical_language>

Target:
public static void registerBrixUnstructuredMixin(Workspace workspace) { String cnd = "[brix:unstructured] mixin" + " - * (undefined) multiple " + " - * (undefined) " + " + * (nt:base) sns version "; try { NodeTypeManager manager = workspace.getNodeTypeManager(); if (manager.hasNodeType("brix:unstructured") == false) { CndImporter.registerNodeTypes(new StringReader(cnd), workspace.getSession()); } } catch (Exception e) { throw new RuntimeException("JCR error - could not create the brix:unstructured mixin", e); } }
Source:
<code>public void testVpnMeterednessWithNullUnderlyingNetwork() throws Exception { if (!supportedHardware()) { return; } <START> Network wifi = ensureWifiConnected(); <END> assertEquals(wifi, mCM.getActiveNetwork()); ArrayList<Network> underlyingNetworks = null; String allowedApps = mPackageName; startVpn( new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"}, new String[] {"0.0.0.0/0", "::/0"}, allowedApps, "", null, underlyingNetworks, false); assertEquals(mNetwork, mCM.getActiveNetwork()); ensureVpnTransportContains(NetworkCapabilities.TRANSPORT_WIFI); assertEquals(isNetworkMetered(wifi), isNetworkMetered(mNetwork)); assertEquals(isNetworkMetered(mNetwork), mCM.isActiveNetworkMetered()); }</code><technical_language>Nit: define final</technical_language>

Target:
public void testVpnMeterednessWithNullUnderlyingNetwork() throws Exception { if (!supportedHardware()) { return; } Network wifi = getWifiNetwork(); assertEquals(wifi, mCM.getActiveNetwork()); ArrayList<Network> underlyingNetworks = null; String allowedApps = mPackageName; startVpn( new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"}, new String[] {"0.0.0.0/0", "::/0"}, allowedApps, "", null, underlyingNetworks, false ); assertEquals(mNetwork, mCM.getActiveNetwork()); ensureVpnTransportContains(NetworkCapabilities.TRANSPORT_WIFI); assertEquals(isNetworkMetered(wifi), isNetworkMetered(mNetwork)); assertEquals(isNetworkMetered(mNetwork), mCM.isActiveNetworkMetered()); }
Source:
<code>protected ActionResult execute() throws EntityDoesNotExistException { GateKeeper.inst().verifyAdminPrivileges(account); BlobKey blobKey = new BlobKey(""); BlobInfo blobInfo = null; data = new AdminEmailComposePageData(account); blobInfo = extractImageKey(); if(blobInfo == null){ data.isFileUploaded = false; data.fileSrcUrl = null; log.info("Image Upload Failed"); statusToAdmin = "Image Upload Failed"; return createAjaxResult(data); } blobKey = blobInfo.getBlobKey(); data.isFileUploaded = true; data.fileSrcUrl = Const.ActionURIs.PUBLIC_EMAIL_FILE_SERVE + "?blob-key=" + blobKey.getKeyString(); <START> log.info("New Image Uploaded : " + Config.APP_URL + data.fileSrcUrl); <END> statusToAdmin = "New Image Uploaded : " + "<a href=" + data.fileSrcUrl + " target=blank>" + Config.APP_URL + data.fileSrcUrl + "</a>"; data.ajaxStatus = "Image Successfully Uploaded to Google Cloud Storage"; return createAjaxResult(data); }</code><technical_language>I if a static method getAbsoluteUrl(String) call instead, making code slightly higher level. Config.APP_URL + is a level operation I is repeated in places</technical_language>

Target:
protected ActionResult execute() throws EntityDoesNotExistException { GateKeeper.inst().verifyAdminPrivileges(account); BlobKey blobKey = new BlobKey(""); BlobInfo blobInfo = null; data = new AdminEmailComposePageData(account); blobInfo = extractImageKey(); if(blobInfo == null){ data.isFileUploaded = false; data.fileSrcUrl = null; log.info("Image Upload Failed"); statusToAdmin = "Image Upload Failed"; return createAjaxResult(data); } blobKey = blobInfo.getBlobKey(); data.isFileUploaded = true; data.fileSrcUrl = Const.ActionURIs.PUBLIC_EMAIL_FILE_SERVE + "?blob-key=" + blobKey.getKeyString(); String absoluteFileSrcUrl = new Url(data.fileSrcUrl).toAbsoluteString(); log.info("New Image Uploaded : " + absoluteFileSrcUrl); statusToAdmin = "New Image Uploaded : " + "<a href=" + data.fileSrcUrl + " target=blank>" + absoluteFileSrcUrl + "</a>"; data.ajaxStatus = "Image Successfully Uploaded to Google Cloud Storage"; return createAjaxResult(data); }
Source:
<code>public void runPreInstallCommand() { if (Strings.isNonBlank(getEntity().getConfig(VanillaWindowsProcess.PRE_INSTALL_COMMAND)) || Strings.isNonBlank(getEntity().getConfig(VanillaWindowsProcess.PRE_INSTALL_POWERSHELL_COMMAND))) { <START> executeCommand( <END> getEntity().getConfig(VanillaWindowsProcess.PRE_INSTALL_COMMAND), getEntity().getConfig(VanillaWindowsProcess.PRE_INSTALL_POWERSHELL_COMMAND), "pre-install", true); } if (entity.getConfig(VanillaWindowsProcess.PRE_INSTALL_REBOOT_REQUIRED)) { rebootAndWait(); } }</code><technical_language>is this method executeCommand, other methods executeNativeOrPsCommand</technical_language>

Target:
public void runPreInstallCommand() { if (Strings.isNonBlank(getEntity().getConfig(VanillaWindowsProcess.PRE_INSTALL_COMMAND)) || Strings.isNonBlank(getEntity().getConfig(VanillaWindowsProcess.PRE_INSTALL_POWERSHELL_COMMAND))) { executeCommandInTask( getEntity().getConfig(VanillaWindowsProcess.PRE_INSTALL_COMMAND), getEntity().getConfig(VanillaWindowsProcess.PRE_INSTALL_POWERSHELL_COMMAND), "pre-install-command"); } if (entity.getConfig(VanillaWindowsProcess.PRE_INSTALL_REBOOT_REQUIRED)) { rebootAndWait(); } }
Source:
<code>public Value decode(final BsonReader reader, final DecoderContext decoderContext) { Map<Value, Value> kvs = new LinkedHashMap<>(); reader.readStartDocument(); while (reader.readBsonType() != BsonType.END_OF_DOCUMENT) { String fieldName = reader.readName(); BsonType type = reader.getCurrentBsonType(); fieldName = normalize(fieldName); Value value; try { value = readValue(reader, decoderContext); kvs.put(newString(fieldName), value); <START> if (incrementalField.isPresent() && incrementalField.get().contains(fieldName)) { <END> this.lastRecord.put(fieldName, value); this.lastRecordType.put(fieldName, type.toString()); } } catch (UnknownTypeFoundException ex) { reader.skipValue(); if (stopOnInvalidRecord) { throw ex; } log.warn(String.format("Skipped document because field '%s' contains unsupported object type [%s]", fieldName, type)); } } reader.readEndDocument(); return newMap(kvs); }</code><technical_language>@sakama If id_field_name incremental_field incremental_filed include _id field, this code is working well. I store originalFIeldName here</technical_language>

Target:
public Value decode(final BsonReader reader, final DecoderContext decoderContext) { Map<Value, Value> kvs = new LinkedHashMap<>(); reader.readStartDocument(); while (reader.readBsonType() != BsonType.END_OF_DOCUMENT) { String originalFieldName = reader.readName(); BsonType type = reader.getCurrentBsonType(); String fieldName = normalize(originalFieldName); Value value; try { value = readValue(reader, decoderContext); kvs.put(newString(fieldName), value); if (incrementalField.isPresent() && incrementalField.get().contains(originalFieldName)) { this.lastRecord.put(originalFieldName, value); this.lastRecordType.put(originalFieldName, type.toString()); } } catch (UnknownTypeFoundException ex) { reader.skipValue(); if (stopOnInvalidRecord) { throw ex; } log.warn(String.format("Skipped document because field '%s' contains unsupported object type [%s]", fieldName, type)); } } reader.readEndDocument(); return newMap(kvs); }
Source:
<code>public void showYesNoConfirmationDialog_tryYesAndNo_getCorrectValue() throws ExecutionException, InterruptedException { FutureTask<Boolean> yesTask = new FutureTask<>(() -> DialogMessage.showYesNoConfirmationDialog("Confirm", "Confirm Header", "Confirm Message", "yEs", "nO")); Platform.runLater(yesTask); waitUntilNodeAppears(hasText("Confirm Header")); assertNodeExists(hasText("Confirm Header")); <START> clickOn("yEs"); <END> assertEquals(true, yesTask.get()); FutureTask<Boolean> noTask = new FutureTask<>(() -> DialogMessage.showYesNoWarningDialog("Confirm", "Confirm Header", "Confirm Message", "yEs", "nO")); Platform.runLater(noTask); waitUntilNodeAppears(hasText("Confirm Message")); assertNodeExists(hasText("Confirm Message")); clickOn("nO"); assertEquals(false, noTask.get()); }</code><technical_language>idea this weird capitalization in yEs</technical_language>

Target:
public void showYesNoConfirmationDialog_tryYesAndNo_getCorrectValue() throws ExecutionException, InterruptedException { FutureTask<Boolean> yesTask = new FutureTask<>(() -> DialogMessage.showYesNoConfirmationDialog("Confirm", "Confirm Header", "Confirm Message", "yes", "no")); Platform.runLater(yesTask); waitUntilNodeAppears(hasText("Confirm Header")); assertNodeExists(hasText("Confirm Header")); clickOn("yes"); assertEquals(true, yesTask.get()); FutureTask<Boolean> noTask = new FutureTask<>(() -> DialogMessage.showYesNoWarningDialog("Confirm", "Confirm Header", "Confirm Message", "Non-Standard-Yes", "Non-Standard-No")); Platform.runLater(noTask); waitUntilNodeAppears(hasText("Confirm Message")); assertNodeExists(hasText("Confirm Message")); clickOn("Non-Standard-No"); assertEquals(false, noTask.get()); }
Source:
<code>public void beforeEach() throws Exception { <START> String addonJSON = FileUtils.readFileToString(new File(testStore, "addon_remote.json")); <END> String hotfixJSON = FileUtils.readFileToString(new File(testStore, "hotfix_remote.json")); String studioJSON = FileUtils.readFileToString(new File(testStore, "studio_remote.json")); NuxeoConnectClient.getConnectGatewayComponent().setTestConnector( new LocalConnectFakeConnector(addonJSON, hotfixJSON, studioJSON)); Environment.setDefault(null); FileUtils.deleteQuietly(nuxeoHome); nuxeoHome.mkdirs(); System.setProperty(Environment.NUXEO_HOME, nuxeoHome.getPath()); System.setProperty(TomcatConfigurator.TOMCAT_HOME, Environment.getDefault().getServerHome().getPath()); buildInitialPackageStore(); server.setHandler(new FakeConnectDownloadHandler()); environment = Environment.getDefault(); environment.setProperty(Environment.DISTRIBUTION_NAME, "server"); environment.setProperty(Environment.DISTRIBUTION_VERSION, "8.3"); environment.setProperty(ConnectBroker.LAUNCHER_CHANGED_PROPERTY, "false"); connectBroker = new ConnectBroker(environment); connectBroker.setPendingFile(environment.getData().toPath().resolve("installAfterRestart.log")); ((StandaloneCallbackHolder) NuxeoConnectClient.getCallBackHolder()).setTestMode(true); }</code><technical_language>This method is deprecated, please charset</technical_language>

Target:
public void beforeEach() throws Exception { String addonJSON = FileUtils.readFileToString(new File(testStore, "addon_remote.json"), UTF_8); String hotfixJSON = FileUtils.readFileToString(new File(testStore, "hotfix_remote.json"), UTF_8); String studioJSON = FileUtils.readFileToString(new File(testStore, "studio_remote.json"), UTF_8); NuxeoConnectClient.getConnectGatewayComponent().setTestConnector( new LocalConnectFakeConnector(addonJSON, hotfixJSON, studioJSON)); Environment.setDefault(null); FileUtils.deleteQuietly(nuxeoHome); nuxeoHome.mkdirs(); System.setProperty(Environment.NUXEO_HOME, nuxeoHome.getPath()); System.setProperty(TomcatConfigurator.TOMCAT_HOME, Environment.getDefault().getServerHome().getPath()); buildInitialPackageStore(); server.setHandler(new FakeConnectDownloadHandler()); environment = Environment.getDefault(); environment.setProperty(Environment.DISTRIBUTION_NAME, "server"); environment.setProperty(Environment.DISTRIBUTION_VERSION, "8.3"); environment.setProperty(ConnectBroker.LAUNCHER_CHANGED_PROPERTY, "false"); connectBroker = new ConnectBroker(environment); connectBroker.setPendingFile(environment.getData().toPath().resolve("installAfterRestart.log")); ((StandaloneCallbackHolder) NuxeoConnectClient.getCallBackHolder()).setTestMode(true); }
Source:
<code>public OpenTSDBWriter build() throws LifecycleException, UnknownHostException { return new OpenTSDBWriter( typeNames.build(), booleanAsNumber, debugEnabled, host, port, tags.build(), tagName, mergeTypeNamesTags, metricNamingExpression, <START> (addHostnameTag == null) ? true : addHostnameTag, <END> null ); }</code><technical_language>Damn autoboxing... A firstNonNull() findbugs happy. cleaner still, addHostnameTag is a Boolean object, true (so Boolean.TRUE in this case)</technical_language>

Target:
public OpenTSDBWriter build() throws LifecycleException, UnknownHostException { return new OpenTSDBWriter( typeNames.build(), booleanAsNumber, debugEnabled, host, port, tags.build(), tagName, mergeTypeNamesTags, metricNamingExpression, addHostnameTag, null ); }