auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>List<T> get(List<String> paths, List<Stat> stats, int options, boolean throwException) throws HelixException; List<T> getChildren(String parentPath, List<Stat> stats, int options); List<T> getChildren(String parentPath, List<Stat> stats, int options, int retryCount, int retryInterval) throws HelixException; List<String> getChildNames(String parentPath, int options); boolean exists(String path, int options); boolean[] exists(List<String> paths, int options); Stat[] getStats(List<String> paths, int options); Stat getStat(String path, int options); void subscribeDataChanges(String path, IZkDataListener listener); void unsubscribeDataChanges(String path, IZkDataListener listener); List<String> subscribeChildChanges(String path, IZkChildListener listener); void unsubscribeChildChanges(String path, IZkChildListener listener); void reset(); default void close() { <START> <END> }</code><technical_language>print "Default close method is invoked! operation is executed." give user some hints</technical_language>

Target:
List<T> get(List<String> paths, List<Stat> stats, int options, boolean throwException) throws HelixException; List<T> getChildren(String parentPath, List<Stat> stats, int options); List<T> getChildren(String parentPath, List<Stat> stats, int options, int retryCount, int retryInterval) throws HelixException; List<String> getChildNames(String parentPath, int options); boolean exists(String path, int options); boolean[] exists(List<String> paths, int options); Stat[] getStats(List<String> paths, int options); Stat getStat(String path, int options); void subscribeDataChanges(String path, IZkDataListener listener); void unsubscribeDataChanges(String path, IZkDataListener listener); List<String> subscribeChildChanges(String path, IZkChildListener listener); void unsubscribeChildChanges(String path, IZkChildListener listener); void reset(); default void close() { System.out.println("Default close() was invoked! No operation was executed."); }
Source:
<code>private void registerCacheEventListener(EventListenerWrapper wrapper) { if(aSyncListenersSet.contains(wrapper) || syncListenersSet.contains(wrapper)) { throw new IllegalStateException("Cache Event Listener already registered: " + wrapper.listener); } <START> if(wrapper.ordering == EventOrdering.ORDERED) { <END> if (orderedListenerCount.incrementAndGet() == 1) { storeEventSource.setEventOrdering(true); } } if (wrapper.firing == EventFiring.ASYNCHRONOUS) { aSyncListenersSet.add(wrapper); } else { syncListenersSet.add(wrapper); } if (listenersCount.incrementAndGet() == 1) { storeEventSource.addEventListener(eventListener); } }</code><technical_language>Switches</technical_language>

Target:
private synchronized void registerCacheEventListener(EventListenerWrapper wrapper) { if(aSyncListenersList.contains(wrapper) || syncListenersList.contains(wrapper)) { throw new IllegalStateException("Cache Event Listener already registered: " + wrapper.getListener()); } if (wrapper.isOrdered() && orderedListenerCount++ == 0) { storeEventSource.setEventOrdering(true); } switch (wrapper.getFiringMode()) { case ASYNCHRONOUS: aSyncListenersList.add(wrapper); break; case SYNCHRONOUS: syncListenersList.add(wrapper); break; default: throw new AssertionError("Unhandled EventFiring value: " + wrapper.getFiringMode()); } if (listenersCount++ == 0) { storeEventSource.addEventListener(eventListener); } }
Source:
<code>public Mono<DetectLanguageResult> detectLanguage(String text) { <START> return detectLanguageWithResponse(text, defaultCountryHint).flatMap(FluxUtil::toMono); <END> }</code><technical_language>Wrap this try-catch return Mono.error() if exceptions. For reference, other async clients</technical_language>

Target:
public Mono<DetectLanguageResult> detectLanguage(String text) { try { return detectLanguageWithResponse(text, defaultCountryHint).flatMap(FluxUtil::toMono); } catch (RuntimeException ex) { return monoError(logger, ex); } }
Source:
<code>private void bumpPromoAnalyticsAndShowPromoDialogIfNecessary() { if (mIsUpdatingStats || mThereWasAnErrorLoadingStats) { return; } if (!StringUtils.isEmpty(AppPrefs.getStatsWidgetsKeys())) { return; } AppPrefs.bumpAnalyticsForStatsWidgetPromo(); <START> if (shouldShouldWidgetPromo()) { <END> AppCompatDialogFragment newFragment = new PromoDialog.Builder( R.drawable.stats_widget_promo_header, R.string.stats_widget_promo_title, R.string.stats_widget_promo_desc, R.string.stats_widget_promo_ok_btn_label) .build(); newFragment.show(getSupportFragmentManager(), "promote_widget_dialog"); } }</code><technical_language>I meant shouldShowWidgetPromo()</technical_language>

Target:
private void bumpPromoAnalyticsAndShowPromoDialogIfNecessary() { if (mIsUpdatingStats || mThereWasAnErrorLoadingStats) { return; } if (!StringUtils.isEmpty(AppPrefs.getStatsWidgetsKeys())) { return; } AppPrefs.bumpAnalyticsForStatsWidgetPromo(); if (shouldShowWidgetPromo()) { AppCompatDialogFragment newFragment = new PromoDialog.Builder( R.drawable.stats_widget_promo_header, R.string.stats_widget_promo_title, R.string.stats_widget_promo_desc, R.string.stats_widget_promo_ok_btn_label) .build(); newFragment.show(getSupportFragmentManager(), "promote_widget_dialog"); } }
Source:
<code>public void testJavadocChild() { final DetailAST commentContentNode = tree.getFirstChild().getNextSibling().getFirstChild(); final ParseTreeTablePModel parseTree = new ParseTreeTablePModel(null); parseTree.setParseMode(ParseMode.JAVA_WITH_JAVADOC_AND_COMMENTS); final Object javadoc = parseTree.getChild(commentContentNode, 0); Assert.assertTrue(javadoc instanceof DetailNode); <START> Assert.assertEquals(JavadocTokenTypes.JAVADOC, ((DetailNode) javadoc).getType()); <END> final Object javadocChild = parseTree.getChild(javadoc, 2); Assert.assertEquals(JavadocTokenTypes.TEXT, ((DetailNode) javadocChild).getType()); }</code><technical_language>I agree, is meant child</technical_language>

