auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private String generateFromArraySchema(ArraySchema schema) { if (schema.getExample() instanceof String) { return (String) schema.getExample(); } <START> StringBuilder json = new StringBuilder(); <END> if (schema.getExample() instanceof Iterable) { try { return Json.mapper().writeValueAsString(schema.getExample()); } catch (JsonProcessingException e) { LOG.warn( "Failed to encode Example Object. Falling back to default example generation"); } } json.append(generate(schema.getItems())); return createJsonArrayWith(json.toString()); }</code><technical_language>This done instantiating StringBuilder</technical_language>

Target:
private String generateFromArraySchema(ArraySchema schema) { if (schema.getExample() instanceof String) { return (String) schema.getExample(); } if (schema.getExample() instanceof Iterable) { try { return Json.mapper().writeValueAsString(schema.getExample()); } catch (JsonProcessingException e) { LOG.warn( "Failed to encode Example Object. Falling back to default example generation", e); } } return createJsonArrayWith(generate(schema.getItems())); }
Source:
<code>public static String getOxdVersion() { try { <START> MavenXpp3Reader reader = new MavenXpp3Reader(); <END> Model model = null; if ((new File("pom.xml")).exists()) model = reader.read(new FileReader("pom.xml")); String oxdVersion = model != null ? model.getVersion() : OxdServerApplication.class.getPackage().getImplementationVersion(); return oxdVersion; } catch (IOException | XmlPullParserException e) { throw new RuntimeException(e.getMessage(), e); } }</code><technical_language>Reader is close. dont want leave unreleased resources</technical_language>

Target:
public static String getOxdVersion() { return !Strings.isNullOrEmpty(System.getProperty("projectVersion")) ? System.getProperty("projectVersion") : OxdServerApplication.class.getPackage().getImplementationVersion(); }
Source:
<code>public JavaWriter beginType(String type, String kind, Set<Modifier> modifiers, String extendsType, String... implementsTypes) throws IOException { indent(); emitModifiers(modifiers); out.write(kind); out.write(" "); emitType(type); if (extendsType != null) { out.write(" extends "); emitType(extendsType); } <START> if ((implementsTypes != null) && (implementsTypes.length > 0)) { <END> out.write("\n"); indent(); out.write(" implements "); for (int i = 0; i < implementsTypes.length; i++) { if (i != 0) { out.write(", "); } emitType(implementsTypes[i]); } } out.write(" {\n"); pushScope(Scope.TYPE_DECLARATION); return this; }</code><technical_language>is null check necessary</technical_language>

Target:
public JavaWriter beginType(String type, String kind, Set<Modifier> modifiers, String extendsType, String... implementsTypes) throws IOException { indent(); emitModifiers(modifiers); out.write(kind); out.write(" "); emitType(type); if (extendsType != null) { out.write(" extends "); emitType(extendsType); } if (implementsTypes.length > 0) { out.write("\n"); indent(); out.write(" implements "); for (int i = 0; i < implementsTypes.length; i++) { if (i != 0) { out.write(", "); } emitType(implementsTypes[i]); } } out.write(" {\n"); pushScope(Scope.TYPE_DECLARATION); return this; }
Source:
<code>public void shouldReturnNoViolationsForPerfectFile() { ReviewFile reviewFile = new ReviewFile(REVIEW_FILE_WITHOUT_VIOLATIONS); Review review = getReview(REVIEW_FILE_WITHOUT_VIOLATIONS); ReviewResult result = sut.process(review); assertThat(result).isNotNull(); <START> assertThat(result.getViolations()).isNotNull().isEmpty(); <END> }</code><technical_language>isEmpty checks notNull anyway, is need defensive here</technical_language>

Target:
public void shouldReturnNoViolationsForPerfectFile() { Review review = getReview(REVIEW_FILE_WITHOUT_VIOLATIONS); ReviewResult result = sut.process(review); assertThat(result).isNotNull(); assertThat(result.getViolations()).isEmpty(); }
Source:
<code>public static CommitMessageComponentState loadState(Repository repository) { IDialogSettings dialogSettings = getDialogSettings(); String[] values = dialogSettings.getArray(repository.getDirectory() .getAbsolutePath()); if (values == null) { return null; } CommitMessageComponentState state = new CommitMessageComponentState(); state.setAmend(Boolean.parseBoolean(values[0])); state.setAuthor(values[1]); state.setCommitMessage(values[2]); if (values.length == MEMBER_COUNT) { state.setCommitter(values[3]); state.setHeadCommit(ObjectId.fromString(values[4])); state.setCaretPosition(Integer.parseInt(values[5])); } else if (values.length == MEMBER_COUNT_WITHOUT_CARET_POSITION) { <START> state.setCommitter(values[3]); state.setHeadCommit(ObjectId.fromString(values[4])); <END> state.setCaretPosition( CommitMessageComponentState.CARET_DEFAULT_POSITION); } else { return null; } return state; }</code><technical_language>lines if. (Remove in other branch.)</technical_language>

Target:
public static CommitMessageComponentState loadState(Repository repository) { IDialogSettings dialogSettings = getDialogSettings(); String[] values = dialogSettings.getArray(repository.getDirectory() .getAbsolutePath()); if (values == null || values.length < MEMBER_COUNT_WITHOUT_CARET_POSITION) { return null; } CommitMessageComponentState state = new CommitMessageComponentState(); state.setAmend(Boolean.parseBoolean(values[0])); state.setAuthor(values[1]); state.setCommitMessage(values[2]); state.setCommitter(values[3]); state.setHeadCommit(ObjectId.fromString(values[4])); if (values.length == MEMBER_COUNT) { state.setCaretPosition(Integer.parseInt(values[5])); } else if (values.length == MEMBER_COUNT_WITHOUT_CARET_POSITION) { state.setCaretPosition( CommitMessageComponentState.CARET_DEFAULT_POSITION); } return state; }
Source:
<code><START> static void appendVersionComponent(StringBuilder val, int versionNumber) { <END> if (versionNumber > -1) { if (val.length() != 0) { val.append("."); } val.append(versionNumber); } }</code><technical_language>Is a reason static? declared private method</technical_language>

Target:
private static void appendVersionComponent(StringBuilder val, int versionNumber) { if (versionNumber > -1) { if (val.length() != 0) { val.append("."); } val.append(versionNumber); } }
Source:
<code>protected void cancelled() { logger.debug("Subscriber cancelled, ignoring the rest of the body"); try { future.done(); } catch (Exception t) { <START> logger.error(t.getMessage(), t); <END> } channelManager.releaseChannelLock(future.getPartitionKey()); channelManager.closeChannel(channel); channel.pipeline().remove(StreamedResponsePublisher.class); }</code><technical_language>raise logging level error</technical_language>

