auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public DeployVirtualMachineOptions apply(CloudStackTemplateOptions templateOptions, Map<String, Network> networks, String zoneId, DeployVirtualMachineOptions options) { if (templateOptions.getSecurityGroupIds().size() > 0) { options.securityGroupIds(templateOptions.getSecurityGroupIds()); } <START> if (templateOptions.getNetworks().size() > 0) { <END> options.networkIds(templateOptions.getNetworks()); } return options; }</code><technical_language>if (!templateOptions.getNetworks().isEmpty())</technical_language>

Target:
public DeployVirtualMachineOptions apply(CloudStackTemplateOptions templateOptions, Map<String, Network> networks, String zoneId, DeployVirtualMachineOptions options) { if (!templateOptions.getSecurityGroupIds().isEmpty()) { options.securityGroupIds(templateOptions.getSecurityGroupIds()); } if (!templateOptions.getNetworks().isEmpty()) { options.networkIds(templateOptions.getNetworks()); } return options; }
Source:
<code><START> public void should_mark_nested_argument_as_part_of_full_argument(){ <END> Formats formats = new AnsiFormats(); Argument fullArg = new Argument(20, "and not yet confirmed"); Argument nestedArg = new Argument(-21, "not yet "); PrettyFormatter prettyFormatter = new PrettyFormatter(null); String formattedText = prettyFormatter.formatStepText("Given ", "the order is placed and not yet confirmed", formats.get("passed"), formats.get("passed_arg"), asList(fullArg, nestedArg)); assertThat(formattedText, equalTo(AnsiEscapes.GREEN + "Given " + AnsiEscapes.RESET + AnsiEscapes.GREEN + "the order is placed " + AnsiEscapes.RESET + AnsiEscapes.GREEN + AnsiEscapes.INTENSITY_BOLD + "and not yet confirmed" + AnsiEscapes.RESET)); }</code><technical_language>good</technical_language>

Target:
public void should_mark_nested_argument_as_part_of_full_argument(){ Formats formats = new AnsiFormats(); Argument enclosingArg = new Argument(20, "and not yet confirmed"); Argument nestedArg = new Argument(-17, "not yet "); PrettyFormatter prettyFormatter = new PrettyFormatter(null); String formattedText = prettyFormatter.formatStepText("Given ", "the order is placed and not yet confirmed", formats.get("passed"), formats.get("passed_arg"), asList(enclosingArg, nestedArg)); assertThat(formattedText, equalTo(AnsiEscapes.GREEN + "Given " + AnsiEscapes.RESET + AnsiEscapes.GREEN + "the order is placed " + AnsiEscapes.RESET + AnsiEscapes.GREEN + AnsiEscapes.INTENSITY_BOLD + "and not yet confirmed" + AnsiEscapes.RESET)); }
Source:
<code>public void tearDown() throws Exception { mJobScheduler.cancel(CONNECTIVITY_JOB_ID); if (mInitialRestrictBackground) { SystemUtil.runShellCommand(getInstrumentation(), RESTRICT_BACKGROUND_ON_CMD); } <START> if (mHasWifi) { if (mWifiManager.isWifiEnabled() <END> != mInitialWiFiState) { NetworkInfo.State expectedState = mInitialWiFiState ? NetworkInfo.State.CONNECTED : NetworkInfo.State.DISCONNECTED; ConnectivityActionReceiver receiver = new ConnectivityActionReceiver(ConnectivityManager.TYPE_WIFI, expectedState); IntentFilter filter = new IntentFilter(); filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); mContext.registerReceiver(receiver, filter); assertTrue(mWifiManager.setWifiEnabled(mInitialWiFiState)); receiver.waitForStateChange(); assertTrue("Failure to restore previous WiFi state", mWifiManager.isWifiEnabled() == mInitialWiFiState); mContext.unregisterReceiver(receiver); } } super.tearDown(); }</code><technical_language>nit: if statements combined reduce indentation</technical_language>

Target:
public void tearDown() throws Exception { mJobScheduler.cancel(CONNECTIVITY_JOB_ID); if (mInitialRestrictBackground) { SystemUtil.runShellCommand(getInstrumentation(), RESTRICT_BACKGROUND_ON_CMD); } if (mHasWifi && (mWifiManager.isWifiEnabled() != mInitialWiFiState)) { NetworkInfo.State expectedState = mInitialWiFiState ? NetworkInfo.State.CONNECTED : NetworkInfo.State.DISCONNECTED; ConnectivityActionReceiver receiver = new ConnectivityActionReceiver(ConnectivityManager.TYPE_WIFI, expectedState); IntentFilter filter = new IntentFilter(); filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); mContext.registerReceiver(receiver, filter); assertTrue(mWifiManager.setWifiEnabled(mInitialWiFiState)); receiver.waitForStateChange(); assertTrue("Failure to restore previous WiFi state", mWifiManager.isWifiEnabled() == mInitialWiFiState); mContext.unregisterReceiver(receiver); } super.tearDown(); }
Source:
<code>public boolean equals(Object obj) { if (!(obj instanceof OgcMessage)) return false; OgcMessage other = (OgcMessage) obj; return new EqualsBuilder() .appendSuper(super.equals(other)) .append(getService(), other.getService()) .append(getOperation(), other.getOperation()) <START> .append(getEndPoint(), other.getEndPoint()) <END> .isEquals(); }</code><technical_language>discussed, sould response/resquest rule also. I unsure wrt of .appendSuper(super.equals(other)), favor a short note of @buehner here</technical_language>