Target:
public void testJavadocChild() { final DetailAST commentContentNode = tree.getFirstChild().getNextSibling().getFirstChild(); final ParseTreeTablePModel parseTree = new ParseTreeTablePModel(null); parseTree.setParseMode(ParseMode.JAVA_WITH_JAVADOC_AND_COMMENTS); final Object javadoc = parseTree.getChild(commentContentNode, 0); Assert.assertTrue(javadoc instanceof DetailNode); Assert.assertEquals(JavadocTokenTypes.JAVADOC, ((DetailNode) javadoc).getType()); final Object javadocChild = parseTree.getChild(javadoc, 2); Assert.assertTrue(javadocChild instanceof DetailNode); Assert.assertEquals(JavadocTokenTypes.TEXT, ((DetailNode) javadocChild).getType()); }
Source:
<code>public ProfilePreferences defaultValue(ProfilePreferences defaultValue) { String profileStr = System.getProperty("org.kie.workbench.profile", Profile.FULL.name()); Profile defaultProfile = Profile.FULL; try { if(profileStr.startsWith(FORCE_PREFIX)) { <START> profileStr = profileStr.substring(FORCE_PREFIX.length(), <END> profileStr.length()); } defaultProfile = Profile.valueOf(profileStr); } catch(IllegalArgumentException e) { logger.warning("Not able to load profile " + profileStr + ". Loading FULL profile."); } defaultValue.setProfile(defaultProfile); return defaultValue; }</code><technical_language>nitpick: need profileStr.length() here. substring index end, [String#substring(int)](<LINK_0></technical_language>

Target:
public ProfilePreferences defaultValue(ProfilePreferences defaultValue) { String profileStr = System.getProperty("org.kie.workbench.profile", Profile.FULL.name()); Profile defaultProfile = Profile.FULL; try { if (profileStr.startsWith(FORCE_PREFIX)) { profileStr = profileStr.substring(FORCE_PREFIX.length()); } defaultProfile = Profile.valueOf(profileStr); } catch(IllegalArgumentException e) { logger.warn("Not able to load profile {}. Loading FULL profile.", profileStr); } defaultValue.setProfile(defaultProfile); return defaultValue; }
Source:
<code>public static PositionedOutputStream wrap(final OutputStream fout) { if (fout instanceof FSDataOutputStream) { return new PositionedOutputStream(fout) { @Override public long position() throws IOException { return ((FSDataOutputStream) fout).getPos(); } }; } else if (fout instanceof PositionedOutput) { return new PositionedOutputStream(fout) { @Override public long position() throws IOException { return ((PositionedOutput) fout).position(); } }; } else { <START> return new PositionedOutputStream(fout) { <END> @Override public long position() throws IOException { throw new UnsupportedOperationException("Underlying stream does not support position()"); } }; } }</code><technical_language>check for non-null</technical_language>

Target:
public static PositionedOutputStream wrap(final OutputStream fout) { Objects.requireNonNull(fout); if (fout instanceof FSDataOutputStream) { return new PositionedOutputStream(fout) { @Override public long position() throws IOException { return ((FSDataOutputStream) fout).getPos(); } }; } else if (fout instanceof PositionedOutput) { return new PositionedOutputStream(fout) { @Override public long position() throws IOException { return ((PositionedOutput) fout).position(); } }; } else { return new PositionedOutputStream(fout) { @Override public long position() throws IOException { throw new UnsupportedOperationException("Underlying stream does not support position()"); } }; } }
Source:
<code>public void onResume() { <START> if (mBluetoothAdapter != null && mBluetoothAdapter.getState() == BluetoothAdapter.STATE_ON) { final BluetoothProfile profile = mBluetoothPan.get(); if (profile == null) { mBluetoothAdapter.getProfileProxy(mContext, mBtProfileServiceListener, BluetoothProfile.PAN); } } <END> if (mAirplaneModeObserver == null) { mAirplaneModeObserver = new SettingObserver(); } if (mTetherReceiver == null) { mTetherReceiver = new TetherBroadcastReceiver(); } mContext.registerReceiver( mTetherReceiver, new IntentFilter(ConnectivityManager.ACTION_TETHER_STATE_CHANGED)); mContext.getContentResolver() .registerContentObserver(mAirplaneModeObserver.uri, false, mAirplaneModeObserver); }</code><technical_language>do need this part</technical_language>

Target:
public void onResume() { if (mAirplaneModeObserver == null) { mAirplaneModeObserver = new SettingObserver(); } if (mTetherReceiver == null) { mTetherReceiver = new TetherBroadcastReceiver(); } mContext.registerReceiver( mTetherReceiver, new IntentFilter(ConnectivityManager.ACTION_TETHER_STATE_CHANGED)); mContext.getContentResolver() .registerContentObserver(mAirplaneModeObserver.uri, false, mAirplaneModeObserver); }
Source:
<code>protected void doAccept(HandlerEvent event) { LOGGER.debug("Accepting Database backup event..."); DatabaseBackupRequest request = event.getData(); Selectable result; Long stackId = request.getResourceId(); try { Stack stack = stackService.getByIdWithListsInTransaction(stackId); Cluster cluster = stack.getCluster(); InstanceMetaData gatewayInstance = stack.getPrimaryGatewayInstance(); GatewayConfig gatewayConfig = gatewayConfigService.getGatewayConfig(stack, gatewayInstance, cluster.getGateway() != null); Set<String> gatewayFQDN = Collections.singleton(gatewayInstance.getDiscoveryFQDN()); <START> ExitCriteriaModel noExitModel = ClusterDeletionBasedExitCriteriaModel.nonCancellableModel(); <END> SaltConfig saltConfig = HandlerMethods.createSaltConfig(request.getBackupLocation(), request.getBackupId(), stack.getCloudPlatform()); hostOrchestrator.backupDatabase(gatewayConfig, gatewayFQDN, stackUtil.collectReachableNodes(stack), saltConfig, noExitModel); result = new DatabaseBackupSuccess(stackId); } catch (Exception e) { LOGGER.info("Database backup event failed", e); result = new DatabaseBackupFailedEvent(stackId, e, DetailedStackStatus.DATABASE_BACKUP_FAILED); } sendEvent(result, event); }</code><technical_language>this? if termination is triggered backup</technical_language>

Target:
protected void doAccept(HandlerEvent event) { DatabaseBackupRequest request = event.getData(); Selectable result; Long stackId = request.getResourceId(); LOGGER.debug("Backing up database on stack {}, backup id {}", stackId, request.getBackupId()); try { Stack stack = stackService.getByIdWithListsInTransaction(stackId); Cluster cluster = stack.getCluster(); InstanceMetaData gatewayInstance = stack.getPrimaryGatewayInstance(); GatewayConfig gatewayConfig = gatewayConfigService.getGatewayConfig(stack, gatewayInstance, cluster.hasGateway()); Set<String> gatewayFQDN = Collections.singleton(gatewayInstance.getDiscoveryFQDN()); ExitCriteriaModel exitModel = ClusterDeletionBasedExitCriteriaModel.clusterDeletionBasedModel(stackId, cluster.getId()); SaltConfig saltConfig = saltConfigGenerator.createSaltConfig(request.getBackupLocation(), request.getBackupId(), stack.getCloudPlatform()); hostOrchestrator.backupDatabase(gatewayConfig, gatewayFQDN, stackUtil.collectReachableNodes(stack), saltConfig, exitModel); result = new DatabaseBackupSuccess(stackId); } catch (Exception e) { LOGGER.error("Database backup event failed", e); result = new DatabaseBackupFailedEvent(stackId, e, DetailedStackStatus.DATABASE_BACKUP_FAILED); } sendEvent(result, event); }
Source:
<code>private Optional<ConsumedEvent> poll() { Optional<ConsumedEvent> result = Optional.ofNullable(eventsQueue.poll()); if (!result.isPresent()) { <START> eventConsumers.values().forEach(consumer -> consumer.readEvent().ifPresent(eventsQueue::add)); <END> result = Optional.ofNullable(eventsQueue.poll()); } return result; }</code><technical_language>reading in parallel? I if optimise kafka consumer pre-fetches data, calling poll data is available. do think</technical_language>

Target:
private List<ConsumedEvent> poll() { List<ConsumedEvent> result = null; boolean newCollectionCreated = false; for (final EventConsumer consumer : eventConsumers.values()) { final List<ConsumedEvent> partialResult = consumer.readEvents(); if (null == result) { result = partialResult; } else { if (!newCollectionCreated) { result = new ArrayList<>(result); newCollectionCreated = true; } result.addAll(partialResult); } } return result == null ? Collections.emptyList() : result; }
Source:
<code>public boolean equals(Object o) { if (o instanceof ReassignmentSet) { ReassignmentSet other = (ReassignmentSet) o; <START> return reassignmentsInfo.equals(other.reassignmentsInfo); <END> } return false; }</code><technical_language>probalby Objects.equals more safe apply in case reassingmentsInfo is null some point</technical_language>

Target:
public boolean equals(Object o) { if (o instanceof ReassignmentSet) { ReassignmentSet other = (ReassignmentSet) o; return Objects.equals(reassignmentsInfo, other.reassignmentsInfo); } return false; }
Source:
<code>private void loadData() { Session session = new Session(activity, userManager.getActiveUser()); <START> Session.setSharedSession(session); <END> listModel = session.getReviewalClaims(); listModel.addObserver(this); setListAdapter(new ExpenseClaimArrayAdapter(activity, listModel.getItems())); final Context context = activity; session.loadReviewalClaims(new ElasticSearchAPIClient.APICallback<List<ExpenseClaim>>() { @Override public void onSuccess(Response response, final List<ExpenseClaim> model) { activity.runOnUiThread(new Runnable() { @Override public void run() { listModel.replace(model); } }); } @Override public void onFailure(Request request, Response response, IOException e) { activity.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(context, R.string.load_fail_error, Toast.LENGTH_LONG).show(); } }); } }); }</code><technical_language>This set once, in activity. (both lines)</technical_language>