Target:
protected void cancelled() { logger.debug("Subscriber cancelled, ignoring the rest of the body"); try { future.done(); } catch (Exception t) { logger.debug(t.getMessage(), t); } channelManager.closeChannel(channel); }
Source:
<code><START> public static CompositeFilter all(Filter first, Filter... rest) { <END> return composeFilters(asList(first, rest), ALL); }</code><technical_language>implemented previously, check for null in public package-private static API. Please review methods of class this matter</technical_language>

Target:
public static CompositeFilter all(Filter first, Filter... rest) { checkNotNull(first); checkNotNull(rest); return composeFilters(asList(first, rest), ALL); }
Source:
<code>public void Restart() { <START> Constants constants = ConstantsManager.getInstance().getConstants(); <END> ConfirmationModel model = new ConfirmationModel(); setConfirmWindow(model); model.setTitle(constants.restartHostsTitle()); model.setHashName("restart_host"); model.setMessage(constants.areYouSureYouWantToRestartTheFollowingHostsMsg()); ArrayList<String> items = new ArrayList<String>(); String vdsEntry = "%1$s (%2$d " + constants.runningVms() + ")"; for (Object item : getSelectedItems()) { VDS vds = (VDS) item; int runningVms = vds.getVmCount(); if (runningVms > 0) { items.add(StringFormat.format(vdsEntry, vds.getName(), runningVms)); } else { items.add(vds.getName()); } } model.setItems(items); UICommand tempVar = new UICommand("OnRestart", this); tempVar.setTitle(constants.ok()); tempVar.setIsDefault(true); model.getCommands().add(tempVar); UICommand tempVar2 = new UICommand("Cancel", this); tempVar2.setTitle(constants.cancel()); tempVar2.setIsCancel(true); model.getCommands().add(tempVar2); }</code><technical_language>declare final static remove declaration</technical_language>

Target:
public void Restart() { final Constants constants = ConstantsManager.getInstance().getConstants(); final Messages messages = ConstantsManager.getInstance().getMessages(); ConfirmationModel model = new ConfirmationModel(); setConfirmWindow(model); model.setTitle(constants.restartHostsTitle()); model.setHashName("restart_host"); model.setMessage(constants.areYouSureYouWantToRestartTheFollowingHostsMsg()); ArrayList<String> items = new ArrayList<String>(); for (Object item : getSelectedItems()) { VDS vds = (VDS) item; int runningVms = vds.getVmCount(); if (runningVms > 0) { items.add(messages.hostNumberOfRunningVms(vds.getName(),runningVms)); } else { items.add(vds.getName()); } } model.setItems(items); UICommand tempVar = new UICommand("OnRestart", this); tempVar.setTitle(constants.ok()); tempVar.setIsDefault(true); model.getCommands().add(tempVar); UICommand tempVar2 = new UICommand("Cancel", this); tempVar2.setTitle(constants.cancel()); tempVar2.setIsCancel(true); model.getCommands().add(tempVar2); }
Source:
<code>public void asyncReadEntries(long firstEntry, long lastEntry, ReadCallback cb, Object ctx) { if (firstEntry < 0 || firstEntry > lastEntry) { cb.readComplete(BKException.Code.ReadException, this, null, ctx); return; } if (firstEntry > lastAddConfirmed || lastEntry > lastAddConfirmed) { try { <START> readLac(); <END> } catch (BKException | InterruptedException e) { LOG.info("Attempted to Read LAC, but nothing found"); } } if (lastEntry > lastAddConfirmed) { cb.readComplete(BKException.Code.ReadException, this, null, ctx); return; } asyncReadEntriesInternal(firstEntry, lastEntry, cb, ctx); }</code><technical_language>please put synchronous call in asynchronous method</technical_language>

Target:
public void asyncReadEntries(long firstEntry, long lastEntry, ReadCallback cb, Object ctx) { if (firstEntry < 0 || firstEntry > lastEntry) { LOG.error("IncorrectParameterException on ledgerId:{} firstEntry:{} lastEntry:{}", new Object[] { ledgerId, firstEntry, lastEntry }); cb.readComplete(BKException.Code.IncorrectParameterException, this, null, ctx); return; } if (lastEntry > lastAddConfirmed) { LOG.error("ReadException on ledgerId:{} firstEntry:{} lastEntry:{}", new Object[] { ledgerId, firstEntry, lastEntry }); cb.readComplete(BKException.Code.ReadException, this, null, ctx); return; } asyncReadEntriesInternal(firstEntry, lastEntry, cb, ctx); }
Source:
<code>private void ensurePreferredNameForLocale(Concept concept) { Set<Locale> checkedLocales = new HashSet<>(); for (ConceptName n : concept.getNames()) { Locale locale = n.getLocale(); if (checkedLocales.contains(locale)) { continue; } ConceptName possiblePreferredName = concept.getPreferredName(locale); <START> if (concept.getFullySpecifiedName(locale) != null) { <END> possiblePreferredName = concept.getFullySpecifiedName(locale); } else if (!CollectionUtils.isEmpty(concept.getSynonyms(locale))) { concept.getSynonyms(locale).iterator().next().setLocalePreferred(true); } if (possiblePreferredName != null) { possiblePreferredName.setLocalePreferred(true); } checkedLocales.add(locale); } }</code><technical_language>Behaviour is changed here, is this intentional? tests failed of this change in behaviour</technical_language>

Target:
private void ensurePreferredNameForLocale(Concept concept) { Set<Locale> checkedLocales = new HashSet<>(); for (ConceptName n : concept.getNames()) { Locale locale = n.getLocale(); if (checkedLocales.contains(locale)) { continue; } ConceptName possiblePreferredName = concept.getPreferredName(locale); if (possiblePreferredName != null) { } else if (concept.getFullySpecifiedName(locale) != null) { possiblePreferredName = concept.getFullySpecifiedName(locale); } else if (!CollectionUtils.isEmpty(concept.getSynonyms(locale))) { concept.getSynonyms(locale).iterator().next().setLocalePreferred(true); } if (possiblePreferredName != null) { possiblePreferredName.setLocalePreferred(true); } checkedLocales.add(locale); } }
Source:
<code>public Link discoverResource(int objectId, AttributeSet objectAttributes, int instanceId, int resourceId) { ReadResponse readResponse = read(resourceId); <START> if (readResponse == null || !readResponse.isSuccess()) { <END> return null; } return DiscoverHelper.resourceLink(objectId, objectAttributes, instanceId, instanceAttributes, resourceId, resourceAttributes.get(resourceId)); }</code><technical_language>Is if a resource is supported ? If check if this resource is returned getResourceIds() instead</technical_language>