Target:
public boolean equals(Object obj) { if (!(obj instanceof OgcMessage)) return false; OgcMessage other = (OgcMessage) obj; return new EqualsBuilder() .append(getService(), other.getService()) .append(getOperation(), other.getOperation()) .append(getEndPoint(), other.getEndPoint()) .append(getRequestRule(), other.getRequestRule()) .append(getResponseRule(), other.getResponseRule()) .isEquals(); }
Source:
<code>void enrich(ConfigDef newDef) { Object aliases = ConfigDef.parseType(aliasConfig, props.get(aliasConfig), Type.LIST); if (!(aliases instanceof List)) { return; } LinkedHashSet<?> uniqueAliases = new LinkedHashSet<>((List<?>) aliases); for (Object o : uniqueAliases) { if (!(o instanceof String)) { throw new ConfigException("Item in " + aliasConfig + " property is not of " + "type String"); } String alias = (String) o; final String prefix = aliasConfig + "." + alias + "."; final String group = aliasGroup + ": " + alias; int orderInGroup = 0; final String typeConfig = prefix + "type"; <START> final ConfigDef.Validator typeValidator = new ConfigDef.Validator() { <END> @Override public void ensureValid(String name, Object value) { validateProps(prefix); getConfigDefFromConfigProvidingClass(typeConfig, (Class<?>) value); } }; newDef.define(typeConfig, Type.CLASS, ConfigDef.NO_DEFAULT_VALUE, typeValidator, Importance.HIGH, "Class for the '" + alias + "' " + aliasKind.toLowerCase(Locale.ENGLISH) + ".", group, orderInGroup++, Width.LONG, baseClass.getSimpleName() + " type for " + alias, Collections.emptyList(), new ClassRecommender()); final ConfigDef configDef = populateConfigDef(typeConfig); if (configDef == null) continue; newDef.embed(prefix, group, orderInGroup, configDef); } }</code><technical_language>Consider LambdaValidator able add a lambda for toString method of this validator</technical_language>

Target:
void enrich(ConfigDef newDef) { Object aliases = ConfigDef.parseType(aliasConfig, props.get(aliasConfig), Type.LIST); if (!(aliases instanceof List)) { return; } LinkedHashSet<?> uniqueAliases = new LinkedHashSet<>((List<?>) aliases); for (Object o : uniqueAliases) { if (!(o instanceof String)) { throw new ConfigException("Item in " + aliasConfig + " property is not of " + "type String"); } String alias = (String) o; final String prefix = aliasConfig + "." + alias + "."; final String group = aliasGroup + ": " + alias; int orderInGroup = 0; final String typeConfig = prefix + "type"; final ConfigDef.Validator typeValidator = ConfigDef.LambdaValidator.with( (String name, Object value) -> { validateProps(prefix); getConfigDefFromConfigProvidingClass(typeConfig, (Class<?>) value); }, () -> "valid configs for " + alias + " " + aliasKind.toLowerCase(Locale.ENGLISH)); newDef.define(typeConfig, Type.CLASS, ConfigDef.NO_DEFAULT_VALUE, typeValidator, Importance.HIGH, "Class for the '" + alias + "' " + aliasKind.toLowerCase(Locale.ENGLISH) + ".", group, orderInGroup++, Width.LONG, baseClass.getSimpleName() + " type for " + alias, Collections.emptyList(), new ClassRecommender()); final ConfigDef configDef = populateConfigDef(typeConfig); if (configDef == null) continue; newDef.embed(prefix, group, orderInGroup, configDef); } }
Source:
<code>public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { Matcher matcher = BITCOIN_URI_PATTERN.matcher(text); if (!matcher.find(startPos) || matcher.start() != startPos) { return startPos; } <START> String linkifiedUri = String.format("<a href=\"%1$s\">%1$s</a>", matcher.group()); <END> outputBuffer.append(linkifiedUri); return matcher.end(); }</code><technical_language>avoids parse format string creating a temporary string. java String bitcoinUri = matcher.group(); outputBuffer.append("<a href=\"") .append(bitcoinUri) .append("\">") .append(bitcoinUri) .append("</a>"); of it. need encode & in href attribute</technical_language>

Target:
public int linkifyUri(String text, int startPos, StringBuffer outputBuffer) { Matcher matcher = BITCOIN_URI_PATTERN.matcher(text); if (!matcher.find(startPos) || matcher.start() != startPos) { return startPos; } String bitcoinUri = matcher.group(); outputBuffer.append("<a href=\"") .append(bitcoinUri) .append("\">") .append(bitcoinUri) .append("</a>"); return matcher.end(); }
Source:
<code>} catch (ClassNotFoundException | NoSuchMethodException e) { rule = new <START> SwitchTargetSdkVersionRule() <END> { @Override protected Statement createStatement(Statement statement, int targetSdkVersion) { return new Statement() { @Override public void evaluate() { fail("Targeting SDK version not supported as " + VMRUNTIME + " is not supported"); } }; } }; }</code><technical_language>I classes necessary? code more difficult read more obvious implementation. If decided this work OpenJDK wanted reflection (not convinced of that, myself), a static initializer try find methods leave null if can't. createStatement() check for null fail() if are, DTRT if aren't. need classes - one</technical_language>

Target:
} catch (ClassNotFoundException | NoSuchMethodException e) { rule = new VMRuntimeNotSupported(); }
Source:
<code>private boolean hidePart(MPart part, boolean save, boolean confirm, boolean force, boolean local) { if (!partService.getParts().contains(part)) { if (local) { return false; } part.setToBeRendered(false); return true; } Object clientObject = part.getObject(); if <START> (clientObject == null || !(clientObject <END> instanceof CompatibilityPart)) { if (save) { if (partService.savePart(part, confirm)) { partService.hidePart(part, force); return true; } return false; } partService.hidePart(part, force); return true; } IWorkbenchPart workbenchPart = getWrappedPart((CompatibilityPart) clientObject); if (save && workbenchPart != null) { ISaveablePart saveablePart = SaveableHelper.getSaveable(workbenchPart); if (saveablePart != null) { if (saveablePart.isSaveOnCloseNeeded()) { if (!saveSaveable(saveablePart, workbenchPart, confirm, true)) { return false; } } } } for (IViewReference viewRef : viewReferences) { if (workbenchPart == viewRef.getPart(false)) { partService.hidePart(part, force); return true; } } for (IEditorReference viewRef : editorReferences) { if (workbenchPart == viewRef.getPart(false)) { partService.hidePart(part, force); return true; } } return false; }</code><technical_language>This is needed, please leave code "as is". null is instanceof of anything</technical_language>