Target:
private void loadData() { Session session = Session.getSharedSession(); listModel = session.getReviewalClaims(); listModel.addObserver(this); setListAdapter(new ExpenseClaimArrayAdapter(activity, listModel.getItems())); final Context context = activity; session.loadReviewalClaims(new ElasticSearchAPIClient.APICallback<List<ExpenseClaim>>() { @Override public void onSuccess(Response response, final List<ExpenseClaim> model) { activity.runOnUiThread(new Runnable() { @Override public void run() { listModel.replace(model); } }); } @Override public void onFailure(Request request, Response response, IOException e) { activity.runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(context, R.string.load_fail_error, Toast.LENGTH_LONG).show(); } }); } }); }
Source:
<code>protected void updateLunDisks() { for (VmDynamic vmDynamic : getPoweringUpVms()) { VmInternalData vmInternalData = getRunningVms().get(vmDynamic.getId()); if (vmInternalData != null) { Map<String, LUNs> lunsMap = vmInternalData.getLunsMap(); <START> List<Disk> vmDisks = getDbFacade().getDiskDao().getAllForVm(vmDynamic.getId(), true); <END> for (Disk disk : vmDisks) { if (disk.getDiskStorageType() != DiskStorageType.LUN) { continue; } LUNs lunFromDB = ((LunDisk) disk).getLun(); LUNs lunFromMap = lunsMap.get(lunFromDB.getId()); if (lunFromMap != null && lunFromMap.getDeviceSize() != 0 && lunFromMap.getDeviceSize() != lunFromDB.getDeviceSize()) { log.infoFormat("Updated LUN device size - ID: {0}, previous size: {1}, new size: {2}.", lunFromDB.getLUN_id(), lunFromDB.getDeviceSize(), lunFromMap.getDeviceSize()); lunFromDB.setDeviceSize(lunFromMap.getDeviceSize()); _vmLunDisksToSave.add(lunFromDB); } } } } }</code><technical_language>Suggestion: add a stored procedure change getAllForVm filter disks storageType</technical_language>

