auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void instead(String consumerEndpointId, MessageHandler mockMessageHandler, boolean autoStartup) { instead(consumerEndpointId, mockMessageHandler, IntegrationConsumer.class, "handler", autoStartup); if (mockMessageHandler instanceof MessageProducer) { Object targetMessageHandler = this.beans.get(consumerEndpointId); if (targetMessageHandler instanceof MessageProducer) { MessageChannel outputChannel = TestUtils.getPropertyValue(targetMessageHandler, "outputChannel", MessageChannel.class); ((MessageProducer) mockMessageHandler).setOutputChannel(outputChannel); } } <START> } <END></code><technical_language>great output channels MessageProducers automatically restored for mocks. deal other components capable of integration flows' start points? Say, RmiInboundGateway in IntegrationFlows.from() method inherit MessageProducer (nor MessageHandler). I guess a lot of work do support components types (if matters) this moment enough inform user automatic channel "re-connection" is applied MessageProducers only</technical_language>

Target:
public void instead(String consumerEndpointId, MessageHandler mockMessageHandler, boolean autoStartup) { Object endpoint = this.beanFactory.getBean(consumerEndpointId, IntegrationConsumer.class); if (autoStartup && endpoint instanceof Lifecycle) { ((Lifecycle) endpoint).stop(); } DirectFieldAccessor directFieldAccessor = new DirectFieldAccessor(endpoint); Object targetMessageHandler = directFieldAccessor.getPropertyValue("handler"); this.beans.put(consumerEndpointId, targetMessageHandler); if (mockMessageHandler instanceof MessageProducer) { if (targetMessageHandler instanceof MessageProducer) { MessageChannel outputChannel = TestUtils.getPropertyValue(targetMessageHandler, "outputChannel", MessageChannel.class); ((MessageProducer) mockMessageHandler).setOutputChannel(outputChannel); } else { if (mockMessageHandler instanceof MockMessageHandler) { if (TestUtils.getPropertyValue(mockMessageHandler, "hasReplies", Boolean.class)) { throw new IllegalStateException("The [" + mockMessageHandler + "] " + "with replies can't replace simple MessageHandler [" + targetMessageHandler + "]"); } } else { throw new IllegalStateException("The MessageProducer handler [" + mockMessageHandler + "] " + "can't replace simple MessageHandler [" + targetMessageHandler + "]"); } } } directFieldAccessor.setPropertyValue("handler", mockMessageHandler); if (autoStartup && endpoint instanceof Lifecycle) { ((Lifecycle) endpoint).start(); } }
Source:
<code>public DataSet buildDataSet(Map<String, String> params) { final DataSetBuilder dsBuilder = DataSetFactory.newDataSetBuilder(); for (final DataColumnDef columnDef : dataSetdef.getColumns()) { dsBuilder.column(columnDef.getId(), columnDef.getColumnType()); } final Collection<OrganizationalUnit> orgUnitList = organizationalUnitService.getOrganizationalUnits(); for (final OrganizationalUnit orgUnit : orgUnitList) { final String org = orgUnit.getName(); <START> final Collection<Project> projects = projectService.getAllProjects(orgUnit); <END> if (projects.isEmpty()) { dsBuilder.row(org, null, null, "Empty organizational unit", null); } else { for (final Project project : projects) { final String repoAlias = project.getRepository().getAlias(); final String projectName = project.getName(); org.uberfire.backend.vfs.Path rootPath = project.getRootPath(); final Path projectRoot = Paths.convert(rootPath); final List<VersionRecord> recordList = recordService.loadVersionRecords(projectRoot); if (recordList.isEmpty()) { dsBuilder.row(org, repoAlias, null, null, null, "Empty project", null); } else { for (VersionRecord record : recordList) { String alias = record.author(); String author = authorMappings.getProperty(alias); author = author == null ? alias : author; String msg = record.comment(); Date date = record.date(); dsBuilder.row(org, repoAlias, projectName, author, msg, date); } } } } } DataSet dataSet = dsBuilder.buildDataSet(); dataSet.setUUID(GIT_CONTRIB); return dataSet; }</code><technical_language>this project (the abstract projecT) query here? for modules</technical_language>

Target:
public DataSet buildDataSet(Map<String, String> params) { final DataSetBuilder dsBuilder = DataSetFactory.newDataSetBuilder(); for (final DataColumnDef columnDef : dataSetdef.getColumns()) { dsBuilder.column(columnDef.getId(), columnDef.getColumnType()); } final Collection<OrganizationalUnit> orgUnitList = organizationalUnitService.getOrganizationalUnits(); for (final OrganizationalUnit orgUnit : orgUnitList) { final String org = orgUnit.getName(); final Collection<WorkspaceProject> projects = projectService.getAllWorkspaceProjects(orgUnit); if (projects.isEmpty()) { dsBuilder.row(org, null, null, "Empty organizational unit", null); } else { for (final WorkspaceProject project : projects) { final String repoAlias = project.getRepository().getAlias(); final String projectName = project.getName(); org.uberfire.backend.vfs.Path rootPath = project.getRootPath(); final Path projectRoot = Paths.convert(rootPath); final List<VersionRecord> recordList = recordService.loadVersionRecords(projectRoot); if (recordList.isEmpty()) { dsBuilder.row(org, repoAlias, null, null, null, "Empty project", null); } else { for (VersionRecord record : recordList) { String alias = record.author(); String author = authorMappings.getProperty(alias); author = author == null ? alias : author; String msg = record.comment(); Date date = record.date(); dsBuilder.row(org, repoAlias, projectName, author, msg, date); } } } } } DataSet dataSet = dsBuilder.buildDataSet(); dataSet.setUUID(GIT_CONTRIB); return dataSet; }
Source:
<code>public StudyEventBean getNextParticipantEvent(StudySubjectBean studySubject) { List<StudyEventBean> studyEvents = (ArrayList<StudyEventBean>)getStudyEventDAO().findAllBySubjectIdOrdered(studySubject.getId()); for (StudyEventBean studyEvent:studyEvents) { if ( (studyEvent.getRemoved()!=null && studyEvent.getRemoved()) || <START> (studyEvent.getArchived()!=null && studyEvent.getArchived()) || <END> (!studyEvent.getWorkflowStatus().equals(StudyEventWorkflowStatusEnum.DATA_ENTRY_STARTED) && !studyEvent.getWorkflowStatus().equals(StudyEventWorkflowStatusEnum.SCHEDULED))) continue; List<EventDefinitionCRFBean> eventDefCrfs = getEventDefCrfsForStudyEvent(studySubject, studyEvent); for (EventDefinitionCRFBean eventDefCrf:eventDefCrfs) { boolean participantForm = eventDefCrf.isParticipantForm(); if (participantForm) { List<FormLayoutBean> formLayouts = getAllFormLayouts(eventDefCrf); boolean eventCrfExists = false; for (FormLayoutBean formLayout:formLayouts) { EventCRFBean eventCRF = getEventCRFDAO().findByEventFormLayout(studyEvent, formLayout); if (eventCRF != null && (eventCRF.getRemoved()==null || !eventCRF.getRemoved()) && (eventCRF.getArchived()==null || !eventCRF.getArchived())) return studyEvent; else if (eventCRF != null) eventCrfExists = true; } if (!eventCrfExists) return studyEvent; } } } return null; }</code><technical_language>BooleanUtils</technical_language>