Target:
private boolean hidePart(MPart part, boolean save, boolean confirm, boolean force, boolean local) { if (!partService.getParts().contains(part)) { if (local) { return false; } part.setToBeRendered(false); return true; } Object clientObject = part.getObject(); if (!(clientObject instanceof CompatibilityPart)) { if (save) { if (partService.savePart(part, confirm)) { partService.hidePart(part, force); return true; } return false; } partService.hidePart(part, force); return true; } IWorkbenchPart workbenchPart = getWrappedPart((CompatibilityPart) clientObject); if (save && workbenchPart != null) { ISaveablePart saveablePart = SaveableHelper.getSaveable(workbenchPart); if (saveablePart != null) { if (saveablePart.isSaveOnCloseNeeded()) { if (!saveSaveable(saveablePart, workbenchPart, confirm, true)) { return false; } } } } for (IViewReference viewRef : viewReferences) { if (workbenchPart == viewRef.getPart(false)) { partService.hidePart(part, force); return true; } } for (IEditorReference viewRef : editorReferences) { if (workbenchPart == viewRef.getPart(false)) { partService.hidePart(part, force); return true; } } return false; }
Source:
<code>public static void populateStockIdInListDataProject(final List<ListDataProject> data , InventoryDataManager inventoryDataManager) { final List<Integer> gids = new ArrayList<>(); if (data != null && !data.isEmpty()) { for (final ListDataProject listDataProject : data) { gids.add(listDataProject.getGermplasmId()); } } Map<Integer, String> stockIds = inventoryDataManager.retrieveStockIds(gids); if (data != null && !data.isEmpty()) { for (final ListDataProject ListData : data) { String stockIdValue = ""; if (stockIds != null) { for (final Integer gid : stockIds.keySet()) { if (ListData.getGermplasmId().equals(gid)) { stockIdValue = stockIds.get(gid); break; } } } <START> ListData.setStockIDs(stockIdValue); <END> } } }</code><technical_language>local variable *ListData* renamed *listData* local variable naming conventions</technical_language>

Target:
public static void populateStockIdInListDataProject(final List<ListDataProject> data , InventoryDataManager inventoryDataManager) { final List<Integer> gids = new ArrayList<>(); if (data != null && !data.isEmpty()) { for (final ListDataProject listDataProject : data) { gids.add(listDataProject.getGermplasmId()); } } Map<Integer, String> stockIds = inventoryDataManager.retrieveStockIds(gids); if (data != null && !data.isEmpty()) { for (final ListDataProject listData : data) { String stockIdValue = ""; if (stockIds != null) { for (final Integer gid : stockIds.keySet()) { if (listData.getGermplasmId().equals(gid)) { stockIdValue = stockIds.get(gid); break; } } } listData.setStockIDs(stockIdValue); } } }
Source:
<code>private static String getSupportedProperty(final List<String> supportedProperties, final Map<String, String> propertiesMap) { for (final String supportedProperty : supportedProperties) { if (propertiesMap.containsKey(supportedProperty)) { final String prop = propertiesMap.get(supportedProperty); ParameterHandler.LOG.debug("Supported convention property: found: {}", supportedProperty, prop); return prop; } } <START> return null; <END> }</code><technical_language>java return supportedProperties.stream() .filter(propertiesMap::containsKey) .findFirst() .map(propertiesMap::get) .orElse(null);</technical_language>

Target:
private static Optional<String> getSupportedProperty(final List<String> supportedProperties, final Map<String, String> propertiesMap) { return supportedProperties.stream().filter(propertiesMap::containsKey).findFirst().map(propertiesMap::get); }
Source:
<code>private String[][] getZoneStringsImpl(boolean needsCopy) { if <START> (zoneStrings == <END> null) { zoneStrings = TimeZoneNames.getZoneStrings(locale); } if (!needsCopy) { return zoneStrings; } int len = zoneStrings.length; String[][] aCopy = new String[len][]; for (int i = 0; i < len; i++) { aCopy[i] = Arrays.copyOf(zoneStrings[i], zoneStrings[i].length); } return aCopy; }</code><technical_language>Is intentional remove synchronized here</technical_language>

Target:
private final String[][] getZoneStringsImpl(boolean needsCopy) { String[][] zoneStrings = internalZoneStrings(); END Android-changed: extract initialization of zoneStrings to separate method. if (!needsCopy) { return zoneStrings; } int len = zoneStrings.length; String[][] aCopy = new String[len][]; for (int i = 0; i < len; i++) { aCopy[i] = Arrays.copyOf(zoneStrings[i], zoneStrings[i].length); } return aCopy; }
Source:
<code>public Collection<Mutation> toMutations(K key, long seq) { Map<RowColumn, Bytes> oldData = generateData(key, oldVal); Map<RowColumn, Bytes> newData = generateData(key, newVal); Map<Bytes, Mutation> mutationMap = new HashMap<>(); for (Map.Entry<RowColumn, Bytes> entry : oldData.entrySet()) { RowColumn rc = entry.getKey(); if (!newData.containsKey(rc)) { Mutation m = mutationMap.computeIfAbsent(rc.getRow(), r -> new Mutation(r.toArray())); <START> m.putDelete(rc.getColumn().getFamily().toArray(), rc.getColumn().getQualifier().toArray()); <END> } } for (Map.Entry<RowColumn, Bytes> entry : newData.entrySet()) { RowColumn rc = entry.getKey(); Column col = rc.getColumn(); Bytes val = entry.getValue(); if (!oldData.containsKey(rc) || !oldData.get(rc).equals(val)) { Mutation m = mutationMap.computeIfAbsent(rc.getRow(), r -> new Mutation(r.toArray())); m.put(col.getFamily().toArray(), col.getQualifier().toArray(), seq, val.toArray()); } } return mutationMap.values(); }</code><technical_language>need set timestamp</technical_language>

Target:
public Collection<Mutation> toMutations(K key, long seq) { Map<RowColumn, Bytes> oldData = generateData(key, oldVal); Map<RowColumn, Bytes> newData = generateData(key, newVal); Map<Bytes, Mutation> mutationMap = new HashMap<>(); for (Map.Entry<RowColumn, Bytes> entry : oldData.entrySet()) { RowColumn rc = entry.getKey(); if (!newData.containsKey(rc)) { Mutation m = mutationMap.computeIfAbsent(rc.getRow(), r -> new Mutation(r.toArray())); m.putDelete(rc.getColumn().getFamily().toArray(), rc.getColumn().getQualifier().toArray(), seq); } } for (Map.Entry<RowColumn, Bytes> entry : newData.entrySet()) { RowColumn rc = entry.getKey(); Column col = rc.getColumn(); Bytes newVal = entry.getValue(); Bytes oldVal = oldData.get(rc); if (oldVal == null || !oldVal.equals(newVal)) { Mutation m = mutationMap.computeIfAbsent(rc.getRow(), r -> new Mutation(r.toArray())); m.put(col.getFamily().toArray(), col.getQualifier().toArray(), seq, newVal.toArray()); } } return mutationMap.values(); }
Source:
<code>public abstract void start() throws RunnerException ; public abstract void stop() throws RunnerException ; public void getLogs(Appendable output) throws IOException, RunnerException { <START> final String url = bindAddress + ':' + port + "/log/_app"; <END> final String logContent = sendGet(new URL(url.startsWith("http://") ? url : "http://" + url)); output.append(String.format("%n====> GWT-code-server.log <====")); output.append(logContent); output.append(System.lineSeparator()); }</code><technical_language>AppendLogs</technical_language>