Target:
protected void updateLunDisks() { for (VmDynamic vmDynamic : getPoweringUpVms()) { VmInternalData vmInternalData = getRunningVms().get(vmDynamic.getId()); if (vmInternalData != null) { Map<String, LUNs> lunsMap = vmInternalData.getLunsMap(); if (lunsMap.isEmpty()) { continue; } List<Disk> vmDisks = getDbFacade().getDiskDao().getAllForVm(vmDynamic.getId(), true); for (Disk disk : vmDisks) { if (disk.getDiskStorageType() != DiskStorageType.LUN) { continue; } LUNs lunFromDB = ((LunDisk) disk).getLun(); LUNs lunFromMap = lunsMap.get(lunFromDB.getId()); if (lunFromMap.getDeviceSize() != 0 && lunFromMap.getDeviceSize() != lunFromDB.getDeviceSize()) { log.infoFormat("Updated LUN device size - ID: {0}, previous size: {1}, new size: {2}.", lunFromDB.getLUN_id(), lunFromDB.getDeviceSize(), lunFromMap.getDeviceSize()); lunFromDB.setDeviceSize(lunFromMap.getDeviceSize()); vmLunDisksToSave.add(lunFromDB); } } } } }
Source:
<code>protected AbstractBeanDefinition doParse(Element element, ParserContext parserContext, String channelName) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(FileTailInboundChannelAdapterFactoryBean.class); if (element.hasAttribute("delay") || element.hasAttribute("end") || element.hasAttribute("reopen")) { if (element.hasAttribute("native-options")) { parserContext.getReaderContext().error( "You cannot have 'native-options' if one or more of " + "'delay', 'end' or 'reopen' is provided", element); } if (element.hasAttribute("task-scheduler")) { parserContext.getReaderContext().error( <START> "You cannot have 'task-scheduler' one or more of " + <END> "'delay', 'end' or 'reopen' is provided", element); } } if (StringUtils.hasText(channelName)) { builder.addPropertyReference("outputChannel", channelName); } IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "native-options"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "file"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "task-executor"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "task-scheduler"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "delay"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "file-delay"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "end"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "reopen"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "auto-startup"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "phase"); return builder.getBeanDefinition(); }</code><technical_language>..**if** more..</technical_language>

Target:
protected AbstractBeanDefinition doParse(Element element, ParserContext parserContext, String channelName) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(FileTailInboundChannelAdapterFactoryBean.class); if (StringUtils.hasText(channelName)) { builder.addPropertyReference("outputChannel", channelName); } IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "native-options"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "file"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "task-executor"); IntegrationNamespaceUtils.setReferenceIfAttributeDefined(builder, element, "task-scheduler"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "delay"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "file-delay"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "end"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "reopen"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "auto-startup"); IntegrationNamespaceUtils.setValueIfAttributeDefined(builder, element, "phase"); return builder.getBeanDefinition(); }
Source:
<code>public static CondaPath build(String path) { Optional<Coordinates> coordinates = parseCoordinates(path); <START> checkNotNull(path); <END> return new CondaPath(path, coordinates); }</code><technical_language>checkNotNull line of method</technical_language>

Target:
public static CondaPath build(String path) { checkNotNull(path); Optional<Coordinates> coordinates = parseCoordinates(path); return new CondaPath(path, coordinates); }
Source:
<code>private synchronized void handleStartState(String testID) { logger.info("handle start state: " + testID); StartTask startTask = new StartTask(testID); Future future = taskExecutorService.submit(startTask); testTasks.put(testID, future); try { future.get(); <START> if (isTerminated(testID)) { <END> return; } testModelDAO.setTestState(testID, BenchFlowTestState.READY); handleTestState(testID); } catch (InterruptedException | ExecutionException | BenchFlowTestIDDoesNotExistException e) { e.printStackTrace(); } }</code><technical_language>check this in setTestState method, is done in place? this possible, get a timeout, need get exclusive access data structure running information cleanup other code executed</technical_language>

