auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void run() throws Exception { <START> requests.add(-100L); <END> }</code><technical_language>super nit: List<Object>, private static final Object CANCELLED = new Object(), requests.add(CANCELLED) java assertEquals(5, requests.get(0)); assertEquals(CANCELLED, requests.get(1));</technical_language>

Target:
public void run() throws Exception { requests.add(CANCELLED); }
Source:
<code>public void validateGetPort() throws Exception { ClusterMapConfig clusterMapConfig; Properties props = new Properties(); props.setProperty("clustermap.ssl.enabled.datacenters", "datacenter1,datacenter2,datacenter3"); clusterMapConfig = new ClusterMapConfig(new VerifiableProperties(props)); System.out.println(clusterMapConfig.clusterMapSslEnabledDatacenters); JSONObject jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 7666, HardwareState.AVAILABLE, getDisks()); DataNode dataNode = new TestDataNode("datacenter2", jsonObject, clusterMapConfig); assertEquals("The datacenter of the data node is in the ssl enabled datacenter list. SSL port should be returned", PortType.SSL, dataNode.getPortToConnectTo().getPortType()); dataNode = new TestDataNode("datacenter5", jsonObject, clusterMapConfig); assertEquals( "The datacenter of the data node is not in the ssl enabled datacenter list. Plaintext port should be returned", <START> PortType.PLAINTEXT, dataNode.getPortToConnectTo().getPortType()); <END> }</code><technical_language>test case for bad case? ssl port in sslenableddatacenters? Is simulate</technical_language>

Target:
public void validateGetPort() throws Exception { ClusterMapConfig clusterMapConfig; Properties props = new Properties(); props.setProperty("clustermap.ssl.enabled.datacenters", "datacenter1,datacenter2,datacenter3"); clusterMapConfig = new ClusterMapConfig(new VerifiableProperties(props)); System.out.println(clusterMapConfig.clusterMapSslEnabledDatacenters); JSONObject jsonObject = TestUtils.getJsonDataNode(TestUtils.getLocalHost(), 6666, 7666, HardwareState.AVAILABLE, getDisks()); DataNode dataNode = new TestDataNode("datacenter2", jsonObject, clusterMapConfig); assertEquals("The datacenter of the data node is in the ssl enabled datacenter list. SSL port should be returned", PortType.SSL, dataNode.getPortToConnectTo().getPortType()); dataNode = new TestDataNode("datacenter5", jsonObject, clusterMapConfig); assertEquals( "The datacenter of the data node is not in the ssl enabled datacenter list. Plaintext port should be returned", PortType.PLAINTEXT, dataNode.getPortToConnectTo().getPortType()); jsonObject.remove("sslport"); dataNode = new TestDataNode("datacenter1", jsonObject, clusterMapConfig); try { dataNode.getPortToConnectTo(); fail("Should have thrown Exception because there is no sslPort."); } catch (IllegalStateException e) { } }
Source:
<code>public void report(String content) throws ReportException { try { <START> try (OutputStream outputStream = reportFile == null ? System.out : new FileOutputStream(reportFile); <END> Writer writer = new BufferedWriter(new OutputStreamWriter(outputStream, encoding))) { writer.write(content); } } catch (IOException ioe) { throw new ReportException(ioe); } }</code><technical_language>I think, this way, easier read. leaving OutputStream of try in verbose format try writer? if writer is closed, underlying stream *should* closed, too. Alternatively, write this: OutputStream outputStream; // ... try (OutputStream out = outputStream; Writer writer = new BufferedWriter(.... way, figure out outputstream multiple lines, auto-close feature</technical_language>

Target:
public void report(String content) throws ReportException { try (Writer writer = new BufferedWriter(new OutputStreamWriter(getOutputStream(), encoding))) { writer.write(content); } catch (IOException ioe) { throw new ReportException(ioe); } }
Source:
<code>protected void parseSiteConfiguration(Map<String, RelayConfig.SiteConfig> map) throws Exception { super.parseSiteConfiguration(map); String testName = TestResourceTracker.getCurrentTestName(); map.forEach((s, siteConfig) -> { List<RelayConfig.BridgeConfig> bridges = siteConfig.getBridges(); for (int i = 0; i < bridges.size(); i++) { RelayConfig.BridgeConfig bridgeConfig = bridges.get(i); String config = (String) TestingUtil.extractField(RelayConfig.PropertiesBridgeConfig.class, bridgeConfig, "config"); <START> if (testName != null) { <END> String clusterName = "bridge-" + testName; bridges.set(i, new RelayConfig.PropertiesBridgeConfig(clusterName, config)); } } }); }</code><technical_language>I guess check testName forEach()</technical_language>

Target:
protected void parseSiteConfiguration(Map<String, RelayConfig.SiteConfig> map) throws Exception { super.parseSiteConfiguration(map); String testName = TestResourceTracker.getCurrentTestName(); map.forEach((s, siteConfig) -> { List<RelayConfig.BridgeConfig> bridges = siteConfig.getBridges(); for (int i = 0; i < bridges.size(); i++) { RelayConfig.BridgeConfig bridgeConfig = bridges.get(i); String config = (String) TestingUtil.extractField(RelayConfig.PropertiesBridgeConfig.class, bridgeConfig, "config"); String clusterName = "bridge-" + (testName != null ? testName : "namenotset"); bridges.set(i, new RelayConfig.PropertiesBridgeConfig(clusterName, config)); } }); }
Source:
<code>public void testRevisionedCheckout() throws Exception { FreeStyleProject p = createFreeStyleProject(); p.setScm(new SubversionSCM("<LINK_0>")); FreeStyleBuild b = p.scheduleBuild2(0, new Cause.UserIdCause()).get(); System.out.println(b.getLog(LOG_LIMIT)); <START> assertTrue(b.getLog(LOG_LIMIT).toString().contains("at revision 13000")); <END> assertBuildStatus(Result.SUCCESS,b); b = p.scheduleBuild2(0, new Cause.UserIdCause()).get(); System.out.println(b.getLog(LOG_LIMIT)); assertTrue(b.getLog(LOG_LIMIT).toString().contains("at revision 13000")); assertBuildStatus(Result.SUCCESS,b); }</code><technical_language>Easier use: assertLogContains("at revision 13000", b);</technical_language>