Target:
public abstract void start() throws RunnerException ; public abstract void stop() throws RunnerException ; public void appendLogs(Appendable output) throws IOException, RunnerException { final String url = bindAddress + ':' + port + "/log/_app"; final String logContent = sendGet(new URL(url.startsWith("http://") ? url : "http://" + url)); output.append(String.format("%n====> GWT-code-server.log <====")); output.append(logContent); output.append(System.lineSeparator()); }
Source:
<code>public Expression add(String field,JsonNode value) { <START> ((ObjectNode)node).set(field,value); <END> return this; }</code><technical_language>I do instanceof check throw a meaningful exception</technical_language>

Target:
public Expression add(String field,JsonNode value) { try { ((ObjectNode)node).set(field,value); return this; } catch (ClassCastException e) { throw new RuntimeException("Object node expected while adding "+field); } }
Source:
<code>ProducerSustainedConnection() { this.producer = null; this.partitions = null; this.topicName = SustainedConnectionWorker.this.spec.topicName(); this.partitionsIterator = null; this.keys = new PayloadIterator(SustainedConnectionWorker.this.spec.keyGenerator()); this.values = new PayloadIterator(SustainedConnectionWorker.this.spec.valueGenerator()); <START> this.refreshRate = SustainedConnectionWorker.this.spec.refreshRateMs(); <END> this.props = new Properties(); this.props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, SustainedConnectionWorker.this.spec.bootstrapServers()); this.props.put(ProducerConfig.MAX_IN_FLIGHT_REQUESTS_PER_CONNECTION, 1); WorkerUtils.addConfigsToProperties( this.props, SustainedConnectionWorker.this.spec.commonClientConf(), SustainedConnectionWorker.this.spec.producerConf()); }</code><technical_language>I suggest passing of variables access in this constructor viaSustainedConnectionWorker.this.spec switched parameters pass instantiation</technical_language>

Target:
ProducerSustainedConnection() { this.producer = null; this.partitions = null; this.topicName = SustainedConnectionWorker.this.spec.topicName(); this.partitionsIterator = null; this.keys = new PayloadIterator(SustainedConnectionWorker.this.spec.keyGenerator()); this.values = new PayloadIterator(SustainedConnectionWorker.this.spec.valueGenerator()); this.refreshRate = SustainedConnectionWorker.this.spec.refreshRateMs(); this.props = new Properties(); this.props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, SustainedConnectionWorker.this.spec.bootstrapServers()); WorkerUtils.addConfigsToProperties( this.props, SustainedConnectionWorker.this.spec.commonClientConf(), SustainedConnectionWorker.this.spec.producerConf()); }
Source:
<code>public TypeSerializerSnapshot<Tuple2<byte[], StreamRecord<IN>>> snapshotConfiguration() { <START> return null; <END> }</code><technical_language>throw a meaningful exception meant in a context snapshots needed</technical_language>

Target:
public TypeSerializerSnapshot<Tuple2<byte[], StreamRecord<IN>>> snapshotConfiguration() { throw new UnsupportedOperationException( "The KeyAndValueSerializer should not be used for persisting into State!"); }
Source:
<code>private void writeSnapshot(long sid, XmlComponentConfigurations conf) throws KuraException { File fSnapshot = getSnapshotFile(sid); if (fSnapshot == null) { <START> throw new KuraException(KuraErrorCode.CONFIGURATION_ERROR); <END> } String xmlResult; try { xmlResult = XmlUtil.marshal(conf); if (xmlResult.trim().isEmpty()) { throw new KuraException(KuraErrorCode.INVALID_PARAMETER, conf); } } catch (Exception e1) { throw new KuraException(KuraErrorCode.INTERNAL_ERROR, e1); } char[] encryptedXML = this.m_cryptoService.encryptAes(xmlResult.toCharArray()); FileOutputStream fos = null; OutputStreamWriter osw = null; try { s_logger.info("Writing snapshot - Saving {}...", fSnapshot.getAbsolutePath()); fos = new FileOutputStream(fSnapshot); osw = new OutputStreamWriter(fos, "UTF-8"); osw.append(new String(encryptedXML)); osw.flush(); fos.flush(); fos.getFD().sync(); s_logger.info("Writing snapshot - Saving {}... Done.", fSnapshot.getAbsolutePath()); } catch (FileNotFoundException e) { throw new KuraException(KuraErrorCode.INTERNAL_ERROR, e); } catch (UnsupportedEncodingException e) { throw new KuraException(KuraErrorCode.INTERNAL_ERROR, e); } catch (IOException e) { throw new KuraException(KuraErrorCode.INTERNAL_ERROR, e); } finally { if (osw != null) { try { osw.close(); } catch (IOException e) { } } if (fos != null) { try { fos.close(); } catch (IOException e) { } } } }</code><technical_language>KuraErrorCode.CONFIGURATION_SNAPSHOT_NOT_FOUND in opinion</technical_language>