Target:
public DiscoverResponse discoverResource(int objectId, AttributeSet objectAttributes, int instanceId, int resourceId) { if (!getAvailableResourceIds().contains(resourceId)) { return DiscoverResponse.notFound(); } return DiscoverResponse.success(new Link[] { DiscoverHelper.resourceLink(objectId, objectAttributes, instanceId, instanceAttributes, resourceId, resourceAttributes.get(resourceId)) }); }
Source:
<code>public void scan(@Nullable Tree element) { if (element != null) { currentElement = element; <START> List<ConsumerWrapper> elementConsumers = consumers.get(element.getKind()); <END> if (elementConsumers != null) { for (ConsumerWrapper consumer : elementConsumers) { consumer.execute(); } } } super.scan(element); }</code><technical_language>getOrDefault(element.getKind(), Collections.emptyList());</technical_language>

Target:
public void scan(@Nullable Tree element) { if (element != null) { currentElement = element; consumers.getOrDefault(element.getKind(), Collections.emptyList()).forEach(SubscriptionContextImpl::execute); } super.scan(element); }
Source:
<code>public void initializeDefaultPreferences() { super.performDefaults(); IPreferenceStore store = Activator.getDefault().getPreferenceStore(); String providerId = ProfileLaunchShortcut .getDefaultLaunchShortcutProviderId(SNAPSHOT); <START> store.setValue(PROVIDER, providerId); <END> }</code><technical_language>ConfigurationScope.INSTANCE .getNode? sense dependency injection <LINK_0></technical_language>

Target:
public void initializeDefaultPreferences() { super.performDefaults(); String providerId = ProfileLaunchShortcut .getDefaultLaunchShortcutProviderId(TYPE); configScopeInstance.getNode(QUALIFIER).put(KEY, providerId); }
Source:
<code>private static IntList getBitmapIndexList( final BoundDimFilter boundDimFilter, final BitmapIndex bitmapIndex ) { <START> return IntIteratorUtils.toIntList(getBitmapIndexIterator(boundDimFilter, bitmapIndex).iterator()); <END> }</code><technical_language>RangeIntList(from, to) implemented here: java class RangeIntList extends AbstractIntList { final int start, end; final int size RangeIntList(int start, int end) { this.start = start; this.end = end; this.size = end - start; } @Override public int getInt(int index) { Preconditions.checkElementIndex(index, size); return start + index; } @Override public int size() { return size; } }</technical_language>

Target:
private static IntList getBitmapIndexList( final BoundDimFilter boundDimFilter, final BitmapIndex bitmapIndex ) { final Pair<Integer, Integer> indexes = getStartEndIndexes(boundDimFilter, bitmapIndex); final int startIndex = indexes.lhs; final int endIndex = indexes.rhs; return IntListUtils.fromTo(startIndex, endIndex); }
Source:
<code>private void sendingMessage(boolean isSending, String message) { streamActv.setEnabled(!isSending); textView.setEnabled(!isSending); messageEt.setEnabled(!isSending); topicActv.setEnabled(!isSending); sendBtn.setEnabled(!isSending); togglePrivateStreamBtn.setEnabled(!isSending); if (isSending) { Log.e("vvvvvvvvvvvvvvvvvv", "visible"); <START> TextView msg = (TextView) composeStatus.getChildAt(1); <END> msg.setText(message); composeStatus.setVisibility(View.VISIBLE); } else composeStatus.setVisibility(View.GONE); }</code><technical_language>This is a brittle. If view layout changes this index longer valid. A brittle do ID element find</technical_language>

Target:
private void sendingMessage(boolean isSending, String message) { streamActv.setEnabled(!isSending); textView.setEnabled(!isSending); messageEt.setEnabled(!isSending); topicActv.setEnabled(!isSending); sendBtn.setEnabled(!isSending); togglePrivateStreamBtn.setEnabled(!isSending); if (isSending) { TextView msg = (TextView) composeStatus.findViewById(R.id.sending_message); msg.setText(message); composeStatus.setVisibility(View.VISIBLE); } else composeStatus.setVisibility(View.GONE); }
Source:
<code>private String getRocksDbAbsoluteDir(Map conf) throws MetricException { String storePath = conf.get(DaemonConfig.STORM_ROCKSDB_LOCATION).toString(); if (storePath == null) { throw new MetricException("Not a vaild RocksDB configuration - Missing store location " + DaemonConfig.STORM_ROCKSDB_LOCATION); } else { <START> if (new File(storePath).isAbsolute()) { <END> return storePath; } else { String stormHome = System.getProperty("storm.home"); if (stormHome == null) { throw new MetricException("storm.home not set"); } return (stormHome + File.separator + storePath); } } }</code><technical_language>storePath null called toString original object line above. want cast a String instead of calling toString it</technical_language>

Target:
private String getRocksDbAbsoluteDir(Map conf) throws MetricException { String storePath = (String)conf.get(DaemonConfig.STORM_ROCKSDB_LOCATION); if (storePath == null) { throw new MetricException("Not a vaild RocksDB configuration - Missing store location " + DaemonConfig.STORM_ROCKSDB_LOCATION); } else { if (new File(storePath).isAbsolute()) { return storePath; } else { String stormHome = System.getProperty("storm.home"); if (stormHome == null) { throw new MetricException("storm.home not set"); } return (stormHome + File.separator + storePath); } } }
Source:
<code>public Guid getProfileId() { <START> if (profileId == null) { <END> if (getParameters().getProfileId() != null) { profileId = getParameters().getProfileId(); } else if (getParameters().getProfile() != null) { profileId = getParameters().getProfile().getId(); } } return profileId; }</code><technical_language>try consolidate previous method</technical_language>

Target:
public Guid getProfileId() { if (profileId == null) { if (getParameters().getProfileId() != null) { profileId = getParameters().getProfileId(); } else if (getParameters().getProfile() != null) { profileId = getParameters().getProfile().getId(); } else { log.error("couldn't find disk profile id"); } } return profileId; }
Source:
<code>private ColumnSelectorFactory getEmptyColumnSelectorFactory() { return new ColumnSelectorFactory() { @Override public DimensionSelector makeDimensionSelector(DimensionSpec dimensionSpec) { return DimensionSelector.constant(null); } @Override public ColumnValueSelector makeColumnValueSelector(String s) { <START> return null; <END> } @Override public ColumnCapabilities getColumnCapabilities(String s) { return null; } }; }</code><technical_language>I guess this NilColumnValueSelector. Otherwise, this throw NPE if aggregator needs ColumnVauleSelector in HyperUniquesAggregatorFactory</technical_language>