Target:
public StudyEventBean getNextParticipantEvent(StudySubjectBean studySubject) { List<StudyEventBean> studyEvents = (ArrayList<StudyEventBean>)getStudyEventDAO().findAllBySubjectIdOrdered(studySubject.getId()); for (StudyEventBean studyEvent:studyEvents) { if ( BooleanUtils.isTrue(studyEvent.getRemoved()) || BooleanUtils.isTrue(studyEvent.getArchived()) || (!studyEvent.getWorkflowStatus().equals(StudyEventWorkflowStatusEnum.DATA_ENTRY_STARTED) && !studyEvent.getWorkflowStatus().equals(StudyEventWorkflowStatusEnum.SCHEDULED))) continue; List<EventDefinitionCRFBean> eventDefCrfs = getEventDefCrfsForStudyEvent(studySubject, studyEvent); for (EventDefinitionCRFBean eventDefCrf:eventDefCrfs) { boolean participantForm = eventDefCrf.isParticipantForm(); if (participantForm) { List<FormLayoutBean> formLayouts = getAllFormLayouts(eventDefCrf); boolean eventCrfExists = false; for (FormLayoutBean formLayout:formLayouts) { EventCRFBean eventCRF = getEventCRFDAO().findByEventFormLayout(studyEvent, formLayout); if (BooleanUtils.isFalse(eventCRF.getRemoved()) && BooleanUtils.isFalse(eventCRF.getArchived())) return studyEvent; else if (eventCRF != null) eventCrfExists = true; } if (!eventCrfExists) return studyEvent; } } } return null; }
Source:
<code>public boolean updateMembers(Collection<Address> newMembers) { collector.retain(newMembers); log.tracef("Rebalance confirmation collector %d@%s members list updated, remaining list is %s", topologyId, cacheName, collector.pending()); <START> return collector.isAllCollected(); <END> }</code><technical_language>I isAllCollected() returns true once, call endRebalance() twice. still, is synchronization covering retain() isAllCompletedCall(), thread confirmation is thread call endRebalance(), for some confusing logs. In end I need for a separate Collector class, RebalanceConfirmationCollector is longer collector extracted it, I suspect XSiteStateTransferCollector shorter it</technical_language>

Target:
public boolean updateMembers(Collection<Address> newMembers) { synchronized (this) { boolean modified = confirmationsNeeded.retainAll(newMembers); log.tracef("Rebalance confirmation collector %d@%s members list updated, remaining list is %s", topologyId, cacheName, confirmationsNeeded); return modified && confirmationsNeeded.isEmpty(); } }
Source:
<code>public boolean isTopicCreationEnabled() { <START> return config.getBoolean(TOPIC_CREATION_ENABLE_CONFIG); <END> }</code><technical_language>new method WorkerConfig instead? suggestion return config.topicCreationEnable();</technical_language>

Target:
public boolean isTopicCreationEnabled() { return config.topicCreationEnable(); }
Source:
<code>public GroupItem(String name, GenericItem baseItem, GroupFunction function) { super(TYPE, name); if (baseItem == null || function == null) { baseItem = null; <START> function = null; <END> } members = new CopyOnWriteArraySet<Item>(); this.function = function; this.baseItem = baseItem; }</code><technical_language>please reassign method parameters. this.baseIteminstead elsecase for other assignement</technical_language>