Target:
private void writeSnapshot(long sid, XmlComponentConfigurations conf) throws KuraException { File fSnapshot = getSnapshotFile(sid); if (fSnapshot == null) { throw new KuraException(KuraErrorCode.CONFIGURATION_SNAPSHOT_NOT_FOUND); } String xmlResult; try { xmlResult = XmlUtil.marshal(conf); if (xmlResult.trim().isEmpty()) { throw new KuraException(KuraErrorCode.INVALID_PARAMETER, conf); } } catch (Exception e1) { throw new KuraException(KuraErrorCode.INTERNAL_ERROR, e1); } char[] encryptedXML = this.cryptoService.encryptAes(xmlResult.toCharArray()); FileOutputStream fos = null; OutputStreamWriter osw = null; try { logger.info("Writing snapshot - Saving {}...", fSnapshot.getAbsolutePath()); fos = new FileOutputStream(fSnapshot); osw = new OutputStreamWriter(fos, "UTF-8"); osw.append(new String(encryptedXML)); osw.flush(); fos.flush(); fos.getFD().sync(); logger.info("Writing snapshot - Saving {}... Done.", fSnapshot.getAbsolutePath()); } catch (FileNotFoundException e) { throw new KuraException(KuraErrorCode.INTERNAL_ERROR, e); } catch (UnsupportedEncodingException e) { throw new KuraException(KuraErrorCode.INTERNAL_ERROR, e); } catch (IOException e) { throw new KuraException(KuraErrorCode.INTERNAL_ERROR, e); } finally { if (osw != null) { try { osw.close(); } catch (IOException e) { } } if (fos != null) { try { fos.close(); } catch (IOException e) { } } } }
Source:
<code>public JavaRDD<StructuredRecord> transform(SparkExecutionPluginContext context, JavaRDD<StructuredRecord> input) throws Exception { if (input.isEmpty()) { return context.getSparkContext().emptyRDD(); } outputSchema = outputSchema != null ? outputSchema : config.getOutputSchema(input.first().getSchema()); final Map<String, String> mapping = config.getFeatureListMapping(); final int vectorSize = loadedModel.wordVectors().length / loadedModel.wordIndex().size(); return input.map(new Function<StructuredRecord, StructuredRecord>() { @Override public StructuredRecord call(StructuredRecord input) throws Exception { StructuredRecord.Builder builder = StructuredRecord.builder(outputSchema); for (Schema.Field field : input.getSchema().getFields()) { String fieldName = field.getName(); builder.set(fieldName, input.get(fieldName)); } for (Map.Entry<String, String> mapEntry : mapping.entrySet()) { String inputField = mapEntry.getKey(); String outputField = mapEntry.getValue(); List<String> text = SparkUtils.getInputFieldValue(input, inputField, config.pattern); int numWords = 0; double[] vectorValues = new double[vectorSize]; for (String word : text) { double[] wordVector = loadedModel.transform(word).toArray(); for (int i = 0; i < vectorSize; i++) { vectorValues[i] += wordVector[i]; } numWords++; } for (int i = 0; i < vectorSize; i++) { vectorValues[i] /= (double) numWords; } <START> builder.set(outputField, new ArrayList<>(Arrays.asList(ArrayUtils.toObject(vectorValues)))); <END> } return builder.build(); } }); }</code><technical_language>need this a List, set double[]</technical_language>

Target:
public JavaRDD<StructuredRecord> transform(SparkExecutionPluginContext context, JavaRDD<StructuredRecord> input) throws Exception { if (input.isEmpty()) { return context.getSparkContext().emptyRDD(); } outputSchema = outputSchema != null ? outputSchema : config.getOutputSchema(input.first().getSchema()); final Map<String, String> mapping = config.getFeatureListMapping(config.outputColumnMapping); final int vectorSize = loadedModel.wordVectors().length / loadedModel.wordIndex().size(); return input.map(new Function<StructuredRecord, StructuredRecord>() { @Override public StructuredRecord call(StructuredRecord input) throws Exception { splitter = splitter == null ? Splitter.on(pattern) : splitter; StructuredRecord.Builder builder = StructuredRecord.builder(outputSchema); for (Schema.Field field : input.getSchema().getFields()) { String fieldName = field.getName(); builder.set(fieldName, input.get(fieldName)); } for (Map.Entry<String, String> mapEntry : mapping.entrySet()) { String inputField = mapEntry.getKey(); String outputField = mapEntry.getValue(); List<String> text = SparkUtils.getInputFieldValue(input, inputField, splitter); int numWords = 0; double[] vectorValues = new double[vectorSize]; for (String word : text) { double[] wordVector = loadedModel.transform(word).toArray(); for (int i = 0; i < vectorSize; i++) { vectorValues[i] += wordVector[i]; } numWords++; } for (int i = 0; i < vectorSize; i++) { vectorValues[i] /= (double) numWords; } builder.set(outputField, vectorValues); } return builder.build(); } }); }
Source:
<code>protected void updateRAfterInstantiation(int binIdx, int itemIdx) throws ContradictionException { <START> if(!R[binIdx].contains(itemIdx)) { <END> R[binIdx].add(itemIdx); sumR[binIdx].add(itemSize[itemIdx]); binLoad[binIdx].updateLowerBound(sumR[binIdx].get(), this); binsToProcess.set(binIdx); for(int k = 0; k<nbAvailableBins; k++) { if(k != binIdx && P[k].contains(itemIdx)) { P[k].remove(itemIdx); sumP[k].add(-itemSize[itemIdx]); binLoad[k].updateUpperBound(sumP[k].get(), this); binsToProcess.set(k); } } } }</code><technical_language>good return of ISet#add instead of calling ISet#contains + ISet#add</technical_language>

Target:
protected void updateRAfterInstantiation(int binIdx, int itemIdx) throws ContradictionException { if(R[binIdx].add(itemIdx)) { binLoad[binIdx].updateLowerBound(sumR[binIdx].add(itemSize[itemIdx]), this); binsToProcess.set(binIdx); for(int k = 0; k<nbAvailableBins; k++) { if(k != binIdx && P[k].remove(itemIdx)) { binLoad[k].updateUpperBound(sumP[k].add(-itemSize[itemIdx]), this); binsToProcess.set(k); } } } }
Source:
<code>public void undeleteTrash() throws ProviderImplementationException { for (Map.Entry<String, Storage> entry : getConfiguration().getStorages().entrySet()) { Storage storage = entry.getValue(); final Map<String, ? extends Repository> repositories = storage.getRepositories(); for (Repository repository : repositories.values()) { if (repository.isTrashEnabled()) { RootRepositoryPath repositoryPath = repositoryPathResolver.resolve(repository); <START> ThrowingConsumer.unchecked(RepositoryFiles::undelete).accept(repositoryPath); <END> } } } RepositoryEvent event = new RepositoryEvent(null, null, RepositoryEventTypeEnum.EVENT_REPOSITORY_UNDELETE_TRASH_FOR_ALL_REPOSITORIES .getType()); repositoryEventListenerRegistry.dispatchEvent(event); }</code><technical_language>@adavid9 please add throws IOException replace original catch (Exception) following: catch (IOException e) { throw new ArtifactStorageException("Unable undelete trash for storage " + storageId + " in repository " + repositoryId, e); }</technical_language>