Target:
private ColumnSelectorFactory getEmptyColumnSelectorFactory() { return new ColumnSelectorFactory() { @Override public DimensionSelector makeDimensionSelector(DimensionSpec dimensionSpec) { return DimensionSelector.constant(null); } @Override public ColumnValueSelector makeColumnValueSelector(String s) { return NilColumnValueSelector.instance(); } @Override public ColumnCapabilities getColumnCapabilities(String s) { return null; } }; }
Source:
<code><START> public void requestTicketOfTypeStringsTypeNull() { <END> User user = persistUser(); String typeString = null; List<String> optionsString = Arrays.asList(CH_MEMBER_OPTION, PICKUP_SERVICE_OPTION); thrown.expect(TicketTypeNotFoundException.class); thrown.expectMessage("TicketType "); ticketService.requestTicketOfType(user, typeString, optionsString); }</code><technical_language>this test differ previous one? is opinion this @skamoen</technical_language>

Target:
public void requestTicketOfTypeStringsTypeNull() { User user = persistUser(); List<String> optionsString = Arrays.asList(CH_MEMBER_OPTION, PICKUP_SERVICE_OPTION); thrown.expect(TicketTypeNotFoundException.class); thrown.expectMessage("TicketType "); ticketService.requestTicketOfType(user, null, optionsString); }
Source:
<code>public void generateAvroSchema(int numberOfFields) { try { File avroFile = new File(AVRO_FULL_PATH); FieldAssembler<Schema> fieldAssembler = SchemaBuilder.record(RECORD).namespace(NAMESPACE_VALUE).fields(); fieldAssembler.name(USER_ID_VALUE).type().stringType().stringDefault(NULL); for (int i = 0; i < numberOfFields; i++) { fieldAssembler.name(FIELD_PREFIX + i).type().stringType().stringDefault(NULL); } Schema sc = fieldAssembler.endRecord(); String schemaString = sc.toString(); JSONObject avroSchema = new JSONObject(schemaString); OutputStreamWriter avroWriter = new OutputStreamWriter(new FileOutputStream(avroFile), StandardCharsets.UTF_8); avroWriter.write(avroSchema.toString(4)); avroWriter.close(); } catch (FileNotFoundException e) { <START> } catch (IOException e) { <END> } }</code><technical_language>omitted handling exception. log exception trace</technical_language>

Target:
public static void generateAvroSchema(int numberOfFields) { try { File avroFile = new File(Constants.AVRO_FULL_PATH); FieldAssembler<Schema> fieldAssembler = SchemaBuilder.record(Constants.RECORD) .namespace(Constants.NAMESPACE_VALUE).fields(); fieldAssembler.name(Constants.USER_ID_VALUE).type().stringType().stringDefault(Constants.NULL); for (int fieldCount = 0; fieldCount < numberOfFields; fieldCount++) { fieldAssembler.name(Constants.FIELD_PREFIX + fieldCount).type().stringType().stringDefault(Constants.NULL); } Schema sc = fieldAssembler.endRecord(); String schemaString = sc.toString(); JSONObject avroSchema = new JSONObject(schemaString); OutputStreamWriter avroWriter = new OutputStreamWriter(new FileOutputStream(avroFile), StandardCharsets.UTF_8); avroWriter.write(avroSchema.toString(4)); avroWriter.close(); } catch (FileNotFoundException e) { LOG.info("Cannot find file " + Constants.AVRO_FULL_PATH, e.getMessage(), e); } catch (IOException e) { LOG.info("There is a problem generating avro schema", e.getMessage(), e); } }
Source:
<code>private Response make() throws IOException { <START> if (this.zipped.get() == null) { <END> this.zipped.compareAndSet( null, new RsWithHeader( new RsWithBody( this.origin, RsGzip.gzip(this.origin.body()) ), "Content-Encoding", "gzip" ) ); } return this.zipped.get(); }</code><technical_language>@essobedo here, thread-safe</technical_language>

Target:
private Response make() throws IOException { synchronized (this.zipped) { if (this.zipped.isEmpty()) { this.zipped.add( new RsWithHeader( new RsWithBody( this.origin, RsGzip.gzip(this.origin.body()) ), "Content-Encoding", "gzip" ) ); } } return this.zipped.get(0); }
Source:
<code>public static void broadcast(Set<Team> teams, String msg) { <START> Iterator<Team> it = teams.iterator(); <END> while(it.hasNext()) { sendMsg(it.next(), msg); } }</code><technical_language>einfacher: for(Team t : teams){..</technical_language>

Target:
public static void broadcast(Set<Team> teams, String msg) { for(Team x : teams) { sendMsg(x, msg); } }
Source:
<code>public static void handle(PacketCubes packet, Level worldIn) { ClientLevel world = (ClientLevel) worldIn; FriendlyByteBuf dataReader = wrapBuffer(packet.packetData); BitSet cubeExists = packet.cubeExists; for (int i = 0; i < packet.cubes.length; i++) { CubePos pos = packet.cubePositions[i]; int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); int[] cubeBiomes = new int[CubeBiomeContainer.CUBE_BIOMES_SIZE]; <START> if (cubeBiomes.length >= 0) <END> System.arraycopy(packet.biomes, i * CubeBiomeContainer.CUBE_BIOMES_SIZE, cubeBiomes, 0, cubeBiomes.length); CubeBiomeContainer cubeBiomeContainer = new CubeBiomeContainer(Minecraft.getInstance().level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), cubeBiomes); ((IClientCubeProvider) world.getChunkSource()).replaceWithPacketData( x, y, z, cubeBiomeContainer, dataReader, new CompoundTag(), cubeExists.get(i)); for (int dx = 0; dx < IBigCube.DIAMETER_IN_SECTIONS; dx++) { for (int dy = 0; dy < IBigCube.DIAMETER_IN_SECTIONS; dy++) { for (int dz = 0; dz < IBigCube.DIAMETER_IN_SECTIONS; dz++) { world.setSectionDirtyWithNeighbors( cubeToSection(x, dx), cubeToSection(y, dy), cubeToSection(z, dz)); } } } for (CompoundTag nbt : packet.tileEntityTags) { BlockPos tePos = new BlockPos(nbt.getInt("x"), nbt.getInt("y"), nbt.getInt("z")); BlockEntity te = world.getBlockEntity(tePos); if (te != null) { te.load(nbt); } } } }</code><technical_language>why</technical_language>