Target:
public GroupItem(String name, GenericItem baseItem, GroupFunction function) { super(TYPE, name); if (baseItem == null || function == null) { this.baseItem = null; this.function = null; } else { this.function = function; this.baseItem = baseItem; } members = new CopyOnWriteArraySet<Item>(); }
Source:
<code>public static void checkNewVersion(@NonNull final App app) { final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(app); if (!prefs.getBoolean(app.getString(R.string.update_app_key), true) || !isGithubApk(app)) { <START> if (disposable != null) { disposable.dispose(); } <END> return; } disposable = Observable.fromCallable(() -> { if (!isConnected(app)) { return null; } try { return DownloaderImpl.getInstance().get(NEWPIPE_API_URL).responseBody(); } catch (IOException | ReCaptchaException e) { if (DEBUG) { Log.w(TAG, Log.getStackTraceString(e)); } } return null; }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(response -> { if (response != null) { try { final JsonObject githubStableObject = JsonParser.object().from(response) .getObject("flavors").getObject("github").getObject("stable"); final String versionName = githubStableObject.getString("version"); final int versionCode = githubStableObject.getInt("version_code"); final String apkLocationUrl = githubStableObject.getString("apk"); compareAppVersionAndShowNotification(app, versionName, apkLocationUrl, versionCode); } catch (final JsonParserException e) { if (DEBUG) { Log.w(TAG, Log.getStackTraceString(e)); } } } }); }</code><technical_language>this</technical_language>

Target:
public static Disposable checkNewVersion(@NonNull final App app) { final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(app); if (!prefs.getBoolean(app.getString(R.string.update_app_key), true) || !isGithubApk(app)) { return Disposables.empty(); } return Observable.fromCallable(() -> { if (!isConnected(app)) { return null; } try { return DownloaderImpl.getInstance().get(NEWPIPE_API_URL).responseBody(); } catch (IOException | ReCaptchaException e) { if (DEBUG) { Log.w(TAG, Log.getStackTraceString(e)); } } return null; }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(response -> { if (response != null) { try { final JsonObject githubStableObject = JsonParser.object().from(response) .getObject("flavors").getObject("github").getObject("stable"); final String versionName = githubStableObject.getString("version"); final int versionCode = githubStableObject.getInt("version_code"); final String apkLocationUrl = githubStableObject.getString("apk"); compareAppVersionAndShowNotification(app, versionName, apkLocationUrl, versionCode); } catch (final JsonParserException e) { if (DEBUG) { Log.w(TAG, Log.getStackTraceString(e)); } } } }); }
Source:
<code>public void addEventListenerFactory(EventListenerFactory eventListenerFactory) { configuredEventListener.set(Optional.of(eventListenerFactory.create(ImmutableMap.of(), new EventListenerContext() { <START> private final MBeanServer mBeanServer = getMBeanNamespaceManager().createMBeanServer("TestEventListener"); <END> @Override public MBeanServer getMBeanServer() { return mBeanServer; } }))); }</code><technical_language>Declare</technical_language>

Target:
public void addEventListenerFactory(EventListenerFactory eventListenerFactory) { configuredEventListener.set(Optional.of(eventListenerFactory.create(ImmutableMap.of(), new EventListenerContext() { @Override public MBeanServer getMBeanServer() { return mBeanServer; } }))); }
Source:
<code>private void waitForPriorityEvents(InputGate inputGate, MailboxExecutor mailboxExecutor) { final CompletableFuture<?> priorityEventAvailableFuture = inputGate.getPriorityEventAvailableFuture(); FutureUtils.assertNoException(priorityEventAvailableFuture.thenRun(() -> { try { mailboxExecutor.execute(this::processPriorityEvents, "process priority event @ gate %s", inputGate); } catch (RejectedExecutionException ex) { <START> LOG.info("Ignored RejectedExecutionException in CheckpointedInputGate.waitForPriorityEvents"); <END> } })); }</code><technical_language>debug</technical_language>

Target:
private void waitForPriorityEvents(InputGate inputGate, MailboxExecutor mailboxExecutor) { final CompletableFuture<?> priorityEventAvailableFuture = inputGate.getPriorityEventAvailableFuture(); assertNoException(priorityEventAvailableFuture.thenRun(() -> { try { mailboxExecutor.execute(this::processPriorityEvents, "process priority event @ gate %s", inputGate); } catch (RejectedExecutionException ex) { LOG.debug("Ignored RejectedExecutionException in CheckpointedInputGate.waitForPriorityEvents"); } })); }
Source:
<code>public void handlePeriodicMeterReadsresponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception, final PeriodicMeterReadsResponseDto periodMeterReadsValueDTO) { LOGGER.info("handlePeriodicMeterReadsresponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, exception); result = ResponseMessageResultType.NOT_OK; } <START> this.webServiceResponseMessageSender.send( <END> ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception) .withDataObject( this.monitoringMapper.map(periodMeterReadsValueDTO, PeriodicMeterReadsContainer.class)) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(), deviceMessageMetadata.getMessageType()); }</code><technical_language>Extract building of ResponseMessage variable (in eclipse, select text, right-click > refactor > extract local variable / select code + shift+alt+L). This code a bit more readable, especially passing in other besides ResponseMessage</technical_language>

Target:
public void handlePeriodicMeterReadsresponse(final DeviceMessageMetadata deviceMessageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception, final PeriodicMeterReadsResponseDto periodMeterReadsValueDTO) { LOGGER.info("handlePeriodicMeterReadsresponse for MessageType: {}", deviceMessageMetadata.getMessageType()); ResponseMessageResultType result = deviceResult; if (exception != null) { LOGGER.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, exception); result = ResponseMessageResultType.NOT_OK; } final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder() .withCorrelationUid(deviceMessageMetadata.getCorrelationUid()) .withOrganisationIdentification(deviceMessageMetadata.getOrganisationIdentification()) .withDeviceIdentification(deviceMessageMetadata.getDeviceIdentification()).withResult(result) .withOsgpException(exception) .withDataObject(this.monitoringMapper.map(periodMeterReadsValueDTO, PeriodicMeterReadsContainer.class)) .withMessagePriority(deviceMessageMetadata.getMessagePriority()).build(); this.webServiceResponseMessageSender.send(responseMessage, deviceMessageMetadata.getMessageType()); }
Source:
<code>private boolean isCandidate(Map<ColumnHandle, NullableValue> bindings) { <START> if (!arguments.stream().anyMatch(bindings.keySet()::contains)) { <END> return true; } LookupSymbolResolver inputs = new LookupSymbolResolver(assignments, bindings); Object optimized = evaluator.optimize(inputs); if (Boolean.FALSE.equals(optimized) || optimized == null || optimized instanceof NullLiteral) { return false; } return true; }</code><technical_language>bindings.keySet() in call isCandidate()</technical_language>

Target:
private boolean isCandidate(Map<ColumnHandle, NullableValue> bindings) { if (intersection(bindings.keySet(), arguments).isEmpty()) { return true; } LookupSymbolResolver inputs = new LookupSymbolResolver(assignments, bindings); Object optimized = evaluator.optimize(inputs); if (Boolean.FALSE.equals(optimized) || optimized == null || optimized instanceof NullLiteral) { return false; } return true; }
Source:
<code>private static Graphics2D createGraphics2d(String fmt, OutputStream out, Dimension dim) throws IOException { switch (fmt) { case Depiction.SVG_FMT: SVGGraphics2D svg = new SVGGraphics2D(out, dim); <START> svg.setCreator("Chemistry Development Kit (CDK)"); <END> svg.writeHeader(); return svg; case Depiction.PDF_FMT: PDFGraphics2D pdf = new PDFGraphics2D(out, dim); pdf.setCreator("Chemistry Development Kit (CDK)"); Properties props = new Properties(); props.setProperty(PDFGraphics2D.FIT_TO_PAGE, "false"); props.setProperty(PDFGraphics2D.PAGE_SIZE, PDFGraphics2D.CUSTOM_PAGE_SIZE); props.setProperty(PDFGraphics2D.CUSTOM_PAGE_SIZE, dim.width + ", " + dim.height); props.setProperty(PDFGraphics2D.PAGE_MARGINS, "0, 0, 0, 0"); pdf.setProperties(props); pdf.writeHeader(); return pdf; case Depiction.PS_FMT: default: throw new IOException("Unsupported vector format, " + fmt); } }</code><technical_language>"Chemistry Development Kit (<LINK_0>"... ? A long time I read Google indexing SVG image content ... sure, though; check..</technical_language>

Target:
private static Graphics2D createGraphics2d(String fmt, OutputStream out, Dimension dim) throws IOException { switch (fmt) { case Depiction.SVG_FMT: SVGGraphics2D svg = new SVGGraphics2D(out, dim); svg.setCreator("Chemistry Development Kit (<LINK_1>"); svg.writeHeader(); return svg; case Depiction.PDF_FMT: PDFGraphics2D pdf = new PDFGraphics2D(out, dim); pdf.setCreator("Chemistry Development Kit (<LINK_1>"); Properties props = new Properties(); props.setProperty(PDFGraphics2D.FIT_TO_PAGE, "false"); props.setProperty(PDFGraphics2D.PAGE_SIZE, PDFGraphics2D.CUSTOM_PAGE_SIZE); props.setProperty(PDFGraphics2D.CUSTOM_PAGE_SIZE, dim.width + ", " + dim.height); props.setProperty(PDFGraphics2D.PAGE_MARGINS, "0, 0, 0, 0"); pdf.setProperties(props); pdf.writeHeader(); return pdf; case Depiction.PS_FMT: default: throw new IOException("Unsupported vector format, " + fmt); } }
Source:
<code>public void run() { try { while (RedisQueueInboundGateway.this.active) { RedisQueueInboundGateway.this.listening = true; <START> RedisQueueInboundGateway.this.popMessageWithHeaderAndSend(); <END> } } finally { if (RedisQueueInboundGateway.this.active) { RedisQueueInboundGateway.this.restart(); } else { RedisQueueInboundGateway.this.lifecycleLock.lock(); try { RedisQueueInboundGateway.this.lifecycleCondition.signalAll(); } finally { RedisQueueInboundGateway.this.lifecycleLock.unlock(); } } } }</code><technical_language>Well, for name receiveAndReply. Nitpick, of course, naming is a good tone</technical_language>

Target:
public void run() { try { while (RedisQueueInboundGateway.this.active) { RedisQueueInboundGateway.this.listening = true; RedisQueueInboundGateway.this.receiveAndReply(); } } finally { if (RedisQueueInboundGateway.this.active) { RedisQueueInboundGateway.this.restart(); } else { RedisQueueInboundGateway.this.lifecycleLock.lock(); try { RedisQueueInboundGateway.this.lifecycleCondition.signalAll(); } finally { RedisQueueInboundGateway.this.lifecycleLock.unlock(); } } } }
Source:
<code>public Future<String> runTransformationAsync(List<ITransformation> transformations, List<String> networkIdList) throws QuadrigaGeneratorException { List<List<TransformNode>> results = matchGraphs.matchGraphs(transformations, networkIdList); <START> logger.info("Check results for transformations: " + results); <END> String graphString = generator.generateText(results, null, true); return new AsyncResult<>(graphString); }</code><technical_language>remove</technical_language>

Target:
public Future<String> runTransformationAsync(List<ITransformation> transformations, List<String> networkIdList) throws QuadrigaGeneratorException { List<List<TransformNode>> results = matchGraphs.matchGraphs(transformations, networkIdList); String graphString = generator.generateText(results, null, true); return new AsyncResult<>(graphString); }
Source:
<code>protected void doPost(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { SQLSource.interact(new SQLInteractionInterface<Integer>() { <START> @Override <END> public Integer run(Connection connection) throws ServiceException, SQLException { uniID = Integer.parseInt(request.getParameter("university")); University university = UniversityUtil.getUniversityID(uniID); deptName = request.getParameter("deptName"); acronym = request.getParameter("acronym"); Department department = Department.create(connection, university, deptName, acronym); ID = department.getID(); return 0; } } ); response.sendRedirect("/department/index.jsp?did=" + ID); }</code><technical_language>_nitpick_: Indentation is pretty for anonymous class definition</technical_language>

Target:
protected void doPost(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { SQLSource.interact(new SQLInteractionInterface<Integer>() { @Override public Integer run(Connection connection) throws ServiceException, SQLException { int uniID = Integer.parseInt(request.getParameter("university")); University university = UniversityUtil.getUniversityID(uniID); String deptName = request.getParameter("deptName"); String acronym = request.getParameter("acronym"); if (university == null || deptName == null || acronym == null) { throw new ServiceException(ServiceStatus.MALFORMED_REQUEST); } Department department = Department.create(connection, university, deptName, acronym); ID = department.getID(); return 0; } } ); response.sendRedirect("/department/index.jsp?did=" + ID); }
Source:
<code>public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionList = new ArrayList<PermissionSubject>(); permissionList.add(new PermissionSubject(getVdsGroupId(), VdcObjectType.VdsGroups, getActionType().getActionGroup())); permissionList.add(new PermissionSubject(getVmTemplateId(), VdcObjectType.VmTemplate, getActionType().getActionGroup())); if (getVmTemplate() != null && !getVmTemplate().getDiskList().isEmpty()) { for (DiskImage disk : getParameters().getDiskInfoDestinationMap().values()) { addStoragePermissionByQuotaMode(permissionList, GuidUtils.getGuidValue(getStoragePoolId()), <START> GuidUtils.getGuidValue(disk.getStorageIds().get(0))); <END> } } addPermissionSubjectForAdminLevelProperties(permissionList); return permissionList; }</code><technical_language>1st one</technical_language>

Target:
public List<PermissionSubject> getPermissionCheckSubjects() { List<PermissionSubject> permissionList = new ArrayList<PermissionSubject>(); permissionList.add(new PermissionSubject(getVdsGroupId(), VdcObjectType.VdsGroups, getActionType().getActionGroup())); permissionList.add(new PermissionSubject(getVmTemplateId(), VdcObjectType.VmTemplate, getActionType().getActionGroup())); if (getVmTemplate() != null && !getVmTemplate().getDiskList().isEmpty()) { for (DiskImage disk : getParameters().getDiskInfoDestinationMap().values()) { if (disk.getStorageIds() != null && !disk.getStorageIds().isEmpty()) { addStoragePermissionByQuotaMode(permissionList, GuidUtils.getGuidValue(getStoragePoolId()), GuidUtils.getGuidValue(disk.getStorageIds().get(0))); } } } addPermissionSubjectForAdminLevelProperties(permissionList); return permissionList; }
Source:
<code>public static String toString(EnumSet<NtfsFileAttributes> ntfsAttributes) { if (ntfsAttributes == null) { return Constants.EMPTY_STRING; } final StringBuilder builder = new StringBuilder(); <START> if (ntfsAttributes.contains(NtfsFileAttributes.READ_ONLY)) { <END> builder.append("ReadOnly|"); } if (ntfsAttributes.contains(NtfsFileAttributes.HIDDEN)) { builder.append("Hidden|"); } if (ntfsAttributes.contains(NtfsFileAttributes.SYSTEM)) { builder.append("System|"); } if (ntfsAttributes.contains(NtfsFileAttributes.NORMAL)) { builder.append("None|"); } if (ntfsAttributes.contains(NtfsFileAttributes.DIRECTORY)) { builder.append("Directory|"); } if (ntfsAttributes.contains(NtfsFileAttributes.ARCHIVE)) { builder.append("Archive|"); } if (ntfsAttributes.contains(NtfsFileAttributes.TEMPORARY)) { builder.append("Temporary|"); } if (ntfsAttributes.contains(NtfsFileAttributes.OFFLINE)) { builder.append("Offline|"); } if (ntfsAttributes.contains(NtfsFileAttributes.NOT_CONTENT_INDEXED)) { builder.append("NotContentIndexed|"); } if (ntfsAttributes.contains(NtfsFileAttributes.NO_SCRUB_DATA)) { builder.append("NoScrubData|"); } builder.deleteCharAt(builder.lastIndexOf("|")); return builder.toString(); }</code><technical_language>add a small helper function takes in StringBuilder, EnumSet, Enum for, String add if enum is found</technical_language>

Target:
public static String toString(EnumSet<NtfsFileAttributes> ntfsAttributes) { if (ntfsAttributes == null) { return Constants.EMPTY_STRING; } final StringBuilder builder = new StringBuilder(); toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.READ_ONLY, "ReadOnly|"); toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.HIDDEN, "ReadOnly|"); toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.READ_ONLY, "Hidden|"); toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.SYSTEM, "System|"); toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.NORMAL, "None|"); toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.DIRECTORY, "Directory|"); toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.ARCHIVE, "Archive|"); toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.TEMPORARY, "Temporary|"); toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.OFFLINE, "Offline|"); toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.NOT_CONTENT_INDEXED, "NotContentIndexed|"); toStringHelper(builder, ntfsAttributes, NtfsFileAttributes.NO_SCRUB_DATA, "NoScrubData|"); builder.deleteCharAt(builder.lastIndexOf("|")); return builder.toString(); }
Source:
<code>private String localizeKey(Context context, String key, String value) { if (key.equals(TITLE) || key.equals(MESSAGE) || key.equals(SUMMARY_TEXT)) { try { <START> JSONObject localeObject = new JSONObject(value); <END> String localeKey = localeObject.getString("locKey"); ArrayList<String> localeFormatData = new ArrayList<String>(); if (!localeObject.isNull("locData")) { String localeData = localeObject.getString("locData"); JSONArray localeDataArray = new JSONArray(localeData); for (int i = 0 ; i < localeDataArray.length(); i++) { localeFormatData.add(localeDataArray.getString(i)); } } String packageName = context.getPackageName(); Resources resources = context.getResources(); int resourceId = resources.getIdentifier(localeKey, "string", packageName); if (resourceId != 0) { return resources.getString(resourceId, localeFormatData.toArray()); } else { Log.d(LOG_TAG, "can't find resource for locale key = " + localeKey); return value; } } catch(JSONException e) { Log.d(LOG_TAG, "no locale found for key = " + key + ", error " + e.getMessage()); return value; } } return value; }</code><technical_language>Instead of create a JSONObject string passed in do a check if needs localized? for apps localizing push messages throw 2 JSONExceptions for push message received. like: if (value.toLowerCase().contains("locKey".toLowerCase()) { // do stuff }</technical_language>

Target:
private String localizeKey(Context context, String key, String value) { if (key.equals(TITLE) || key.equals(MESSAGE) || key.equals(SUMMARY_TEXT)) { try { JSONObject localeObject = new JSONObject(value); String localeKey = localeObject.getString(LOC_KEY); ArrayList<String> localeFormatData = new ArrayList<String>(); if (!localeObject.isNull(LOC_DATA)) { String localeData = localeObject.getString(LOC_DATA); JSONArray localeDataArray = new JSONArray(localeData); for (int i = 0 ; i < localeDataArray.length(); i++) { localeFormatData.add(localeDataArray.getString(i)); } } String packageName = context.getPackageName(); Resources resources = context.getResources(); int resourceId = resources.getIdentifier(localeKey, "string", packageName); if (resourceId != 0) { return resources.getString(resourceId, localeFormatData.toArray()); } else { Log.d(LOG_TAG, "can't find resource for locale key = " + localeKey); return value; } } catch(JSONException e) { Log.d(LOG_TAG, "no locale found for key = " + key + ", error " + e.getMessage()); return value; } } return value; }
Source:
<code>String recite() { if (words.length < 1) return ""; <START> String initWord = "", <END> result = ""; for(int i = 0; i < words.length; i++) { String word = words[i]; if (initWord.isEmpty()) { initWord = word; } else { result += "the " + word + " was lost.\n"; } if (i + 1 != words.length) result += "For want of a " + word + " "; } return result += "And all for the want of a " + initWord + "."; }</code><technical_language>this set words[0] instead of setting empty string immediately checking if empty</technical_language>

Target:
String recite() { if (words.length < 1) { return ""; } final StringBuilder result = new StringBuilder(); for(int i = 1; i < words.length; i++) { result.append("For want of a " + words[i - 1] + " the " + words[i] + " was lost.\n"); } result.append("And all for the want of a " + words[0] + "."); return result.toString(); }
Source:
<code>private List<HomeFeedbackSessionRow> createSessionRows(List<FeedbackSessionAttributes> sessions, InstructorAttributes instructor) { List<HomeFeedbackSessionRow> rows = new ArrayList<>(); for (FeedbackSessionAttributes session : sessions) { InstructorHomeFeedbackSessionRow row = new InstructorHomeFeedbackSessionRow( sanitizeForHtml(session.getFeedbackSessionName()), getInstructorSubmissionsTooltipForFeedbackSession(session), getInstructorPublishedTooltipForFeedbackSession(session), getInstructorSubmissionStatusForFeedbackSession(session), getInstructorPublishedStatusForFeedbackSession(session), TimeHelper.formatDateTimeForInstructorHomePage(session.getStartTimeLocal()), session.getStartTimeInIso8601UtcFormat(), <START> TimeHelper.formatDateTimeForSessionsFixedOffset(session.getStartTime(), session.getTimeZone()), <END> TimeHelper.formatDateTimeForInstructorHomePage(session.getEndTimeLocal()), session.getEndTimeInIso8601UtcFormat(), TimeHelper.formatDateTimeForSessionsFixedOffset(session.getEndTime(), session.getTimeZone()), getInstructorFeedbackStatsLink(session.getCourseId(), session.getFeedbackSessionName()), getInstructorFeedbackSessionActions( session, Const.ActionURIs.INSTRUCTOR_HOME_PAGE, instructor)); rows.add(row); } return rows; }</code><technical_language>yes, change this formatDateTimeForSessions delete this method TimeHelper? a workaround for this issue</technical_language>

Target:
private List<HomeFeedbackSessionRow> createSessionRows(List<FeedbackSessionAttributes> sessions, InstructorAttributes instructor) { List<HomeFeedbackSessionRow> rows = new ArrayList<>(); for (FeedbackSessionAttributes session : sessions) { InstructorHomeFeedbackSessionRow row = new InstructorHomeFeedbackSessionRow( sanitizeForHtml(session.getFeedbackSessionName()), getInstructorSubmissionsTooltipForFeedbackSession(session), getInstructorPublishedTooltipForFeedbackSession(session), getInstructorSubmissionStatusForFeedbackSession(session), getInstructorPublishedStatusForFeedbackSession(session), TimeHelper.formatDateTimeForInstructorHomePage(session.getStartTimeLocal()), session.getStartTimeInIso8601UtcFormat(), TimeHelper.formatDateTimeForSessions(session.getStartTime(), session.getTimeZone()), TimeHelper.formatDateTimeForInstructorHomePage(session.getEndTimeLocal()), session.getEndTimeInIso8601UtcFormat(), TimeHelper.formatDateTimeForSessions(session.getEndTime(), session.getTimeZone()), getInstructorFeedbackStatsLink(session.getCourseId(), session.getFeedbackSessionName()), getInstructorFeedbackSessionActions( session, Const.ActionURIs.INSTRUCTOR_HOME_PAGE, instructor)); rows.add(row); } return rows; }
Source:
<code>public void visitToken(DetailAST ast) { final String line = getLine(ast.getLineNo() - 1); final int before = ast.getColumnNo() - 1; if (isColonOfCaseOrDefault(ast) && (before == -1 <START> || Character.isWhitespace(line.charAt(before)))) { <END> log(ast, MSG_KEY, ast.getText()); } }</code><technical_language>please work AST only, discourage usage of getLine method possible. need compare AST nodes line columnNo +1 of previous AST column + previous AST text</technical_language>

Target:
public void visitToken(DetailAST ast) { final DetailAST parent = ast.getParent(); final boolean isColonOfCase = parent.getType() == TokenTypes.LITERAL_CASE; final boolean isColonOfDefault = parent.getType() == TokenTypes.LITERAL_DEFAULT; if (isColonOfCase || isColonOfDefault) { final boolean violation = isColonOfCase && checkWhitespaceBeforeColonOfCase(ast) || isColonOfDefault && checkWhitespaceBeforeColonOfDefault(ast); if (violation) { log(ast, MSG_KEY, ast.getText()); } } }
Source:
<code>private void markExpiredCommandAsFailure(Guid cmdId) { CommandEntity cmdEntity = coco.getCommandEntity(cmdId); if (cmdEntity != null && cmdEntity.getCommandStatus() == CommandStatus.ACTIVE) { Calendar cal = Calendar.getInstance(); Integer cmdLifeTimeInMin = cmdEntity.getCommandParameters().getLifeInMinutes(); cal.add(Calendar.MINUTE, (-1) * (cmdLifeTimeInMin == null ? Config.<Integer>getValue(ConfigValues.CoCoLifeInMinutes) : cmdLifeTimeInMin)); if (cmdEntity.getCreatedAt().getTime() < cal.getTime().getTime()) { <START> log.info("Marking expired command as Failed: command '{} ({})' that started at '{}' has been marked as Failed.", <END> cmdEntity.getCommandType(), cmdEntity.getId(), cmdEntity.getCreatedAt()); coco.updateCommandStatus(cmdId, CommandStatus.FAILED); } } }</code><technical_language>Consider change this warn</technical_language>

Target:
private void markExpiredCommandAsFailure(Guid cmdId) { CommandEntity cmdEntity = coco.getCommandEntity(cmdId); if (cmdEntity != null && cmdEntity.getCommandStatus() == CommandStatus.ACTIVE) { Calendar cal = Calendar.getInstance(); Integer cmdLifeTimeInMin = cmdEntity.getCommandParameters().getLifeInMinutes(); cal.add(Calendar.MINUTE, (-1) * (cmdLifeTimeInMin == null ? Config.<Integer>getValue(ConfigValues.CoCoLifeInMinutes) : cmdLifeTimeInMin)); if (cmdEntity.getCreatedAt().getTime() < cal.getTime().getTime()) { log.warn("Marking expired command as Failed: command '{} ({})' that started at '{}' has been marked as Failed.", cmdEntity.getCommandType(), cmdEntity.getId(), cmdEntity.getCreatedAt()); coco.updateCommandStatus(cmdId, CommandStatus.FAILED); } } }
Source:
<code>private String newNamesQuery(final Set<Locale> locales, final String name, final boolean keywords) { final String phrase; if (keywords) { phrase = "(" + newRequirePartialWordsSearchPhrase(name) + " \"" + name + "\"^10)"; } else { phrase = "\"" + LuceneQuery.escapeQuery(name) + "\""; } StringBuilder query = new StringBuilder(); query.append(" +name:").append(phrase); query.append(" +locale:("); <START> for (Locale locale : locales) { <END> query.append(locale.getLanguage()).append("* "); if (!StringUtils.isBlank(locale.getCountry())) { query.append(locale).append("^2"); } } query.append(")"); query.append(" +voided:false"); return query.toString(); }</code><technical_language>this work if locales list is empty</technical_language>

Target:
private String newNamesQuery(final Set<Locale> locales, final String name, final boolean keywords) { final String phrase; if (keywords) { phrase = "(" + newRequirePartialWordsSearchPhrase(name) + " \"" + name + "\"^1000)"; } else { phrase = "\"" + LuceneQuery.escapeQuery(name) + "\""; } StringBuilder query = new StringBuilder(); query.append(" +name:").append(phrase); query.append(" +locale:("); for (Locale locale : locales) { query.append(locale.getLanguage()).append("* "); if (!StringUtils.isBlank(locale.getCountry())) { query.append(locale).append("^2"); } } query.append(")"); query.append(" +voided:false"); return query.toString(); }
Source:
<code>private static Content getPathIdFile(BlackboardArtifact artifact) throws ExecutionException { try { for (BlackboardAttribute attribute : artifact.getAttributes()) { if (attribute.getAttributeType().getTypeID() == BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID.getTypeID()) { return contentCache.get(attribute.getValueLong(), () -> artifact.getSleuthkitCase().getContentById(attribute.getValueLong())); } } } catch (TskCoreException ex) { <START> logger.log(Level.WARNING, MessageFormat.format("Error getting content for path id attrbiute for artifact: ", artifact.getId()), ex); END> } return null; }</code><technical_language>I simplify this code slightly advantage of this BlackboardArtifact method: BlackboardAttribute getAttribute(BlackboardAttribute.Type attributeType)</technical_language>

Target:
private static Content getPathIdFile(BlackboardArtifact artifact) throws ExecutionException { try { BlackboardAttribute attribute = artifact.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PATH_ID)); if (attribute != null) { return contentCache.get(attribute.getValueLong(), () -> artifact.getSleuthkitCase().getContentById(attribute.getValueLong())); } } catch (TskCoreException ex) { logger.log(Level.WARNING, MessageFormat.format("Error getting content for path id attrbiute for artifact: ", artifact.getId()), ex); } return null; }
Source:
<code>private String getProxyUri() { <START> String scheme = Config.<Boolean>getValue(ConfigValues.ImageProxySSLEnabled) ? "https" : "http"; <END> String address = Config.getValue(ConfigValues.ImageProxyAddress); return scheme + "://" + address + "/images"; }</code><technical_language>Consider a constant for "https://" "http://" more clean in line 599</technical_language>

