auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void fillRegions(D3 map) { JSONArray countriesFeatures = geoData.countries(); map.style("fill", (d, i, el) -> { Optional<Double> val = geoData.valueByCountry(data, countriesFeatures.get(i)); d3.select(el[i]).attr("class", "fill-region"); if (val.isPresent()) { return colorScale.call(colorScale, val.get()); } return null; }).on("mouseenter", (d, i, el) -> { Optional<Double> val = geoData.valueByCountry(data, countriesFeatures.get(i)); String countryName = geoData.countryName(countriesFeatures.get(i)); mapTooltip.show(countryName, conf.getTitle(), val, conf.getFormatter()); return null; }).on("mousemove", (d, i, el) -> { mapTooltip.move(); return null; }).on("mouseleave", (d, i, el) -> { mapTooltip.hide(); return null; }).on("click", (d, i, el) -> { <START> Optional<Entry<String, Double>> val = geoData.entryByCountry(data, countriesFeatures.get(i)); <END> if (val.isPresent()) { conf.getPathClickHandler().accept(val.get().getKey()); } return null; }); }</code><technical_language>Nitpick: instead of java Optional<Something> myoptional = ... if (myoptional.isPresent()) { = myoptional.get() /*do value*/ } more lightweight java myoptional.ifPresent(value -> {/*do value*/}); need return</technical_language>

Target:
private void fillRegions(D3 map) { Feature[] countriesFeatures = countriesGeoJsonService.getCountries(); map.style("fill", (d, i, el) -> { Optional<Double> val = countriesGeoJsonService.valueByCountry(data, countriesFeatures[i]); d3.select(el[i]).attr("class", "fill-region"); if (val.isPresent()) { return colorScale.call(colorScale, val.get()); } return null; }).on("mouseenter", (d, i, el) -> { Optional<Double> val = countriesGeoJsonService.valueByCountry(data, countriesFeatures[i]); String countryName = countriesGeoJsonService.getCountryName(countriesFeatures[i]); mapTooltip.show(countryName, conf.getTitle(), val, conf.getFormatter()); return null; }).on("mousemove", (d, i, el) -> { mapTooltip.move(); return null; }).on("mouseleave", (d, i, el) -> { mapTooltip.hide(); return null; }).on("click", (d, i, el) -> { countriesGeoJsonService.entryByCountry(data, countriesFeatures[i]) .ifPresent(v -> conf.getPathClickHandler().accept(v.getKey())); return null; }); }
Source:
<code>public ResourcesRoute(String name, String baseRestPath, String baseResourcePath, ImmutableMap<String, String> aliases, List<CachedResourcePolicy> cachedResourcePolicies) { this.name = checkNotNull(name); this.baseRestPath = ("/" + checkNotNull(baseRestPath) + "/").replaceAll("/+", "/"); this.baseResourcePath = checkNotNull(baseResourcePath) .replace('.', '/').replaceAll("^/", "").replaceAll("/$", "") + "/"; <START> if("/".equals(this.baseResourcePath)){ <END> throw new IllegalArgumentException("Please, avoid using '/' as ResourcesRoute's baseResourcePath as it represents serious security flaws (people will be able to read your classpath configuration files)"); } this.aliases = checkNotNull(aliases); this.cachedResourcePolicies = ImmutableList.copyOf(cachedResourcePolicies); }</code><technical_language>allow do a special setting. In some situations, security is issue (if server is isolated open world). restx.security.allowServingRootResources? WDYT</technical_language>

Target:
public ResourcesRoute(String name, String baseRestPath, String baseResourcePath, ImmutableMap<String, String> aliases, List<CachedResourcePolicy> cachedResourcePolicies) { this.name = checkNotNull(name); this.baseRestPath = ("/" + checkNotNull(baseRestPath) + "/").replaceAll("/+", "/"); this.baseResourcePath = this.ensureBaseResourcePathValid(baseResourcePath); this.aliases = checkNotNull(aliases); this.cachedResourcePolicies = ImmutableList.copyOf(cachedResourcePolicies); }
Source:
<code>private boolean shouldAction(long time){ <START> if (time < actionTime){ <END> return false; } else { return true; } }</code><technical_language>return time >= actionTime;</technical_language>

Target:
private boolean shouldAction(long time){ return time >= actionTime; }
Source:
<code>public static void initializePerspectives() { contributedPerspectives = new ArrayList<AbstractPerspectiveFactory>(); final IPerspectiveRegistry perspectives = PlatformUI.getWorkbench().getPerspectiveRegistry(); for (final IPerspectiveDescriptor perspectiveDescriptor : perspectives.getPerspectives()) { <START> System.out.println(perspectiveDescriptor.getId()); <END> } final IConfigurationElement[] extensions = BonitaStudioExtensionRegistryManager.getInstance().getConfigurationElements(PERSPECTIVES_EXTENSION_POINT); for (final IConfigurationElement extension : extensions) { try { System.out.println(extension.getAttribute("id")); final Object perspectiveFactory = extension.createExecutableExtension("class"); if(perspectiveFactory instanceof AbstractPerspectiveFactory){ contributedPerspectives.add((AbstractPerspectiveFactory) perspectiveFactory); } } catch (final Exception ex) { BonitaStudioLog.error(ex); } } }</code><technical_language>sysout</technical_language>

Target:
public static void initializePerspectives() { contributedPerspectives = new ArrayList<AbstractPerspectiveFactory>(); final IConfigurationElement[] extensions = BonitaStudioExtensionRegistryManager.getInstance().getConfigurationElements(PERSPECTIVES_EXTENSION_POINT); for (final IConfigurationElement extension : extensions) { try { final Object perspectiveFactory = extension.createExecutableExtension("class"); if(perspectiveFactory instanceof AbstractPerspectiveFactory){ contributedPerspectives.add((AbstractPerspectiveFactory) perspectiveFactory); } } catch (final Exception ex) { BonitaStudioLog.error(ex); } } }
Source:
<code><START> public static URI convertURI(RyaType value) { <END> return new URIImpl(value.getData()); }</code><technical_language>RyaType is general of argument here. discussion, create a private method want</technical_language>