Target:
public void testRevisionedCheckout() throws Exception { FreeStyleProject p = createFreeStyleProject(); p.setScm(new SubversionSCM("<LINK_0>")); FreeStyleBuild b = p.scheduleBuild2(0, new Cause.UserIdCause()).get(); System.out.println(b.getLog(LOG_LIMIT)); assertLogContains("at revision 13000", b); assertBuildStatus(Result.SUCCESS,b); b = p.scheduleBuild2(0, new Cause.UserIdCause()).get(); System.out.println(b.getLog(LOG_LIMIT)); assertLogContains("at revision 13000", b); assertBuildStatus(Result.SUCCESS,b); }
Source:
<code>public int getNextRow(int column) { int curRow; if(firstEmptyRowOfColumns == null) { <START> firstEmptyRowOfColumns = new HashMap<Integer, Integer>(); <END> } if(!firstEmptyRowOfColumns.containsKey(column)) { firstEmptyRowOfColumns.put(column, 0); } curRow = firstEmptyRowOfColumns.get(column); firstEmptyRowOfColumns.put(column, curRow+1); return curRow; }</code><technical_language>this initialization moved constructor, avoid checking time</technical_language>

Target:
public int getNextRow(int column) { int curRow; if(!nextEmptyRowForColumn.containsKey(column)) { nextEmptyRowForColumn.put(column, 0); } curRow = nextEmptyRowForColumn.get(column); nextEmptyRowForColumn.put(column, curRow+1); return curRow; }
Source:
<code>public void onContradiction(ContradictionException cex) { if (cex.c instanceof Propagator) { Propagator p = (Propagator) cex.c; double qj = q.get(p); q.put(p, (1 - a) * qj + a * r.get(p)); double rj = r.get(p); <START> r.put(p, 1d / (conflicts - rj + 1)); <END> a = Math.max(0.06, a - STEP); conflict.put(p, conflicts); conflicts++; } }</code><technical_language>I do agree update of reward. paper, reward update of q(cj) reward (1d / (conflicts - rj + 1)) rj is simply latest of variable conflicts this specific constraint (here Propagator) fails. So, for me, code : r.put(p, 1d / (conflicts - conflict.get(p) + 1));</technical_language>

Target:
public void onContradiction(ContradictionException cex) { if (cex.c instanceof Propagator) { Propagator p = (Propagator) cex.c; double qj = q.get(p); double r = 1d / (conflicts - conflict.get(p) + 1); q.put(p, (1 - a) * qj + a * r); a = Math.max(0.06, a - STEP); conflict.put(p, conflicts); conflicts++; } }
Source:
<code>public void setReply(Message<?> reply) { if (this.reply == null) { this.reply = reply; <START> logger.debug("reply" + reply); <END> this.latch.countDown(); } else if (this.reply instanceof ErrorMessage) { this.reply = reply; logger.debug("second" + reply); this.secondChanceLatch.countDown(); } }</code><technical_language>be: if (logger.isDebugEnabled()) { logger.debug("reply: " + reply); } remove all</technical_language>

Target:
public void setReply(Message<?> reply) { if (this.reply == null) { this.reply = reply; this.latch.countDown(); } else if (this.reply instanceof ErrorMessage) { this.reply = reply; this.secondChanceLatch.countDown(); } }
Source:
<code>public void getShareDoesNotCreateAShare() { ShareAsyncClient client = serviceClient.getShareAsyncClient(shareName); try { client.getStatistics().block(); <START> fail("getShareAsyncClient shouldn't create a share in Azure."); <END> } catch (Exception ex) { TestHelpers.assertExceptionStatusCode(ex, 400); } }</code><technical_language>fail tests here? get exception client.getStatistics, catch StorageException directly</technical_language>

Target:
public void getShareDoesNotCreateAShare() { ShareAsyncClient client = serviceClient.getShareAsyncClient(shareName); try { client.getStatistics().block(); fail("getShareAsyncClient shouldn't create a share in Azure."); } catch (Exception ex) { helper.assertExceptionStatusCode(ex, 404); } }
Source:
<code>private void dequeue(Connection connection) { while (!pendingBorrows.isEmpty()) { while (true) { int inFlight = connection.inFlight.get(); if (inFlight >= Math.min(connection.maxAvailableStreams(), options().getMaxRequestsPerConnection(hostDistance))) { return; } if (connection.inFlight.compareAndSet(inFlight, inFlight + 1)) break; } SettableFuture<Connection> pendingBorrow = pendingBorrows.poll(); if (pendingBorrow == null) { connection.inFlight.decrementAndGet(); } else { <START> pendingBorrowCount.decrementAndGet(); <END> pendingBorrow.set(connection); } } }</code><technical_language>I observed in testing totalInFlight offset time a negative number. I is totalInFlight is incremented here</technical_language>

Target:
private void dequeue(Connection connection) { while (!pendingBorrows.isEmpty()) { while (true) { int inFlight = connection.inFlight.get(); if (inFlight >= Math.min(connection.maxAvailableStreams(), options().getMaxRequestsPerConnection(hostDistance))) { return; } if (connection.inFlight.compareAndSet(inFlight, inFlight + 1)) { break; } } final SettableFuture<Connection> pendingBorrow = pendingBorrows.poll(); if (pendingBorrow == null) { connection.inFlight.decrementAndGet(); } else { totalInFlight.incrementAndGet(); pendingBorrowCount.decrementAndGet(); ListenableFuture<Connection> setKeyspaceFuture = connection.setKeyspaceAsync(manager.poolsState.keyspace); if (setKeyspaceFuture.isDone()) { try { pendingBorrow.set(Uninterruptibles.getUninterruptibly(setKeyspaceFuture)); } catch (ExecutionException e) { pendingBorrow.setException(e.getCause()); } } else { Futures.addCallback(setKeyspaceFuture, new FutureCallback<Connection>() { @Override public void onSuccess(Connection c) { pendingBorrow.set(c); } @Override public void onFailure(Throwable t) { pendingBorrow.setException(t); } }); } } } }
Source:
<code>public void testDirectoryHeaders() throws Exception { MockHttpServletResponse response = getAsServletResponse("/rest/resource/mydir?format=xml"); Assert.assertEquals(FORMAT_HEADER.format(myRes.lastmodified()), response.getHeader("Last-Modified")); <START> Assert.assertEquals("http://localhost:8080/geoserver/rest/resource/?format=xml", response.getHeader("Resource-Parent")); <END> Assert.assertEquals("directory", response.getHeader("Resource-Type")); Assert.assertEquals("application/xml", response.getHeader("Content-Type")); }</code><technical_language>discussed mailing list, remove query</technical_language>