Target:
private String getProxyUri() { String scheme = Config.<Boolean> getValue(ConfigValues.ImageProxySSLEnabled)? HTTPS_SCHEME : HTTP_SCHEME; String address = Config.getValue(ConfigValues.ImageProxyAddress); return scheme + address + IMAGES_PATH; }
Source:
<code>protected VdcReturnValueBase convertToVdcReturnValueBase(final VDSReturnValue vdsReturnValue) { VdcReturnValueBase returnValue = new VdcReturnValueBase(); returnValue.setSucceeded(false); returnValue.setActionReturnValue(vdsReturnValue.getReturnValue()); returnValue.setExecuteFailedMessages(new ArrayList<String>() {{ <START> add(getVdsDAO().get(vdsReturnValue.getVdsError().getVdsId()).getName() <END> + " : " + vdsReturnValue.getVdsError().getMessage()); }} ); return returnValue; }</code><technical_language>assuming getVdsDao.get() return a non-null object. lead NPE</technical_language>

Target:
protected VdcReturnValueBase convertToVdcReturnValueBase(final VDSReturnValue vdsReturnValue) { VdcReturnValueBase returnValue = new VdcReturnValueBase(); returnValue.setSucceeded(false); returnValue.setActionReturnValue(vdsReturnValue.getReturnValue()); returnValue.setExecuteFailedMessages(new ArrayList<String>() {{ String failedMesssage = null; VDS vds = getVdsDAO().get(vdsReturnValue.getVdsError().getVdsId()); if (vds != null) { failedMesssage = vds.getName() + ":"; } add(failedMesssage == null ? vdsReturnValue.getVdsError().getMessage() : failedMesssage.concat(vdsReturnValue.getVdsError().getMessage())); }} ); return returnValue; }
Source:
<code><START> public void testStickyPartitionCache() { <END> final String topicA = "topicA"; final String topicB = "topicB"; List<PartitionInfo> allPartitions = asList(new PartitionInfo(topicA, 0, node0, nodes, nodes), new PartitionInfo(topicA, 1, node1, nodes, nodes), new PartitionInfo(topicA, 2, node2, nodes, nodes), new PartitionInfo(topicB, 0, node0, nodes, nodes) ); Cluster testCluster = new Cluster("clusterId", asList(node0, node1, node2), allPartitions, Collections.<String>emptySet(), Collections.<String>emptySet()); StickyPartitionCache stickyPartitionCache = new StickyPartitionCache(); int partA = stickyPartitionCache.partition(topicA, testCluster); assertEquals(partA, stickyPartitionCache.partition(topicA, testCluster)); int partB = stickyPartitionCache.partition(topicB, testCluster); assertEquals(partB, stickyPartitionCache.partition(topicB, testCluster)); int changedPartA = stickyPartitionCache.nextPartition(topicA, testCluster, partA); assertEquals(changedPartA, stickyPartitionCache.partition(topicA, testCluster)); assertNotEquals(partA, changedPartA); int changedPartA2 = stickyPartitionCache.partition(topicA, testCluster); assertEquals(changedPartA2, changedPartA); int changedPartA3 = stickyPartitionCache.nextPartition(topicA, testCluster, partA); assertEquals(changedPartA3, changedPartA2); int changedPartB = stickyPartitionCache.nextPartition(topicB, testCluster, partB); assertEquals(changedPartB, stickyPartitionCache.partition(topicB, testCluster)); }</code><technical_language>a test is partition chosen. a test of some of partitions (unavailable partitions chosen, unavailable)</technical_language>