Target:
private static URI convertURI(RyaType value) { return new URIImpl(value.getData()); }
Source:
<code>private SlicePredicate getSlicePredicateForSingleColumn(RangeRequest rangeRequest, long startTs) { SlicePredicate predicate; byte[] colName = rangeRequest.getColumnNames().iterator().next(); predicate = SlicePredicates.latestVersionForColumn(colName, startTs); <START> return predicate; <END> }</code><technical_language>nit: java byte[] colName = rangeRequest.getColumnNames().iterator().next(); return SlicePredicates.latestVersionForColumn(colName, startTs);</technical_language>

Target:
private SlicePredicate getSlicePredicateForSingleColumn(RangeRequest rangeRequest, long startTs) { byte[] colName = rangeRequest.getColumnNames().iterator().next(); return SlicePredicates.latestVersionForColumn(colName, startTs); }
Source:
<code>public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); <START> Permanent sourcePermanent = game.getPermanent(source.getSourceId()); <END> if (controller != null && sourcePermanent != null) { String message = "sacrifice a land?"; message = CardUtil.replaceSourceName(message, sourcePermanent.getLogName()); message = Character.toUpperCase(message.charAt(0)) + message.substring(1); if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game) && controller.chooseUse(Outcome.Benefit, message, source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return true; } } if (source.getSourceObjectZoneChangeCounter() == game.getState().getZoneChangeCounter(source.getSourceId()) && game.getState().getZone(source.getSourceId()) == Zone.BATTLEFIELD) { ContinuousEffect effect = new GiveControlEffect(); effect.setTargetPointer(new FixedTarget(source.getFirstTarget())); game.addEffect(effect, source); game.informPlayers(game.getPlayer(source.getFirstTarget()).getLogName() + " gains control of " + sourcePermanent.getIdName()); } return true; } return false; }</code><technical_language>getPermanentOrLKI otherwisw thr resolution fail if Enchantment left battlefield triggering resolution</technical_language>

Target:
public boolean apply(Game game, Ability source) { Player controller = game.getPlayer(source.getControllerId()); Permanent sourcePermanent = game.getPermanentOrLKIBattlefield(source.getSourceId()); if (controller != null && sourcePermanent != null) { String message = "sacrifice a land?"; message = CardUtil.replaceSourceName(message, sourcePermanent.getLogName()); message = Character.toUpperCase(message.charAt(0)) + message.substring(1); if (cost.canPay(source, source.getSourceId(), source.getControllerId(), game) && controller.chooseUse(Outcome.Benefit, message, source, game)) { cost.clearPaid(); if (cost.pay(source, game, source.getSourceId(), source.getControllerId(), false, null)) { return true; } } if (source.getSourceObjectZoneChangeCounter() == game.getState().getZoneChangeCounter(source.getSourceId()) && game.getState().getZone(source.getSourceId()) == Zone.BATTLEFIELD) { ContinuousEffect effect = new GiveControlEffect(); effect.setTargetPointer(new FixedTarget(source.getFirstTarget())); game.addEffect(effect, source); game.informPlayers(game.getPlayer(source.getFirstTarget()).getLogName() + " gains control of " + sourcePermanent.getIdName()); } return true; } return false; }
Source:
<code>public void setSupportedCRS(final String supportedCRS) throws ConfigurationException { Set<String> newSupportedCRS = Sets.newHashSet(); newSupportedCRS.addAll(StringHelper.splitToSet(supportedCRS, Constants.COMMA_STRING)); <START> this.supportedCRS = newSupportedCRS; <END> }</code><technical_language>This lines combined: this.supportedCRS = StringHelper.splitToSet(supportedCRS, ",");</technical_language>

Target:
public void setSupportedCRS(final String supportedCRS) throws ConfigurationException { this.supportedCRS = StringHelper.splitToSet(supportedCRS, Constants.COMMA_STRING); }
Source:
<code>public void install(ITextViewer textViewer) { for (IReconciler iReconciler : fReconcilers) { <START> if(iReconciler != null) { <END> iReconciler.install(textViewer); } } }</code><technical_language>run checks in constructor reconciler is null, create actual list of non-null reconcilers dereferenced here</technical_language>

Target:
public void install(ITextViewer textViewer) { for (IReconciler iReconciler : fReconcilers) { iReconciler.install(textViewer); } }
Source:
<code>private static void startFileWatcher() { if (startedWatcher.get()) { return; } startedWatcher.set(true); Job job = new Job("Links File Watcher") { @Override protected IStatus run(IProgressMonitor monitor) { try { final Path dir = new File(System.getProperty("user.home")).toPath(); final WatchService watcher = FileSystems.getDefault().newWatchService(); WatchKey key; try { key = dir.register(watcher, StandardWatchEventKinds.ENTRY_MODIFY); } <START> catch (IOException <END> ex) { OseeLog.log(EditLinksNavigateItem.class, Level.SEVERE, ex); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, ex.getLocalizedMessage(), ex); } for (;;) { try { key = watcher.take(); } catch (InterruptedException ex) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, ex.getLocalizedMessage(), ex); } for (WatchEvent<?> event : key.pollEvents()) { @SuppressWarnings("unchecked") WatchEvent<Path> ev = (WatchEvent<Path>) event; Path filename = ev.context(); for (FileChangedListener listener : listeners) { listener.fileChanged(filename.toString()); } } boolean valid = key.reset(); if (!valid) { break; } } return Status.OK_STATUS; } catch (IOException ex) { OseeLog.log(EditLinksNavigateItem.class, Level.SEVERE, ex); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, ex.getLocalizedMessage(), ex); } } }; Jobs.startJob(job); }</code><technical_language>this try/catch out duplicate IOException is caught bottom of method</technical_language>