Target:
public static void handle(PacketCubes packet, Level worldIn) { ClientLevel world = (ClientLevel) worldIn; FriendlyByteBuf dataReader = wrapBuffer(packet.packetData); BitSet cubeExists = packet.cubeExists; for (int i = 0; i < packet.cubes.length; i++) { CubePos pos = packet.cubePositions[i]; int x = pos.getX(); int y = pos.getY(); int z = pos.getZ(); CubeBiomeContainer cubeBiomeContainer = new CubeBiomeContainer(Minecraft.getInstance().level.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), packet.biomeDataArrays.get(i)); ((IClientCubeProvider) world.getChunkSource()).replaceWithPacketData( x, y, z, cubeBiomeContainer, dataReader, new CompoundTag(), cubeExists.get(i)); for (int dx = 0; dx < IBigCube.DIAMETER_IN_SECTIONS; dx++) { for (int dy = 0; dy < IBigCube.DIAMETER_IN_SECTIONS; dy++) { for (int dz = 0; dz < IBigCube.DIAMETER_IN_SECTIONS; dz++) { world.setSectionDirtyWithNeighbors( cubeToSection(x, dx), cubeToSection(y, dy), cubeToSection(z, dz)); } } } for (CompoundTag nbt : packet.tileEntityTags) { BlockPos tePos = new BlockPos(nbt.getInt("x"), nbt.getInt("y"), nbt.getInt("z")); BlockEntity te = world.getBlockEntity(tePos); if (te != null) { te.load(nbt); } } } }
Source:
<code>public void testUpdateNotification() { Notification notification = curationApiAdmin.createNotification(testNotification()); long id = notification.getId(); System.out.println(id); Notification update = anotherTestNotification(); <START> System.out.println("here"); <END> update.setId(id); boolean userCanUpdate = true; try { System.out.println(update.getId()); curationApiUser.updateNotification(id, update); } catch (ApiException e) { userCanUpdate = false; } assertFalse(userCanUpdate); System.out.println(id); curationApiAdmin.updateNotification(id, update); System.out.println(id); String message = testingPostgres.runSelectStatement(String.format("select message from notification where id = '%s'", id), String.class); assertEquals(message, "ayy"); }</code><technical_language>want leave this in some other println's have, a test, a huge deal</technical_language>

Target:
public void testUpdateNotification() { Notification notification = curationApiAdmin.createNotification(testNotification()); long id = notification.getId(); Notification update = anotherTestNotification(); update.setId(id); boolean userCanUpdate = true; try { curationApiUser.updateNotification(id, update); } catch (ApiException e) { userCanUpdate = false; assertEquals(Response.Status.UNAUTHORIZED.getStatusCode(), e.getCode()); } assertFalse(userCanUpdate); curationApiAdmin.updateNotification(id, update); String message = testingPostgres.runSelectStatement(String.format("select message from notification where id = '%s'", id), String.class); assertEquals(currentMsg, message); }
Source:
<code>protected boolean isForceRefLog(ReceiveCommand cmd) { return cmd.isForceRefLog() != null ? <START> cmd.isForceRefLog().booleanValue() <END> : isForceRefLog(); }</code><technical_language>ReceiveCommand.isForceRefLog() is annotated @Nullable this a "potential null pointer" error in Eclipse. This is a false positive check for null previous line. Factoring out a variable fixes it</technical_language>

Target:
protected boolean isForceRefLog(ReceiveCommand cmd) { Boolean isForceRefLog = cmd.isForceRefLog(); return isForceRefLog != null ? isForceRefLog.booleanValue() : isForceRefLog(); }
Source:
<code><START> VoltPSetOpsRule(RelOptRuleOperand operand, MatchType matchType) { <END> super(operand, "VoltPSetOpsRule_" + matchType.name()); m_matchType = matchType; }</code><technical_language>constructor private</technical_language>

Target:
private VoltPSetOpsRule(RelOptRuleOperand operand, MatchType matchType) { super(operand, "VoltPSetOpsRule_" + matchType.name()); m_matchType = matchType; }
Source:
<code>public void destroy() throws Exception { apiPublisher.deleteAPI("PhoneVerificationAdd", apiVersion, ADMIN_LOGIN_USERNAME); apiPublisher.deleteAPI("APIWildCardApi", apiVersion, ADMIN_LOGIN_USERNAME); userManagementClient1.deleteUser("SubscriberUser"); userManagementClient1.deleteRole("Health-Subscriber"); <START> userManagementClient2.deleteUser("MultipleRoleUser"); <END> userManagementClient2.deleteRole("NewRole1"); userManagementClient2.deleteRole("NewRole2"); }</code><technical_language>do need 2 userManagement Clients? 1 right</technical_language>

Target:
public void destroy() throws Exception { apiPublisher.deleteAPI("PhoneVerificationAdd", apiVersion, ADMIN_LOGIN_USERNAME); apiPublisher.deleteAPI("APIWildCardApi", apiVersion, ADMIN_LOGIN_USERNAME); userManagementClient.deleteUser("SubscriberUser"); userManagementClient.deleteRole("Health-Subscriber"); userManagementClient.deleteUser("MultipleRoleUser"); userManagementClient.deleteRole("NewRole1"); userManagementClient.deleteRole("NewRole2"); }
Source:
<code>public void deleteItemVariant(@PathParam("id") long id) { ItemVariant itemVariant = stockService.findItemVariantById(id); activeStateChecker.checkState(itemVariant, true); <START> itemVariant.setActive(Boolean.FALSE); <END> stockService.saveItemVariant(itemVariant); }</code><technical_language>setActive(false) is enough (autoboxing)</technical_language>

Target:
public void deleteItemVariant(@PathParam("id") long id) { ItemVariant itemVariant = stockService.findItemVariantById(id); activeStateChecker.checkState(itemVariant, true); itemVariant.setActive(false); stockService.saveItemVariant(itemVariant); }
Source:
<code>public CalculationFunctions composedWith(DerivedCalculationFunction<?, ?>... derivedFunctions) { Map<Class<?>, List<DerivedCalculationFunction<?, ?>>> functionsByTargetType = Arrays.stream(derivedFunctions).collect(groupingBy(fn -> fn.targetType())); List<CalculationFunction<?>> wrappedFunctions = MapStream.of(functionsByTargetType) .map((targetType, fns) -> wrap(targetType, fns)) .collect(toList()); Map<Class<?>, CalculationFunction<?>> allFunctions = new HashMap<>(functions); wrappedFunctions.forEach(fn -> allFunctions.put(fn.targetType(), fn)); <START> return DefaultCalculationFunctions.of(allFunctions); <END> }</code><technical_language>do CalculationFunctions.of(wrappedFunctions)</technical_language>