Target:
public void testStickyPartitionCache() { List<PartitionInfo> allPartitions = asList(new PartitionInfo(TOPIC_A, 0, NODES[0], NODES, NODES), new PartitionInfo(TOPIC_A, 1, NODES[1], NODES, NODES), new PartitionInfo(TOPIC_A, 2, NODES[2], NODES, NODES), new PartitionInfo(TOPIC_B, 0, NODES[0], NODES, NODES) ); Cluster testCluster = new Cluster("clusterId", asList(NODES), allPartitions, Collections.<String>emptySet(), Collections.<String>emptySet()); StickyPartitionCache stickyPartitionCache = new StickyPartitionCache(); int partA = stickyPartitionCache.partition(TOPIC_A, testCluster); assertEquals(partA, stickyPartitionCache.partition(TOPIC_A, testCluster)); int partB = stickyPartitionCache.partition(TOPIC_B, testCluster); assertEquals(partB, stickyPartitionCache.partition(TOPIC_B, testCluster)); int changedPartA = stickyPartitionCache.nextPartition(TOPIC_A, testCluster, partA); assertEquals(changedPartA, stickyPartitionCache.partition(TOPIC_A, testCluster)); assertNotEquals(partA, changedPartA); int changedPartA2 = stickyPartitionCache.partition(TOPIC_A, testCluster); assertEquals(changedPartA2, changedPartA); int changedPartA3 = stickyPartitionCache.nextPartition(TOPIC_A, testCluster, partA); assertEquals(changedPartA3, changedPartA2); int changedPartB = stickyPartitionCache.nextPartition(TOPIC_B, testCluster, partB); assertEquals(changedPartB, stickyPartitionCache.partition(TOPIC_B, testCluster)); }
Source:
<code>public PipelineTimelineEntrySet() { <START> maximumId = -1; <END> naturalOrderSet = new TreeSet<>(); scheduledOrderSet = new ArrayList<>(); }</code><technical_language>Set in field declaration, remove constructor</technical_language>