Target:
private static void startFileWatcher() { if (startedWatcher.get()) { return; } startedWatcher.set(true); Job job = new Job("Links File Watcher") { @Override protected IStatus run(IProgressMonitor monitor) { try { final Path dir = new File(System.getProperty("user.home")).toPath(); final WatchService watcher = FileSystems.getDefault().newWatchService(); WatchKey key = dir.register(watcher, StandardWatchEventKinds.ENTRY_MODIFY); for (;;) { try { key = watcher.take(); } catch (InterruptedException ex) { return new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, ex.getLocalizedMessage(), ex); } for (WatchEvent<?> event : key.pollEvents()) { @SuppressWarnings("unchecked") WatchEvent<Path> ev = (WatchEvent<Path>) event; Path filename = ev.context(); for (FileChangedListener listener : listeners) { listener.fileChanged(filename.toString()); } } boolean valid = key.reset(); if (!valid) { break; } } return Status.OK_STATUS; } catch (IOException ex) { OseeLog.log(EditLinksNavigateItem.class, Level.SEVERE, ex); return new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, ex.getLocalizedMessage(), ex); } } }; Jobs.startJob(job); }
Source:
<code><START> private CompletableFuture<RecordMetadata> produceMessage(Producer<K, V> producer, ProducerRecord<K, V> record) { CompletableFuture<RecordMetadata> future = new CompletableFuture<>(); producer.send(record, (metadata, exception) -> { if (exception == null) { future.complete(metadata); } else { future.completeExceptionally(new KafkaClientException(metadata, exception)); } }); return future; } <END></code><technical_language>Thinking out loud: - This method is need: creates a CompletableFuture is completed if callback is called (send success/failure). - missing bit is canceling future timeout elapses if future.isDone() is false, accomplished a ScheduledExecutorService. I this is CompletableFutureUtils.failAfter() is I logic is more absolutely necessary; need other CompletableFuture failAfter() creates additional logic in within(). cancel this future if done timeout elapses. java scheduler.schedule(() -> { if (!future.isDone()) { future.cancel(); } }, _sendTimeout, TimeUnit.MILLISECONDS); - future.cancel() a java.util.concurrent.CancellationException thrown, means construct a TimeoutException a CancellationException cancelled timeout elapsed. This this method do a private executor service. I need a utils class for this purpose</technical_language>

Target:
private CompletableFuture<RecordMetadata> produceMessage(Producer<K, V> producer, ProducerRecord<K, V> record) { CompletableFuture<RecordMetadata> future = new CompletableFuture<>(); producer.send(record, (metadata, exception) -> { if (exception == null) { future.complete(metadata); } else { future.completeExceptionally(exception); } }); return future; }
Source:
<code>protected TreeViewer doCreateTreeViewer(Composite parentComposite, int style) { fCheckboxTreeViewer = new CheckboxTreeViewer(parentComposite, style); fCheckboxTreeViewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { fObjects.put(event.getElement(), event.getChecked()); } }); <START> treeViewer = <END> fCheckboxTreeViewer; return treeViewer; }</code><technical_language>treeViewer is set in base class return of this method</technical_language>

Target:
protected TreeViewer doCreateTreeViewer(Composite parentComposite, int style) { fCheckboxTreeViewer = new CheckboxTreeViewer(parentComposite, style); fCheckboxTreeViewer.addCheckStateListener(new ICheckStateListener() { @Override public void checkStateChanged(CheckStateChangedEvent event) { if (event.getChecked()) { fObjects.add(event.getElement()); } else { fObjects.remove(event.getElement()); } } }); return fCheckboxTreeViewer; }
Source:
<code>protected void showBusy(boolean busy) { MPart part = site.getModel(); int tagsListCount = part.getTags().size(); boolean containsBusyTag = part.getTags().contains(CSSConstants.CSS_BUSY_CLASS); if (busy && !containsBusyTag) { part.getTags().add(CSSConstants.CSS_BUSY_CLASS); } else if (!busy && containsBusyTag) { part.getTags().remove(CSSConstants.CSS_BUSY_CLASS); } <START> if (part.getTags().size() != tagsListCount) { <END> UIEvents.publishEvent(createEvent(UIEvents.UILabel.TOPIC_BUSY) .withParam(UIEvents.EventTags.ELEMENT, part) .withParam(UIEvents.EventTags.ATTNAME, UIEvents.UILifeCycle.BUSY) .withParam(UIEvents.EventTags.NEW_VALUE, busy)); } }</code><technical_language>removed</technical_language>

Target:
protected void showBusy(boolean busy) { MPart part = site.getModel(); boolean containsBusyTag = part.getTags().contains(CSSConstants.CSS_BUSY_CLASS); if (busy && !containsBusyTag) { part.getTags().add(CSSConstants.CSS_BUSY_CLASS); } else if (!busy && containsBusyTag) { part.getTags().remove(CSSConstants.CSS_BUSY_CLASS); } }
Source:
<code>public Map<String, Metric> getMetrics() { final Map<String, Metric> gauges = new HashMap<>(); gauges.put("open", (Gauge<Long>)() -> invoke("getOpenFileDescriptorCount")); gauges.put("max", (Gauge<Long>)() -> invoke("getMaxFileDescriptorCount")); gauges.put("exception.open.NoSuchMethod", openMethodMeter); gauges.put("exception.open.IllegalAccess", openAccessMeter); gauges.put("exception.open.InvocationTarget", openTargetMeter); gauges.put("exception.max.NoSuchMethod", maxMethodMeter); gauges.put("exception.max.IllegalAccess", maxAccessMeter); <START> gauges.put("exception.max.InvocationTarget", maxTargetMeter); <END> return Collections.unmodifiableMap(gauges); }</code><technical_language>Prefer lower-case, dash-separated names for metrics. E.g., exception.max.no-such-method</technical_language>

Target:
public Map<String, Metric> getMetrics() { final Map<String, Metric> gauges = new HashMap<>(); gauges.put(FDTYPE.get(0), (Gauge<Long>)() -> invoke(openMethod, FDTYPE.get(0))); gauges.put(FDTYPE.get(1), (Gauge<Long>)() -> invoke(maxMethod, FDTYPE.get(1))); for (String type: FDTYPE) { for(String ex: EXCEPTION) { gauges.put(String.format("%s.%s.%s", "exception", type, ex), calls.get(type).get(ex)); } } return Collections.unmodifiableMap(gauges); }
Source:
<code>private void loadPlugins(String[] pluginsUrls) { for (final String url : pluginsUrls) { ScriptInjector.fromUrl(url) .setWindow(ScriptInjector.TOP_WINDOW) .setCallback(new Callback<Void, Exception>() { @Override public void onSuccess(Void result) { } @Override public void onFailure(Exception reason) { <START> Window.alert("Failed load pluing: " + url); <END> } }).inject(); } }</code><technical_language>This a translated message. instead of Window.alert ErrorDialog type</technical_language>

