auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Property resolveProperty(Type type, ModelConverterContext context, Annotation[] annotations, Iterator<ModelConverter> next) { JavaType propType = null; if (type instanceof NestedComplexType) { propType = pMapper.constructType(((NestedComplexType) type).getOriginalType()); } else { propType = pMapper.constructType(type); } <START> LOGGER.debug("resolveProperty " + propType); <END> Property property = null; if (propType.isContainerType()) { JavaType keyType = propType.getKeyType(); JavaType valueType = propType.getContentType(); if (keyType != null && valueType != null) { property = new MapProperty() .additionalProperties(context.resolveProperty(valueType, new Annotation[] {})); } else if (valueType != null) { ArrayProperty arrayProperty = new ArrayProperty() .items(context.resolveProperty(valueType, new Annotation[] {})); if (pIsSetType(propType.getRawClass())) { arrayProperty.setUniqueItems(true); } property = arrayProperty; } } else { property = PrimitiveType.createProperty(propType); } if (property == null) { if (propType.isEnumType()) { property = new StringProperty(); pAddEnumProps(propType.getRawClass(), property); } else if (pIsOptionalType(propType)) { property = context.resolveProperty(propType.containedType(0), null); } else { Model innerModel = context.resolve(type); if (innerModel instanceof ModelImpl) { ModelImpl mi = (ModelImpl) innerModel; property = new RefProperty( StringUtils.isNotEmpty(mi.getReference()) ? mi.getReference() : mi.getName()); } } } return property; }</code><technical_language>curly brace expansion</technical_language>

Target:
public Property resolveProperty(Type type, ModelConverterContext context, Annotation[] annotations, Iterator<ModelConverter> next) { JavaType propType = null; if (type instanceof NestedComplexType) { propType = pMapper.constructType(((NestedComplexType) type).getOriginalType()); } else { propType = pMapper.constructType(type); } log.debug("resolveProperty {}", propType); Property property = null; if (propType.isContainerType()) { JavaType keyType = propType.getKeyType(); JavaType valueType = propType.getContentType(); if (keyType != null && valueType != null) { property = new MapProperty() .additionalProperties(context.resolveProperty(valueType, new Annotation[] {})); } else if (valueType != null) { ArrayProperty arrayProperty = new ArrayProperty() .items(context.resolveProperty(valueType, new Annotation[] {})); if (pIsSetType(propType.getRawClass())) { arrayProperty.setUniqueItems(true); } property = arrayProperty; } } else { property = PrimitiveType.createProperty(propType); } if (property == null) { if (propType.isEnumType()) { property = new StringProperty(); pAddEnumProps(propType.getRawClass(), property); } else if (pIsOptionalType(propType)) { property = context.resolveProperty(propType.containedType(0), null); } else { Model innerModel = context.resolve(type); if (innerModel instanceof ModelImpl) { ModelImpl mi = (ModelImpl) innerModel; property = new RefProperty( StringUtils.isNotEmpty(mi.getReference()) ? mi.getReference() : mi.getName()); } } } return property; }
Source:
<code>public void testEditMarkerSet() { insertContent(); SWTBotRootMenu viewMenu = fViewBot.viewMenu(); List<String> menuItems = viewMenu.menu("Marker Set").menuItems(); <START> assertEquals("number of items", 5, menuItems.size()); <END> assertArrayEquals("menu items, no marker set", MENU_ITEMS_2_MARKERS_SET, menuItems.toArray()); testActiveMarkersSet(viewMenu, new int[] { 0, 1, 2 }); viewMenu.menu("Marker Set", MENU_ITEMS_2_MARKERS_SET[1]).click(); testActiveMarkersSet(viewMenu, new int[] { 1, 0, 2 }); viewMenu.menu("Marker Set", MENU_ITEMS_2_MARKERS_SET[2]).click(); testActiveMarkersSet(viewMenu, new int[] { 2, 1, 0 }); viewMenu.menu("Marker Set", MENU_ITEMS_2_MARKERS_SET[0]).click(); testActiveMarkersSet(viewMenu, new int[] { 0, 1, 2 }); removeContent(); menuItems.clear(); menuItems = viewMenu.menu("Marker Set").menuItems(); assertEquals("number of items", 3, menuItems.size()); assertArrayEquals("menu items, no marker set", MENU_ITEMS_NO_MARKERS_SET, menuItems.toArray()); }</code><technical_language>assertArrayEquals check length</technical_language>

Target:
public void testEditMarkerSet() { insertContent(); SWTBotRootMenu viewMenu = fViewBot.viewMenu(); List<String> menuItems = viewMenu.menu("Marker Set").menuItems(); assertArrayEquals("menu items, 2 marker set", MENU_ITEMS_2_MARKERS_SET, menuItems.toArray()); assertTrue("None is checked", viewMenu.menu("Marker Set").menu(MENU_ITEMS_2_MARKERS_SET[0]).isChecked()); viewMenu.menu("Marker Set", MENU_ITEMS_2_MARKERS_SET[1]).click(); assertTrue("None is checked", viewMenu.menu("Marker Set").menu(MENU_ITEMS_2_MARKERS_SET[1]).isChecked()); viewMenu.menu("Marker Set", MENU_ITEMS_2_MARKERS_SET[2]).click(); assertTrue("None is checked", viewMenu.menu("Marker Set").menu(MENU_ITEMS_2_MARKERS_SET[2]).isChecked()); viewMenu.menu("Marker Set", MENU_ITEMS_2_MARKERS_SET[0]).click(); assertTrue("None is checked", viewMenu.menu("Marker Set").menu(MENU_ITEMS_2_MARKERS_SET[0]).isChecked()); removeContent(); menuItems = viewMenu.menu("Marker Set").menuItems(); assertArrayEquals("menu items, no marker set", MENU_ITEMS_NO_MARKERS_SET, menuItems.toArray()); }
Source:
<code>public void onDeveloperOptionsSwitchDisabled_shouldDisablePreference() { mController.onDeveloperOptionsSwitchDisabled(); <START> assertThat(mPreference.getSummary()).isFalse(); <END> assertThat(mPreference.getSummary()).isEqualTo( mContext.getString(R.string.angle_enabled_app_not_set)); }</code><technical_language>isEnabled()</technical_language>