Target:
public void undeleteTrash() throws IOException { for (Map.Entry<String, Storage> entry : getConfiguration().getStorages().entrySet()) { Storage storage = entry.getValue(); final Map<String, ? extends Repository> repositories = storage.getRepositories(); for (Repository repository : repositories.values()) { final String storageId = storage.getId(); final String repositoryId = repository.getId(); try { if (repository.isTrashEnabled()) { RootRepositoryPath repositoryPath = repositoryPathResolver.resolve(repository); RepositoryFiles.undelete(repositoryPath); } } catch (IOException e) { throw new ArtifactStorageException( "Unable to undelete trash for storage " + storageId + " in repository " + repositoryId, e); } } } RepositoryEvent event = new RepositoryEvent(null, null, RepositoryEventTypeEnum.EVENT_REPOSITORY_UNDELETE_TRASH_FOR_ALL_REPOSITORIES .getType()); repositoryEventListenerRegistry.dispatchEvent(event); }
Source:
<code>static public void runAsTask(Long surveyId) { log.info("Forking to task for long assembly"); com.google.appengine.api.taskqueue.TaskOptions options = com.google.appengine.api.taskqueue.TaskOptions.Builder .withUrl("/app_worker/surveyassembly") .param(SurveyAssemblyRequest.ACTION_PARAM, SurveyAssemblyRequest.ASSEMBLE_SURVEY) <START> .param(SurveyAssemblyRequest.IS_FWD_PARAM, "true") <END> .param(SurveyAssemblyRequest.SURVEY_ID_PARAM, surveyId.toString()); com.google.appengine.api.taskqueue.Queue queue = QueueFactory.getQueue("surveyAssembly"); queue.add(options); }</code><technical_language>this IS_FWD_PARAM for other backend publishing</technical_language>

Target:
static public void runAsTask(Long surveyId) { log.info("Forking to task for long assembly"); TaskOptions options = TaskOptions.Builder .withUrl("/app_worker/surveyassembly") .param(SurveyAssemblyRequest.ACTION_PARAM, SurveyAssemblyRequest.ASSEMBLE_SURVEY) .param(SurveyAssemblyRequest.SURVEY_ID_PARAM, surveyId.toString()); Queue queue = QueueFactory.getQueue("surveyAssembly"); queue.add(options); Survey s = new SurveyDAO().getById(surveyId); SurveyGroup sg = s != null ? new SurveyGroupDAO().getByKey(s.getSurveyGroupId()) : null; if (sg != null && sg.getNewLocaleSurveyId() != null && sg.getNewLocaleSurveyId().longValue() == surveyId.longValue()) { DataProcessorRestServlet.scheduleDatapointNameAssembly(sg.getKey().getId(), null); } }
Source:
<code>public Set<? extends AbstractBean<?, ?>> apply(Bean<?> specializingBean) { Set<? extends AbstractBean<?, ?>> result = null; if (specializingBean instanceof AbstractClassBean<?>) { result = apply((AbstractClassBean<?>) specializingBean); } if (specializingBean instanceof ProducerMethod<?, ?>) { result = apply((ProducerMethod<?, ?>) specializingBean); } if (result != null) { if (isEnabledInAnyBeanDeployment(specializingBean)) { for (AbstractBean<?, ?> specializedBean : result) { if (specializedBeansMap.get(specializedBean) == null) { specializedBeansMap.put(specializedBean, new AtomicLong(1)); } else { specializedBeansMap.put(specializedBean, new AtomicLong(specializedBeansMap.get(specializedBean).get() + 1)); } <START> } <END> } return result; } throw new IllegalArgumentException("Unsupported bean type " + specializingBean); }</code><technical_language>This produces findbug warning: > 06:13:08 [INFO] Sequence of calls java.util.concurrent.ConcurrentHashMap atomic in org.jboss.weld.bootstrap.SpecializationAndEnablementRegistry$BeansSpecializedByBean.apply(Bean) org.jboss.weld.bootstrap.SpecializationAndEnablementRegistry$BeansSpecializedByBean SpecializationAndEnablementRegistry.java:[lines 79-115] I this work: AtomicLong = specializedBeansMap.get(specializedBean); if (value == null) { = new AtomicLong(1); AtomicLong previous = specializedBeansMap.putIfAbsent(specializedBean, value); if (previous != null) { = previous; } } value.incrementAndGet();</technical_language>

Target:
public Set<? extends AbstractBean<?, ?>> apply(Bean<?> specializingBean) { Set<? extends AbstractBean<?, ?>> result = null; if (specializingBean instanceof AbstractClassBean<?>) { result = apply((AbstractClassBean<?>) specializingBean); } if (specializingBean instanceof ProducerMethod<?, ?>) { result = apply((ProducerMethod<?, ?>) specializingBean); } if (result != null) { if (isEnabledInAnyBeanDeployment(specializingBean)) { for (AbstractBean<?, ?> specializedBean : result) { AtomicLong value = specializedBeansMap.get(specializedBean); if (value == null) { value = new AtomicLong(0); AtomicLong previous = specializedBeansMap.putIfAbsent(specializedBean, value); if (previous != null) { value = previous; } } value.incrementAndGet(); } } return result; } throw new IllegalArgumentException("Unsupported bean type " + specializingBean); }
Source:
<code>public void activate(Context context) { try { if (clazz != null) { setters = new ArrayList<>(); List<String> fieldNames = schema.getFieldNames(); if (fieldNames != null) { for (String fieldName : fieldNames) { addSetter(fieldName); } } } } catch (Exception e) { <START> logger.error("Cannot activate Parser Reason {}", e.getMessage()); <END> } }</code><technical_language>swallow exception</technical_language>

Target:
public void activate(Context context) { try { if (clazz != null) { setters = new ArrayList<>(); List<String> fieldNames = schema.getFieldNames(); if (fieldNames != null) { for (String fieldName : fieldNames) { addSetter(fieldName); } } } } catch (Exception e) { logger.error("Cannot activate Parser Reason {}", e.getMessage()); throw e; } }
Source:
<code>default CompletionStage<Void> commit(Transaction transaction) { <START> throw new UnsupportedOperationException("Store characteristic included " + Characteristic.TRANSACTIONAL + ", but it does not implement rollback"); <END> }</code><technical_language>Wrong method name in error message</technical_language>