Target:
synchronized void handleStartState(String testID) { logger.info("handle start state: " + testID); StartTask startTask = new StartTask(testID); AbortableFutureTask future = (AbortableFutureTask) taskExecutorService.submit(startTask); testTasks.put(testID, future); try { if (getAbortableFutureTask(future).isAborted()) { return; } testModelDAO.setTestState(testID, READY); } catch (InterruptedException | ExecutionException | BenchFlowTestIDDoesNotExistException e) { e.printStackTrace(); } }
Source:
<code>public boolean conflict(LockRequest request) { <START> if (request instanceof TimeChunkLockRequest) { <END> return dataSource.equals(request.getDataSource()) && interval.overlaps(request.getInterval()); } else if (request instanceof SpecificSegmentLockRequest) { if (dataSource.equals(request.getDataSource()) && interval.equals(request.getInterval())) { final SpecificSegmentLockRequest specificSegmentLockRequest = (SpecificSegmentLockRequest) request; return specificSegmentLockRequest.getPartitionId() == partitionId; } else { return dataSource.equals(request.getDataSource()) && interval.overlaps(request.getInterval()); } } else if (request instanceof LockRequestForNewSegment) { return false; } else { throw new ISE("Unknown request type[%s]", request.getClass().getCanonicalName()); } }</code><technical_language>I this method more readable if checked for instanceof LockRequestForNewSegment !dataSource.equals(request.getDataSource() separate checks return false (i.e., cases conflict), TimeChunkLockRequest SpecificSegmentLockRequest blocks</technical_language>

Target:
public boolean conflict(LockRequest request) { if (request instanceof LockRequestForNewSegment) { return false; } if (!dataSource.equals(request.getDataSource())) { return false; } if (request instanceof TimeChunkLockRequest) { return interval.overlaps(request.getInterval()); } else if (request instanceof SpecificSegmentLockRequest) { if (interval.equals(request.getInterval())) { final SpecificSegmentLockRequest specificSegmentLockRequest = (SpecificSegmentLockRequest) request; return specificSegmentLockRequest.getPartitionId() == partitionId; } else { return interval.overlaps(request.getInterval()); } } else { throw new ISE("Unknown request type[%s]", request.getClass().getName()); } }
Source:
<code><START> default Object getIngressTimestamp() { <END> return getBrokerProperty(HDR_INGRESS_TIMESTAMP); }</code><technical_language>Is Object needed here? a long (and converted if not)</technical_language>

Target:
default Long getIngressTimestamp() { return (Long) getBrokerProperty(HDR_INGRESS_TIME); }
Source:
<code>public static void main(String[] args) throws Exception { Args searchArgs = new Args(); CmdLineParser parser = new CmdLineParser(searchArgs, ParserProperties.defaults().withUsageWidth(90)); try { parser.parseArgument(args); } catch (CmdLineException e) { System.err.println(e.getMessage()); parser.printUsage(System.err); System.err.println("Example command: "+ EntityLinking.class.getSimpleName() + parser.printExample(OptionHandlerFilter.REQUIRED)); return; } if (searchArgs.hits > 0) EntityLinking.numHits = searchArgs.hits; LOG.info("searching gold data: " + searchArgs.goldData); if (searchArgs.goldData) new EntityLinking(searchArgs.index).searchGoldFile(searchArgs.data); else new EntityLinking(searchArgs.index).searchFile(searchArgs.data); <START> } <END></code><technical_language>Enclose if-else blocks { } for single statements</technical_language>

Target:
public static void main(String[] args) throws Exception { Args searchArgs = new Args(); CmdLineParser parser = new CmdLineParser(searchArgs, ParserProperties.defaults().withUsageWidth(90)); try { parser.parseArgument(args); } catch (CmdLineException e) { System.err.println(e.getMessage()); parser.printUsage(System.err); System.err.println("Example command: "+ EntityLinking.class.getSimpleName() + parser.printExample(OptionHandlerFilter.REQUIRED)); return; } LOG.info("searching gold data: " + searchArgs.goldData); if (searchArgs.goldData) { new EntityLinking(searchArgs.index).searchGoldFile(searchArgs.data, searchArgs.hits, searchArgs.output); } else { new EntityLinking(searchArgs.index).bruteSearchFile(searchArgs.data, searchArgs.hits, searchArgs.output); } }
Source:
<code>private void createUser(String userId, String password, Role role, String userName, String email) { if (userRepository.findOneByUserId(userId) == null) { User user = new User(); user.setUserId(userId); SecuredUser securedUser = new SecuredUser(user, null); Object salt = saltSource.getSalt(securedUser); user.setPassword(passwordEncoder.encodePassword(password, salt)); user.setRole(role); user.setUserName(userName); user.setEmail(email); <START> Date createdDate = new Date(); <END> user.setCreatedDate(createdDate); user.setLastModifiedDate(createdDate); user.setLastModifiedUser(user); user = userRepository.save(user); fileEntryService.prepare(user); } }</code><technical_language>Date = new Date() name for it</technical_language>

Target:
private void createUser(String userId, String password, Role role, String userName, String email) { if (userRepository.findOneByUserId(userId) == null) { User user = new User(); user.setUserId(userId); SecuredUser securedUser = new SecuredUser(user, null); Object salt = saltSource.getSalt(securedUser); user.setPassword(passwordEncoder.encodePassword(password, salt)); user.setRole(role); user.setUserName(userName); user.setEmail(email); Date now = new Date(); user.setCreatedDate(now); user.setLastModifiedDate(now); user.setCreatedUser(user); user.setLastModifiedUser(user); user = userRepository.save(user); fileEntryService.prepare(user); } }
Source:
<code><START> protected Object resolveImpl(@Nonnull final Form<?> form, final String name) { <END> if (name.equals("errors")) { return extractErrors(form); } else { final String value = form.field(name).value(); return isFalsy(value) ? false : firstNonNull(value, UNRESOLVED); } }</code><technical_language>I happy for opening this class much</technical_language>

Target:
private Object resolveImpl(@Nonnull final Form<?> form, final String name) { if (name.equals("errors")) { return extractErrors(form); } else { final String value = form.field(name).value(); return isFalsy(value) ? false : firstNonNull(value, UNRESOLVED); } }
Source:
<code>private void exportAnalysis() { FileDialog dialog = TmfFileDialogFactory.create(Display.getCurrent().getActiveShell(), SWT.SAVE); String selection = fAnalysesTable.getSelection()[0].getText(); dialog.setText(NLS.bind(Messages.ManageXMLAnalysisDialog_SelectFileExport, selection)); dialog.setFilterExtensions(new String[] { XML_FILTER_EXTENSION, TmfXmlStrings.WILDCARD }); String selectionXml = XmlUtils.createXmlFileString(selection); dialog.setFileName(selectionXml); String path = dialog.open(); <START> if (path != null) { if (!XmlUtils.exportXmlFile(selectionXml, path).isOK()) { Activator.logError(NLS.bind(Messages.ManageXMLAnalysisDialog_FailedToExport, selectionXml)); } } <END> }</code><technical_language>Merge if statement: if (path != null && !XmlUtils.exportXmlFile(selectionXml, path).isOK())</technical_language>

Target:
private void exportAnalysis() { FileDialog dialog = TmfFileDialogFactory.create(Display.getCurrent().getActiveShell(), SWT.SAVE); String selection = fAnalysesTable.getSelection()[0].getText(); dialog.setText(NLS.bind(Messages.ManageXMLAnalysisDialog_SelectFileExport, selection)); dialog.setFilterExtensions(new String[] { XML_FILTER_EXTENSION, TmfXmlStrings.WILDCARD }); String selectionXml = XmlUtils.createXmlFileString(selection); dialog.setFileName(selectionXml); String path = dialog.open(); if (path != null && !XmlUtils.exportXmlFile(selectionXml, path).isOK()) { Activator.logError(NLS.bind(Messages.ManageXMLAnalysisDialog_FailedToExport, selectionXml)); } }
Source:
<code>public void onViewCreated(View view, Bundle savedInstanceState) { <START> super.onViewCreated(view, savedInstanceState); <END> if (isInflateWebViewLayout) { swipeContainer.setEnabled(false); } else { view.findViewById(R.id.content_error).setVisibility(View.VISIBLE); view.findViewById(R.id.content_error_icon).setVisibility(View.GONE); tvContentError.setText(getString(R.string.error_unknown)); btnContentErrorAction.setVisibility(View.VISIBLE); btnContentErrorAction.setText(R.string.lbl_reload); btnContentErrorAction.setOnClickListener(v -> getFragmentManager().beginTransaction() .detach(AuthenticatedWebViewFragment.this) .attach(AuthenticatedWebViewFragment.this).commitAllowingStateLoss()); } }</code><technical_language>Mention reason here, catching inflation exception is necessary here</technical_language>

Target:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); if (!isSystemUpdatingWebView) { swipeContainer.setEnabled(false); } else { view.findViewById(R.id.content_error).setVisibility(View.VISIBLE); final IconImageView ivContentError = view.findViewById(R.id.content_error_icon); ivContentError.setIcon(FontAwesomeIcons.fa_exclamation_circle); tvContentError.setText(getString(R.string.error_unknown)); btnContentErrorAction.setVisibility(View.VISIBLE); btnContentErrorAction.setText(R.string.lbl_reload); btnContentErrorAction.setOnClickListener( v -> UiUtil.restartFragment(AuthenticatedWebViewFragment.this)); } }
Source:
<code>protected Void visitCreateTableAsSelect(CreateTableAsSelect node, Integer indent) { builder.append("CREATE TABLE "); if (node.isNotExists()) { builder.append("IF NOT EXISTS "); } builder.append(formatName(node.getName())); if (node.getColumnAliases().isPresent()) { <START> builder.append(format("(%s) ", join(",", node.getColumnAliases().get()))); <END> } if (node.getComment().isPresent()) { builder.append("\nCOMMENT " + formatStringLiteral(node.getComment().get())); } appendTableProperties(builder, node.getProperties()); builder.append(" AS "); process(node.getQuery(), indent); if (!node.isWithData()) { builder.append(" WITH NO DATA"); } return null; }</code><technical_language>This escape column names if illegal sql identifier characters</technical_language>