Target:
public void onDeveloperOptionsSwitchDisabled_shouldDisablePreference() { mController.onDeveloperOptionsSwitchDisabled(); assertThat(mPreference.isEnabled()).isFalse(); assertThat(mPreference.getSummary()).isEqualTo( mContext.getString(R.string.angle_enabled_app_not_set)); }
Source:
<code>public void doImport( Input input ) throws IOException { try ( BatchingNeoStores store = instantiateNeoStores( fileSystem, storeDir, externalPageCache, recordFormats, config, logService, additionalInitialIds, dbConfig ); ImportLogic logic = new ImportLogic( storeDir, fileSystem, store, config, logService, executionMonitor, recordFormats, input ) ) { store.createNew(); logic.importNodes(); logic.prepareIdMapper(); logic.importRelationships(); logic.calculateNodeDegrees(); <START> int type = 0; <END> do { type = logic.linkRelationships( type ); } while ( type != -1 ); logic.defragmentRelationshipGroups(); logic.buildCountsStore(); store.success(); } }</code><technical_language>I hide this loop ImportLogic call try import types loop. Smt like: logic.linkRelationships() looping internal detail</technical_language>

Target:
public void doImport( Input input ) throws IOException { try ( BatchingNeoStores store = instantiateNeoStores( fileSystem, storeDir, externalPageCache, recordFormats, config, logService, additionalInitialIds, dbConfig ); ImportLogic logic = new ImportLogic( storeDir, fileSystem, store, config, logService, executionMonitor, recordFormats, input ) ) { store.createNew(); logic.importNodes(); logic.prepareIdMapper(); logic.importRelationships(); logic.calculateNodeDegrees(); logic.linkRelationshipsOfAllTypes(); logic.defragmentRelationshipGroups(); logic.buildCountsStore(); store.success(); } }
Source:
<code>public List<Modification> modificationsSince(GitMaterial material, File baseDir, Revision revision, SubprocessExecutionContext execCtx) { material = material.withShallowClone(isServerSideShallowCloneOn()); <START> return material.withShallowClone(true).modificationsSince(baseDir, revision, execCtx); <END> }</code><technical_language>flag is set true always, previous statement right - leave this mistake</technical_language>

Target:
public List<Modification> modificationsSince(GitMaterial material, File baseDir, Revision revision, SubprocessExecutionContext execCtx) { return toggleShallowCloneFeature(material).modificationsSince(baseDir, revision, execCtx); }
Source:
<code>public T call() throws Exception { <START> hasStarted = true; <END> return callable.call(); }</code><technical_language>do recording time instead of a boolean? determine long wait for task</technical_language>

Target:
public T call() throws Exception { endTime = timeoutInNanos + System.nanoTime(); startedTasks.put(this); return callable.call(); }
Source:
<code>public boolean isValid(Date value) { if (this.configuration.containsKey(AgeValidator.CONFIG_MIN_AGE)) { <START> Calendar calander = Calendar.getInstance(); <END> calander.add(Calendar.YEAR, -((Integer)this.configuration.get(AgeValidator.CONFIG_MIN_AGE))); calander.set(Calendar.MILLISECOND, 1); calander.set(Calendar.SECOND, 0); calander.set(Calendar.MINUTE, 0); calander.set(Calendar.HOUR_OF_DAY, 0); Date minAgeDate = new Date(calander.getTimeInMillis()); if (value.after(minAgeDate)) { return false; } } return true; }</code><technical_language>Please able Calendar package in GWT</technical_language>

Target:
public boolean isValid(Date value) { if (this.configuration.containsKey(AgeValidator.CONFIG_MIN_AGE)) { Date minAgeDate = new Date(); int year = minAgeDate.getYear(); minAgeDate.setYear(year-(Integer)configuration.get(AgeValidator.CONFIG_MIN_AGE)); minAgeDate.setHours(0); minAgeDate.setMinutes(0); minAgeDate.setSeconds(1); if (value.after(minAgeDate)) { return false; } } return true; }
Source:
<code>public void run(final Server server, final User user, final String label, final String[] args) throws Exception { switch (args.length) { case 0: throw new NotEnoughArgumentsException(); default: final User target = getPlayer(server, args, 0, true, true); final Location logout = target.getLogoutLocation(); if (user.getWorld() != logout.getWorld() && ess.getSettings().isWorldTeleportPermissions() && !user.isAuthorized("essentials.worlds." + logout.getWorld().getName())) { throw new Exception(tl("noPerm", "essentials.worlds." + logout.getWorld().getName())); } user.sendMessage(tl("teleporting", logout.getWorld().getName(), logout.getBlockX(), logout.getBlockY(), logout.getBlockZ())); <START> CompletableFuture<Exception> eFuture = new CompletableFuture<>(); eFuture.thenAccept(e -> showError(user.getBase(), e, label)); <END> user.getAsyncTeleport().now(logout, false, PlayerTeleportEvent.TeleportCause.COMMAND, eFuture, new CompletableFuture<>()); } }</code><technical_language>getNewExceptionFuture</technical_language>