Target:
private void loadPlugins(String[] pluginsUrls) { for (final String url : pluginsUrls) { ScriptInjector.fromUrl(url) .setWindow(ScriptInjector.TOP_WINDOW) .setCallback(new Callback<Void, Exception>() { @Override public void onSuccess(Void result) { } @Override public void onFailure(Exception reason) { new ErrorDialog("Failed load pluing: " + url).show(); } }).inject(); } }
Source:
<code>public BootSequence getSequence() { <START> StringBuilder str = new StringBuilder(""); END> for (EntityModel a : getItems()) { if (a.getIsChangable()) { BootSequence bs = (BootSequence) a.getEntity(); str.append(bs.toString()); } } return !str.equals("") ? BootSequence.valueOf(str.toString()) : null; }</code><technical_language>empty string is redundent</technical_language>

Target:
public BootSequence getSequence() { StringBuilder str = new StringBuilder(); for (EntityModel a : getItems()) { if (a.getIsChangable()) { BootSequence bs = (BootSequence) a.getEntity(); str.append(bs.toString()); } } return !str.equals("") ? BootSequence.valueOf(str.toString()) : null; }
Source:
<code>protected void setQcowCompatByQemuImageInfo(Guid storagePoolId, Guid newImageGroupId, Guid newImageId, Guid newStorageDomainID, DiskImage diskImage) { VM vm = vmDao.getVmsWithPlugInfo(diskImage.getId()).stream(). <START> map(pair -> pair.getFirst()). <END> findFirst().get(); setQcowCompat(diskImage.getImage(), storagePoolId, newImageGroupId, newImageId, newStorageDomainID, vm.getRunOnVds()); }</code><technical_language>is check if disk is plugged</technical_language>

Target:
protected void setQcowCompatByQemuImageInfo(Guid storagePoolId, Guid newImageGroupId, Guid newImageId, Guid newStorageDomainID, DiskImage diskImage) { VM vm = vmDao.getVmsWithPlugInfo(diskImage.getId()).stream(). map(Pair::getFirst). findFirst().get(); setQcowCompat(diskImage.getImage(), storagePoolId, newImageGroupId, newImageId, newStorageDomainID, vm.getRunOnVds()); }
Source:
<code>private ChaosType pickChaosType(CloudClient cloudClient, String instanceId) { Random random = new Random(); List<ChaosType> applicable = Lists.newArrayList(); for (ChaosType chaosType : allChaosTypes) { <START> if (chaosType.canApply(cloudClient, instanceId)) { <END> applicable.add(chaosType); } } if (applicable.isEmpty()) { return null; } int index = random.nextInt(applicable.size()); return applicable.get(index); }</code><technical_language>This be: java if( chaosType.isEnabled() && chaosType.canApply(cloudClient, instanceId)) { ... } warnings "Not AWSClient, security groups" type is disabled</technical_language>

Target:
private ChaosType pickChaosType(CloudClient cloudClient, String instanceId) { Random random = new Random(); SshConfig sshConfig = new SshConfig(cfg); ChaosInstance instance = new ChaosInstance(cloudClient, instanceId, sshConfig); List<ChaosType> applicable = Lists.newArrayList(); for (ChaosType chaosType : allChaosTypes) { if (chaosType.isEnabled() && chaosType.canApply(instance)) { applicable.add(chaosType); } } if (applicable.isEmpty()) { return null; } int index = random.nextInt(applicable.size()); return applicable.get(index); }
Source:
<code>public CryptByteBuffer(CryptByteBufferType type, SecretKey key, IvParameterSpec iv) throws InvalidKeyException, InvalidAlgorithmParameterException{ <START> if(iv != null && type.ivSize == -1){ <END> throw new UnsupportedTypeException(type, "This type does not take an IV."); } else if(iv != null){ this.iv = iv; } else if(type.ivSize != -1){ genIV(); } this.type = type; this.key = key; try{ if(type.cipherName == "RIJNDAEL"){ blockCipher = new Rijndael(type.keyType.keySize, type.blockSize); blockCipher.initialize(key.getEncoded()); if(type == CryptByteBufferType.RijndaelPCFB){ encryptPCFB = PCFBMode.create(blockCipher, this.iv.getIV()); decryptPCFB = PCFBMode.create(blockCipher, this.iv.getIV()); } } else{ encryptCipher = Cipher.getInstance(type.algName); decryptCipher = Cipher.getInstance(type.algName); encryptCipher.init(Cipher.ENCRYPT_MODE, this.key, this.iv); decryptCipher.init(Cipher.DECRYPT_MODE, this.key, this.iv); } }catch (UnsupportedCipherException e) { e.printStackTrace(); Logger.error(CryptByteBuffer.class, "Internal error; please report:", e); } catch (GeneralSecurityException e) { e.printStackTrace(); Logger.error(CryptByteBuffer.class, "Internal error; please report:", e); } }</code><technical_language>in terms of polish nice IV_UNSUPPORTED size constant Integer if unsupported null. explicit supportsIV() something? do thing, more readably</technical_language>