Target:
public CalculationFunctions composedWith(DerivedCalculationFunction<?, ?>... derivedFunctions) { Map<Class<?>, List<DerivedCalculationFunction<?, ?>>> functionsByTargetType = Arrays.stream(derivedFunctions).collect(groupingBy(fn -> fn.targetType())); List<CalculationFunction<?>> wrappedFunctions = MapStream.of(functionsByTargetType) .map((targetType, fns) -> wrap(targetType, fns)) .collect(toList()); Map<Class<?>, CalculationFunction<?>> allFunctions = new HashMap<>(functions); wrappedFunctions.forEach(fn -> allFunctions.put(fn.targetType(), fn)); return CalculationFunctions.of(allFunctions); }
Source:
<code>public CdpElement findByGlobalDeviceId(String deviceId) { List<CdpElement> elements = find("from CdpElement rec where rec.cdpGlobalDeviceId = ? ", deviceId); if (elements.size() > 1) { LoggerFactory.getLogger(getClass()).warn("Expected one CdpElement for device with id but found {}. Using CdpElement and ignoring others.", deviceId, elements.size(), elements.get(0)); } <START> return elements.isEmpty() ? null : elements.get(0); <END> }</code><technical_language>I list of sorted some criteria, consistently choose element if/when many</technical_language>

Target:
public CdpElement findByGlobalDeviceId(String deviceId) { List<CdpElement> elements = find("from CdpElement rec where rec.cdpGlobalDeviceId = ? order by rec.id", deviceId); if (elements.size() > 1) { LoggerFactory.getLogger(getClass()).warn("Expected 1 CdpElement for device with id '{}' but found {}. Using CdpElement and ignoring others.", deviceId, elements.size(), elements.get(0)); } return elements.isEmpty() ? null : elements.get(0); }
Source:
<code><START> public static void main(String[] args) throws InterruptedException { <END> SpringApplication.run(JdbcSinkApplication.class, args); }</code><technical_language>throws overhead here</technical_language>

Target:
public static void main(String[] args) { SpringApplication.run(JdbcSinkApplication.class, args); }
Source:
<code>public void init() { get( "/forms/query", (req, res) -> util.getMetacardsByFilter(QUERY_TEMPLATE_TAG) .values() .stream() .map(Result::getMetacard) .filter(Objects::nonNull) .map(transformer::toFormTemplate) .filter(Objects::nonNull) .collect(Collectors.toList()), MAPPER::toJson); get( "/forms/result", (req, res) -> util.getMetacardsByFilter(ATTRIBUTE_GROUP_TAG) .values() .stream() .map(Result::getMetacard) .filter(Objects::nonNull) .map(transformer::toFieldFilter) .filter(Objects::nonNull) .collect(Collectors.toList()), MAPPER::toJson); delete( "/forms/:id", APPLICATION_JSON, (req, res) -> { String id = req.params(":id"); Subject subject = ThreadContext.getSubject(); String currentUser = SubjectUtils.getName(subject); Map<String, Object> originalMetacardOwner = JsonFactory.create().parser().parseMap(util.safeGetBody(req)); <START> if (!originalMetacardOwner.get(Core.METACARD_OWNER).equals(currentUser)) { <END> res.status(500); LOGGER.debug("Failed to Delete Form {}", id); return ImmutableMap.of("message", "Failed to delete."); } DeleteResponse deleteResponse = catalogFramework.delete(new DeleteRequestImpl(id)); if (!deleteResponse.getProcessingErrors().isEmpty()) { res.status(500); LOGGER.debug("Failed to Delete Form {}", id); return ImmutableMap.of("message", "Failed to delete."); } return ImmutableMap.of("message", "Successfully deleted."); }, util::getJson); }</code><technical_language>nice more complex decision logic involving user roles such, left for future improvements</technical_language>

Target:
public void init() { get( "/forms/query", (req, res) -> util.getMetacardsByFilter(QUERY_TEMPLATE_TAG) .values() .stream() .map(Result::getMetacard) .filter(Objects::nonNull) .map(transformer::toFormTemplate) .filter(Objects::nonNull) .collect(Collectors.toList()), MAPPER::toJson); get( "/forms/result", (req, res) -> util.getMetacardsByFilter(ATTRIBUTE_GROUP_TAG) .values() .stream() .map(Result::getMetacard) .filter(Objects::nonNull) .map(transformer::toFieldFilter) .filter(Objects::nonNull) .collect(Collectors.toList()), MAPPER::toJson); delete( "/forms/:id", APPLICATION_JSON, (req, res) -> { String id = req.params(":id"); Subject subject = SecurityUtils.getSubject(); String currentUser = SubjectUtils.getName(subject); Map<String, Object> originalMetacardOwner = JsonFactory.create().parser().parseMap(util.safeGetBody(req)); if (!originalMetacardOwner.get(Core.METACARD_OWNER).equals(currentUser)) { res.status(500); LOGGER.debug("Failed to Delete Form {}", id); return ImmutableMap.of(RESP_MSG, "Failed to delete."); } DeleteResponse deleteResponse = catalogFramework.delete(new DeleteRequestImpl(id)); if (!deleteResponse.getProcessingErrors().isEmpty()) { res.status(500); LOGGER.debug("Failed to Delete Form {}", id); return ImmutableMap.of(RESP_MSG, "Failed to delete."); } return ImmutableMap.of(RESP_MSG, "Successfully deleted."); }, util::getJson); }
Source:
<code>public RuntimeWorkspace getRuntimeWorkspaceByName(@PathParam("name") String name) { <START> return asRuntimeWorkspaceDto(workspaceManager.getRuntimeWorkspace(name, getCurrentUserId())); <END> }</code><technical_language>DtoConverter here</technical_language>