Target:
public void run(final Server server, final User user, final String label, final String[] args) throws Exception { switch (args.length) { case 0: throw new NotEnoughArgumentsException(); default: final User target = getPlayer(server, args, 0, true, true); final Location logout = target.getLogoutLocation(); if (user.getWorld() != logout.getWorld() && ess.getSettings().isWorldTeleportPermissions() && !user.isAuthorized("essentials.worlds." + logout.getWorld().getName())) { throw new Exception(tl("noPerm", "essentials.worlds." + logout.getWorld().getName())); } user.sendMessage(tl("teleporting", logout.getWorld().getName(), logout.getBlockX(), logout.getBlockY(), logout.getBlockZ())); user.getAsyncTeleport().now(logout, false, PlayerTeleportEvent.TeleportCause.COMMAND, getNewExceptionFuture(user.getSource(), label)); } }
Source:
<code>public Object status(@PathParam("executionId") String executionId) throws IOException, MessagingException { <START> String error = getError(executionId); <END> if (error != null) { throw new NuxeoException(error, HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } if (isCompleted(executionId)) { String resURL = String.format("%s/%s", getPath(), executionId); return redirect(resURL); } else { if (isAsync(executionId)) { Serializable taskId = getTaskId(executionId); Object result = getAsyncService(executionId).getStatus(taskId); return ResponseHelper.getResponse(result, request, HttpServletResponse.SC_OK); } else { return Response.status(HttpServletResponse.SC_OK).entity(RUNNING_STATUS).build(); } } }</code><technical_language>normal call /status costs 2 trips, transient store check for error kv get status</technical_language>

Target:
public Object status(@PathParam("executionId") String executionId) throws IOException, MessagingException { String error = getError(executionId); if (error != null) { throw new NuxeoException(error, HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } if (isCompleted(executionId)) { String resURL = String.format("%s/%s", getPath(), executionId); return redirect(resURL); } else { if (isAsync(executionId)) { Serializable taskId = getTaskId(executionId); Object result = getAsyncService(executionId).getStatus(taskId); return ResponseHelper.getResponse(result, request, HttpServletResponse.SC_OK); } else { return Response.status(HttpServletResponse.SC_OK) .entity(MAPPER.writeValueAsString(RUNNING_STATUS)) .build(); } } }
Source:
<code>public void click() { <START> click(false, false, false, 0); <END> }</code><technical_language>Check if is constant for "no metakeys" mask</technical_language>

Target:
public void click() { click(false, false, false, EMPTY_MASK); }
Source:
<code><START> public @CheckForNull Node getBuiltOn() { <END> Jenkins j = Jenkins.getInstance(); if (builtOn == null || builtOn.isEmpty() || j == null) { return j; } else { return j.getNode(builtOn); } }</code><technical_language>bug: code style</technical_language>

Target:
public Node getBuiltOn() { Jenkins j = Jenkins.getInstance(); if (builtOn == null || builtOn.isEmpty() || j == null) { return j; } else { return j.getNode(builtOn); } }
Source:
<code>public boolean apply(Server server) { checkNotNull(server, "Server"); server = api.serverApi().get(server.id()); if ((server.status().state() != Types.ServerState.POWERED_OFF && server.status().state() != Types.ServerState.POWERED_ON) || server.status().percent() != 0) { return false; } else { return true; <START> } <END> }</code><technical_language>Try avoid conditionals if (condition) return true else return false. return condition</technical_language>

Target:
public boolean apply(Server server) { checkNotNull(server, "Server"); server = api.serverApi().get(server.id()); return !((server.status().state() != Types.ServerState.POWERED_OFF && server.status().state() != Types.ServerState.POWERED_ON) || server.status().percent() != 0); }
Source:
<code>void convertChildNodes( ElementContainer p, DefinitionsBuildingContext context) { List<SubProcessPropertyWriter> subprocesses = context.nodes().map(converterFactory.subProcessConverter()::convertSubProcess) .filter(Result::notIgnored) .map(Result::value) .map(Optional::get) .collect(toList()); Set<String> processed = subprocesses.stream() .flatMap(sub -> sub.getChildElements().stream().map(BasePropertyWriter::getId)) .collect(toSet()); subprocesses.stream() .filter(e -> !processed.contains(e.getId())) .forEach(p::addChildElement); context.nodes() .filter(e -> !processed.contains(e.getUUID())) .map(converterFactory.viewDefinitionConverter()::toFlowElement) .filter(Result::notIgnored) .map(Result::value) <START> .map(Optional::get) <END> .forEach(p::addChildElement); convertLanes(context, processed, p); }</code><technical_language>this optional access is isPresent check. I Success result is internally "protected" a nullable optional. Is reach this point a Faiure</technical_language>

Target:
void convertChildNodes( ElementContainer p, DefinitionsBuildingContext context) { List<SubProcessPropertyWriter> subprocesses = context.nodes().map(converterFactory.subProcessConverter()::convertSubProcess) .filter(Result::notIgnored) .map(Result::value) .collect(toList()); Set<String> processed = subprocesses.stream() .flatMap(sub -> sub.getChildElements().stream().map(BasePropertyWriter::getId)) .collect(toSet()); subprocesses.stream() .filter(e -> !processed.contains(e.getId())) .forEach(p::addChildElement); context.nodes() .filter(e -> !processed.contains(e.getUUID())) .map(converterFactory.viewDefinitionConverter()::toFlowElement) .filter(Result::notIgnored) .map(Result::value) .forEach(p::addChildElement); convertLanes(context, processed, p); }
Source:
<code>public void renameBranchSingleConfigValue() throws Exception { StoredConfig config = git.getRepository().getConfig(); config.setEnum(ConfigConstants.CONFIG_BRANCH_SECTION, Constants.MASTER, ConfigConstants.CONFIG_KEY_REBASE, BranchRebaseMode.REBASE); config.save(); String branch = "b1"; assertEquals(BranchRebaseMode.REBASE, config.getEnum(BranchRebaseMode.values(), ConfigConstants.CONFIG_BRANCH_SECTION, Constants.MASTER, ConfigConstants.CONFIG_KEY_REBASE, BranchRebaseMode.NONE)); assertEquals(BranchRebaseMode.NONE, config.getEnum(BranchRebaseMode.values(), ConfigConstants.CONFIG_BRANCH_SECTION, branch, ConfigConstants.CONFIG_KEY_REBASE, <START> BranchRebaseMode.NONE)); <END> assertNotNull(git.branchRename().setNewName(branch).call()); config = git.getRepository().getConfig(); assertEquals(BranchRebaseMode.NONE, config.getEnum(BranchRebaseMode.values(), ConfigConstants.CONFIG_BRANCH_SECTION, Constants.MASTER, ConfigConstants.CONFIG_KEY_REBASE, BranchRebaseMode.NONE)); assertEquals(BranchRebaseMode.REBASE, config.getEnum(BranchRebaseMode.values(), ConfigConstants.CONFIG_BRANCH_SECTION, branch, ConfigConstants.CONFIG_KEY_REBASE, BranchRebaseMode.NONE)); }</code><technical_language>I null default</technical_language>

Target:
public void renameBranchSingleConfigValue() throws Exception { StoredConfig config = git.getRepository().getConfig(); config.setEnum(ConfigConstants.CONFIG_BRANCH_SECTION, Constants.MASTER, ConfigConstants.CONFIG_KEY_REBASE, BranchRebaseMode.REBASE); config.save(); String branch = "b1"; assertEquals(BranchRebaseMode.REBASE, config.getEnum(BranchRebaseMode.values(), ConfigConstants.CONFIG_BRANCH_SECTION, Constants.MASTER, ConfigConstants.CONFIG_KEY_REBASE, BranchRebaseMode.NONE)); assertNull(config.getEnum(BranchRebaseMode.values(), ConfigConstants.CONFIG_BRANCH_SECTION, branch, ConfigConstants.CONFIG_KEY_REBASE, null)); assertNotNull(git.branchRename().setNewName(branch).call()); config = git.getRepository().getConfig(); assertNull(config.getEnum(BranchRebaseMode.values(), ConfigConstants.CONFIG_BRANCH_SECTION, Constants.MASTER, ConfigConstants.CONFIG_KEY_REBASE, null)); assertEquals(BranchRebaseMode.REBASE, config.getEnum(BranchRebaseMode.values(), ConfigConstants.CONFIG_BRANCH_SECTION, branch, ConfigConstants.CONFIG_KEY_REBASE, BranchRebaseMode.NONE)); }
Source:
<code>private void updateGameStatusMenuText(PlayerStatus status) { playerStatusFilter = status; if (status == null) { gameStatusMenu.setText(i18n.get("game.gameStatus")); gameStatusToggleGroup.selectToggle(null); return; } String key = switch (status) { case PLAYING -> PLAYING.getI18nKey(); case LOBBYING -> LOBBYING.getI18nKey(); case IDLE -> IDLE.getI18nKey(); default -> throw new ProgrammingError("Uncovered player status: " + status); }; <START> gameStatusMenu.setText(i18n.get(key)); <END> }</code><technical_language>this need for switch statement gameStatusMenu.setText(i18n.get(status.getI18nKey()));</technical_language>

Target:
private void updateGameStatusMenuText(PlayerStatus status) { playerStatusFilter = status; if (status == null) { gameStatusMenu.setText(i18n.get("game.gameStatus")); gameStatusToggleGroup.selectToggle(null); return; } gameStatusMenu.setText(i18n.get(status.getI18nKey())); }
Source:
<code>private Runnable createProxyThreadRunnable() { Runnable runnable= () -> { isRunning = true; try { consumerPollThreadStartLatch.countDown(); LOG.info("Starting runnable " + consumerPollThread.getName()); initializeLags(); while (isRunning) { fetchMessages(); } } catch (Throwable throwable) { LOG.error(String.format("Error in KafkaConsumerProxy poll thread for system: %s.", systemName), throwable); failureCause = throwable; isRunning = false; } if (!isRunning) { <START> LOG.info("Stopping the KafkaConsumerProxy poll thread for system: {}.", systemName); <END> } }; return runnable; }</code><technical_language>stopping here</technical_language>

Target:
private Runnable createProxyThreadRunnable() { Runnable runnable = () -> { isRunning = true; try { consumerPollThreadStartLatch.countDown(); LOG.info("Starting consumer poll thread for system {}", consumerPollThread.getName(), systemName); initializeLags(); while (isRunning) { fetchMessages(); } } catch (Throwable throwable) { LOG.error(String.format("Error in KafkaConsumerProxy poll thread for system: %s.", systemName), throwable); failureCause = throwable; isRunning = false; } if (!isRunning) { LOG.info("KafkaConsumerProxy for system has stopped.", systemName); } }; return runnable; }
Source:
<code>public boolean hasStudentAsGiverInFeedbackPaths(StudentAttributes student) { if (giverType == FeedbackParticipantType.CUSTOM && recipientType == FeedbackParticipantType.CUSTOM) { for (FeedbackPathAttributes feedbackPath : feedbackPaths) { if (feedbackPath.isStudentFeedbackPathGiver(student)) { return true; } } <START> } <END> return false; }</code><technical_language>reverse if condition reduce nesting. Try avoid if conditions swallow a long chunk of code</technical_language>

Target:
public boolean hasStudentAsGiverInFeedbackPaths(StudentAttributes student) { for (FeedbackPathAttributes feedbackPath : feedbackPaths) { if (feedbackPath.isStudentFeedbackPathGiver(student)) { return true; } } return false; }
Source:
<code>private Template getTemplate(String templateName, Theme theme) throws IOException { <START> Configuration cfg = new Configuration(Configuration.VERSION_2_3_26); <END> if (templateName.toLowerCase().endsWith(".ftl")) { cfg.setOutputFormat(HTMLOutputFormat.INSTANCE); } cfg.setTemplateLoader(new ThemeTemplateLoader(theme)); return cfg.getTemplate(templateName, "UTF-8"); }</code><technical_language>honest I implications here. this requires FreeMarker do additional reflection of classes, expensive? Also, break in existing templates this</technical_language>

Target:
private Template getTemplate(String templateName, Theme theme) throws IOException { Configuration cfg = new Configuration(); if (templateName.toLowerCase().endsWith(".ftl")) { cfg.setOutputFormat(HTMLOutputFormat.INSTANCE); } cfg.setTemplateLoader(new ThemeTemplateLoader(theme)); return cfg.getTemplate(templateName, "UTF-8"); }
Source:
<code>private static void toStringBuilder(Iterable iterable, StringBuilder builder) { Iterator<Object> iterator = iterable.iterator(); <START> if (!iterator.hasNext()) { builder.append("[]"); return; } <END> builder.append("["); while (iterator.hasNext()) { toStringBuilder(iterator.next(), builder); if (iterator.hasNext()) { builder.append(", "); } } builder.append("]"); }</code><technical_language>need this special case</technical_language>

Target:
private static void toStringBuilder(Iterable iterable, StringBuilder builder) { builder.append("["); Iterator<Object> iterator = iterable.iterator(); while (iterator.hasNext()) { toStringBuilder(iterator.next(), builder); if (iterator.hasNext()) { builder.append(", "); } } builder.append("]"); }
Source:
<code>public void addJobProperties(Job job) { Configuration conf = job.getConfiguration(); for (final Map.Entry<String, String> entry : schema.getTuningConfig().getJobProperties().entrySet()) { conf.set(entry.getKey(), entry.getValue()); } <START> } <END></code><technical_language>change this impl addJobProperties(job.getConfiguration())</technical_language>

Target:
public void addJobProperties(Job job) { addJobProperties(job.getConfiguration()); }
Source:
<code>protected void RunCommands() { SortCommands(); <START> for (final CommandBase<?> command : getCommands()) { <END> ThreadPoolUtil.execute(new Runnable() { @Override public void run() { executeValidatedCommand(command); } }); } }</code><technical_language>add a check: if(command.getReturnValue().getCanDoAction()) { } ThreadPoolUtil.execute()</technical_language>

Target:
protected void RunCommands() { SortCommands(); for (final CommandBase<?> command : getCommands()) { if (command.getReturnValue().getCanDoAction()) { ThreadPoolUtil.execute(new Runnable() { @Override public void run() { executeValidatedCommand(command); } }); } } }
Source:
<code>public void bindServiceShouldAddServiceConnectionToListOfBoundServiceConnections() { final ShadowApplication shadowApplication = Shadows.shadowOf(RuntimeEnvironment.application); final ServiceConnection expectedServiceConnection = new EmptyServiceConnection(); <START> assertEquals(0, shadowApplication.getBoundServiceConnections().size()); <END> assertTrue(shadowApplication.bindService(new Intent("connect"), expectedServiceConnection, 0)); assertEquals(1, shadowApplication.getBoundServiceConnections().size()); assertSame(expectedServiceConnection, shadowApplication.getBoundServiceConnections().get(0)); }</code><technical_language>mind updating of assertions assertThat? I style forward</technical_language>

Target:
public void bindServiceShouldAddServiceConnectionToListOfBoundServiceConnections() { final ShadowApplication shadowApplication = Shadows.shadowOf(RuntimeEnvironment.application); final ServiceConnection expectedServiceConnection = new EmptyServiceConnection(); assertThat(shadowApplication.getBoundServiceConnections()).hasSize(0); assertThat(shadowApplication.bindService(new Intent("connect"), expectedServiceConnection, 0)).isTrue(); assertThat(shadowApplication.getBoundServiceConnections()).hasSize(1); assertThat(shadowApplication.getBoundServiceConnections().get(0)).isSameAs(expectedServiceConnection); }
Source:
<code>public ModuleDeploymentStatus(String container, ModuleDescriptor.Key key, Map<String,String> map) { this.container = container; this.key = key; <START> Assert.state(map.containsKey(STATUS_KEY)); <END> this.state = State.valueOf(map.get(STATUS_KEY)); this.errorDescription = map.get(ERROR_DESCRIPTION_KEY); }</code><technical_language>include additional String param this Assert.state() call required key missing</technical_language>

Target:
public ModuleDeploymentStatus(String container, ModuleDescriptor.Key key, Map<String,String> map) { this.container = container; this.key = key; Assert.state(map.containsKey(STATUS_KEY), String.format("missing key '%s' from map; contents: %s", STATUS_KEY, map)); this.state = State.valueOf(map.get(STATUS_KEY)); this.errorDescription = map.get(ERROR_DESCRIPTION_KEY); }
Source:
<code>public final GenericType<?> getComponentType() { <START> return new GenericType(token.getComponentType()); <END> }</code><technical_language>This produces a warning new GenericType(...) is null. is symptom of a bug: token.getComponentType() null, this handled. fixing directly</technical_language>

Target:
public final GenericType<?> getComponentType() { TypeToken<?> componentTypeToken = token.getComponentType(); return (componentTypeToken == null) ? null : new GenericType(componentTypeToken); }
Source:
<code>public Destination getJMSReplyTo() throws JMSException { if (replyTo == null) { SimpleString address = MessageUtil.getJMSReplyTo(message); if (address != null) { String name = address.toString(); <START> if (session.isEnable1xPrefixes()) { <END> if (address.startsWith(OLD_QUEUE_QUALIFIED_PREFIX)) { name = address.subSeq(OLD_QUEUE_QUALIFIED_PREFIX.length(), address.length()).toString(); } else if (address.startsWith(OLD_TEMP_QUEUE_QUALIFED_PREFIX)) { name = address.subSeq(OLD_TEMP_QUEUE_QUALIFED_PREFIX.length(), address.length()).toString(); } else if (address.startsWith(OLD_TOPIC_QUALIFIED_PREFIX)) { name = address.subSeq(OLD_TOPIC_QUALIFIED_PREFIX.length(), address.length()).toString(); } else if (address.startsWith(OLD_TEMP_TOPIC_QUALIFED_PREFIX)) { name = address.subSeq(OLD_TEMP_TOPIC_QUALIFED_PREFIX.length(), address.length()).toString(); } } replyTo = ActiveMQDestination.fromPrefixedName(address.toString(), name); } } return replyTo; }</code><technical_language>more invasive changes for support of 1.x (isnt point of major version change signal breaking changes) a 1x jms client module, bits in users 2.0.x dont get affected a bit more clean room</technical_language>

Target:
public Destination getJMSReplyTo() throws JMSException { if (replyTo == null) { SimpleString repl = MessageUtil.getJMSReplyTo(message); if (repl != null) { replyTo = ActiveMQDestination.fromPrefixedName(repl.toString()); } } return replyTo; }
Source:
<code>public Pair<Long, Long> getTxAt(long ts) throws IOException { long closestTS = Long.MAX_VALUE, closestTx = -1; Pair<Long, Long> before, after; for(byte i = 0; i < SIConstants.TRANSACTION_TABLE_BUCKET_COUNT; ++i) { before = first(i); if(before == null ) { continue; } if(before.getSecond() > ts) { if(LOG.isTraceEnabled()) SpliceLogUtils.trace(LOG,"in bucket %d the first txn [%s (TS: %s), id %s] happened after the needle (%s) exiting!", (int)i, TxnUtils.rowKeytoHbaseEscaped(toRowKeyWithBucket(before.getFirst(), i)), new Timestamp(before.getSecond()).toString(), before.getFirst().toString(), new Timestamp(ts).toString()); return new Pair<>(slideToNextTx(closestTx), closestTS); } after = last(i); if(after.getSecond() < ts) { if(LOG.isTraceEnabled()) <START> SpliceLogUtils.trace(LOG,"in bucket %d the last txn [%s (TS: %s), id %s] happened before the needle (%s) exiting!", <END> (int)i, TxnUtils.rowKeytoHbaseEscaped(toRowKeyWithBucket(after.getFirst(), i)), new Timestamp(after.getSecond()).toString(), after.getFirst().toString(), new Timestamp(ts).toString()); return new Pair<>(slideToNextTx(after.getFirst()), after.getSecond()); } Pair<Long, Long> seachResults = bsearch(ts, i, toRowKeyWithBucket(before.getFirst(), i), before.getSecond(), toRowKeyWithBucket(after.getFirst(), i), after.getSecond()); if(seachResults == null) { continue; } if(Math.abs(seachResults.getSecond() - ts)< Math.abs(closestTS)) { closestTx = seachResults.getFirst(); closestTS = seachResults.getSecond(); } } return new Pair<>(slideToNextTx(closestTx), closestTS); }</code><technical_language>TRACE DEBUG</technical_language>

Target:
public Pair<Long, Long> getTxAt(long ts) throws IOException { long closestTS = Long.MAX_VALUE, closestTx = -1; Pair<Long, Long> before, after; for(byte i = 0; i < SIConstants.TRANSACTION_TABLE_BUCKET_COUNT; ++i) { before = first(i); if(before == null ) { continue; } if(before.getSecond() > ts) { if(LOG.isDebugEnabled()) SpliceLogUtils.debug(LOG,"in bucket %d the first txn [%s (TS: %s), id %s] happened after the needle (%s) exiting!", (int)i, TxnUtils.rowKeytoHbaseEscaped(toRowKeyWithBucket(before.getFirst(), i)), new Timestamp(before.getSecond()).toString(), before.getFirst().toString(), new Timestamp(ts).toString()); return new Pair<>(slideToNextTx(closestTx), closestTS); } after = last(i); if(after.getSecond() < ts) { if(LOG.isDebugEnabled()) SpliceLogUtils.debug(LOG,"in bucket %d the last txn [%s (TS: %s), id %s] happened before the needle (%s) exiting!", (int)i, TxnUtils.rowKeytoHbaseEscaped(toRowKeyWithBucket(after.getFirst(), i)), new Timestamp(after.getSecond()).toString(), after.getFirst().toString(), new Timestamp(ts).toString()); return new Pair<>(slideToNextTx(after.getFirst()), after.getSecond()); } Pair<Long, Long> seachResults = bsearch(ts, i, toRowKeyWithBucket(before.getFirst(), i), before.getSecond(), toRowKeyWithBucket(after.getFirst(), i), after.getSecond()); if(seachResults == null) { continue; } if(Math.abs(seachResults.getSecond() - ts)< Math.abs(closestTS)) { closestTx = seachResults.getFirst(); closestTS = seachResults.getSecond(); } } return new Pair<>(slideToNextTx(closestTx), closestTS); }
Source:
<code>public String getBranchNameSuggestion() { ITask task = getCurrentTask(); if (task == null) return null; String taskKey = task.getTaskKey(); if (taskKey == null) taskKey = task.getTaskId(); StringBuilder sb = new StringBuilder(); sb.append(TasksUiInternal.getTaskPrefix(task.getConnectorKind())); sb.append(taskKey); <START> sb.append("-"); END> sb.append(task.getSummary()); return normalizeBranchName(sb.toString()); }</code><technical_language>'-' is slightly "-", need commen</technical_language>

Target:
public String getBranchNameSuggestion() { ITask task = getCurrentTask(); if (task == null) return null; String taskKey = task.getTaskKey(); if (taskKey == null) taskKey = task.getTaskId(); StringBuilder sb = new StringBuilder(); sb.append(TasksUiInternal.getTaskPrefix(task.getConnectorKind())); sb.append(taskKey); sb.append('-'); sb.append(task.getSummary()); return normalizeBranchName(sb.toString()); }
Source:
<code>private Set<UpdateSite.Warning> getActiveWarnings() { ExtensionList<UpdateSiteWarningsConfiguration> configurations = ExtensionList.lookup(UpdateSiteWarningsConfiguration.class); if (configurations.isEmpty()) { return Collections.emptySet(); } UpdateSiteWarningsConfiguration configuration = configurations.get(0); HashSet<UpdateSite.Warning> warnings = new HashSet<>(configuration.getApplicableWarnings()); for (Iterator<UpdateSite.Warning> it = warnings.iterator(); it.hasNext(); ) { UpdateSite.Warning warning = it.next(); if (configuration.getIgnoredWarnings().contains(warning.id)) { <START> it.remove(); <END> } } return Collections.unmodifiableSet(warnings); }</code><technical_language>Clearer Util.filter, empty set add ignored</technical_language>

Target:
private Set<UpdateSite.Warning> getActiveWarnings() { ExtensionList<UpdateSiteWarningsConfiguration> configurations = ExtensionList.lookup(UpdateSiteWarningsConfiguration.class); if (configurations.isEmpty()) { return Collections.emptySet(); } UpdateSiteWarningsConfiguration configuration = configurations.get(0); HashSet<UpdateSite.Warning> activeWarnings = new HashSet<>(); for (UpdateSite.Warning warning : configuration.getApplicableWarnings()) { if (!configuration.getIgnoredWarnings().contains(warning.id)) { activeWarnings.add(warning); } } return Collections.unmodifiableSet(activeWarnings); }
Source:
<code>private RexNode simplifyNot(RexCall call) { final RexNode a = call.getOperands().get(0); if (a.isAlwaysTrue()) { return rexBuilder.makeLiteral(false); <START> } else if (a.isAlwaysFalse()) { <END> return rexBuilder.makeLiteral(true); } switch (a.getKind()) { case NOT: return simplify_(((RexCall) a).getOperands().get(0)); } final SqlKind negateKind = a.getKind().negate(); if (a.getKind() != negateKind) { return simplify_( rexBuilder.makeCall(RexUtil.op(negateKind), ((RexCall) a).getOperands())); } final SqlKind negateKind2 = a.getKind().negateNullSafe(); if (a.getKind() != negateKind2) { return simplify_( rexBuilder.makeCall(RexUtil.op(negateKind2), ((RexCall) a).getOperands())); } if (a.getKind() == SqlKind.AND) { final List<RexNode> newOperands = new ArrayList<>(); for (RexNode operand : ((RexCall) a).getOperands()) { newOperands.add( simplify_(rexBuilder.makeCall(SqlStdOperatorTable.NOT, operand))); } return simplify_( rexBuilder.makeCall(SqlStdOperatorTable.OR, newOperands)); } if (a.getKind() == SqlKind.OR) { final List<RexNode> newOperands = new ArrayList<>(); for (RexNode operand : ((RexCall) a).getOperands()) { newOperands.add( simplify_(rexBuilder.makeCall(SqlStdOperatorTable.NOT, operand))); } return simplify_( rexBuilder.makeCall(SqlStdOperatorTable.AND, newOperands)); } return call; }</code><technical_language>Please avoid of isAlways... here. Please optimize literals only. Consider not(not(not(not(vBool() case. isAlways.. deep tree return false. result in O(N^2) behavior want in RexSimplify</technical_language>

Target:
private RexNode simplifyNot(RexCall call) { final RexNode a = call.getOperands().get(0); switch (a.getKind()) { case NOT: return simplify_(((RexCall) a).getOperands().get(0)); case LITERAL: if (a.getType().getSqlTypeName() == SqlTypeName.BOOLEAN && !RexLiteral.isNullLiteral(a)) { return rexBuilder.makeLiteral(!RexLiteral.booleanValue(a)); } } final SqlKind negateKind = a.getKind().negate(); if (a.getKind() != negateKind) { return simplify_( rexBuilder.makeCall(RexUtil.op(negateKind), ((RexCall) a).getOperands())); } final SqlKind negateKind2 = a.getKind().negateNullSafe(); if (a.getKind() != negateKind2) { return simplify_( rexBuilder.makeCall(RexUtil.op(negateKind2), ((RexCall) a).getOperands())); } if (a.getKind() == SqlKind.AND) { final List<RexNode> newOperands = new ArrayList<>(); for (RexNode operand : ((RexCall) a).getOperands()) { newOperands.add( simplify_(rexBuilder.makeCall(SqlStdOperatorTable.NOT, operand))); } return simplify_( rexBuilder.makeCall(SqlStdOperatorTable.OR, newOperands)); } if (a.getKind() == SqlKind.OR) { final List<RexNode> newOperands = new ArrayList<>(); for (RexNode operand : ((RexCall) a).getOperands()) { newOperands.add( simplify_(rexBuilder.makeCall(SqlStdOperatorTable.NOT, operand))); } return simplify_( rexBuilder.makeCall(SqlStdOperatorTable.AND, newOperands)); } return call; }
Source:
<code><START> public ChannelFuture getHandshakeFuture() { <END> return handshakePromise; }</code><technical_language>this method is</technical_language>

Target:
ChannelFuture getHandshakeFuture() { return handshakePromise; }
Source:
<code>public void testMiniBatchBalanced() { int miniBatchSize = 10; DataSetIterator iterator = new IrisDataSetIterator(miniBatchSize, 150); BalanceMinibatches balanceMinibatches = BalanceMinibatches.builder().dataSetIterator(iterator).miniBatchSize(miniBatchSize) .numLabels(iterator.totalOutcomes()).rootDir(new File("minibatches")).rootSaveDir(new File("minibatchessave")).build(); balanceMinibatches.balance(); DataSetIterator balanced = new ExistingMiniBatchDataSetIterator(balanceMinibatches.getRootSaveDir()); assert(iterator.resetSupported()); <START> iterator.reset(); <END> ArrayList<Double> totalCounts = new ArrayList<Double>(iterator.totalOutcomes()); while (iterator.hasNext()) { Map<Integer, Double> outcomes = iterator.next().labelCounts(); for (int i = 0; i < iterator.totalOutcomes(); i++) { if (outcomes.containsKey(i)) { totalCounts.set(i, totalCounts.get(i) + outcomes.get(i)); } } } ArrayList<Integer> fullBatches = new ArrayList<Integer>(totalCounts.size()); for (int i = 0; i < totalCounts.size(); i++) { fullBatches.set(i, totalCounts.get(i).intValue() * iterator.totalOutcomes() / miniBatchSize); } int fullyBalanceableBatches = Collections.min(fullBatches); for (int b = 0; b < fullyBalanceableBatches; b++){ Map<Integer, Double> balancedCounts = balanced.next().labelCounts(); for (int i = 0; i < iterator.totalOutcomes(); i++) { assertTrue(balancedCounts.containsKey(i) && balancedCounts.get(i) >= miniBatchSize / iterator.totalOutcomes()); } } }</code><technical_language>I normal asserts> Please junit asserts</technical_language>

Target:
public void testMiniBatchBalanced() { int miniBatchSize = 10; DataSetIterator iterator = new IrisDataSetIterator(miniBatchSize, 150); BalanceMinibatches balanceMinibatches = BalanceMinibatches.builder().dataSetIterator(iterator).miniBatchSize(miniBatchSize) .numLabels(iterator.totalOutcomes()).rootDir(new File("minibatches")).rootSaveDir(new File("minibatchessave")).build(); balanceMinibatches.balance(); DataSetIterator balanced = new ExistingMiniBatchDataSetIterator(balanceMinibatches.getRootSaveDir()); assertTrue(iterator.resetSupported()); iterator.reset(); List<Double> totalCounts = new ArrayList<Double>(iterator.totalOutcomes()); while (iterator.hasNext()) { Map<Integer, Double> outcomes = iterator.next().labelCounts(); for (int i = 0; i < iterator.totalOutcomes(); i++) { if (outcomes.containsKey(i)) { totalCounts.set(i, totalCounts.get(i) + outcomes.get(i)); } } } List<Integer> fullBatches = new ArrayList<Integer>(totalCounts.size()); for (int i = 0; i < totalCounts.size(); i++) { fullBatches.set(i, totalCounts.get(i).intValue() * iterator.totalOutcomes() / miniBatchSize); } int fullyBalanceableBatches = Collections.min(fullBatches); for (int b = 0; b < fullyBalanceableBatches; b++){ Map<Integer, Double> balancedCounts = balanced.next().labelCounts(); for (int i = 0; i < iterator.totalOutcomes(); i++) { assertTrue(balancedCounts.containsKey(i) && balancedCounts.get(i) >= miniBatchSize / iterator.totalOutcomes()); } } }
Source:
<code>public static boolean isPortInUse(int port) { if(port < 0 || port >= 65536) { return false; } try { new ServerSocket(port).close(); return false; } catch (IOException e) { return true; } <START> } <END></code><technical_language>Current code detect port 8080 is local EAP. works for is if implemented java try (Socket socket = new Socket("localhost", port)){ return true; } catch (IOException e) { return false; }</technical_language>

Target:
public static boolean isPortInUse(int port) { if(port < 0 || port >= 65536) { return false; } try { new ServerSocket(port).close(); return false; } catch (IOException e) { } try (Socket socket = new Socket("localhost", port)) { return true; } catch (IOException e) { return false; } }
Source:
<code>public static void writeSegmentFile(final TargetCollection<AllelicCount> snps, final String sampleName, final File outputFile) { try { final File targetsFromSNPCountsFile = File.createTempFile("targets-from-snps", ".tsv"); List<TargetCoverage> targetsFromSNPCounts = snps.targets().stream() .map(count -> count.toMinorAlleleFractionTargetCoverage("snp-target" + count.getContig() + ":" + <START> count.getStart() + "_" + count.getEnd())).collect(Collectors.toList()); <END> TargetCoverageUtils.writeTargetsWithCoverage(targetsFromSNPCountsFile, sampleName, targetsFromSNPCounts); RCBSSegmenter.writeSegmentFile(sampleName, targetsFromSNPCountsFile.getAbsolutePath(), outputFile.getAbsolutePath(), false); } catch (final IOException e) { throw new UserException.CouldNotCreateOutputFile("Could not create temporary output file during " + "SNP segmentation.", e); } }</code><technical_language>Do for underscore a dash</technical_language>

Target:
public static void writeSegmentFile(final TargetCollection<AllelicCount> snps, final String sampleName, final File outputFile) { try { final File targetsFromSNPCountsFile = File.createTempFile("targets-from-snps", ".tsv"); List<TargetCoverage> targetsFromSNPCounts = snps.targets().stream() .map(count -> count.toMinorAlleleFractionTargetCoverage("snp-target" + count.getContig() + ":" + count.getStart() + "-" + count.getEnd())).collect(Collectors.toList()); TargetCoverageUtils.writeTargetsWithCoverage(targetsFromSNPCountsFile, sampleName, targetsFromSNPCounts); RCBSSegmenter.writeSegmentFile(sampleName, targetsFromSNPCountsFile.getAbsolutePath(), outputFile.getAbsolutePath(), false); } catch (final IOException e) { throw new UserException.CouldNotCreateOutputFile("Could not create temporary output file during " + "SNP segmentation.", e); } }
Source:
<code>public WeldConfiguration(ServiceRegistry services, Deployment deployment) { Preconditions.checkArgumentNotNull(deployment, "deployment"); this.properties = init(services, deployment); this.proxyDumpFilePath = initProxyDumpFilePath(); this.proxyIgnoreFinalMethodsPattern = initProxyIgnoreFinalMethodsPattern(); StringJoiner logOutputBuilder = new StringJoiner(", ", "{", "}"); for (Entry<ConfigurationKey, Object> entry : properties.entrySet()) { <START> logOutputBuilder.add(entry.getKey().get() + "=" + properties.get(entry.getKey())); <END> } ConfigurationLogger.LOG.configurationInitialized(logOutputBuilder.toString()); }</code><technical_language>properties.get(entry.getKey()) entry.getValue(), I improvement attempt spotbugs happy ;-)</technical_language>

Target:
public WeldConfiguration(ServiceRegistry services, Deployment deployment) { Preconditions.checkArgumentNotNull(deployment, "deployment"); this.properties = init(services, deployment); this.proxyDumpFilePath = initProxyDumpFilePath(); this.proxyIgnoreFinalMethodsPattern = initProxyIgnoreFinalMethodsPattern(); StringJoiner logOutputBuilder = new StringJoiner(", ", "{", "}"); for (Entry<ConfigurationKey, Object> entry : properties.entrySet()) { logOutputBuilder.add(entry.getKey().get() + "=" + entry.getValue()); } ConfigurationLogger.LOG.configurationInitialized(logOutputBuilder.toString()); }
Source:
<code><START> public void stopCacheSafely(GridCacheContext<?, ?> cctx) { <END> stopCacheSafely(cctx, true); }</code><technical_language>this class</technical_language>

Target:
private void stopCacheSafely(GridCacheContext<?, ?> cctx) { stopCacheSafely(cctx, true); }
Source:
<code>public long getFromValueFromIntRange(AnnotatedTypeMirror atm) { AnnotationMirror anno = atm.getAnnotation(IntRange.class); if (AnnotationUtils.hasElementValue(anno, "from")) { return AnnotationUtils.getElementValue(anno, "from", Long.class, false); } long from; TypeMirror type = atm.getUnderlyingType(); switch (type.getKind()) { case INT: from = Integer.MIN_VALUE; break; case SHORT: from = Short.MIN_VALUE; break; case BYTE: from = Byte.MIN_VALUE; break; case CHAR: from = Character.MIN_VALUE; break; case DECLARED: String qualifiedName = TypesUtils.getQualifiedName((DeclaredType) type).toString(); switch (qualifiedName) { case "java.lang.Integer": from = Integer.MIN_VALUE; break; case "java.lang.Short": from = Short.MIN_VALUE; break; case "java.lang.Byte": from = Byte.MIN_VALUE; break; case "java.lang.Character": from = Character.MIN_VALUE; break; <START> default: <END> from = Long.MIN_VALUE; } break; default: from = Long.MIN_VALUE; } return from; }</code><technical_language>of default a contributor problem. Please default case throw exception, explicit test for "java.lang.Long"</technical_language>

Target:
public long getFromValueFromIntRange(AnnotatedTypeMirror atm) { AnnotationMirror anno = atm.getAnnotation(IntRange.class); if (AnnotationUtils.hasElementValue(anno, "from")) { return AnnotationUtils.getElementValue(anno, "from", Long.class, false); } long from; TypeMirror type = atm.getUnderlyingType(); switch (type.getKind()) { case INT: from = Integer.MIN_VALUE; break; case SHORT: from = Short.MIN_VALUE; break; case BYTE: from = Byte.MIN_VALUE; break; case CHAR: from = Character.MIN_VALUE; break; case LONG: from = Long.MIN_VALUE; break; case DECLARED: String qualifiedName = TypesUtils.getQualifiedName((DeclaredType) type).toString(); switch (qualifiedName) { case "java.lang.Integer": from = Integer.MIN_VALUE; break; case "java.lang.Short": from = Short.MIN_VALUE; break; case "java.lang.Byte": from = Byte.MIN_VALUE; break; case "java.lang.Character": from = Character.MIN_VALUE; break; case "java.lang.Long": from = Long.MIN_VALUE; break; default: throw new UserError( "Illegal type \"@IntRange " + qualifiedName + "\". @IntRange can be applied to Java integral types."); } break; default: throw new BugInCF(anno.toString() + " on a type of kind " + type.getKind()); } return from; }
Source:
<code>public void missedUpdate() throws IOException { ByteArrayOutputStream buf = new ByteArrayOutputStream(); ReftableWriter writer = new ReftableWriter(buf) .setMinUpdateIndex(1) .setMaxUpdateIndex(3) .begin(); writer.writeRef(ref("refs/heads/a", 1), 1); writer.writeRef(ref("refs/heads/c", 3), 3); writer.finish(); byte[] base = buf.toByteArray(); byte[] delta = <START> write(Arrays.asList( ref("refs/heads/b", 2), ref("refs/heads/c", 4)), <END> 2); MergedReftable mr = merge(base, delta); assertEquals(1, mr.minUpdateIndex()); assertEquals(3, mr.maxUpdateIndex()); try (RefCursor rc = mr.allRefs()) { assertTrue(rc.next()); assertEquals("refs/heads/a", rc.getRef().getName()); assertEquals(id(1), rc.getRef().getObjectId()); assertEquals(1, rc.getRef().getUpdateIndex()); assertTrue(rc.next()); assertEquals("refs/heads/b", rc.getRef().getName()); assertEquals(id(2), rc.getRef().getObjectId()); assertEquals(2, rc.getRef().getUpdateIndex()); assertTrue(rc.next()); assertEquals("refs/heads/c", rc.getRef().getName()); assertEquals(id(3), rc.getRef().getObjectId()); assertEquals(3, rc.getRef().getUpdateIndex()); } }</code><technical_language>Ugh. This spelled out in spec, currently trigger other ISEs, for file based storage. <LINK_0> conditions create a set of reftables overlapping ranges</technical_language>

Target:
public void missedUpdate() throws IOException { ByteArrayOutputStream buf = new ByteArrayOutputStream(); ReftableWriter writer = new ReftableWriter(buf) .setMinUpdateIndex(1) .setMaxUpdateIndex(3) .begin(); writer.writeRef(ref("refs/heads/a", 1), 1); writer.writeRef(ref("refs/heads/c", 3), 3); writer.finish(); byte[] base = buf.toByteArray(); byte[] delta = write(Arrays.asList( ref("refs/heads/b", 2), ref("refs/heads/c", 4)), 2); MergedReftable mr = merge(base, delta); try (RefCursor rc = mr.allRefs()) { assertTrue(rc.next()); assertEquals("refs/heads/a", rc.getRef().getName()); assertEquals(id(1), rc.getRef().getObjectId()); assertEquals(1, rc.getRef().getUpdateIndex()); assertTrue(rc.next()); assertEquals("refs/heads/b", rc.getRef().getName()); assertEquals(id(2), rc.getRef().getObjectId()); assertEquals(2, rc.getRef().getUpdateIndex()); assertTrue(rc.next()); assertEquals("refs/heads/c", rc.getRef().getName()); assertEquals(id(3), rc.getRef().getObjectId()); assertEquals(3, rc.getRef().getUpdateIndex()); } }