Target:
default CompletionStage<Void> commit(Transaction transaction) { throw new UnsupportedOperationException("Store characteristic included " + Characteristic.TRANSACTIONAL + ", but it does not implement commit"); }
Source:
<code>public void addOnSubscriptionsChangedListener(OnSubscriptionsChangedListener listener) { <START> if (listener == null) return; String pkgName = mContext != null ? mContext.getOpPackageName() : "<unknown>"; if (DBG) { logd("register OnSubscriptionsChangedListener pkgName=" + pkgName + " listener=" + listener); } TelephonyRegistryManager telephonyRegistryManager = (TelephonyRegistryManager) mContext.getSystemService(Context.TELEPHONY_REGISTRY_SERVICE); if (telephonyRegistryManager != null) { telephonyRegistryManager.addOnSubscriptionsChangedListener(listener, listener.mExecutor); } <END> }</code><technical_language>Avoid duplicate code. call addOnSubscriptionsChangedListener(listener, listener.mExecutor)</technical_language>

Target:
public void addOnSubscriptionsChangedListener(OnSubscriptionsChangedListener listener) { if (listener == null) return; addOnSubscriptionsChangedListener(listener, listener.mExecutor); }
Source:
<code>private boolean refreshTt() throws IOException { log.debug("Obtaining TT"); final HttpGet getTT = new HttpGet(TOKEN_URL); getTT.addHeader(SST_HEADER, sst); try { <START> final HttpResponse response = httpClient.execute(authHost, getTT, (HttpContext) null); <END> final int status = response.getStatusLine().getStatusCode(); switch (status) { case HttpStatus.SC_OK: tt = TokenUtils.extractTT(response); return true; case HttpStatus.SC_UNAUTHORIZED: return false; default: throw new GoodDataAuthException("Unable to obtain TT, HTTP status: " + status); } } finally { getTT.releaseConnection(); } }</code><technical_language>execute(HttpHost host, HttpRequest req) method here? is default context breaking things</technical_language>

Target:
private boolean refreshTt() throws IOException { log.debug("Obtaining TT"); final HttpGet request = new HttpGet(TOKEN_URL); try { request.setHeader(HttpHeaders.ACCEPT, YAML_CONTENT_TYPE); request.setHeader(SST_HEADER, sst); final HttpResponse response = httpClient.execute(authHost, request, (HttpContext) null); final int status = response.getStatusLine().getStatusCode(); switch (status) { case HttpStatus.SC_OK: tt = TokenUtils.extractToken(response); return true; case HttpStatus.SC_UNAUTHORIZED: return false; default: throw new GoodDataAuthException("Unable to obtain TT, HTTP status: " + status); } } finally { request.releaseConnection(); } }
Source:
<code>public SecurityGroup removeIpPermission(IpProtocol protocol, int startPort, int endPort, Multimap<String, String> tenantIdGroupNamePairs, Iterable<String> ipRanges, Iterable<String> groupIds, SecurityGroup group) { String zone = group.getLocation().getId(); String id = group.getId(); <START> Optional<? extends SecurityGroupApi> sgApi = client.getSecurityGroupExtensionForZone(zone); <END> if (!sgApi.isPresent()) { return null; } org.jclouds.openstack.nova.v2_0.domain.SecurityGroup securityGroup = sgApi.get().get(id); if (Iterables.size(ipRanges) > 0) { for (String cidr : ipRanges) { for (SecurityGroupRule rule : filter(securityGroup.getRules(), and(ruleCidr(cidr), ruleProtocol(protocol), ruleStartPort(startPort), ruleEndPort(endPort)))) { sgApi.get().deleteRule(rule.getId()); } } } if (Iterables.size(groupIds) > 0) { for (String groupId : groupIds) { for (SecurityGroupRule rule : filter(securityGroup.getRules(), and(ruleGroup(groupId), ruleProtocol(protocol), ruleStartPort(startPort), ruleEndPort(endPort)))) { sgApi.get().deleteRule(rule.getId()); } } } return getSecurityGroupById(ZoneAndId.fromZoneAndId(zone, id).slashEncode()); }</code><technical_language>null check for zone</technical_language>

Target:
public SecurityGroup removeIpPermission(IpProtocol protocol, int startPort, int endPort, Multimap<String, String> tenantIdGroupNamePairs, Iterable<String> ipRanges, Iterable<String> groupIds, SecurityGroup group) { String zone = group.getLocation().getId(); String id = group.getId(); Optional<? extends SecurityGroupApi> sgApi = api.getSecurityGroupExtensionForZone(zone); if (!sgApi.isPresent()) { return null; } org.jclouds.openstack.nova.v2_0.domain.SecurityGroup securityGroup = sgApi.get().get(id); if (Iterables.size(ipRanges) > 0) { for (String cidr : ipRanges) { for (SecurityGroupRule rule : filter(securityGroup.getRules(), and(ruleCidr(cidr), ruleProtocol(protocol), ruleStartPort(startPort), ruleEndPort(endPort)))) { sgApi.get().deleteRule(rule.getId()); } } } if (Iterables.size(groupIds) > 0) { for (String groupId : groupIds) { for (SecurityGroupRule rule : filter(securityGroup.getRules(), and(ruleGroup(groupId), ruleProtocol(protocol), ruleStartPort(startPort), ruleEndPort(endPort)))) { sgApi.get().deleteRule(rule.getId()); } } } return getSecurityGroupById(ZoneAndId.fromZoneAndId(zone, id).slashEncode()); }
Source:
<code>public void deleteAll(long inodeId) throws StorageException { final String query = String.format("DELETE FROM %s WHERE %s=%d", TablesDef.BlockChecksumTableDef.TABLE_NAME, TablesDef.BlockChecksumTableDef.INODE_ID, inodeId); PreparedStatement s = null; try { Connection conn = mysqlConnector.obtainSession(); s = conn.prepareStatement(query); s.executeUpdate(); } catch (SQLException ex) { throw HopsSQLExceptionHelper.wrap(ex); } finally { if (s != null) { try { s.close(); <START> } catch (SQLException ex) { <END> } } mysqlConnector.closeSession(); } }</code><technical_language>throw SQLException? log</technical_language>