Target:
public RuntimeWorkspace getRuntimeWorkspaceByName(@PathParam("name") String name) { return asDto(workspaceManager.getRuntimeWorkspace(name, getCurrentUserId())); }
Source:
<code>public void testQueryConsistencyOnFailover() throws Exception { int CLUSTER_SIZE = 2; try (LocalIgniteCluster cluster = LocalIgniteCluster.start(CLUSTER_SIZE); IgniteClient client = Ignition.startClient(new ClientConfiguration() .setAddresses(cluster.clientAddresses().toArray(new String[CLUSTER_SIZE]))) ) { ClientCache<Integer, Integer> cache = client.createCache("cache"); cache.put(0, 0); cache.put(1, 1); Query<Cache.Entry<Integer, String>> qry = new ScanQuery<Integer, String>().setPageSize(1); try (QueryCursor<Cache.Entry<Integer, String>> cur = cache.query(qry)) { int cnt = 0; for (Iterator<Cache.Entry<Integer, String>> it = cur.iterator(); it.hasNext(); it.next()) { cnt++; if (cnt == 1) dropAllThinClientConnections(Ignition.allGrids().get(0)); } assertEquals(2, cnt); } <START> catch (ClientReconnectedException expected) { <END> } } }</code><technical_language>check expected exception thrown</technical_language>

Target:
public void testQueryConsistencyOnFailover() throws Exception { int CLUSTER_SIZE = 2; try (LocalIgniteCluster cluster = LocalIgniteCluster.start(CLUSTER_SIZE); IgniteClient client = Ignition.startClient(new ClientConfiguration() .setAddresses(cluster.clientAddresses().toArray(new String[CLUSTER_SIZE]))) ) { ClientCache<Integer, Integer> cache = client.createCache("cache"); cache.put(0, 0); cache.put(1, 1); Query<Cache.Entry<Integer, String>> qry = new ScanQuery<Integer, String>().setPageSize(1); try (QueryCursor<Cache.Entry<Integer, String>> cur = cache.query(qry)) { int cnt = 0; for (Iterator<Cache.Entry<Integer, String>> it = cur.iterator(); it.hasNext(); it.next()) { cnt++; if (cnt == 1) { for (int i = 0; i < CLUSTER_SIZE; i++) dropAllThinClientConnections(Ignition.allGrids().get(i)); } } fail("ClientReconnectedException must be thrown"); } catch (ClientReconnectedException expected) { } } }
Source:
<code>public int setCloseTime(int childSequenceNumber, long endTime) { int index = -1; for (int i = 0; i < nbChildren; i++) { if (childSequenceNumber == this.children[i]) { childEnd[i] = endTime; <START> index = i; <END> } } return index; }</code><technical_language>return i; break; need continue loop</technical_language>

Target:
public int setCloseTime(int childSequenceNumber, long endTime) { for (int i = 0; i < nbChildren; i++) { if (childSequenceNumber == this.children[i]) { childEnd[i] = endTime; return i; } } return -1; }
Source:
<code>public String analyze() { long min = Long.MAX_VALUE; long max = Long.MIN_VALUE; long sum = 0L; for (long current : measurements) { if (current < min) { min = current; } if (current > max) { max = current; } sum += current; } <START> String res = nanoToMillisString(sum / measurements.size()); <END> if (measurements.size() > 1) { res += "(n: " + measurements.size() + "; min: " + nanoToMillisString(min) + "; max: " + nanoToMillisString(max) + ")"; } return res; }</code><technical_language>guard divide zero? res = nanoToMillisString(measurements.isEmpty() ? 0 : (sum / measurements.size()))</technical_language>

Target:
public String analyze() { long min = Long.MAX_VALUE; long max = Long.MIN_VALUE; long sum = 0L; if (measurements.isEmpty()) { return "No measurements to analyze"; } for (long current : measurements) { if (current < min) { min = current; } if (current > max) { max = current; } sum += current; } String res = toMillisecondString(sum / measurements.size()); res += "(n: " + measurements.size() + "; min: " + toMillisecondString(min) + "; max: " + toMillisecondString(max) + ")"; return res; }
Source:
<code>private boolean fillBuffer() { boolean status = false; try { enqueuePermits.acquire(); Bundle p = source.next(); if (p == null) { log.info("exiting on null bundle from {}", source); } else { totalBundles++; <START> mapperPool.submit(new MapperTask(p)); <END> status = true; } } catch (NoSuchElementException ignored) { log.info("exiting on premature stream termination"); } catch (InterruptedException ignored) { Thread.currentThread().interrupt(); status = true; } return status; }</code><technical_language>do need create a task task do post-complete accounting? uncaught exception handler a listener future, a method reference</technical_language>