Target:
protected Void visitCreateTableAsSelect(CreateTableAsSelect node, Integer indent) { builder.append("CREATE TABLE "); if (node.isNotExists()) { builder.append("IF NOT EXISTS "); } builder.append(formatName(node.getName())); if (node.getColumnAliases().isPresent()) { String columnList = node.getColumnAliases().get().stream().map(element -> formatName(element.getName())).collect(joining(", ")); builder.append(format("( %s )", columnList)); } if (node.getComment().isPresent()) { builder.append("\nCOMMENT " + formatStringLiteral(node.getComment().get())); } appendTableProperties(builder, node.getProperties()); builder.append(" AS "); process(node.getQuery(), indent); if (!node.isWithData()) { builder.append(" WITH NO DATA"); } return null; }
Source:
<code>private void addEnrollmentsToSession(HttpServletRequest request, StringBuilder sb) { M_log.debug("ENROLLMENTS: " + sb.toString()); HashMap<Integer, String> enrollmentsFound = new HashMap<Integer, String>(); JSONArray enrollmentsArray = new JSONArray(sb.toString()); for(int i = 0; i < enrollmentsArray.length(); i++){ JSONObject childJSONObject = enrollmentsArray.getJSONObject(i); M_log.debug("ENROLLMENT RECORD: " + childJSONObject.get("course_id") + " " + childJSONObject.get("course_section_id") + " " + childJSONObject.get("type")); String newType = childJSONObject.getString("type"); String newRole = childJSONObject.getString("role"); M_log.debug("NEW TYPE: " + newType); M_log.debug("NEW ROLE: " + newRole); boolean isTeacher = false; boolean isDesigner = false; if(newType.equals("DesignerEnrollment") && newRole.equals("DesignerEnrollment")){ isDesigner = true; } if(newType.equals("TeacherEnrollment")){ isTeacher = true; } if(isTeacher || isDesigner){ enrollmentsFound.put(childJSONObject.getInt("course_id"), childJSONObject.getString("type")); <START> M_log.debug("BREAKING"); <END> break; } else{ enrollmentsFound.put(childJSONObject.getInt("course_id"), childJSONObject.getString("TAEnrollment")); } } M_log.debug("DONE"); request.getSession().setAttribute("enrollments", enrollmentsFound); M_log.debug("SESSION ENROLLMENTS: " + request.getSession().getAttribute("enrollments")); }</code><technical_language>informative debug message</technical_language>

Target:
private void addEnrollmentsToSession(HttpServletRequest request, StringBuilder sb) { M_log.debug("ENROLLMENTS: " + sb.toString()); HashMap<Integer, String> enrollmentsFound = new HashMap<Integer, String>(); JSONArray enrollmentsArray = new JSONArray(sb.toString()); for(int i = 0; i < enrollmentsArray.length(); i++){ JSONObject childJSONObject = enrollmentsArray.getJSONObject(i); M_log.debug("ENROLLMENT RECORD: " + childJSONObject.get("course_id") + " " + childJSONObject.get("course_section_id") + " " + childJSONObject.get("type")); String newType = childJSONObject.getString("type"); String newRole = childJSONObject.getString("role"); M_log.debug("NEW TYPE: " + newType); M_log.debug("NEW ROLE: " + newRole); boolean canAddTeacher = false; if(newType.equals(DESIGNER_ENROLLMENT) && newRole.equals(DESIGNER_ENROLLMENT)){ canAddTeacher = true; } if(newType.equals(TEACHER_ENROLLMENT)){ canAddTeacher = true; } if(canAddTeacher){ enrollmentsFound.put(childJSONObject.getInt("course_id"), childJSONObject.getString(TEACHER_ENROLLMENT)); break; } else{ enrollmentsFound.put(childJSONObject.getInt("course_id"), childJSONObject.getString(TA_ENROLLMENT)); } } request.getSession().setAttribute("enrollments", enrollmentsFound); M_log.debug("SESSION ENROLLMENTS: " + request.getSession().getAttribute("enrollments")); }
Source:
<code>public void testDetectCleanWorkingDirectory() throws Exception { File dotGitDirectory = AvailableGitTestRepo.GIT_WITH_NO_CHANGES.getDir(); GitDescribeConfig gitDescribeConfig = new GitDescribeConfig(); gitDescribeConfig.setSkip(false); String prefix = "git"; int abbrevLength = 7; String dateFormat = "dd.MM.yyyy '@' HH:mm:ss z"; GitCommitIdMojo mojo = new GitCommitIdMojo(); mojo.setDotGitDirectory(dotGitDirectory); mojo.setPrefix(prefix); mojo.setAbbrevLength(abbrevLength); mojo.setDateFormat(dateFormat); <START> mojo.setVerbose(true); <END> mojo.useNativeGit(false); mojo.setGitDescribe(gitDescribeConfig); mojo.setCommitIdGenerationMode("flat"); mojo.project = mock(MavenProject.class, RETURNS_MOCKS); Properties props = new Properties(); when(mojo.project.getProperties()).thenReturn(props); when(mojo.project.getPackaging()).thenReturn("jar"); mojo.execute(); Properties properties = mojo.getProperties(); assertThat(properties.get("git.dirty")).isEqualTo("false"); }</code><technical_language>please field, easier find (maybe for :wink: )</technical_language>