Target:
public void testDirectoryHeaders() throws Exception { MockHttpServletResponse response = getAsServletResponse("/rest/resource/mydir?format=xml"); Assert.assertEquals(FORMAT_HEADER.format(myRes.lastmodified()), response.getHeader("Last-Modified")); Assert.assertEquals("http://localhost:8080/geoserver/rest/resource/", response.getHeader("Resource-Parent")); Assert.assertEquals("directory", response.getHeader("Resource-Type")); Assert.assertEquals("application/xml", response.getHeader("Content-Type")); }
Source:
<code>public void createFromEmptyStoreWithNoProjectionGeoTif() throws Exception { URL storeUrl = TestData.url(this, "nocrs"); File testDataFolder = new File(storeUrl.toURI()); File testDirectory = crsMosaicFolder.newFolder("no_crs"); FileUtils.copyDirectory(testDataFolder, testDirectory); for (File file : testDirectory.listFiles(f -> f.getName().endsWith("prj"))) { file.delete(); } <START> Properties properties = new Properties(); <END> properties.put(Utils.Prop.STORE_NAME, "test"); try (FileOutputStream fos = new FileOutputStream(new File(testDirectory, "datastore.properties"))) { properties.store(fos, null); } properties = new Properties(); properties.put(Utils.Prop.TYPENAME, "abcd"); try (FileOutputStream fos = new FileOutputStream(new File(testDirectory, "indexer.properties"))) { properties.store(fos, null); } DefaultRepository repository = new DefaultRepository(); final Map<String, Serializable> params = Collections.singletonMap( ShapefileDataStoreFactory.URLP.key, URLs.fileToUrl(testDirectory)); DataStore ds = new ShapefileDataStoreFactory().createDataStore(params); assertNotNull(ds); repository.register("test", ds); Hints hints = new Hints(Hints.REPOSITORY, repository); ImageMosaicReader reader = FORMAT.getReader(testDirectory, hints); final File expectedIndexFile = new File(testDirectory, "abcd.shp"); assertTrue( expectedIndexFile.getAbsolutePath() + " does not exist", expectedIndexFile.exists()); assertNotNull(reader); GridCoverage2D coverage = reader.read(NO_DEFERRED_LOAD); assertNotNull(coverage); coverage.dispose(true); reader.dispose(); ds.dispose(); }</code><technical_language>in terms of store repository, needed for purpose of test</technical_language>

Target:
public void createFromEmptyStoreWithNoProjectionGeoTif() throws Exception { URL storeUrl = TestData.url(this, "nocrs"); File testDataFolder = new File(storeUrl.toURI()); File testDirectory = crsMosaicFolder.newFolder("no_crs"); FileUtils.copyDirectory(testDataFolder, testDirectory); for (File file : testDirectory.listFiles(f -> f.getName().endsWith("prj"))) { file.delete(); } ImageMosaicReader reader = FORMAT.getReader(testDirectory); assertNotNull(reader); GridCoverage2D coverage = reader.read(NO_DEFERRED_LOAD); assertNotNull(coverage); coverage.dispose(true); reader.dispose(); }
Source:
<code>private IWorkingSet[] getSelectedWorkingSet(IStructuredSelection selection) { if (!(selection instanceof ITreeSelection)) return EMPTY_WORKING_SET_ARRAY; ITreeSelection treeSelection = (ITreeSelection) selection; if (treeSelection.isEmpty()) return EMPTY_WORKING_SET_ARRAY; <START> @SuppressWarnings("unchecked") <END> List<Object> elements= treeSelection.toList(); if (elements.size() == 1) { Object element = elements.get(0); TreePath[] paths = treeSelection.getPathsFor(element); if (paths.length != 1 || paths[0].getSegmentCount() == 0) return EMPTY_WORKING_SET_ARRAY; Object candidate = paths[0].getSegment(0); if (!(candidate instanceof IWorkingSet)) return EMPTY_WORKING_SET_ARRAY; IWorkingSet workingSetCandidate = (IWorkingSet) candidate; if (!workingSetCandidate.isAggregateWorkingSet()) return new IWorkingSet[] { workingSetCandidate }; return EMPTY_WORKING_SET_ARRAY; } ArrayList<IWorkingSet> result = new ArrayList<IWorkingSet>(); for (Iterator<Object> iterator = elements.iterator(); iterator.hasNext();) { Object element = iterator.next(); if (element instanceof IWorkingSet && !((IWorkingSet) element).isAggregateWorkingSet()) { result.add((IWorkingSet)element); } } if (result.size() > 0) { return result.toArray(new IWorkingSet[result.size()]); } else { return EMPTY_WORKING_SET_ARRAY; } }</code><technical_language>I prefer if SuppressWarnings is used. List<?> give warnings equaly meaningful</technical_language>

Target:
private IWorkingSet[] getSelectedWorkingSet(IStructuredSelection selection) { if (!(selection instanceof ITreeSelection)) return EMPTY_WORKING_SET_ARRAY; ITreeSelection treeSelection = (ITreeSelection) selection; if (treeSelection.isEmpty()) return EMPTY_WORKING_SET_ARRAY; List<?> elements= treeSelection.toList(); if (elements.size() == 1) { Object element = elements.get(0); TreePath[] paths = treeSelection.getPathsFor(element); if (paths.length != 1 || paths[0].getSegmentCount() == 0) return EMPTY_WORKING_SET_ARRAY; Object candidate = paths[0].getSegment(0); if (!(candidate instanceof IWorkingSet)) return EMPTY_WORKING_SET_ARRAY; IWorkingSet workingSetCandidate = (IWorkingSet) candidate; if (!workingSetCandidate.isAggregateWorkingSet()) return new IWorkingSet[] { workingSetCandidate }; return EMPTY_WORKING_SET_ARRAY; } ArrayList<IWorkingSet> result = new ArrayList<IWorkingSet>(); for (Object element : elements) { if (element instanceof IWorkingSet && !((IWorkingSet) element).isAggregateWorkingSet()) { result.add((IWorkingSet)element); } } if (!result.isEmpty()) { return result.toArray(new IWorkingSet[result.size()]); } else { return EMPTY_WORKING_SET_ARRAY; } }
Source:
<code>public InetSocketAddress getHost() { String value = getFirst(HOST); if (value == null) { return null; } <START> int idx = value.indexOf(':'); <END> String hostname = null; int port = 0; if (idx != -1 && idx < value.length() - 1) { hostname = value.substring(0, idx); String portString = value.substring(idx + 1); try { port = Integer.parseInt(portString); } catch (NumberFormatException ex) { } } if (hostname == null) { hostname = value; } return InetSocketAddress.createUnresolved(hostname, port); }</code><technical_language>work IPv6 addresses though? Wondering if lastIndexOf is enough if more checks required for addresses [2001:db8::ff00:42:8329]:8080</technical_language>