Target:
private boolean fillBuffer() { boolean status = false; try { enqueuePermits.acquire(); Bundle p = source.next(); if (p == null) { log.info("exiting on null bundle from {}", source); } else { totalBundles++; CompletableFuture<Void> future = CompletableFuture.runAsync(() -> task.process(p), mapperPool); future.whenComplete((v, e) -> enqueuePermits.release()); status = true; } } catch (NoSuchElementException ignored) { log.info("exiting on premature stream termination"); } catch (InterruptedException ignored) { Thread.currentThread().interrupt(); status = true; } return status; }
Source:
<code>public Object visit(ASTFieldDeclaration node, Object data) { if (!node.isStatic()) { return data; } ASTClassOrInterfaceType cit = node.getFirstDescendantOfType(ASTClassOrInterfaceType.class); if (cit == null || !TypeHelper.isA(cit, formatterClassToCheck)) { return data; } ASTVariableDeclaratorId var = node.getFirstDescendantOfType(ASTVariableDeclaratorId.class); <START> if (var.getType() != null && Arrays.asList(threadSafeFormatter).contains(var.getType().getName())) { <END> return data; } for (NameOccurrence occ : var.getUsages()) { Node n = occ.getLocation(); if (n.getFirstParentOfType(ASTSynchronizedStatement.class) != null) { continue; } if (!n.getImage().contains(".")) { continue; } ASTMethodDeclaration method = n.getFirstParentOfType(ASTMethodDeclaration.class); if (method != null && !method.isSynchronized()) { addViolation(data, n); } } return data; }</code><technical_language>this check work FastDateFormat, classes extend FastDateFormat, brittle. suggest TypeHelper.isA(TypeNode, String) (you need check for var.getType() == null, type helper for you</technical_language>

Target:
public Object visit(ASTFieldDeclaration node, Object data) { if (!node.isStatic()) { return data; } ASTClassOrInterfaceType cit = node.getFirstDescendantOfType(ASTClassOrInterfaceType.class); if (cit == null || !TypeHelper.isA(cit, formatterClassToCheck)) { return data; } ASTVariableDeclaratorId var = node.getFirstDescendantOfType(ASTVariableDeclaratorId.class); for (String formatter: THREAD_SAFE_FORMATTER) { if (TypeHelper.isA(var, formatter)) { return data; } } for (NameOccurrence occ : var.getUsages()) { Node n = occ.getLocation(); if (n.getFirstParentOfType(ASTSynchronizedStatement.class) != null) { continue; } if (!n.getImage().contains(".")) { continue; } ASTMethodDeclaration method = n.getFirstParentOfType(ASTMethodDeclaration.class); if (method != null && !method.isSynchronized()) { addViolation(data, n); } } return data; }
Source:
<code>private void asyncFetch() { if (pointer != null && lastEndTimestamp.get() < query.getEndTimestamp()) { if (pointer.get() > Math.round((FETCH_PERCENTAGE * (lastEndTimestamp.get() - lastStartTimestamp.get()))) + lastStartTimestamp.get()) { fetch(); } } else { if (!query.getEndTimestamp().equals(lastEndTimestamp.get())) { <START> fetch(); <END> } } }</code><technical_language>This method discussed is in a synchronous() fashion. if intend do this in a separate thread</technical_language>

Target:
private void asyncFetch() { lock.readLock().lock(); Long point = null; Long lastEnd = null; Long lastStart = null; boolean fetch = true; try { point = pointer == null ? null : pointer.get(); lastEnd = lastEndTimestamp.get(); lastStart = lastStartTimestamp.get(); fetch = fetching.get(); } finally { lock.readLock().unlock(); } if (point != null && lastEnd < query.getEndTimestamp()) { if (point > Math.round((FETCH_PERCENTAGE * (lastEnd - lastStart))) + lastStart) { if (!fetch) { _startScheduledExecutorService(); } } } else { if (!query.getEndTimestamp().equals(lastEnd)) { if (!fetch) { _startScheduledExecutorService(); } } } }
Source:
<code>public static OkHttpClient getClientPinnedIfAvailable(URL url, Proxy proxy) { OkHttpClient.Builder builder = new OkHttpClient.Builder(); builder.followRedirects(false) .followSslRedirects(false); if (proxy != null) { builder.proxy(proxy); builder.connectTimeout(30000, TimeUnit.MILLISECONDS) .readTimeout(45000, TimeUnit.MILLISECONDS); } else { builder.connectTimeout(5000, TimeUnit.MILLISECONDS) .readTimeout(25000, TimeUnit.MILLISECONDS); } <START> TlsCertificatePinning tlsCertificatePinning = new TlsCertificatePinning(url); <END> boolean isHttpsProtocol = url.getProtocol().equals("https"); boolean isPinAvailable = tlsCertificatePinning.isPinAvailable(); if (isHttpsProtocol && isPinAvailable) { tlsCertificatePinning.pinCertificate(builder); } return builder.build(); }</code><technical_language>this a null check before, is longer relevant</technical_language>

Target:
public static OkHttpClient getClientPinnedIfAvailable(URL url, Proxy proxy) { OkHttpClient.Builder builder = new OkHttpClient.Builder(); builder.followRedirects(false) .followSslRedirects(false); if (proxy != null) { builder.proxy(proxy); builder.connectTimeout(30000, TimeUnit.MILLISECONDS) .readTimeout(45000, TimeUnit.MILLISECONDS); } else { builder.connectTimeout(5000, TimeUnit.MILLISECONDS) .readTimeout(25000, TimeUnit.MILLISECONDS); } TlsCertificatePinning tlsCertificatePinning = new TlsCertificatePinning(url); boolean isHttpsProtocol = "https".equals(url.getProtocol()); boolean isPinAvailable = tlsCertificatePinning.isPinAvailable(); if (isHttpsProtocol && isPinAvailable) { tlsCertificatePinning.pinCertificate(builder); } return builder.build(); }
Source:
<code>public DataAccountFetchesPage() { initWidget(uiBinder.createAndBindUi(this)); BootstrapGwtDatePicker.INSTANCE.styles().ensureInjected(); addColumns(); dataAccountFetchTable.setLoadingIndicator(new Image(Images.INSTANCE.preloader())); dataAccountFetchTable.setEmptyTableWidget(new HTMLPanel("<h6>No Data Account Fetches</h6>")); DataAccountFetchController.get().addDataDisplay(dataAccountFetchTable); simplePager.setDisplay(dataAccountFetchTable); List<PresetDateRange> dateSelectorPresetRanges = new ArrayList<PresetDateRange>(); <START> dateSelectorPresetRanges.add(new PresetDateRange() { <END> @Override public String getName() { return "1 day"; } @Override public DateRange getDateRange() { return FilterHelper.createRange(FilterHelper.getDaysAgo(1), FilterHelper.getToday()); } }); dateSelectorPresetRanges.add(new PresetDateRange() { @Override public String getName() { return "1 wk"; } @Override public DateRange getDateRange() { return FilterHelper.createRange(FilterHelper.getWeeksAgo(1), FilterHelper.getToday()); } }); dateSelectorPresetRanges.add(new PresetDateRange() { @Override public String getName() { return "2 wks"; } @Override public DateRange getDateRange() { return FilterHelper.createRange(FilterHelper.getWeeksAgo(2), FilterHelper.getToday()); } }); dateSelectorPresetRanges.add(new PresetDateRange() { @Override public String getName() { return "30 days"; } @Override public DateRange getDateRange() { return FilterHelper.createRange(FilterHelper.getDaysAgo(30), FilterHelper.getToday()); } }); dateSelector.addFixedRanges(dateSelectorPresetRanges); updateFromFilter(); }</code><technical_language>Please create a DefaultPresetDateRange class date selector replace a custom preset date range one</technical_language>

Target:
public DataAccountFetchesPage() { initWidget(uiBinder.createAndBindUi(this)); BootstrapGwtDatePicker.INSTANCE.styles().ensureInjected(); addColumns(); dataAccountFetchTable.setLoadingIndicator(new Image(Images.INSTANCE.preloader())); dataAccountFetchTable.setEmptyTableWidget(new HTMLPanel("<h6>No Data Account Fetches</h6>")); DataAccountFetchController.get().addDataDisplay(dataAccountFetchTable); simplePager.setDisplay(dataAccountFetchTable); dateSelector.addFixedRanges(FilterHelper.getAdminDateRanges()); updateFromFilter(); }
Source:
<code>public SelectedCounterQueryFilter(long start, long end, int n, Collection<Long> ids, boolean isCumulative) { <START> super(start, end, n, ImmutableList.copyOf(ids)); <END> fIsCumulative = isCumulative; }</code><technical_language>put</technical_language>

Target:
public SelectedCounterQueryFilter(long start, long end, int n, Collection<Long> ids, boolean isCumulative) { super(start, end, n, ids); fIsCumulative = isCumulative; }