Target:
public void testDetectCleanWorkingDirectory() throws Exception { File dotGitDirectory = AvailableGitTestRepo.GIT_WITH_NO_CHANGES.getDir(); GitDescribeConfig gitDescribeConfig = new GitDescribeConfig(); gitDescribeConfig.setSkip(false); String prefix = "git"; int abbrevLength = 7; String dateFormat = "dd.MM.yyyy '@' HH:mm:ss z"; boolean verbose = true; boolean useNativeGit = false; String commitIdGenerationMode = "flat"; GitCommitIdMojo mojo = new GitCommitIdMojo(); mojo.setDotGitDirectory(dotGitDirectory); mojo.setPrefix(prefix); mojo.setAbbrevLength(abbrevLength); mojo.setDateFormat(dateFormat); mojo.setVerbose(verbose); mojo.useNativeGit(useNativeGit); mojo.setGitDescribe(gitDescribeConfig); mojo.setCommitIdGenerationMode(commitIdGenerationMode); mojo.project = mock(MavenProject.class, RETURNS_MOCKS); Properties props = new Properties(); when(mojo.project.getProperties()).thenReturn(props); when(mojo.project.getPackaging()).thenReturn("jar"); mojo.execute(); Properties properties = mojo.getProperties(); assertThat(properties.get("git.dirty")).isEqualTo("false"); }
Source:
<code>public void linkifyMessageChangeId() throws Exception { Config config = new Config(); config.setString("commentlink", "bugzilla", "match", "(bug\\s+#?)(\\d+)"); config.setString("commentlink", "bugzilla", "link", "<LINK_1>$2"); <START> <END> config.setString("commentlink", "tracker", "match", "([Bb]ug:\\s+)(\\d+)"); config.setString("commentlink", "tracker", "html", "$1<a href=\"<LINK_0>$2\">$2</a>"); Linkifier l = new Linkifier(TestGitilesUrls.URLS, config); assertEquals(ImmutableList.of( ImmutableMap.of("text", "I0123456789", "url", "http://test-host-review/foo/#/q/I0123456789,n,z")), l.linkify(REQ, "I0123456789")); assertEquals(ImmutableList.of( ImmutableMap.of("text", "Change-Id: "), ImmutableMap.of("text", "I0123456789", "url", "http://test-host-review/foo/#/q/I0123456789,n,z")), l.linkify(REQ, "Change-Id: I0123456789")); assertEquals(ImmutableList.of( ImmutableMap.of("text", "Change-Id: "), ImmutableMap.of("text", "I0123456789", "url", "http://test-host-review/foo/#/q/I0123456789,n,z"), ImmutableMap.of("text", " exists")), l.linkify(REQ, "Change-Id: I0123456789 exists")); }</code><technical_language>(nit) trailing whitespace [and below]</technical_language>

Target:
public void linkifyMessageChangeId() throws Exception { Config config = new Config(); Linkifier l = new Linkifier(TestGitilesUrls.URLS, config); assertEquals(ImmutableList.of( ImmutableMap.of("text", "I0123456789", "url", "http://test-host-review/foo/#/q/I0123456789,n,z")), l.linkify(REQ, "I0123456789")); assertEquals(ImmutableList.of( ImmutableMap.of("text", "Change-Id: "), ImmutableMap.of("text", "I0123456789", "url", "http://test-host-review/foo/#/q/I0123456789,n,z")), l.linkify(REQ, "Change-Id: I0123456789")); assertEquals(ImmutableList.of( ImmutableMap.of("text", "Change-Id: "), ImmutableMap.of("text", "I0123456789", "url", "http://test-host-review/foo/#/q/I0123456789,n,z"), ImmutableMap.of("text", " exists")), l.linkify(REQ, "Change-Id: I0123456789 exists")); }
Source:
<code><START> private String convertFromHtml(final String textToConvert) { <END> String regex1 = "<br />|<p>|</p>|<table>|</table >|<a href='(.*)'>(.*)</a>|<h4>|<pre>|</pre>|<ul>|</ul>|</li>|</tr>|<hr />"; String regex2 = "</h4>|<tbody>|</tbody>|<tr>|<th>"; String regex3 = "<li>"; String regex4 = "</th>"; return textToConvert.replaceAll(regex1, "\n").replaceAll(regex2, "").replaceAll(regex3, " - ").replaceAll(regex4, "\t"); }</code><technical_language>I noticed some-times non-ascii characters embedded docs, for this point fail if this do rely reviewers catch this</technical_language>

Target:
private String convertFromHtml(final String textToConvert) { final String regex1 = "<br />|<p>|</p>|<table>|</table >|<a href='(.*)'>(.*)</a>|<h4>|<pre>|</pre>|<ul>|</ul>|</li>|</tr>|<hr />"; final String regex2 = "<li>"; final String regex3 = "</th>"; final String regex4 = "</h4>|<tbody>|</tbody>|<tr>|<th>|<.*?>"; return textToConvert .replaceAll(regex1, "\n") .replaceAll(regex2, " - ") .replaceAll(regex3, "\t") .replaceAll(regex4, ""); }
Source:
<code>public void poll(long timeoutMs, List<NetworkSend> sends) throws IOException { this.sends = sends; if (sends != null) { for (NetworkSend send : sends) { if (state.get() == MockSelectorState.ThrowExceptionOnPoll) { throw new IOException("Mock exception on poll"); } if (state.get() == MockSelectorState.DisconnectOnSend) { disconnected.add(send.getConnectionId()); } else { MockServer server = connIdToServer.get(send.getConnectionId()); BoundedByteBufferReceive receive = server.send(send.getPayload()); receives.add(new NetworkReceive(send.getConnectionId(), receive, time)); } } } if (state.get() == MockSelectorState.SleepOnPoll) { try { Thread.sleep(0); } catch (InterruptedException e) { <START> throw new IOException("Caught interrupted exception"); <END> } } }</code><technical_language>do throw IOException here</technical_language>