Target:
public InetSocketAddress getHost() { String value = getFirst(HOST); if (value == null) { return null; } int idx = value.lastIndexOf(':'); String hostname = null; int port = 0; if (idx != -1 && idx < value.length() - 1) { hostname = value.substring(0, idx); String portString = value.substring(idx + 1); try { port = Integer.parseInt(portString); } catch (NumberFormatException ex) { } } if (hostname == null) { hostname = value; } return InetSocketAddress.createUnresolved(hostname, port); }
Source:
<code>public static Map<Task.PullHost, List<IntermediateEntry>> hashByHost(List<IntermediateEntry> entries) { Map<Task.PullHost, List<IntermediateEntry>> hashed = new HashMap<>(); Task.PullHost host; for (IntermediateEntry entry : entries) { host = entry.getPullHost(); if (hashed.containsKey(host)) { hashed.get(host).add(entry); } else { List inputList = new ArrayList<>(); inputList.addAll(Arrays.asList(entry)); <START> hashed.put(host, inputList); <END> } } return hashed; }</code><technical_language>rewritten Arrays.asList()</technical_language>

Target:
public static Map<Task.PullHost, List<IntermediateEntry>> hashByHost(List<IntermediateEntry> entries) { Map<Task.PullHost, List<IntermediateEntry>> hashed = new HashMap<>(); Task.PullHost host; for (IntermediateEntry entry : entries) { host = entry.getPullHost(); if (hashed.containsKey(host)) { hashed.get(host).add(entry); } else { hashed.put(host, Arrays.asList(entry)); } } return hashed; }
Source:
<code>public void dispose() { if (fTreeViewer != null) { fTreeViewer.dispose(); } if (fXYViewer != null) { fXYViewer.dispose(); <START> } <END> }</code><technical_language>call super.dispose()</technical_language>

Target:
public void dispose() { super.dispose(); if (fTreeViewer != null) { fTreeViewer.dispose(); } if (fXYViewer != null) { fXYViewer.dispose(); } }
Source:
<code>public boolean isValid(DeveloperValidationContext context) { ErrorMessageUtil msgUtil = context.getErrorMessageUtil(); DeveloperDTO updatedDev = context.getDeveloperDTO(); DeveloperDTO beforeDev = context.getBeforeDev(); DeveloperStatusEventDTO newDevStatus = updatedDev.getStatus(); DeveloperStatusEventDTO currDevStatus = beforeDev.getStatus(); boolean currentStatusChanged = !currDevStatus.getStatus().getStatusName() .equals(newDevStatus.getStatus().getStatusName()); if (currentStatusChanged && !newDevStatus.getStatus().getStatusName() .equals(DeveloperStatusType.UnderCertificationBanByOnc.toString()) && !resourcePermissions.isUserRoleAdmin() && !resourcePermissions.isUserRoleOnc()) { String msg = msgUtil.getMessage("developer.statusChangeNotAllowedWithoutAdmin"); getMessages().add(msg); return false; } <START> if (!StringUtils.isEmpty(updatedDev.getWebsite())) { <END> if (!ValidationUtils.isWellFormedUrl(updatedDev.getWebsite())) { String msg = msgUtil.getMessage("developer.websiteIsInvalid"); getMessages().add(msg); return false; } } return true; }</code><technical_language>website do status change? extracted</technical_language>

Target:
public boolean isValid(DeveloperValidationContext context) { ErrorMessageUtil msgUtil = context.getErrorMessageUtil(); DeveloperDTO updatedDev = context.getDeveloperDTO(); DeveloperDTO beforeDev = context.getBeforeDev(); DeveloperStatusEventDTO newDevStatus = updatedDev.getStatus(); DeveloperStatusEventDTO currDevStatus = beforeDev.getStatus(); boolean currentStatusChanged = !currDevStatus.getStatus().getStatusName() .equals(newDevStatus.getStatus().getStatusName()); if (currentStatusChanged && !newDevStatus.getStatus().getStatusName() .equals(DeveloperStatusType.UnderCertificationBanByOnc.toString()) && !resourcePermissions.isUserRoleAdmin() && !resourcePermissions.isUserRoleOnc()) { String msg = msgUtil.getMessage("developer.statusChangeNotAllowedWithoutAdmin"); getMessages().add(msg); return false; } return true; }
Source:
<code><START> public CounterManager getCounterManager() { <END> return counterManager; }</code><technical_language>Is this approach for remote clients? counters in module (infinispan-hotrod-client), sense, asymmetry embedded approach. In case, sync @karesti multimap (maybe post infinispan-dev it)</technical_language>

Target:
CounterManager getCounterManager() { return counterManager; }
Source:
<code>private List<FieldSpec> getFields() { <START> ArrayList<FieldSpec> results = new ArrayList(); <END> TypeName functionOfTransactionAndTriggersType = ParameterizedTypeName.get( ClassName.get(Function.class), WildcardTypeName.supertypeOf(Transaction.class), sharedTriggersType); results.add(FieldSpec.builder(Namespace.class, "namespace") .addModifiers(Modifier.PRIVATE, Modifier.FINAL) .build()); results.add(FieldSpec.builder(ParameterizedTypeName.get( ClassName.get(List.class), functionOfTransactionAndTriggersType), "sharedTriggers") .addModifiers(Modifier.PRIVATE, Modifier.FINAL) .build()); results.add(getDefaultNamespaceField()); return results; }</code><technical_language>new ArrayList<>()</technical_language>

Target:
private List<FieldSpec> getFields() { ArrayList<FieldSpec> results = new ArrayList<>(); TypeName functionOfTransactionAndTriggersType = ParameterizedTypeName.get( ClassName.get(Function.class), WildcardTypeName.supertypeOf(Transaction.class), sharedTriggersType); results.add(getDefaultNamespaceField()); results.add(FieldSpec.builder(ParameterizedTypeName.get( ClassName.get(List.class), functionOfTransactionAndTriggersType), "sharedTriggers") .addModifiers(Modifier.PRIVATE, Modifier.FINAL) .build()); results.add(FieldSpec.builder(Namespace.class, "namespace") .addModifiers(Modifier.PRIVATE, Modifier.FINAL) .build()); return results; }
Source:
<code>protected Collection<AuthorizedKeyEntry> reloadAuthorizedKeys(Path path, String username, ServerSession session) throws IOException { if (isStrict()) { if (log.isDebugEnabled()) { log.debug("reloadAuthorizedKeys({})[{}] check permissions of {}", username, session, path); } PosixFilePermission violation = KeyUtils.validateStrictKeyFilePermissions(path); if (violation != null) { throw new IOException("String permission violation (" + violation + ") for " + path); } String ownerViolation = KeyUtils.validateStrictKeyFileOwner(path); if (ownerViolation != null) { throw new IOException("String owner violation (" + ownerViolation + ") for " + path); } <START> } <END> return super.reloadAuthorizedKeys(path, username, session); }</code><technical_language>previous remark _GenericUtils.length(...) > 0_</technical_language>