Target:
public CryptByteBuffer(CryptByteBufferType type, SecretKey key, IvParameterSpec iv) throws InvalidKeyException, InvalidAlgorithmParameterException{ if(iv != null && !type.hasIV()){ throw new UnsupportedTypeException(type, "This type does not take an IV."); } else if(iv != null){ this.iv = iv; } else if(type.hasIV()){ genIV(); } this.type = type; this.key = key; try{ if(type.cipherName.equals("RIJNDAEL")){ blockCipher = new Rijndael(type.keyType.keySize, type.blockSize); blockCipher.initialize(key.getEncoded()); if(type == CryptByteBufferType.RijndaelPCFB){ encryptPCFB = PCFBMode.create(blockCipher, this.iv.getIV()); decryptPCFB = PCFBMode.create(blockCipher, this.iv.getIV()); } } else{ encryptCipher = Cipher.getInstance(type.algName); decryptCipher = Cipher.getInstance(type.algName); encryptCipher.init(Cipher.ENCRYPT_MODE, this.key, this.iv); decryptCipher.init(Cipher.DECRYPT_MODE, this.key, this.iv); } }catch (UnsupportedCipherException | GeneralSecurityException e) { e.printStackTrace(); Logger.error(CryptByteBuffer.class, "Internal error; please report:", e); } }
Source:
<code>private String buildDayOfWeek() { Time t = new Time(mTimeZone); t.set(mMilliTime); long julianDay = Time.getJulianDay(mMilliTime, t.gmtoff); String dayOfWeek; mStringBuilder.setLength(0); if (julianDay == mTodayJulianDay) { dayOfWeek = mContext.getString(R.string.agenda_today, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString()); } else if (julianDay == mTodayJulianDay - 1) { dayOfWeek = mContext.getString(R.string.agenda_yesterday, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString()); } else if (julianDay == mTodayJulianDay + 1) { dayOfWeek = mContext.getString(R.string.agenda_tomorrow, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString()); } else { dayOfWeek = DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString(); } <START> String[] split = dayOfWeek.toLowerCase().split(" "); <END> StringBuilder sb = new StringBuilder(); for (String word : split) { sb.append(word.substring(0, 1).toUpperCase() + word.substring(1)); sb.append(" "); } dayOfWeek = sb.toString(); return dayOfWeek; }</code><technical_language>enough remove .toUpperCase() here? change pull request accordingly</technical_language>

Target:
private String buildDayOfWeek() { Time t = new Time(mTimeZone); t.set(mMilliTime); long julianDay = Time.getJulianDay(mMilliTime, t.gmtoff); String dayOfWeek; mStringBuilder.setLength(0); if (julianDay == mTodayJulianDay) { dayOfWeek = mContext.getString(R.string.agenda_today, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString()); } else if (julianDay == mTodayJulianDay - 1) { dayOfWeek = mContext.getString(R.string.agenda_yesterday, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString()); } else if (julianDay == mTodayJulianDay + 1) { dayOfWeek = mContext.getString(R.string.agenda_tomorrow, DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString()); } else { dayOfWeek = DateUtils.formatDateRange(mContext, mFormatter, mMilliTime, mMilliTime, DateUtils.FORMAT_SHOW_WEEKDAY, mTimeZone).toString(); } return dayOfWeek; }
Source:
<code>private OnHeapValueHolder<V> internalGet(final K key, final boolean updateAccess) throws CacheAccessException { getObserver.begin(); StoreEventSink<K, V> eventSink = null; try { <START> OnHeapValueHolder<V> mapping = getQuiet(key); <END> if (mapping == null) { getObserver.end(StoreOperationOutcomes.GetOutcome.MISS); return null; } if (updateAccess) { eventSink = storeEventDispatcher.eventSink(); mapping = setAccessTimeAndExpiryThenReturnMapping(key, mapping, timeSource.getTimeMillis(), eventSink); storeEventDispatcher.releaseEventSink(eventSink); } if (mapping != null) { getObserver.end(StoreOperationOutcomes.GetOutcome.HIT); } else { getObserver.end(StoreOperationOutcomes.GetOutcome.MISS); } return mapping; } catch (RuntimeException re) { if (eventSink != null) { storeEventDispatcher.releaseEventSinkAfterFailure(eventSink, re); } handleRuntimeException(re); return null; } }</code><technical_language>this change, get getInternal merged</technical_language>

Target:
private OnHeapValueHolder<V> internalGet(final K key, final boolean updateAccess) throws CacheAccessException { getObserver.begin(); try { OnHeapValueHolder<V> mapping = getQuiet(key); if (mapping == null) { getObserver.end(StoreOperationOutcomes.GetOutcome.MISS); return null; } if (updateAccess) { setAccessTimeAndExpiryThenReturnMappingOutsideLock(key, mapping, timeSource.getTimeMillis()); } getObserver.end(StoreOperationOutcomes.GetOutcome.HIT); return mapping; } catch (RuntimeException re) { handleRuntimeException(re); return null; } }
Source:
<code>protected TrackingCall(Call<RequestT, ResponseT> delegate, Integer id, Set<Integer> outstandingRequests) { super(delegate); this.id = id; this.outstandingRequests = outstandingRequests; <START> outstandingRequests.add(id); <END> }</code><technical_language>add outstandingRequests in start(), reason is if a Call is created start() is called, prevent channel closing</technical_language>

Target:
protected TrackingCall(Call<RequestT, ResponseT> delegate, Integer id, Set<Integer> outstandingRequests) { super(delegate); outstandingRequests.add(id); this.id = id; this.outstandingRequests = outstandingRequests; }
Source:
<code>protected boolean canDoAction() { VmValidator vmValidator = createVmValidator(); SnapshotsValidator snapshotValidator = createSnapshotValidator(); StoragePoolValidator spValidator = createStoragePoolValidator(); if (!(validateVM(vmValidator) && validate(spValidator.isUp()) && validate(vmValidator.vmNotIlegal()) && validate(vmValidator.vmNotLocked()) && validate(snapshotValidator.vmNotDuringSnapshot(getVmId())) && validate(snapshotValidator.vmNotInPreview(getVmId())) && validate(vmValidator.vmNotDuringMigration()) && validate(vmValidator.vmNotRunningStateless()))) { return false; } List<DiskImage> disksList = getDisksList(); if (disksList.size() > 0) { MultipleStorageDomainsValidator sdValidator = createMultipleStorageDomainsValidator(disksList); DiskImagesValidator diskImagesValidator = createDiskImageValidator(disksList); if (!(validate(diskImagesValidator.diskImagesNotLocked()) && validate(diskImagesValidator.diskImagesNotIllegal()) && validate(sdValidator.allDomainsExistAndActive()) && validate(sdValidator.allDomainsWithinThresholds()))) { return false; } } <START> if (getStorageDomainId().equals(Guid.Empty)) { <END> return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_NO_SUITABLE_DOMAIN_FOUND); } return true; }</code><technical_language>this fail create snapshot of diskless vm isSaveMemory()==false some other weird scenarios</technical_language>