Target:
public void poll(long timeoutMs, List<NetworkSend> sends) throws IOException { this.sends = sends; if (sends != null) { for (NetworkSend send : sends) { if (state.get() == MockSelectorState.ThrowExceptionOnSend) { throw new IOException("Mock exception on send"); } if (state.get() == MockSelectorState.DisconnectOnSend) { disconnected.add(send.getConnectionId()); } else { MockServer server = connIdToServer.get(send.getConnectionId()); BoundedByteBufferReceive receive = server.send(send.getPayload()); receives.add(new NetworkReceive(send.getConnectionId(), receive, time)); } } } if (state.get() == MockSelectorState.ThrowExceptionOnAllPoll) { throw new IOException("Mock exception on poll"); } }
Source:
<code>private Set<BasicAuthorizerRole> getRolesForUser( BasicAuthorizerUser user, Map<String, BasicAuthorizerRole> roleMap ) { Set<BasicAuthorizerRole> roles = new HashSet<>(); for (String roleName : user.getRoles()) { BasicAuthorizerRole role = roleMap.get(roleName); if (role == null) { <START> log.error("User [%s] had role [%s], but role was not found.", user.getName(), roleName); <END> } else { roles.add(role); } } return roles; }</code><technical_language>nit: suggestion log.error("User [%s] role [%s], role object found.", user.getName(), roleName);</technical_language>

Target:
private Set<BasicAuthorizerRole> getRolesForUser( BasicAuthorizerUser user, Map<String, BasicAuthorizerRole> roleMap ) { Set<BasicAuthorizerRole> roles = new HashSet<>(); for (String roleName : user.getRoles()) { BasicAuthorizerRole role = roleMap.get(roleName); if (role == null) { log.error("User [%s] had role [%s], but role object was not found.", user.getName(), roleName); } else { roles.add(role); } } return roles; }
Source:
<code>private boolean fillDestMap() { if (getParameters().getStorageDomainId() != null && !Guid.Empty.equals(getParameters().getStorageDomainId())) { Guid storageId = getParameters().getStorageDomainId(); for (DiskImage image : getImagesToCheckDestinationStorageDomains()) { if (isImageOnDomain(image, storageId)) { diskInfoDestinationMap.put(image.getId(), makeNewImage(storageId, image)); } else { <START> addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_TEMPLATE_NOT_FOUND_ON_DESTINATION_DOMAIN); <END> return false; } } return validateProvidedDestinations(); } ImagesHandler.fillImagesMapBasedOnTemplate(getVmTemplate(), diskInfoDestinationMap, destStorages, false); return true; }</code><technical_language>check is correct- I error message is specific (covers case of templates)</technical_language>

Target:
private boolean fillDestMap() { if (getParameters().getStorageDomainId() != null && !Guid.Empty.equals(getParameters().getStorageDomainId())) { Guid storageId = getParameters().getStorageDomainId(); for (DiskImage image : getImagesToCheckDestinationStorageDomains()) { diskInfoDestinationMap.put(image.getId(), makeNewImage(storageId, image)); } return validateProvidedDestinations(); } ImagesHandler.fillImagesMapBasedOnTemplate(getVmTemplate(), diskInfoDestinationMap, destStorages, false); return true; }
Source:
<code><START> public Attribute getAttributeValue(PerunSessionImpl sess, User user, AttributeDefinition attributeDefinition) throws InternalErrorException { <END> Attribute attribute = new Attribute(attributeDefinition); SortedSet<String> tcsMailsValue = new TreeSet<>(); tcsMailsValue.addAll(getEmailValues(sess, user, A_U_D_preferredMail)); tcsMailsValue.addAll(getEmailValues(sess, user, A_U_D_ISMail)); tcsMailsValue.addAll(getEmailValues(sess, user, A_U_D_o365EmailAddressesMU)); tcsMailsValue.addAll(getEmailValues(sess, user, A_U_D_publicAliasMails)); tcsMailsValue.addAll(getEmailValues(sess, user, A_U_D_privateAliasMails)); attribute.setValue(new ArrayList(tcsMailsValue)); return attribute; }</code><technical_language>throw InternalErrorException in of methods :)</technical_language>

Target:
public Attribute getAttributeValue(PerunSessionImpl sess, User user, AttributeDefinition attributeDefinition) { Attribute attribute = new Attribute(attributeDefinition); SortedSet<String> tcsMailsValue = new TreeSet<>(); tcsMailsValue.addAll(getEmailValues(sess, user, A_U_D_preferredMail)); tcsMailsValue.addAll(getEmailValues(sess, user, A_U_D_ISMail)); tcsMailsValue.addAll(getEmailValues(sess, user, A_U_D_o365EmailAddressesMU)); tcsMailsValue.addAll(getEmailValues(sess, user, A_U_D_publicAliasMails)); tcsMailsValue.addAll(getEmailValues(sess, user, A_U_D_privateAliasMails)); attribute.setValue(new ArrayList<>(tcsMailsValue)); return attribute; }
Source:
<code>public void watchLogs(PodLogHandler handler) throws InfrastructureException { if (logWatcher == null) { LOG.debug("start watching logs of workspace [{}]", workspaceId); logWatcher = new LogWatcher(clientFactory, workspaceId, namespace, handler); watchEvents(logWatcher); } else { <START> LOG.debug("Already watching logs of workspace [{}]", workspaceId); <END> } }</code><technical_language>This is strange IMHO forces caller track of called this method it. KubernetesDeployments is in a couple of places. a alternative provide handler in constructor watchLogs() (or ensureLogsWatched() somesuch). clear is responsible for setting logging starts it</technical_language>

Target:
public void watchLogs(PodLogHandler handler) throws InfrastructureException { if (logWatcher == null) { LOG.debug("start watching logs of workspace [{}]", workspaceId); logWatcher = new LogWatcher(clientFactory, workspaceId, namespace, executor); logWatcher.addLogHandler(handler); watchEvents(logWatcher); } else { LOG.debug("Already watching logs of workspace [{}], just adding log handler", workspaceId); logWatcher.addLogHandler(handler); } }
Source:
<code>public void testToStreamRecordV2WhenNewImageIsNull() { com.amazonaws.services.lambda.runtime.events.models.dynamodb.StreamRecord streamRecord = streamRecord_event.clone(); streamRecord.setNewImage(null); Assertions.assertDoesNotThrow(() -> { <START> StreamRecord convertedStreamRecord = DynamodbStreamRecordTransformer.toStreamRecordV2(streamRecord); <END> }); }</code><technical_language>unnecessary storing of local variable convertedStreamRecord</technical_language>

Target:
public void testToStreamRecordV2WhenNewImageIsNull() { com.amazonaws.services.lambda.runtime.events.models.dynamodb.StreamRecord streamRecord = streamRecord_event.clone(); streamRecord.setNewImage(null); Assertions.assertDoesNotThrow(() -> { DynamodbStreamRecordTransformer.toStreamRecordV2(streamRecord); }); }