Target:
protected Collection<AuthorizedKeyEntry> reloadAuthorizedKeys(Path path, String username, ServerSession session) throws IOException { if (isStrict()) { if (log.isDebugEnabled()) { log.debug("reloadAuthorizedKeys({})[{}] check permissions of {}", username, session, path); } Pair<String, Object> violation = KeyUtils.validateStrictKeyFilePermissions(path); if (violation != null) { throw new IOException(String.format("%s for %s", violation.getFirst(), path)); } } return super.reloadAuthorizedKeys(path, username, session); }
Source:
<code>void merge(GitSyncObjectCache value, String parentPath, Collection<String> updateRequests) { if (value.members != null) { if (members == null) members = new HashMap<String, GitSyncObjectCache>(); else for (Entry<String, GitSyncObjectCache> entry : members .entrySet()) { String entryKey = entry.getKey(); if (!value.members.containsKey(entryKey)) { GitSyncObjectCache entryValue = entry.getValue(); if (updateRequests.contains(parentPath + "/" <START> + entryValue.diffEntry)) <END> entryValue.diffEntry.changeType = ChangeType.IN_SYNC; } } for (Entry<String, GitSyncObjectCache> entry : value.members .entrySet()) { String key = entry.getKey(); if (members.containsKey(key)) members.get(key).merge(entry.getValue(), parentPath + "/" + key, updateRequests); else members.put(key, entry.getValue()); } } else if (members != null) for (GitSyncObjectCache obj : members.values()) { if (updateRequests.contains(obj.diffEntry.getPath())) obj.diffEntry.changeType = ChangeType.IN_SYNC; } else diffEntry.changeType = value.diffEntry.changeType; }</code><technical_language>this read entryValue.diffEntry.getPath()</technical_language>

Target:
void merge(GitSyncObjectCache value, String parentPath, Collection<String> updateRequests) { if (value.members != null) { if (members == null) members = new HashMap<String, GitSyncObjectCache>(); else for (Entry<String, GitSyncObjectCache> entry : members .entrySet()) { String entryKey = entry.getKey(); if (!value.members.containsKey(entryKey)) { GitSyncObjectCache entryValue = entry.getValue(); if (updateRequests.contains(entryValue.getDiffEntry() .getPath())) entryValue.diffEntry.changeType = ChangeType.IN_SYNC; } } for (Entry<String, GitSyncObjectCache> entry : value.members .entrySet()) { String key = entry.getKey(); if (members.containsKey(key)) { final String entryPath; if ("".equals(parentPath)) { entryPath = key; } else { entryPath = parentPath + "/" + key; } members.get(key).merge(entry.getValue(), entryPath, updateRequests); } else { members.put(key, entry.getValue()); } } } else if (members != null) for (GitSyncObjectCache obj : members.values()) { String entryPath = obj.getDiffEntry().getPath(); if (updateRequests.contains(entryPath)) obj.diffEntry.changeType = ChangeType.IN_SYNC; } else diffEntry.changeType = value.diffEntry.changeType; }
Source:
<code>public void updateTargetToModel() { <START> final IObservableSet<T> targetSet = target; <END> targetSet.getRealm().exec(() -> { SetDiff<T> diff = Diffs.computeSetDiff(Collections.emptySet(), targetSet); doUpdate(targetSet, model, diff, targetToModel, true, true); }); }</code><technical_language>necessary</technical_language>

Target:
public void updateTargetToModel() { target.getRealm().exec(() -> { SetDiff<T> diff = Diffs.computeSetDiff(Collections.emptySet(), target); doUpdate(target, model, diff, targetToModel, true, true); }); }
Source:
<code>private void populate() { this.pathField = new TextField(); <START> this.openBrowser = new Button(tr("Choose Directory…")); <END> openBrowser.setOnAction(event -> { DirectoryChooser chooser = new DirectoryChooser(); File directory = chooser.showDialog(null); pathField.setText(directory.toString()); }); HBox content = new HBox(pathField, openBrowser); content.setId("addLocalRepository"); HBox.setHgrow(pathField, Priority.ALWAYS); this.setCenter(content); }</code><technical_language>No. dialog open a directory. allows choose a directory repository is located</technical_language>