Target:
protected boolean canDoAction() { VmValidator vmValidator = createVmValidator(); SnapshotsValidator snapshotValidator = createSnapshotValidator(); StoragePoolValidator spValidator = createStoragePoolValidator(); if (!(validateVM(vmValidator) && validate(spValidator.isUp()) && validate(vmValidator.vmNotIlegal()) && validate(vmValidator.vmNotLocked()) && validate(snapshotValidator.vmNotDuringSnapshot(getVmId())) && validate(snapshotValidator.vmNotInPreview(getVmId())) && validate(vmValidator.vmNotDuringMigration()) && validate(vmValidator.vmNotRunningStateless()))) { return false; } List<DiskImage> disksList = getDisksList(); if (disksList.size() > 0) { MultipleStorageDomainsValidator sdValidator = createMultipleStorageDomainsValidator(disksList); DiskImagesValidator diskImagesValidator = createDiskImageValidator(disksList); if (!(validate(diskImagesValidator.diskImagesNotLocked()) && validate(diskImagesValidator.diskImagesNotIllegal()) && validate(sdValidator.allDomainsExistAndActive()) && validate(sdValidator.allDomainsWithinThresholds()))) { return false; } } if (getParameters().isSaveMemory() && Guid.Empty.equals(getStorageDomainIdForVmMemory())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_NO_SUITABLE_DOMAIN_FOUND); } return true; }
Source:
<code>private void handleOnEscape() { <START> if (getText().equals(previousText)) { <END> onCancel.run(); } else { revertEdit(); } }</code><technical_language>escape key press dismiss menu, revert field? in total 3 for key</technical_language>

Target:
private void handleOnEscape() { if (getText().equals(previousText)) { onCancel.run(); } else if (suggestions.isShowing()){ suggestions.hide(); } else { revertEdit(); } }
Source:
<code>public List<InputRow> parseBatch(Map<String, Object> theMap) { <START> final List<String> dimensions = !this.dimensions.isEmpty() <END> ? this.dimensions : Lists.newArrayList( Sets.difference( theMap.keySet(), parseSpec.getDimensionsSpec() .getDimensionExclusions() ) ); final DateTime timestamp; try { timestamp = parseSpec.getTimestampSpec().extractTimestamp(theMap); if (timestamp == null) { final String input = theMap.toString(); throw new NullPointerException( StringUtils.format( "Null timestamp in input: %s", input.length() < 100 ? input : input.substring(0, 100) + "..." ) ); } } catch (Exception e) { throw new ParseException(e, "Unparseable timestamp found! Event: %s", theMap); } return ImmutableList.of(new MapBasedInputRow(timestamp.getMillis(), dimensions, theMap)); }</code><technical_language>Please if-else instead of multiline ternary. In other places too</technical_language>

Target:
public List<InputRow> parseBatch(Map<String, Object> theMap) { final List<String> dimensions; if (!this.dimensions.isEmpty()) { dimensions = this.dimensions; } else { dimensions = Lists.newArrayList( Sets.difference(theMap.keySet(), parseSpec.getDimensionsSpec().getDimensionExclusions()) ); } final DateTime timestamp; try { timestamp = parseSpec.getTimestampSpec().extractTimestamp(theMap); if (timestamp == null) { final String input = theMap.toString(); throw new NullPointerException( StringUtils.format( "Null timestamp in input: %s", input.length() < 100 ? input : input.substring(0, 100) + "..." ) ); } } catch (Exception e) { throw new ParseException(e, "Unparseable timestamp found! Event: %s", theMap); } return ImmutableList.of(new MapBasedInputRow(timestamp, dimensions, theMap)); }
Source:
<code>public String getMappedType(final String requestName, final String argName) { if (containsArgument(requestName, argName)) { return typeMapper.get(requestName).get(argName); <START> } else { <END> LOG.error("Could not map type for: " + requestName + ", " + argName); } return null; }</code><technical_language>need else statement here. remove leaving LOG statement code same</technical_language>

Target:
public String getMappedType(final String requestName, final String argName) { return ds3TypeMapper.getMappedType(requestName, argName); }
Source:
<code>public CPPASTQualifiedName copy(CopyStyle style) { CPPASTQualifiedName copy = new CPPASTQualifiedName(); if (fLastName != null) copy.addName(fLastName.copy(style)); <START> for (ICPPASTNameSpecifier nameSpecifier : getQualifier()) <END> copy.addNameSpecifier(nameSpecifier == null ? null : nameSpecifier.copy(style)); copy.setFullyQualified(fIsFullyQualified); copy.setOffsetAndLength(this); if (style == CopyStyle.withLocations) { copy.setCopyLocation(this); } return copy; }</code><technical_language>Please curly braces in 'for' statements</technical_language>

Target:
public CPPASTQualifiedName copy(CopyStyle style) { CPPASTQualifiedName copy = new CPPASTQualifiedName(); if (fLastName != null) copy.addName(fLastName.copy(style)); for (ICPPASTNameSpecifier nameSpecifier : getQualifier()) { copy.addNameSpecifier(nameSpecifier == null ? null : nameSpecifier.copy(style)); } copy.setFullyQualified(fIsFullyQualified); copy.setOffsetAndLength(this); if (style == CopyStyle.withLocations) { copy.setCopyLocation(this); } return copy; }
Source:
<code>long grabLocksAndRun(SweepLocks locks) throws InterruptedException { boolean sweptSuccessfully = false; try { if (isSweepEnabled.get()) { locks.lockOrRefresh(); if (locks.haveLocks()) { sweptSuccessfully = runOnce(); } else { log.warn("Skipping sweep because sweep is running elsewhere."); } } else { <START> log.info("Skipping sweep because it is currently disabled."); <END> } } catch (InsufficientConsistencyException e) { log.warn("Could not sweep because not all nodes of the database are online.", e); } catch (RuntimeException e) { sweepMetrics.sweepError(); if (checkAndRepairTableDrop()) { log.error("The table being swept by the background sweeper was dropped, moving on..."); } else { SweepBatchConfig lastBatchConfig = getAdjustedBatchConfig(); log.error("The background sweep job failed unexpectedly with batch config {}" + ". Attempting to continue with a lower batch size...", SafeArg.of("", lastBatchConfig), e); batchSizeMultiplier = Math.max(batchSizeMultiplier / 2, 1.5 / lastBatchConfig.candidateBatchSize()); } } if (sweptSuccessfully) { batchSizeMultiplier = Math.min(1.0, batchSizeMultiplier * 1.01); return sweepPauseMillis.get(); } else { return 20 * (1000 + sweepPauseMillis.get()); } }</code><technical_language>This spamming logs if config flag is disabled. leave debug</technical_language>