Target:
public PipelineTimelineEntrySet() { naturalOrderSet = new TreeSet<>(); scheduledOrderSet = new ArrayList<>(); }
Source:
<code>public String getErrorMessage(String clientID) { TranslationSystem translationSystem = context.get(TranslationSystem.class); if (isClientBlacklisted(clientID)) { <START> return translationSystem.translate("${engine:menu#client-on-blacklist}"); <END> } if (!isClientWhitelisted(clientID)) { return translationSystem.translate("${engine:menu#client-not-on-whitelist}"); } return null; }</code><technical_language>If I understand correctly, this string is translated *by server*, language set in client set in server differ translation in understanding pointless, possibly confusing if for example user client set in English server is set another language user understand. For I send English string (basically reverse changes access TranslationSystem, including part brings Context), if is time / else wants do it, work a separate "improve localization" PR translation client (the "non-trivial" stuff discussing yesterday)</technical_language>

Target:
public String getErrorMessage(String clientID) { if (isClientBlacklisted(clientID)) { return "client on blacklist"; } if (!isClientWhitelisted(clientID)) { return "client not on whitelist"; } return null; }
Source:
<code>public void shouldAddLabelNode() throws Exception { long node; int labelId; final String labelName = "Town"; try ( org.neo4j.graphdb.Transaction ctx = graphDb.beginTx() ) { <START> node = graphDb.createNode( label( labelName ) ).getId(); <END> ctx.success(); } try ( Transaction tx = session.beginTransaction() ) { labelId = session.token().labelGetOrCreateForName( labelName ); tx.dataWrite().nodeAddLabel( node, labelId ); tx.success(); } try ( org.neo4j.graphdb.Transaction ctx = graphDb.beginTx() ) { assertThat( graphDb.getNodeById( node ).getLabels(), equalTo( Iterables.iterable( label( labelName ) ) ) ); } }</code><technical_language>I meant do create a node a label add label in a separate transaction (with new api)</technical_language>