Target:
public void deleteAll(long inodeId) throws StorageException { final String query = String.format("DELETE FROM %s WHERE %s=%d", TablesDef.BlockChecksumTableDef.TABLE_NAME, TablesDef.BlockChecksumTableDef.INODE_ID, inodeId); PreparedStatement s = null; try { Connection conn = mysqlConnector.obtainSession(); s = conn.prepareStatement(query); s.executeUpdate(); } catch (SQLException ex) { throw HopsSQLExceptionHelper.wrap(ex); } finally { if (s != null) { try { s.close(); } catch (SQLException ex) { LOG.warn("Exception when closing the PrepareStatement", ex); } } mysqlConnector.closeSession(); } }
Source:
<code>protected void operateServerState(String menuItem, final ServerState resultState) { log.debug("Operate server's state: '" + menuItem + "'"); select(); <START> AbstractWaitCondition condition = new AbstractWaitCondition() { <END> @Override public boolean test() { return resultState.equals(getLabel().getState()); } @Override public String description() { return "server's state is: " + resultState.getText(); } }; new ContextMenu(menuItem).select(); new WaitUntil(new JobIsRunning(), TIMEOUT); if (resultState == ServerState.STARTING || resultState == ServerState.STARTED) { confirmSSLCertificateDialog(); } new WaitUntil(condition, TIMEOUT); new WaitWhile(new JobIsRunning(), TIMEOUT); new WaitUntil(condition, TIMEOUT); log.debug("Operate server's state finished, the result server's state is: '" + getLabel().getState() + "'"); }</code><technical_language>good talk RedDeer people making org.jboss.reddeer.eclipse.wst.server.ui.view.Server.ServerStateCondition public this abstract is copy-paste of private class</technical_language>

Target:
protected void operateServerState(String menuItem, final ServerState resultState) { log.debug("Operate server's state: '" + menuItem + "'"); select(); new ContextMenu(menuItem).select(); new WaitUntil(new JobIsRunning(), TIMEOUT); if (resultState == ServerState.STARTING || resultState == ServerState.STARTED) { confirmSSLCertificateDialog(); } new WaitUntil(new ServerHasState(this, resultState), TIMEOUT); new WaitWhile(new JobIsRunning(), TIMEOUT); log.debug("Operate server's state finished, the result server's state is: '" + getLabel().getState() + "'"); }
Source:
<code>public Xid[] getXidsToRecoverForParentNode(boolean recoverInFlight, String parentNodeName, int recoveryFlags) throws XAException { final Set<Xid> xidsToRecover = new HashSet<Xid>(); if (recoverInFlight) { final TransactionImporter transactionImporter = SubordinationManager.getTransactionImporter(); <START> if (transactionImporter instanceof com.arjuna.ats.internal.jta.transaction.jts.jca.TransactionImporterImple) { <END> final Set<Xid> inFlightXids = ((com.arjuna.ats.internal.jta.transaction.jts.jca.TransactionImporterImple) transactionImporter).getInflightXids(parentNodeName); if (inFlightXids != null) { xidsToRecover.addAll(inFlightXids); } } } final javax.resource.spi.XATerminator xaTerminator = SubordinationManager.getXATerminator(); if (xaTerminator instanceof com.arjuna.ats.internal.jta.transaction.jts.jca.XATerminatorImple) { final Xid[] inDoubtTransactions = ((com.arjuna.ats.internal.jta.transaction.jts.jca.XATerminatorImple) xaTerminator).doRecover(null, parentNodeName); if (inDoubtTransactions != null) { xidsToRecover.addAll(Arrays.asList(inDoubtTransactions)); } } else { final Xid[] inDoubtTransactions = xaTerminator.recover(recoveryFlags); if (inDoubtTransactions != null) { xidsToRecover.addAll(Arrays.asList(inDoubtTransactions)); } } return xidsToRecover.toArray(NO_XIDS); }</code><technical_language>investigating...</technical_language>

Target:
public Xid[] getXidsToRecoverForParentNode(boolean recoverInFlight, String parentNodeName, int recoveryFlags) throws XAException { final Set<Xid> xidsToRecover = new HashSet<Xid>(); if (recoverInFlight) { final TransactionImporter transactionImporter = SubordinationManager.getTransactionImporter(); if (transactionImporter instanceof TransactionImporterImple) { throw new UnsupportedOperationException(jtaxLogger.i18NLogger.get_not_supported()); } } final javax.resource.spi.XATerminator xaTerminator = SubordinationManager.getXATerminator(); if (xaTerminator instanceof XATerminatorImple) { throw new UnsupportedOperationException(jtaxLogger.i18NLogger.get_not_supported()); } else { final Xid[] inDoubtTransactions = xaTerminator.recover(recoveryFlags); if (inDoubtTransactions != null) { xidsToRecover.addAll(Arrays.asList(inDoubtTransactions)); } } return xidsToRecover.toArray(NO_XIDS); }
Source:
<code>public MongoFeedStatisticsStore build() { <START> return new MongoFeedStatisticsStore(mongo, taskStore, clock, destinationType); <END> }</code><technical_language>same, pass builder object in</technical_language>

Target:
public MongoFeedStatisticsStore build() { return new MongoFeedStatisticsStore(this); }
Source:
<code>public void commit_step_does_not_throw_reached_max_size_exception_when_two_phase() { String mapName = "map"; long maxWbqCapacity = 10; int keySpace = 100; Config config = getConfig(mapName, maxWbqCapacity); HazelcastInstance node = createHazelcastInstance(config); TransactionContext context = newTransactionContext(node, TWO_PHASE); context.beginTransaction(); TransactionalMap txMap = context.getMap(mapName); for (int i = 0; i < keySpace; i++) { txMap.remove("item-" + i); } try { context.commitTransaction(); } catch (TransactionException e) { <START> context.rollbackTransaction(); <END> } sleepSeconds(10); assertEquals(0, node.getMap(mapName).size()); assertWriteBehindQueuesEmpty(mapName, Collections.singletonList(node)); assertEquals(0, getTotalNumOfTxnReservedCapacity(mapName, node)); assertEquals(0, getNodeWideUsedCapacity(node)); }</code><technical_language>fail expect exception</technical_language>

Target:
public void commit_step_does_not_throw_reached_max_size_exception_when_two_phase() { String mapName = "map"; long maxWbqCapacity = 10; int keySpace = 10; Config config = getConfig(mapName, maxWbqCapacity); HazelcastInstance node = createHazelcastInstance(config); TransactionContext context = newTransactionContext(node, TWO_PHASE); context.beginTransaction(); TransactionalMap txMap = context.getMap(mapName); for (int i = 0; i < keySpace; i++) { txMap.remove("item-" + i); } try { context.commitTransaction(); } catch (TransactionException e) { fail("no txn exception is expected here..."); } assertEquals(0, node.getMap(mapName).size()); assertWriteBehindQueuesEmpty(mapName, Collections.singletonList(node)); assertEquals(0, getTotalNumOfTxnReservedCapacity(mapName, node)); assertEquals(0, getNodeWideUsedCapacity(node)); }