Target:
long grabLocksAndRun(SweepLocks locks) throws InterruptedException { boolean sweptSuccessfully = false; try { if (isSweepEnabled.get()) { locks.lockOrRefresh(); if (locks.haveLocks()) { sweptSuccessfully = runOnce(); } else { log.debug("Skipping sweep because sweep is running elsewhere."); } } else { log.debug("Skipping sweep because it is currently disabled."); } } catch (InsufficientConsistencyException e) { log.warn("Could not sweep because not all nodes of the database are online.", e); } catch (RuntimeException e) { sweepMetrics.sweepError(); if (checkAndRepairTableDrop()) { log.info("The table being swept by the background sweeper was dropped, moving on..."); } else { SweepBatchConfig lastBatchConfig = getAdjustedBatchConfig(); log.warn("The background sweep job failed unexpectedly with batch config {}." + " Attempting to continue with a lower batch size...", SafeArg.of("cell batch size", lastBatchConfig), e); batchSizeMultiplier = Math.max(batchSizeMultiplier / 2, 1.5 / lastBatchConfig.candidateBatchSize()); } } if (sweptSuccessfully) { batchSizeMultiplier = Math.min(1.0, batchSizeMultiplier * 1.01); return sweepPauseMillis.get(); } else { return 20 * (1000 + sweepPauseMillis.get()); } }
Source:
<code>public static InspectorModulesProvider defaultInspectorModulesProvider(final Context context) { return new InspectorModulesProvider() { @Override public Iterable<ChromeDevtoolsDomain> get() { ArrayList<ChromeDevtoolsDomain> modules = new ArrayList<ChromeDevtoolsDomain>(); modules.add(new Console()); modules.add(new CSS()); modules.add(new Debugger()); if (Build.VERSION.SDK_INT >= AndroidDOMConstants.MIN_API_LEVEL) { modules.add(new DOM(new AndroidDOMProviderFactory((Application)context.getApplicationContext()))); } modules.add(new DOMStorage(context)); modules.add(new HeapProfiler()); modules.add(new Inspector()); <START> modules.add(new Network(context, DefaultAsyncPrettyPrinterRegistry.getInstance())); <END> modules.add(new Page(context)); modules.add(new Profiler()); modules.add(new Runtime()); modules.add(new Worker()); if (Build.VERSION.SDK_INT >= DatabaseConstants.MIN_API_LEVEL) { modules.add(new Database(context, new DefaultDatabaseFilesProvider(context))); } return modules; } }; }</code><technical_language>This is awkward a singleton. Strongly prefer new .... In particular, edit singleton state Network code harder explore reason about. Instead, expose a getter or, yet, Network offer register methods internally</technical_language>

Target:
public static InspectorModulesProvider defaultInspectorModulesProvider(final Context context) { return new InspectorModulesProvider() { @Override public Iterable<ChromeDevtoolsDomain> get() { return new DefaultInspectorModulesBuilder(context).finish(); } }; }
Source:
<code>public static void moveToList(final Collection<Geocache> caches, final int listId) { if (caches.isEmpty()) { return; } final AbstractList list = AbstractList.getListById(listId); if (list == null) { <START> return; <END> } if (!list.isConcrete()) { return; } init(); final SQLiteStatement add = PreparedStatement.ADD_TO_LIST.getStatement(); final SQLiteStatement remove = PreparedStatement.REMOVE_FROM_ALL_LISTS.getStatement(); database.beginTransaction(); try { for (final Geocache cache : caches) { remove.bindString(1, cache.getGeocode()); remove.execute(); add.bindLong(1, listId); add.bindString(2, cache.getGeocode()); add.execute(); cache.getLists().add(listId); } database.setTransactionSuccessful(); } finally { database.endTransaction(); } }</code><technical_language>happen, right? Please log error there</technical_language>

Target:
public static void moveToList(final Collection<Geocache> caches, final int listId) { if (caches.isEmpty()) { Log.e("No cache was passed to moveToList"); return; } final AbstractList list = AbstractList.getListById(listId); if (list == null) { Log.e("Target list with id " + list + " does not exist in moveToList"); return; } if (!list.isConcrete()) { return; } init(); final SQLiteStatement add = PreparedStatement.ADD_TO_LIST.getStatement(); final SQLiteStatement remove = PreparedStatement.REMOVE_FROM_ALL_LISTS.getStatement(); database.beginTransaction(); try { for (final Geocache cache : caches) { remove.bindString(1, cache.getGeocode()); remove.execute(); add.bindLong(1, listId); add.bindString(2, cache.getGeocode()); add.execute(); cache.getLists().add(listId); } database.setTransactionSuccessful(); } finally { database.endTransaction(); } }
Source:
<code>public boolean equals(Object obj) { if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } <START> final TocTreeNodeLayer other = (TocTreeNodeLayer) obj; <END> if (this.layer != other.layer && (this.layer == null || !this.layer.equals(other.layer))) { return false; } return true; }</code><technical_language>If perform a obj instanceof TocTreeNodeLayer is null required type. faster easier understand. perform cast safely</technical_language>

Target:
public boolean equals(Object obj) { if (obj instanceof TocTreeNodeLayer) { final TocTreeNodeLayer other = (TocTreeNodeLayer) obj; return this.layer != null && this.layer.equals(other.layer); } else { return false; } }
Source:
<code>public static void beforeClass() throws TmfTraceException { fTrace = new TmfTraceStub(TEST_TRACE.getFullPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null); fProvider = new <START> TmfEventTableDataProvider(fTrace); TmfSignalManager.deregister(fTrace); <END> }</code><technical_language>do deregister trace</technical_language>