Target:
private void populate() { this.pathField = new TextField(); this.openBrowser = new Button(tr("Choose Directory ...")); openBrowser.setOnAction(event -> { DirectoryChooser chooser = new DirectoryChooser(); File directory = chooser.showDialog(null); pathField.setText(directory.toString()); }); HBox content = new HBox(pathField, openBrowser); content.setId("addLocalRepository"); HBox.setHgrow(pathField, Priority.ALWAYS); this.setCenter(content); }
Source:
<code>public void testTaskWithDisableAutoClaimTaskWithActorAndGroup() throws Exception { TestWorkItemManager manager = new TestWorkItemManager(); <START> env.set("Autoclaim", new String("false")); <END> ksession.setEnvironment(env); ksession.setWorkItemManager(manager); WorkItemImpl workItem = new WorkItemImpl(); workItem.setName("Human Task"); workItem.setParameter("NodeName", "TaskName"); workItem.setParameter("Comment", "Comment"); workItem.setParameter("Priority", "10"); workItem.setParameter("GroupId", "Crusaders"); workItem.setParameter("ActorId", "Darth Vader"); workItem.setParameter("SwimlaneActorId", "Darth Vader"); workItem.setProcessInstanceId(10); handler.executeWorkItem(workItem, manager); List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK"); assertEquals(1, tasks.size()); TaskSummary task = tasks.get(0); assertEquals("TaskName", task.getName()); assertEquals(10, task.getPriority().intValue()); assertEquals("Comment", task.getDescription()); assertEquals(Status.Ready, task.getStatus()); assertEquals(10, task.getProcessInstanceId().intValue()); taskService.start(task.getId(), "Darth Vader"); taskService.complete(task.getId(), "Darth Vader", null); assertTrue(manager.waitTillCompleted(MANAGER_COMPLETION_WAIT_TIME)); }</code><technical_language>I plain "false" here. is sufficient</technical_language>

Target:
public void testTaskWithDisableAutoClaimTaskWithActorAndGroup() throws Exception { TestWorkItemManager manager = new TestWorkItemManager(); env.set("Autoclaim", "false"); ksession.setEnvironment(env); ksession.setWorkItemManager(manager); WorkItemImpl workItem = new WorkItemImpl(); workItem.setName("Human Task"); workItem.setParameter("NodeName", "TaskName"); workItem.setParameter("Comment", "Comment"); workItem.setParameter("Priority", "10"); workItem.setParameter("GroupId", "Crusaders"); workItem.setParameter("ActorId", "Darth Vader"); workItem.setParameter("SwimlaneActorId", "Darth Vader"); workItem.setProcessInstanceId(10); handler.executeWorkItem(workItem, manager); List<TaskSummary> tasks = taskService.getTasksAssignedAsPotentialOwner("Darth Vader", "en-UK"); assertEquals(1, tasks.size()); TaskSummary task = tasks.get(0); assertEquals("TaskName", task.getName()); assertEquals(10, task.getPriority().intValue()); assertEquals("Comment", task.getDescription()); assertEquals(Status.Ready, task.getStatus()); assertEquals(10, task.getProcessInstanceId().intValue()); taskService.start(task.getId(), "Darth Vader"); taskService.complete(task.getId(), "Darth Vader", null); assertTrue(manager.waitTillCompleted(MANAGER_COMPLETION_WAIT_TIME)); }
Source:
<code>public void onAjax(AjaxRequestTarget target, JQueryEvent event) { if (event instanceof NavigateEvent) { <START> this.listener.onNavigate(target, ((NavigateEvent) event)); <END> } if (event instanceof SchedulerPayload) { SchedulerPayload payload = (SchedulerPayload) event; SchedulerEvent schedulerEvent = this.factory.toObject(payload.getObject(), this.getResourceListModel().getObject()); if (event instanceof EditEvent) { this.listener.onEdit(target, schedulerEvent, payload.getView()); } if (event instanceof CreateEvent) { this.listener.onCreate(target, schedulerEvent); } if (event instanceof UpdateEvent) { this.listener.onUpdate(target, schedulerEvent); } if (event instanceof DeleteEvent) { this.listener.onDelete(target, schedulerEvent); } } }</code><technical_language>extra parenthesis</technical_language>

Target:
public void onAjax(AjaxRequestTarget target, JQueryEvent event) { if (event instanceof NavigateEvent) { this.listener.onNavigate(target, (NavigateEvent) event); } if (event instanceof SchedulerPayload) { SchedulerPayload payload = (SchedulerPayload) event; SchedulerEvent schedulerEvent = this.factory.toObject(payload.getObject(), this.getResourceListModel().getObject()); if (event instanceof EditEvent) { this.listener.onEdit(target, schedulerEvent, payload.getView()); } if (event instanceof CreateEvent) { this.listener.onCreate(target, schedulerEvent); } if (event instanceof UpdateEvent) { this.listener.onUpdate(target, schedulerEvent); } if (event instanceof DeleteEvent) { this.listener.onDelete(target, schedulerEvent); } } }
Source:
<code>public DatabaseInfo getDatabaseInfo() throws IOException { try { GetDatabaseRequest dbRequest = new GetDatabaseRequest() .withCatalogId(mGlueConfiguration.get(Property.CATALOG_ID)) .withName(mGlueDbName); GetDatabaseResult dbResult = mGlueClient.getDatabase(dbRequest); Database glueDatabase = dbResult.getDatabase(); String glueDbLocation = glueDatabase.getLocationUri() == null ? "" : glueDatabase.getLocationUri(); String glueDbDescription = glueDatabase.getDescription() == null ? "" : glueDatabase.getDescription(); Map<String, String> glueParameters = glueDatabase.getParameters() == null ? Collections.emptyMap() : glueDatabase.getParameters(); return new DatabaseInfo( <START> glueDbLocation, <END> mOwnerName, mOwnerType, glueDbDescription, glueParameters); } catch (EntityNotFoundException e) { throw new IOException("Cannot find glue database: " + mGlueDbName + "Catalog ID: " + mGlueConfiguration.get(Property.CATALOG_ID) + ". " + e.getMessage(), e); } }</code><technical_language>I feel previous code better, create a new map for internal data structure. new code fix? change this code a bit like: if (parameters != null) { glueParameters.putAll(parameters); }</technical_language>

Target:
public DatabaseInfo getDatabaseInfo() throws IOException { try { GetDatabaseRequest dbRequest = new GetDatabaseRequest() .withCatalogId(mGlueConfiguration.get(Property.CATALOG_ID)) .withName(mGlueDbName); GetDatabaseResult dbResult = mGlueClient.getDatabase(dbRequest); Database glueDatabase = dbResult.getDatabase(); String glueDbLocation = glueDatabase.getLocationUri() == null ? "" : glueDatabase.getLocationUri(); String glueDbDescription = glueDatabase.getDescription() == null ? "" : glueDatabase.getDescription(); Map<String, String> glueParameters = new HashMap<>(); if (glueDatabase.getParameters() != null) { glueParameters.putAll(glueDatabase.getParameters()); } return new DatabaseInfo( glueDbLocation, mOwnerName, mOwnerType, glueDbDescription, glueParameters); } catch (EntityNotFoundException e) { throw new IOException("Cannot find glue database: " + mGlueDbName + "Catalog ID: " + mGlueConfiguration.get(Property.CATALOG_ID) + ". " + e.getMessage(), e); } }
Source:
<code>public void heartbeat() { LinkedMultiValueMap<String, ElasticAgentMetadata> elasticAgentsOfMissingPlugins = agentService.allElasticAgents(); long pingMessageTimeToLive = elasticPluginHeartBeatInterval - 10000L; for (PluginDescriptor descriptor : elasticAgentPluginRegistry.getPlugins()) { List<ClusterProfile> clusterProfiles = clusterProfilesService.getPluginProfiles().findByPluginId(descriptor.id()); <START> resolveSecrets(clusterProfiles); <END> serverPingQueue.post(new ServerPingMessage(descriptor.id(), clusterProfiles), pingMessageTimeToLive); elasticAgentsOfMissingPlugins.remove(descriptor.id()); serverHealthService.removeByScope(scope(descriptor.id())); } if (!elasticAgentsOfMissingPlugins.isEmpty()) { for (String pluginId : elasticAgentsOfMissingPlugins.keySet()) { Collection<String> uuids = elasticAgentsOfMissingPlugins.get(pluginId).stream().map(ElasticAgentMetadata::uuid).collect(toList()); String description = format("Elastic agent plugin with identifier %s has gone missing, but left behind %s agent(s) with UUIDs %s.", pluginId, elasticAgentsOfMissingPlugins.get(pluginId).size(), uuids); serverHealthService.update(ServerHealthState.warning("Elastic agents with no matching plugins", description, HealthStateType.general(scope(pluginId)))); LOGGER.warn(description); } } }</code><technical_language>If secrets resolution for of cluster profile fails, plugin get a ping for of clusters. do notify users in cases of secret resolution failures</technical_language>

Target:
public void heartbeat() { LinkedMultiValueMap<String, ElasticAgentMetadata> elasticAgentsOfMissingPlugins = agentService.allElasticAgents(); long pingMessageTimeToLive = elasticPluginHeartBeatInterval - 10000L; for (PluginDescriptor descriptor : elasticAgentPluginRegistry.getPlugins()) { elasticAgentsOfMissingPlugins.remove(descriptor.id()); List<ClusterProfile> clusterProfiles = clusterProfilesService.getPluginProfiles().findByPluginId(descriptor.id()); boolean secretsResolved = resolveSecrets(descriptor.id(), clusterProfiles); if (!secretsResolved) continue; serverPingQueue.post(new ServerPingMessage(descriptor.id(), clusterProfiles), pingMessageTimeToLive); serverHealthService.removeByScope(scope(descriptor.id())); } if (!elasticAgentsOfMissingPlugins.isEmpty()) { for (String pluginId : elasticAgentsOfMissingPlugins.keySet()) { Collection<String> uuids = elasticAgentsOfMissingPlugins.get(pluginId).stream().map(ElasticAgentMetadata::uuid).collect(toList()); String description = format("Elastic agent plugin with identifier %s has gone missing, but left behind %s agent(s) with UUIDs %s.", pluginId, elasticAgentsOfMissingPlugins.get(pluginId).size(), uuids); serverHealthService.update(ServerHealthState.warning("Elastic agents with no matching plugins", description, general(scope(pluginId)))); LOGGER.warn(description); } } }
Source:
<code>public Response saveServiceDefinition(ServiceDefinitionPair serviceDefinition) { try { getServiceDefinitionRegistry().saveServiceDefinition(serviceDefinition); <START> return ok().entity("{ \"added service definition\": \"" + serviceDefinition.toString() + "\" }").build(); <END> } catch (ServiceDefinitionRegistryException e) { return serverError().entity("{ \"failed to save service definition\": \"" + e.getMessage() + "\" }").build(); } }</code><technical_language>a fan of in API is "added service definition" is verbose coming end user. in API static unique strings ERROR_CODE whatever. id description</technical_language>

Target:
public Response saveServiceDefinition(ServiceDefinitionPair serviceDefinition) { try { getServiceDefinitionRegistry().saveServiceDefinition(serviceDefinition); return created(toUri(serviceDefinition)).build(); } catch (URISyntaxException | ServiceDefinitionRegistryException e) { return serverError().entity("{ \"" + ERROR_CODE_CREATION + "\": \"" + e.getMessage() + "\" }").build(); } }
Source:
<code>private Driver createNeo4jDriver(RemoteNeo4jDatabaseIdentifier identifier, RemoteNeo4jConfiguration configuration) { <START> String uri = identifier.getDatabaseUri(); <END> Config.ConfigBuilder configBuilder = Config.build(); configBuilder.withMaxIdleSessions( configuration.getClientRestPoolSize() ); try { if ( configuration.isAuthenticationRequired() ) { AuthToken authToken = AuthTokens.basic( configuration.getUsername(), configuration.getPassword() ); return GraphDatabase.driver( uri, authToken, configBuilder.toConfig() ); } else { return GraphDatabase.driver( uri, configBuilder.toConfig() ); } } catch (Neo4jException e) { throw log.connectionFailed( databaseUri, e.code(), e.getMessage() ); } }</code><technical_language>Do attibutes meaning</technical_language>

Target:
private Driver createNeo4jDriver(RemoteNeo4jDatabaseIdentifier identifier, RemoteNeo4jConfiguration configuration) { String uri = identifier.getDatabaseUri(); Config.ConfigBuilder configBuilder = Config.build(); configBuilder.withMaxIdleSessions( configuration.getClientPoolSize() ); try { if ( configuration.isAuthenticationRequired() ) { AuthToken authToken = AuthTokens.basic( configuration.getUsername(), configuration.getPassword() ); return GraphDatabase.driver( uri, authToken, configBuilder.toConfig() ); } else { return GraphDatabase.driver( uri, configBuilder.toConfig() ); } } catch (Neo4jException e) { throw log.connectionFailed( databaseUri, e.code(), e.getMessage() ); } }
Source:
<code>String getPath(String prefix) { <START> String Host = ""+VoltDB.instance().getHostMessenger().getHostId(); <END> if (m_batched) { return m_uniquename ? m_dirContainingFiles.getPath() + File.separator + generation + "-" + tableName + "-" + Host + m_extension : m_dirContainingFiles.getPath() + File.separator + generation + "-" + tableName + m_extension; } else { return m_uniquename ? m_dirContainingFiles.getPath() + File.separator + prefix + m_nonce + "-" + generation + "-" + tableName + "-" + Host+ "-" + m_dateformat.get().format(start) + m_extension : m_dirContainingFiles.getPath() + File.separator + prefix + m_nonce + "-" + generation + "-" + tableName + "-" + m_dateformat.get().format(start) + m_extension; } }</code><technical_language>Variable names start case. this hostId, instead of host is more accurate</technical_language>

Target:
String getPath(String prefix) { String hostId = ""; if(m_uniquenames) { hostId = "-("+VoltDB.instance().getHostMessenger().getHostId()+")"; } return getPathUtility(m_extension, hostId, prefix); }
Source:
<code>private void onHandlingComplete(RestRequestInfo restRequestInfo, Exception e) { if (restRequestInfo != null) { <START> logger.debug("Performing onHandlingComplete tasks for RestRequestInfo {}. Handling exception, if any, attached", <END> restRequestInfo, e); try { restRequestInfo.onHandlingComplete(e); } catch (Exception ee) { logger.error("Swallowing exception during onHandlingComplete tasks. Original exception also attached", ee, e); restServerMetrics.dequeuedRequestHandlerHandlingCompleteTasksFailure.inc(); } finally { RestResponseHandler responseHandler = restRequestInfo.getRestResponseHandler(); if (e != null) { responseHandler.onRequestComplete(e, false); } if (responseHandler.isRequestComplete()) { logger.debug("Marking request as complete based on information from the RestResponseHandler"); onRequestComplete(restRequestInfo.getRestRequestMetadata()); } logger.debug("Handling of RestRequestInfo completed (Exception, if any, attached)", restRequestInfo, e); } } }</code><technical_language>attached mean? Also, usage of throwable work</technical_language>

Target:
private void onHandlingComplete(RestRequestInfo restRequestInfo, Exception e) { String uri = restRequestInfo.getRestRequestMetadata().getUri(); logger.trace("Performing onComplete tasks for RestRequestInfo of request {}", uri); try { restRequestInfo.onComplete(e); } catch (Exception ee) { logger.error("Swallowing exception during onComplete tasks.", ee); restServerMetrics.dequeuedRequestHandlerHandlingCompleteTasksError.inc(); } finally { RestResponseHandler responseHandler = restRequestInfo.getRestResponseHandler(); if (e != null) { responseHandler.onRequestComplete(e, false); } if (responseHandler.isRequestComplete()) { logger.trace("Marking request as complete based on information from the RestResponseHandler", uri); onRequestComplete(restRequestInfo.getRestRequestMetadata()); } logger.trace("Handling of RestRequestInfo of request completed", uri); } }
Source:
<code>public void upgrade_movePassword_passwordMoved() throws IllegalArgumentException, IllegalAccessException { String vpnPassword = "upgrade_movePassword_passwordMoved"; vpnPasswordField.set(userPrivateField.get(richard), vpnPassword); <START> <END> UserDevice device = createDevice(); richard.addDevice(device); migrationStep.upgrade(richard); assertThat(device.getVpnPassword(), equalTo(vpnPassword)); assertThat(richard.takeVpnPassword(), equalTo(Optional.empty())); }</code><technical_language>I prefer remove this newline add call upgrade separate arrange/act/assert</technical_language>

Target:
public void upgrade_movePassword_passwordMoved() throws IllegalArgumentException, IllegalAccessException { String vpnPassword = "upgrade_movePassword_passwordMoved"; vpnPasswordField.set(userPrivateField.get(richard), vpnPassword); UserDevice device = createDevice(); richard.addDevice(device); migrationStep.upgrade(richard); assertThat(device.getVpnPassword(), equalTo(vpnPassword)); assertThat(richard.getAndClearVpnPassword(), equalTo(Optional.empty())); }
Source:
<code>public Object poll() { <START> return queue.poll(); <END> }</code><technical_language>Need add if (capacity != null) capacity.incrementAndGet(); here</technical_language>

Target:
public Object poll() { Object value = queue.poll(); if (capacity != null && value != null) { capacity.incrementAndGet(); } return value; }
Source:
<code>public void testCheckSamples(final List<File> files1, final List<File> files2, final int expectedRetVal, final int numberOfSamples, boolean ExpectAllMatch) throws IOException { File metrics = File.createTempFile("Fingerprinting", "test.crosscheck_metrics"); metrics.deleteOnExit(); <START> File matrix = File.createTempFile("Fingerprinting", "test.matrix"); <END> matrix.deleteOnExit(); final List<String> args = new ArrayList<>(); files1.forEach(f->args.add("INPUT="+f.getAbsolutePath())); files2.forEach(f->args.add("INPUT2="+f.getAbsolutePath())); args.add("OUTPUT=" + metrics.getAbsolutePath()); args.add("HAPLOTYPE_MAP=" + HAPLOTYPE_MAP); args.add("LOD_THRESHOLD=" + -1.0); args.add("CROSSCHECK_BY=SAMPLE"); doTest(args.toArray(new String[args.size()]), metrics, expectedRetVal, numberOfSamples , CrosscheckMetric.DataType.SAMPLE, ExpectAllMatch); }</code><technical_language>I this is unused</technical_language>

Target:
public void testCheckSamples(final List<File> files1, final List<File> files2, final int expectedRetVal, final int numberOfSamples, boolean ExpectAllMatch) throws IOException { File metrics = File.createTempFile("Fingerprinting", "test.crosscheck_metrics"); metrics.deleteOnExit(); final List<String> args = new ArrayList<>(); files1.forEach(f->args.add("INPUT="+f.getAbsolutePath())); files2.forEach(f->args.add("SECOND_INPUT="+f.getAbsolutePath())); args.add("OUTPUT=" + metrics.getAbsolutePath()); args.add("HAPLOTYPE_MAP=" + HAPLOTYPE_MAP); args.add("LOD_THRESHOLD=" + -1.0); args.add("CROSSCHECK_BY=SAMPLE"); doTest(args.toArray(new String[args.size()]), metrics, expectedRetVal, numberOfSamples , CrosscheckMetric.DataType.SAMPLE, ExpectAllMatch); }
Source:
<code>public void convertsXmlToJsonArray() throws Exception { final XML xml = new XMLDocument( <START> "<users><user>Jeff</user><user>Bauer</user><user>Iko</user></users>" <END> ); final JsonObject json = new JsonNode(xml).json(); MatcherAssert.assertThat( json.toString(), new IsEqual<>("{\"users\": [\"Jeff\", \"Bauer\", \"Iko\"]}") ); }</code><technical_language>@paulodamaso I assumptions simplistic. JsonNode children of users treated arrays? I adding metadata - attribute array of type xsd:boolean - arbitrary element better</technical_language>

Target:
public void convertsXmlToJsonArray() throws Exception { final XML xml = new XMLDocument( "<users array=\"true\"><item>Jeff</item><item>Bauer</item><item>Iko</item></users>" ); final JsonObject json = new JsonNode(xml).json(); MatcherAssert.assertThat( json.toString(), new IsEqual<>("{\"users\": [\"Jeff\", \"Bauer\", \"Iko\"]}") ); }
Source:
<code>public boolean onCreateOptionsMenu(final Menu menu) { getMenuInflater().inflate(R.menu.wallet_options, menu); super.onCreateOptionsMenu(menu); <START> getMenuInflater().inflate(R.menu.wallet_options, menu); <END> MenuItem walletLockMenuItem = menu.findItem(R.id.wallet_options_lock); walletLockMenuItem.setVisible(WalletLock.getInstance().isWalletLocked(wallet)); hidePersonalSettingsIfLocked(); return true; }</code><technical_language>This is a duplicate of is lines above</technical_language>

Target:
public boolean onCreateOptionsMenu(final Menu menu) { getMenuInflater().inflate(R.menu.wallet_options, menu); super.onCreateOptionsMenu(menu); MenuItem walletLockMenuItem = menu.findItem(R.id.wallet_options_lock); walletLockMenuItem.setVisible(WalletLock.getInstance().isWalletLocked(wallet)); hidePersonalSettingsIfLocked(); return true; }