Target:
public void shouldAddLabelNode() throws Exception { long node; int labelId; final String labelName = "Town"; try ( org.neo4j.graphdb.Transaction ctx = graphDb.beginTx() ) { node = graphDb.createNode().getId(); ctx.success(); } try ( Transaction tx = session.beginTransaction() ) { labelId = session.token().labelGetOrCreateForName( labelName ); tx.dataWrite().nodeAddLabel( node, labelId ); tx.success(); } try ( org.neo4j.graphdb.Transaction ctx = graphDb.beginTx() ) { assertThat( graphDb.getNodeById( node ).getLabels(), equalTo( Iterables.iterable( label( labelName ) ) ) ); } }
Source:
<code>private void updateActiveBucketId(final BucketID bucketId, final Bucket<IN, BucketID> restoredBucket) throws IOException { if (!restoredBucket.isActive()) { <START> if (bucketLifeCycleListener != null) { <END> bucketLifeCycleListener.bucketInactive(restoredBucket); } return; } final Bucket<IN, BucketID> bucket = activeBuckets.get(bucketId); if (bucket != null) { bucket.merge(restoredBucket); } else { activeBuckets.put(bucketId, restoredBucket); } }</code><technical_language>Add a method: inactiveBucket(Bucket<IN, BucketID>)</technical_language>

Target:
private void updateActiveBucketId(final BucketID bucketId, final Bucket<IN, BucketID> restoredBucket) throws IOException { if (!restoredBucket.isActive()) { notifyBucketInactive(restoredBucket); return; } final Bucket<IN, BucketID> bucket = activeBuckets.get(bucketId); if (bucket != null) { bucket.merge(restoredBucket); } else { activeBuckets.put(bucketId, restoredBucket); } }