Target:
public static void beforeClass() throws TmfTraceException { fTrace.dispose(); fTrace = new TmfTraceStub(TEST_TRACE.getFullPath(), ITmfTrace.DEFAULT_TRACE_CACHE_SIZE, false, null); fProvider = new TmfEventTableDataProvider(fTrace); TmfSignalManager.deregister(fTrace); }
Source:
<code>public AssetDto createAsset(String resourceType, MultipartFile file, String group, List<String> categories) { BaseResourceDataBean resourceFile = new BaseResourceDataBean(); validateMimeType(resourceType, file.getContentType()); try { resourceFile.setInputStream(file.getInputStream()); resourceFile.setFileSize(file.getBytes().length / 1000); resourceFile.setFileName(file.getOriginalFilename()); resourceFile.setMimeType(file.getContentType()); resourceFile.setDescr(file.getOriginalFilename()); resourceFile.setMainGroup(group); resourceFile.setResourceType(resourceType); resourceFile.setCategories(categories.stream() .map(code -> categoryManager.getCategory(code)).collect(Collectors.toList())); ResourceInterface resource = resourceManager.addResource(resourceFile); return convertResourceToDto(resourceType, resourceManager.loadResource(resource.getId())); } catch (ApsSystemException e) { <START> throw new RestServerError("Error saving new resource", e); <END> } catch (IOException e) { throw new RestServerError("Error reading resource stream", e); } }</code><technical_language>Do exceptions get logged elsewhere? confirm this is right type for error</technical_language>

Target:
public AssetDto createAsset(String resourceType, MultipartFile file, String group, List<String> categories) { BaseResourceDataBean resourceFile = new BaseResourceDataBean(); validateMimeType(resourceType, file.getContentType()); try { resourceFile.setInputStream(file.getInputStream()); resourceFile.setFileSize(file.getBytes().length / 1000); resourceFile.setFileName(file.getOriginalFilename()); resourceFile.setMimeType(file.getContentType()); resourceFile.setDescr(file.getOriginalFilename()); resourceFile.setMainGroup(group); resourceFile.setResourceType(resourceType); resourceFile.setCategories(categories.stream() .map(code -> categoryManager.getCategory(code)).collect(Collectors.toList())); ResourceInterface resource = resourceManager.addResource(resourceFile); return convertResourceToDto(resourceType, resourceManager.loadResource(resource.getId())); } catch (ApsSystemException e) { throw new RestServerError("plugins.jacms.resources.resourceManager.error.list", e); } catch (IOException e) { log.error("Error reading file input stream", e); throw new RestServerError("plugins.jacms.resources.image.errorReadingStream", e); } }
Source:
<code>protected void configureCommitLogBackups() { if (!config.isBackingUpCommitLogs()) return; Properties props = new Properties(); props.put("archive_command", config.getCommitLogBackupArchiveCmd()); props.put("restore_command", config.getCommitLogBackupRestoreCmd()); props.put("restore_directories", config.getCommitLogBackupRestoreFromDirs()); props.put("restore_point_in_time", config.getCommitLogBackupRestorePointInTime()); try (FileOutputStream fos = new FileOutputStream(new File(config.getCommitLogBackupPropsFile()))) { props.store(fos, "cassandra commit log archive props, as written by priam"); } catch (IOException e) { <START> logger.error("Could not store commitlog_archiving.properties", e); <END> } }</code><technical_language>eating exception here? Earlier priam in restart loop proceed next steps</technical_language>

Target:
protected void configureCommitLogBackups() throws IOException { if (!config.isBackingUpCommitLogs()) return; Properties props = new Properties(); props.put("archive_command", config.getCommitLogBackupArchiveCmd()); props.put("restore_command", config.getCommitLogBackupRestoreCmd()); props.put("restore_directories", config.getCommitLogBackupRestoreFromDirs()); props.put("restore_point_in_time", config.getCommitLogBackupRestorePointInTime()); try (FileOutputStream fos = new FileOutputStream(new File(config.getCommitLogBackupPropsFile()))) { props.store(fos, "cassandra commit log archive props, as written by priam"); } catch (IOException e) { logger.error("Could not store commitlog_archiving.properties", e); throw e; } }
Source:
<code>public void bulkWrite() throws IOException { try (BufferedMutator bufferedMutator = connection.getBufferedMutator(TableName.valueOf(BENCHMARK_WRITE_TABLE))) { <START> String rowPrefix = getRowPrefix(jobConfig.cellsPerRow, jobConfig.cellSize); <END> byte[] cellValue = getRandomBytes(jobConfig.cellSize); ImmutableList.Builder<Put> putBuilder = ImmutableList.builderWithExpectedSize(ROWS_PER_BATCH); long currentTimestamp = System.currentTimeMillis(); for (int rowInd = 0, sendBatchInd = 0; rowInd < jobConfig.totalRows; rowInd++, sendBatchInd++) { Put put = new Put(Bytes.toBytes(rowPrefix + String.format(SUFFIX_FMT, rowInd))); for (int cellInd = 0; cellInd < jobConfig.cellsPerRow; cellInd++) { put.addColumn( COL_FAMILY, Bytes.toBytes("qualifier-" + String.format(SUFFIX_FMT, cellInd)), currentTimestamp, cellValue); } putBuilder.add(put); if (sendBatchInd % ROWS_PER_BATCH == 0 || rowInd == (jobConfig.totalRows - 1)) { bufferedMutator.mutate(putBuilder.build()); bufferedMutator.flush(); putBuilder = ImmutableList.builderWithExpectedSize(ROWS_PER_BATCH); } } } }</code><technical_language>Please randomize prefix targeting</technical_language>

Target:
public void bulkWrite() throws IOException { try (BufferedMutator bufferedMutator = connection.getBufferedMutator(TableName.valueOf(BENCHMARK_WRITE_TABLE))) { for (int rowInd = 0; rowInd < 100; rowInd++) { Put put = new Put( Bytes.toBytes(MUTATE_ROW_PREFIX + String.format("%06d", getRandomInt(1_000_000)))); for (int cellInd = 0; cellInd < rowShapeParams.cellsPerRow; cellInd++) { put.addColumn( COL_FAMILY, Bytes.toBytes("qualifier-" + String.format("%06d", cellInd)), SAMPLE_TIMESTAMP, getRandomBytes(rowShapeParams.cellSize)); } bufferedMutator.mutate(put); } } }