auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Authentication supply(@Nonnull HttpServletRequest request) { if (suppliers == null || suppliers.isEmpty()) { <START> logger.debug("There was no any provided.", AuthenticationSupplier.class); <END> return null; } AuthenticationException lastException = null; for (final AuthenticationSupplier supplier : suppliers) { final String supplierName = supplier.getClass() .getName(); if (!supplier.supports(request)) { logger.debug("Supplier does not support this request [method: {}] [URI: {}] [ContentType {}]", supplierName, request.getMethod(), request.getRequestURI(), request.getContentType()); continue; } logger.debug("Authentication supplier attempt using {}", supplierName); Authentication authentication; try { authentication = supplier.supply(request); } catch (AuthenticationException e) { lastException = e; continue; } if (authentication != null) { logger.debug("Authentication supplied by {}", supplierName); return authentication; } } if (lastException != null) { throw lastException; } return null; }</code><technical_language>suggestion logger.debug("There provided.", AuthenticationSupplier.class);</technical_language>

Target:
public Authentication supply(@Nonnull HttpServletRequest request) { if (suppliers == null || suppliers.isEmpty()) { logger.debug("There was no provided.", AuthenticationSupplier.class); return null; } AuthenticationException lastException = null; for (final AuthenticationSupplier supplier : suppliers) { final String supplierName = supplier.getClass() .getName(); if (!supplier.supports(request)) { logger.debug("Supplier does not support this request [method: {}] [URI: {}] [ContentType {}]", supplierName, request.getMethod(), request.getRequestURI(), request.getContentType()); continue; } logger.debug("Authentication supplier attempt using {}", supplierName); Authentication authentication; try { authentication = supplier.supply(request); } catch (AuthenticationException e) { lastException = e; continue; } if (authentication != null) { logger.debug("Authentication supplied by {}", supplierName); return authentication; } } if (lastException != null) { throw lastException; } return null; }
Source:
<code><START> public void addTaskLatency(String daemonId, long value) { <END> daemonTaskLatency.compute(daemonId, (k, v) -> { v = (v == null ? new DaemonLatencyMetric(daemonId, latencyMetricWindowSize) : v); v.addValue(value); return v; }); }</code><technical_language>nit. this simpler java concurrentHashMap.computeIfAbsent("key", -> new DaemonLatencyMetric()).add(val);</technical_language>

Target:
public void addTaskLatency(String daemonId, long value) { if (latencyMetricWindowSize > 0) { daemonTaskLatency.computeIfAbsent(daemonId, k -> new DaemonLatencyMetric(daemonId, latencyMetricWindowSize)).addValue(value); } }
Source:
<code>protected void waitUntil(BooleanSupplier supplier, long timeout) { long start = System.currentTimeMillis(); while (true) { if (supplier.getAsBoolean()) { break; } try { Thread.sleep(10); } catch (InterruptedException ignore) { <START> } <END> long now = System.currentTimeMillis(); if (now - start > timeout) { throw new IllegalStateException("Timed out"); } } }</code><technical_language>reset interrupted status Thread.currentThread().interrupt()</technical_language>

Target:
protected void waitUntil(BooleanSupplier supplier, long timeout) { long start = System.currentTimeMillis(); while (true) { if (supplier.getAsBoolean()) { break; } try { Thread.sleep(10); } catch (InterruptedException ignore) { Thread.currentThread().interrupt(); } long now = System.currentTimeMillis(); if (now - start > timeout) { throw new IllegalStateException("Timed out"); } } }
Source:
<code><START> private synchronized void loadFromDisk() { <END> try { synchronized (goConfigWriteLock.mutex()) { GoConfigHolder configHolder = dataSource.load(); if (configHolder != null) { saveValidConfigToCacheAndNotifyConfigChangeListeners(configHolder); } } } catch (Exception e) { LOGGER.warn("Error loading cruise-config.xml from disk, keeping previous one", e); saveConfigError(e); } }</code><technical_language>I if methods in this class need synchronized now, synchronization is done a common object</technical_language>

Target:
private void loadFromDisk() { try { synchronized (GoConfigWriteLock.class) { GoConfigHolder configHolder = dataSource.load(); if (configHolder != null) { saveValidConfigToCacheAndNotifyConfigChangeListeners(configHolder); } } } catch (Exception e) { LOGGER.warn("Error loading cruise-config.xml from disk, keeping previous one", e); saveConfigError(e); } }
Source:
<code>protected void run() throws Exception { <START> File configFile = getConfigFile(); <END> ProgressMonitor monitor = new TextProgressMonitor(out); SubscriptionManager manager = new SubscriptionManager(monitor, out); try { while (true) { long changeTime = configFile.lastModified(); manager.sync(getConfig().getPublishers()); while (changeTime == configFile.lastModified()) Thread.sleep(5000); } } finally { manager.close(); } }</code><technical_language>I want FileSnapshot for this</technical_language>

Target:
protected void run() throws Exception { File configFile = getConfigFile(); ProgressMonitor monitor = new TextProgressMonitor(out); SubscriptionManager manager = new SubscriptionManager(monitor, out); try { while (true) { FileSnapshot configFileSnapshot = FileSnapshot.save(configFile); manager.sync(getConfig().getPublishers()); while (!configFileSnapshot.isModified(configFile)) Thread.sleep(1000 * pollTime); } } finally { manager.close(); } }
Source:
<code>private void removeAndUpdateAddressMap(final Address address) throws Exception { Bindings bindings = super.getBindingsForRoutingAddress(address.getAddress()); if (bindings == null || bindings.getBindings().isEmpty()) { synchronized (this) { <START> List<Address> addresses = address.getLinkedAddresses(); <END> for (Address address1 : addresses) { address1.removeLinkedAddress(address); Bindings linkedBindings = super.getBindingsForRoutingAddress(address1.getAddress()); if (linkedBindings == null || linkedBindings.getBindings().size() == 0) { removeAddress(address1); } } removeAddress(address); } } }</code><technical_language>confused here.. move synchronize specific address (synchronize (address) { // returned getLinkedAddresses(); synchronized... this is right thing</technical_language>

Target:
private void removeAndUpdateAddressMap(final Address address) throws Exception { Bindings bindings = super.getBindingsForRoutingAddress(address.getAddress()); if (bindings == null || bindings.getBindings().isEmpty()) { synchronized (this) { for (Address address1 : address.getLinkedAddresses()) { address1.removeLinkedAddress(address); Bindings linkedBindings = super.getBindingsForRoutingAddress(address1.getAddress()); if (linkedBindings == null || linkedBindings.getBindings().size() == 0) { removeAddress(address1); } } removeAddress(address); } } }
Source:
<code>protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getGlusterVolume().getVolumeType().isDispersedType()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_REMOVE_BRICK_FROM_DISPERSE_VOLUME_NOT_SUPPORTED); } if <START> (getGlusterVolume().getVolumeType().isDistributedDispersedType()) { <END> return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_REMOVE_BRICK_FROM_DISTRIBUTED_DISPERSE_VOLUME_NOT_SUPPORTED); } GlusterBrickValidator brickValidator = new GlusterBrickValidator(); return validate(brickValidator.canRemoveBrick(getParameters().getBricks(), getGlusterVolume(), getParameters().getReplicaCount(), true)); }</code><technical_language>getVolumeType().isDispersedType() care of distributed disperse types. imple of isDispersedType(). public boolean isDispersedType() { return value().contains("DISPERSE"); }</technical_language>

Target:
protected boolean canDoAction() { if (!super.canDoAction()) { return false; } if (getGlusterVolume().getVolumeType().isDispersedType()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_REMOVE_BRICK_FROM_DISPERSE_VOLUME_NOT_SUPPORTED); } GlusterBrickValidator brickValidator = new GlusterBrickValidator(); return validate(brickValidator.canRemoveBrick(getParameters().getBricks(), getGlusterVolume(), getParameters().getReplicaCount(), true)); }
Source:
<code>public static void scanFile() { <START> String dir = "src/test/resources/org/sonar/plugins/python/squid-sensor"; <END> File file = new File(dir, "/symbolVisitor.py"); DefaultInputFile inputFile = TestInputFileBuilder.create("moduleKey", file.getName()) .initMetadata(TestUtils.fileContent(file, StandardCharsets.UTF_8)) .build(); context = SensorContextTester.create(file); context.fileSystem().add(inputFile); componentKey = inputFile.key(); SymbolVisitor symbolVisitor = new SymbolVisitor(context.newSymbolTable().onFile(inputFile)); PythonVisitorContext context = TestPythonVisitorRunner.createContext(file); FileInput fileInput = context.rootTree(); fileInput.accept(symbolVisitor); }</code><technical_language>dir variable ? I inline concatenate file name</technical_language>

Target:
public static void scanFile() { File file = new File("src/test/resources/org/sonar/plugins/python/squid-sensor", "/symbolVisitor.py"); DefaultInputFile inputFile = TestInputFileBuilder.create("moduleKey", file.getName()) .initMetadata(TestUtils.fileContent(file, StandardCharsets.UTF_8)) .build(); context = SensorContextTester.create(file); context.fileSystem().add(inputFile); componentKey = inputFile.key(); SymbolVisitor symbolVisitor = new SymbolVisitor(context.newSymbolTable().onFile(inputFile)); PythonVisitorContext context = TestPythonVisitorRunner.createContext(file); FileInput fileInput = context.rootTree(); fileInput.accept(symbolVisitor); }
Source:
<code>private Set<ObjectId> listNonHEADIndexObjects() throws CorruptObjectException, IOException { RevWalk revWalk = null; try { if (repo.getIndexFile() == null) return Collections.emptySet(); } catch (NoWorkTreeException e) { return Collections.emptySet(); } TreeWalk treeWalk = new TreeWalk(repo); try { treeWalk.addTree(new DirCacheIterator(repo.readDirCache())); ObjectId headID = repo.resolve(Constants.HEAD); if (headID != null) { revWalk = new RevWalk(repo); treeWalk.addTree(revWalk.parseTree(headID)); <START> revWalk.dispose(); <END> } treeWalk.setFilter(TreeFilter.ANY_DIFF); treeWalk.setRecursive(true); Set<ObjectId> ret = new HashSet<ObjectId>(); while (treeWalk.next()) { ObjectId objectId = treeWalk.getObjectId(0); if (!ObjectId.zeroId().equals(objectId)) ret.add(objectId); } return ret; } finally { if (revWalk != null) revWalk.dispose(); treeWalk.release(); } }</code><technical_language>add revWalk = null this line save calling dispose in finally block. need call in finally in case exception throws parseTree</technical_language>

Target:
private Set<ObjectId> listNonHEADIndexObjects() throws CorruptObjectException, IOException { RevWalk revWalk = null; try { if (repo.getIndexFile() == null) return Collections.emptySet(); } catch (NoWorkTreeException e) { return Collections.emptySet(); } TreeWalk treeWalk = new TreeWalk(repo); try { treeWalk.addTree(new DirCacheIterator(repo.readDirCache())); ObjectId headID = repo.resolve(Constants.HEAD); if (headID != null) { revWalk = new RevWalk(repo); treeWalk.addTree(revWalk.parseTree(headID)); revWalk.dispose(); revWalk = null; } treeWalk.setFilter(TreeFilter.ANY_DIFF); treeWalk.setRecursive(true); Set<ObjectId> ret = new HashSet<ObjectId>(); while (treeWalk.next()) { ObjectId objectId = treeWalk.getObjectId(0); switch (treeWalk.getRawMode(0) & FileMode.TYPE_MASK) { case FileMode.TYPE_MISSING: case FileMode.TYPE_GITLINK: continue; case FileMode.TYPE_TREE: case FileMode.TYPE_FILE: case FileMode.TYPE_SYMLINK: ret.add(objectId); continue; default: throw new IOException(MessageFormat.format( JGitText.get().corruptObjectInvalidMode3, String .format("%o", Integer.valueOf(treeWalk .getRawMode(0)), (objectId == null) ? "null" : objectId.name(), treeWalk .getPathString(), repo .getIndexFile()))); } } return ret; } finally { if (revWalk != null) revWalk.dispose(); treeWalk.release(); } }
Source:
<code>public List<Metric> filter(Map<Metric, String> extendedSortedMap, String limit) { SystemAssert.requireArgument(extendedSortedMap != null && !extendedSortedMap.isEmpty(), "New map is not constructed successfully!"); SystemAssert.requireArgument(limit != null && !limit.equals(""), "Limit must be provided!"); List<Metric> result = new ArrayList<Metric>(); for (Map.Entry<Metric, String> entry : extendedSortedMap.entrySet()) { Number bound; try { <START> bound = Long.parseLong(limit); <END> } catch (NumberFormatException nfe) { try { bound = Double.parseDouble(limit); } catch (NumberFormatException nfe2) { throw new IllegalArgumentException("The limit " + limit + " is not a valid number."); } } Number val; try { val = Long.parseLong(entry.getValue()); } catch (NumberFormatException nfe) { try { val = Double.parseDouble(entry.getValue()); } catch (NumberFormatException nfe2) { throw new IllegalArgumentException("The data value " + entry.getValue() + " is not a valid number."); } } if (NumberOperations.isGreaterThan(val, bound)) { result.add(entry.getKey()); } } return result; }</code><technical_language>limit needs re-parsed for loop (I realize code this)</technical_language>

Target:
public List<Metric> filter(Map<Metric, String> extendedSortedMap, String limit) { SystemAssert.requireArgument(extendedSortedMap != null && !extendedSortedMap.isEmpty(), "New map is not constructed successfully!"); SystemAssert.requireArgument(limit != null && !limit.equals(""), "Limit must be provided!"); List<Metric> result = new ArrayList<Metric>(); Number bound = NumberOperations.parseConstant(limit); for (Map.Entry<Metric, String> entry : extendedSortedMap.entrySet()) { Number val = NumberOperations.parseConstant(entry.getValue()); if (NumberOperations.isGreaterThan(val, bound)) { result.add(entry.getKey()); } } return result; }
Source:
<code>public void detachNodeFailInActiveAtPrepare() throws Exception { final int activeId = findActive(1).getAsInt(); final int passiveId = findPassives(1)[0]; String propertySettingString = "stripe.1.node." + activeId + ".tc-properties.detachStatus=prepareDeletion-failure"; assertThat(configToolInvocation("set", "-s", "localhost:" + getNodePort(1, 1), "-c", propertySettingString), is(successful())); out.clearLog(1, passiveId); assertThat( configToolInvocation("detach", "-f", "-d", "localhost:" + getNodePort(1, activeId), "-s", "localhost:" + getNodePort(1, passiveId)), containsOutput("Two-Phase commit failed")); waitUntil(out.getLog(1, passiveId), containsLog("Restarting the server")); <START> waitUntil(out.getLog(1, passiveId), containsLog("Moved to State[ PASSIVE-STANDBY ]")); <END> }</code><technical_language>now, #615, if prepare phase is failing, node restarted Nomad transaction is applied. status quo ;-)</technical_language>

Target:
public void detachNodeFailInActiveAtPrepare() throws Exception { final int activeId = findActive(1).getAsInt(); final int passiveId = findPassives(1)[0]; String propertySettingString = "stripe.1.node." + activeId + ".tc-properties.detachStatus=prepareDeletion-failure"; assertThat(configToolInvocation("set", "-s", "localhost:" + getNodePort(1, 1), "-c", propertySettingString), is(successful())); assertThat( configToolInvocation("detach", "-f", "-d", "localhost:" + getNodePort(1, activeId), "-s", "localhost:" + getNodePort(1, passiveId)), containsOutput("Two-Phase commit failed")); assertThat(getUpcomingCluster("localhost", getNodePort(1, activeId)).getNodeCount(), is(equalTo(2))); assertThat(getRuntimeCluster("localhost", getNodePort(1, activeId)).getNodeCount(), is(equalTo(2))); assertThat(getUpcomingCluster("localhost", getNodePort(1, passiveId)).getNodeCount(), is(equalTo(2))); assertThat(getRuntimeCluster("localhost", getNodePort(1, passiveId)).getNodeCount(), is(equalTo(2))); withTopologyService(1, activeId, topologyService -> assertTrue(topologyService.isActivated())); withTopologyService(1, passiveId, topologyService -> assertTrue(topologyService.isActivated())); }
Source:
<code>public void testMsgNotifHeartbeat_requestModel() throws Exception { TestApplication app = new TestApplication(); app.setDirectory( this.folder.newFolder()); ManagedApplication ma = new ManagedApplication( app ); this.managerWrapper.getNameToManagedApplication().put( app.getName(), ma ); <START> String targetId = this.manager.targetsMngr().createTarget( "id: tid1\nhandler: h" ); <END> this.manager.targetsMngr().associateTargetWith( targetId, app, null ); File dir = new File( this.manager.configurationMngr().getWorkingDirectory(), ConfigurationUtils.TARGETS + "/" + targetId ); Utils.createDirectory( dir ); Utils.writeStringInto( "#!/bin/bash\necho Bonjour le monde cruel > toto.txt", new File( dir, Constants.TARGET_SCRIPT_FILE_NAME )); Assert.assertNotNull( this.manager.targetsMngr().findScriptResources(targetId) ); this.msgClient.allSentMessages.clear(); Assert.assertEquals( 0, this.msgClient.allSentMessages.size()); MsgNotifHeartbeat msg = new MsgNotifHeartbeat( app.getName(), app.getMySqlVm(), "192.168.1.45" ); msg.setModelRequired( true ); this.managerWrapper.getMessagingClient().getMessageProcessor().storeMessage( msg ); Thread.sleep( 100 ); Assert.assertEquals( 1, this.msgClient.allSentMessages.size()); Message sentMessage = this.msgClient.allSentMessages.get( 0 ); Assert.assertEquals( MsgCmdSetScopedInstance.class, sentMessage.getClass()); Assert.assertNotNull(((MsgCmdSetScopedInstance) sentMessage).getScopedInstance()); }</code><technical_language>A HUGE no. Do modify this test. Write a new one. This test prevents regressions</technical_language>

Target:
public void testMsgNotifHeartbeat_requestModel() throws Exception { TestApplication app = new TestApplication(); app.setDirectory( this.folder.newFolder()); ManagedApplication ma = new ManagedApplication( app ); this.managerWrapper.getNameToManagedApplication().put( app.getName(), ma ); this.msgClient.allSentMessages.clear(); Assert.assertEquals( 0, this.msgClient.allSentMessages.size()); MsgNotifHeartbeat msg = new MsgNotifHeartbeat( app.getName(), app.getMySqlVm(), "192.168.1.45" ); msg.setModelRequired( true ); this.managerWrapper.getMessagingClient().getMessageProcessor().storeMessage( msg ); Thread.sleep( 100 ); Assert.assertEquals( 1, this.msgClient.allSentMessages.size()); Message sentMessage = this.msgClient.allSentMessages.get( 0 ); Assert.assertEquals( MsgCmdSetScopedInstance.class, sentMessage.getClass()); Assert.assertNotNull(((MsgCmdSetScopedInstance) sentMessage).getScopedInstance()); }
Source:
<code>public void dropPartition(String databaseName, String tableName, List<String> parts, boolean deleteData) { Table tbl = getTableOrElseThrow(databaseName, tableName); Partition partition = getPartition(databaseName, tableName, parts) .orElseThrow(() -> new PartitionNotFoundException(new SchemaTableName(databaseName, tableName), parts)); try { glueClient.deletePartition(new DeletePartitionRequest() .withDatabaseName(databaseName) <START> .withTableName(tableName) <END> .withPartitionValues(parts)); } catch (AmazonServiceException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } String partLocation = partition.getStorage().getLocation(); if (deleteData && !isExternalTable(tbl) && !isNullOrEmpty(partLocation)) { deleteDir(hdfsContext, hdfsEnvironment, new Path(partLocation), true); } }</code><technical_language>Restore thread interrupt status interrupted: java if (e instanceof InterruptedException) { Thread.currentThread().interrupt(); }</technical_language>

Target:
public void dropPartition(String databaseName, String tableName, List<String> parts, boolean deleteData) { Table table = getTableOrElseThrow(databaseName, tableName); Partition partition = getPartition(databaseName, tableName, parts) .orElseThrow(() -> new PartitionNotFoundException(new SchemaTableName(databaseName, tableName), parts)); try { glueClient.deletePartition(new DeletePartitionRequest() .withDatabaseName(databaseName) .withTableName(tableName) .withPartitionValues(parts)); } catch (AmazonServiceException e) { throw new PrestoException(HIVE_METASTORE_ERROR, e); } String partLocation = partition.getStorage().getLocation(); if (deleteData && isManagedTable(table) && !isNullOrEmpty(partLocation)) { deleteDir(hdfsContext, hdfsEnvironment, new Path(partLocation), true); } }
Source:
<code>public void manages_a_forms_configuration() { ExportForms forms = new ExportForms(buildFormStatusList(2), new HashMap<>(), new HashMap<>()); FormStatus firstForm = forms.get(0); FormStatus secondForm = forms.get(1); <START> assertThat(forms.hasConfiguration(firstForm), is(false)); <END> forms.setConfiguration(firstForm, VALID_CONFIGURATION); assertThat(forms.hasConfiguration(firstForm), is(true)); assertThat(forms.getConfiguration(firstForm), isPresentAndIs(VALID_CONFIGURATION)); assertThat(forms.getConfiguration(firstForm.getFormDefinition()), isPresentAndIs(VALID_CONFIGURATION)); forms.setConfiguration(secondForm, INVALID_CONFIGURATION); assertThat(forms.getValidConfigurations().values(), Matchers.hasSize(1)); assertThat(forms.getValidConfigurations().values(), Matchers.contains(VALID_CONFIGURATION)); forms.removeConfiguration(firstForm); assertThat(forms.hasConfiguration(firstForm), is(false)); }</code><technical_language>starting actively dislike this verbose form (instead of assertFalse). I dislike if (value == false) ... I accept people styles, I live it</technical_language>

Target:
public void manages_a_forms_configuration() { ExportForms forms = new ExportForms(buildFormStatusList(2), ExportConfiguration.empty(), new HashMap<>(), new HashMap<>()); FormStatus firstForm = forms.get(0); FormStatus secondForm = forms.get(1); assertThat(forms.hasConfiguration(firstForm), is(false)); forms.putConfiguration(firstForm, VALID_CONFIGURATION); assertThat(forms.hasConfiguration(firstForm), is(true)); assertThat(forms.getConfiguration(firstForm.getFormDefinition().getFormId()), is(VALID_CONFIGURATION)); assertThat(forms.getConfiguration(firstForm.getFormDefinition().getFormId()), is(VALID_CONFIGURATION)); forms.putConfiguration(secondForm, INVALID_CONFIGURATION); assertThat(forms.getCustomConfigurations().values(), hasSize(2)); assertThat(forms.getCustomConfigurations().values(), contains(VALID_CONFIGURATION, INVALID_CONFIGURATION)); forms.removeConfiguration(firstForm); assertThat(forms.hasConfiguration(firstForm), is(false)); }
Source:
<code>protected boolean rewindToMarkAndSet(String value) { int markIndex = getLatestMarkPosition(steps); if (markIndex >= 0) { String markDatumId = steps.get(markIndex).getId(); steps = new Vector<>(steps.subList(0, markIndex)); <START> steps.addElement(new StackFrameStep(SessionFrame.STATE_DATUM_VAL, markDatumId, value)); <END> return true; } else { return false; } }</code><technical_language>I want unknown. datum_val sense for</technical_language>

Target:
protected boolean rewindToMarkAndSet(String value) { int markIndex = getLatestMarkPosition(steps); if (markIndex >= 0) { String markDatumId = steps.get(markIndex).getId(); steps = new Vector<>(steps.subList(0, markIndex)); if (value != null) { steps.addElement(new StackFrameStep(SessionFrame.STATE_UNKNOWN, markDatumId, value)); } return true; } else { return false; } }
Source:
<code>public synchronized void initialize(URI uri, Configuration configuration) { setConf(configuration); statistics = getStatistics(uri.getScheme(), getClass()); Map<String, Object> uriConfProperties = getConfigurationFromUri(uri); AlluxioProperties alluxioProperties = ConfigurationUtils.defaults(); InstancedConfiguration newConf = HadoopConfigurationUtils.mergeHadoopConfiguration(configuration, alluxioProperties); newConf.merge(uriConfProperties, Source.RUNTIME); mAlluxioConf = newConf; Properties metricsProps = new Properties(); for (Map.Entry<String, String> e : configuration) { metricsProps.setProperty(e.getKey(), e.getValue()); } MetricsSystem.startSinksFromConfig(new MetricsConfig(metricsProps)); mFileSystem = new LocalCacheFileSystem( <START> new AlluxioCachingClientFileSystem(fileSystem, mAlluxioConf), mAlluxioConf); <END> }</code><technical_language>move this previous line</technical_language>

Target:
public synchronized void initialize(URI uri, Configuration configuration) throws IOException { setConf(configuration); statistics = getStatistics(uri.getScheme(), getClass()); Map<String, Object> configurationFromUri = getConfigurationFromUri(uri); AlluxioProperties alluxioProperties = ConfigurationUtils.defaults(); InstancedConfiguration newConfiguration = HadoopConfigurationUtils.mergeHadoopConfiguration(configuration, alluxioProperties); newConfiguration.merge(configurationFromUri, Source.RUNTIME); mAlluxioConf = newConfiguration; Properties metricsProperties = new Properties(); for (Map.Entry<String, String> entry : configuration) { metricsProperties.setProperty(entry.getKey(), entry.getValue()); } MetricsSystem.startSinksFromConfig(new MetricsConfig(metricsProperties)); mFileSystem = new LocalCacheFileSystem(new AlluxioCachingClientFileSystem(fileSystem, mAlluxioConf), mAlluxioConf); super.initialize(uri, configuration); }
Source:
<code>public void removeScript(String name) { <START> if (!getScriptCache().containsKey(name)) { <END> throw log.noNamedScript(name); } else { getScriptCache().remove(name); } }</code><technical_language>do this a null check of return of remove ? else this atomic</technical_language>

Target:
public void removeScript(String name) { if (getScriptCache().remove(name) == null) { throw log.noNamedScript(name); } }
Source:
<code>public void should_return_http400_error_code_when_no_queryString() throws Exception { <START> Response response = request("/system/i18ntranslationv2").get(); <END> assertThat(response).hasStatus(Status.CLIENT_ERROR_BAD_REQUEST); }</code><technical_language>-1: i18ntranslation /system/i18ntranslationv2 is mapped</technical_language>

Target:
public void should_return_http400_error_code_when_no_queryString() throws Exception { Response response = request("/system/i18ntranslation").get(); assertThat(response).hasStatus(Status.CLIENT_ERROR_BAD_REQUEST); }
Source:
<code>private List<IClasspathEntry> collectExternalDependencies() { Builder<IClasspathEntry> result = ImmutableList.builder(); for (OmniExternalDependency dependency : this.gradleProject.getExternalDependencies()) { File dependencyFile = dependency.getFile(); String dependencyName = dependencyFile.getName(); if (!dependencyFile.exists()) { IPath path = new Path("/" + dependencyFile.getPath()); IResource member = this.eclipseProject.getProject().findMember(path); if (member != null) { IClasspathEntry entry = JavaCore.newLibraryEntry(member.getFullPath(), null, null); result.add(entry); <START> continue; <END> } } if (dependencyFile.isDirectory() || dependencyName.endsWith(".jar") || dependencyName.endsWith(".zip")) { IPath path = org.eclipse.core.runtime.Path.fromOSString(dependencyFile.getAbsolutePath()); File dependencySource = dependency.getSource(); IPath sourcePath = dependencySource != null ? org.eclipse.core.runtime.Path.fromOSString(dependencySource.getAbsolutePath()) : null; IClasspathEntry entry = JavaCore.newLibraryEntry(path, sourcePath, null, ClasspathUtils.createAccessRules(dependency), ClasspathUtils .createClasspathAttributes(dependency), dependency.isExported()); result.add(entry); } } return result.build(); }</code><technical_language>else instead of continue</technical_language>

Target:
private List<IClasspathEntry> collectExternalDependencies() { Builder<IClasspathEntry> result = ImmutableList.builder(); for (OmniExternalDependency dependency : this.gradleProject.getExternalDependencies()) { File dependencyFile = dependency.getFile(); boolean linkedResourceCreated = tryCreatingLinkedResource(dependencyFile, result); if (!linkedResourceCreated) { String dependencyName = dependencyFile.getName(); if (dependencyFile.isDirectory() || dependencyName.endsWith(".jar") || dependencyName.endsWith(".zip")) { IPath path = org.eclipse.core.runtime.Path.fromOSString(dependencyFile.getAbsolutePath()); File dependencySource = dependency.getSource(); IPath sourcePath = dependencySource != null ? org.eclipse.core.runtime.Path.fromOSString(dependencySource.getAbsolutePath()) : null; IClasspathEntry entry = JavaCore.newLibraryEntry(path, sourcePath, null, ClasspathUtils.createAccessRules(dependency), ClasspathUtils .createClasspathAttributes(dependency), dependency.isExported()); result.add(entry); } } } return result.build(); }
Source:
<code>public SlackNotificationPayloadContent(){ <START> payloadCommits = new PayloadContentCommits(); <END> }</code><technical_language>move this declaration variable initializer top of file save additional 3 declarations. this() call next constructor, a practice. (I this is case right now, title is called refactoring sense ;) )</technical_language>

Target:
public SlackNotificationPayloadContent(){ }
Source:
<code>if (a instanceof TimeGraphEntry && b instanceof TimeGraphEntry) { ITimeGraphEntryModel aModel = ((TimeGraphEntry) a).getModel(); ITimeGraphEntryModel bModel = ((TimeGraphEntry) b).getModel(); if (aModel instanceof <START> traceEntryModel && <END> bModel instanceof traceEntryModel) { ITmfTrace ta = ((traceEntryModel) a).getTrace(); ITmfTrace tb = ((traceEntryModel) b).getTrace(); if (ta instanceof TmfExperiment && !(tb instanceof TmfExperiment)) { return -1; } else if (!(ta instanceof TmfExperiment) && (tb instanceof TmfExperiment)) { return 1; } } }</code><technical_language>Class name start capital letter</technical_language>

Target:
if (a instanceof TimeGraphEntry && b instanceof TimeGraphEntry) { ITimeGraphEntryModel aModel = ((TimeGraphEntry) a).getModel(); ITimeGraphEntryModel bModel = ((TimeGraphEntry) b).getModel(); if (aModel instanceof TraceEntryModel && bModel instanceof TraceEntryModel) { ITmfTrace ta = ((TraceEntryModel) a).getTrace(); ITmfTrace tb = ((TraceEntryModel) b).getTrace(); if (ta instanceof TmfExperiment && !(tb instanceof TmfExperiment)) { return -1; } else if (!(ta instanceof TmfExperiment) && (tb instanceof TmfExperiment)) { return 1; } } }
Source:
<code>private boolean isOgmEnabled(Map<?, ?> settings) { Boolean ogmEnabled = new ConfigurationPropertyReader( settings ) .property( OgmProperties.ENABLED, boolean.class ) .withDefault( false ) .getValue(); <START> return ogmEnabled || isOgmImplicitEnabled( settings ); <END> }</code><technical_language>I start OGM if ogmEnabled is set false. do if null</technical_language>

Target:
private boolean isOgmEnabled(Map<?, ?> settings) { Boolean ogmEnabled = new ConfigurationPropertyReader( settings ) .property( OgmProperties.ENABLED, Boolean.class ) .getValue(); if ( ogmEnabled == null ) { return isOgmImplicitEnabled( settings ); } return ogmEnabled; }
Source:
<code>private boolean satisfiedByNetCapabilities(NetworkCapabilities nc, boolean onlyImmutable) { long requestedCapabilities = mNetworkCapabilities; long requestedUnwantedCapabilities = mUnwantedNetworkCapabilities; long providedCapabilities = nc.mNetworkCapabilities; if (onlyImmutable) { requestedCapabilities &= ~MUTABLE_CAPABILITIES; requestedUnwantedCapabilities &= ~MUTABLE_CAPABILITIES; <START> providedCapabilities &= ~MUTABLE_CAPABILITIES; <END> } return ((providedCapabilities & requestedCapabilities) == requestedCapabilities) && ((requestedUnwantedCapabilities & providedCapabilities) == 0); }</code><technical_language>I this line anything. Rationale: providedCapabilities ANDing requestedCapabilities requestedUnwantedCapabilities. MUTABLE_CAPABILITIES masked out. result of ANDs guaranteed MUTABLE_CAPABILITIES masked out if this line is present. Remove</technical_language>

Target:
private boolean satisfiedByNetCapabilities(NetworkCapabilities nc, boolean onlyImmutable) { long requestedCapabilities = mNetworkCapabilities; long requestedUnwantedCapabilities = mUnwantedNetworkCapabilities; long providedCapabilities = nc.mNetworkCapabilities; if (onlyImmutable) { requestedCapabilities &= ~MUTABLE_CAPABILITIES; requestedUnwantedCapabilities &= ~MUTABLE_CAPABILITIES; } return ((providedCapabilities & requestedCapabilities) == requestedCapabilities) && ((requestedUnwantedCapabilities & providedCapabilities) == 0); }
Source:
<code>@Override public void visitToken(DetailAST ast) { DetailAST nodeWithAnnotations = ast; <START> if (ast.getType() == TokenTypes.TYPECAST) { <END> nodeWithAnnotations = ast.findFirstToken(TokenTypes.TYPE); } DetailAST modifiersNode = nodeWithAnnotations.findFirstToken(TokenTypes.MODIFIERS); if (modifiersNode == null) { modifiersNode = nodeWithAnnotations.findFirstToken(TokenTypes.ANNOTATIONS); } if (modifiersNode != null) { for (DetailAST annotationNode = modifiersNode.getFirstChild(); annotationNode != null; annotationNode = annotationNode.getNextSibling()) { if (annotationNode.getType() == TokenTypes.ANNOTATION && OVERRIDE.equals(getAnnotationName(annotationNode)) && onDifferentLines(annotationNode)) { log(annotationNode.getLineNo(), DIFF_LINE_ERR_MSG, getAnnotationName(annotationNode)); } } } }</code><technical_language>below: Please, remove curly brackets for one-line statement if</technical_language>

Target:
@Override public void visitToken(DetailAST ast) { DetailAST node = ast.findFirstToken(MODIFIERS); if (node == null) node = ast.findFirstToken(ANNOTATIONS); if (node == null) return; for (node = node.getFirstChild(); node != null; node = node.getNextSibling()) { if (node.getType() == TokenTypes.ANNOTATION && Override.class.getSimpleName().equals(annotationName(node)) && node.getLineNo() != nextNode(node).getLineNo()) log(node.getLineNo(), DIFF_LINE_ERR_MSG, annotationName(node)); } }
Source:
<code>public void testSimulatePackfileReplacement() throws Exception { File f1 = createFile("file"); File f2 = createFile("fool"); waitNextSec(f2); waitNextSec(f2); FileTime timestamp = Files.getLastModifiedTime(f1.toPath()); FileSnapshot save = FileSnapshot.save(f1); Files.move(f2.toPath(), f1.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE); Files.setLastModifiedTime(f1.toPath(), timestamp); <START> assertTrue(save.isModified(f1)); <END> assertTrue("unexpected change of fileKey", save.wasFileKeyChanged()); assertFalse("unexpected size change", save.wasSizeChanged()); assertFalse("unexpected lastModified change", save.wasLastModifiedChanged()); assertFalse("lastModified was unexpectedly racily clean", save.wasLastModifiedRacilyClean()); }</code><technical_language>fails Windows</technical_language>

Target:
public void testSimulatePackfileReplacement() throws Exception { Assume.assumeFalse(SystemReader.getInstance().isWindows()); File f1 = createFile("file"); File f2 = createFile("fool"); waitNextSec(f2); waitNextSec(f2); FileTime timestamp = Files.getLastModifiedTime(f1.toPath()); FileSnapshot save = FileSnapshot.save(f1); Files.move(f2.toPath(), f1.toPath(), StandardCopyOption.REPLACE_EXISTING, StandardCopyOption.ATOMIC_MOVE); Files.setLastModifiedTime(f1.toPath(), timestamp); assertTrue(save.isModified(f1)); assertTrue("unexpected change of fileKey", save.wasFileKeyChanged()); assertFalse("unexpected size change", save.wasSizeChanged()); assertFalse("unexpected lastModified change", save.wasLastModifiedChanged()); assertFalse("lastModified was unexpectedly racily clean", save.wasLastModifiedRacilyClean()); }
Source:
<code>public boolean hasPreciseLocation() { <START> return isLocationPrecise && (ownLocation != null); <END> }</code><technical_language>rlly nit-picky: turn from: is location precise do do a location is precise</technical_language>

Target:
public boolean hasPreciseLocation() { return (ownLocation != null) && isLocationPrecise; }
Source:
<code><START> public Timestamp handle(TUAssignProject command) <END> throws TUFailedToCreateProject { throw new TUFailedToCreateProject(getId()); }</code><technical_language>Please fix this method sense in terms of everything. LGTM</technical_language>

Target:
public TUProjectAssigned handle(TUAssignProject command) throws TUFailedToAssignProject { throw new TUFailedToAssignProject(getId()); }
Source:
<code>public String docs() { <START> return "boolean {locationArray, [name]} Sets the name to the Command Block at the given location." <END> + "If no name is given, the Command Block's name is set to @."; }</code><technical_language>one</technical_language>

Target:
public String docs() { return "void {locationArray, [name]} Sets the name of the Command Block at the given location." + "If no name is given or name is null, the Command Block's name is reset to @."; }
Source:
<code>private boolean validateStorageNameUpdate() { storageDomainNameChanged = !StringUtils.equals(oldDomain.getStorageName(), getStorageDomain().getStorageName()); if (storageDomainNameChanged) { if (!checkStorageDomainStatus(StorageDomainStatus.Active) || !checkStorageDomainNameLengthValid()) { return false; } <START> if (storageDomainNameChanged && !validate(new StoragePoolValidator(getStoragePool()).isUp())) { <END> return false; } if (storageDomainNameChanged && isStorageWithSameNameExists()) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_NAME_ALREADY_EXIST); } } return true; }</code><technical_language>storageDomainNameChanged is true this point - re-check it</technical_language>

Target:
private boolean validateStorageNameUpdate() { storageDomainNameChanged = !StringUtils.equals(oldDomain.getStorageName(), getStorageDomain().getStorageName()); if (!storageDomainNameChanged) { return true; } return checkStorageDomainStatus(StorageDomainStatus.Active) && checkStorageDomainNameLengthValid() && descriptionChangeAllowed() && validateNotTheSameName(); }
Source:
<code>public void handle(Willie bot, Channel channel, User sender, String[] args) { <START> if(args.length==0 || args.length >= 2) { <END> bot.sendAction(channel, "Please use '!pet <person>'!"); return; } String person = args[0]; bot.sendAction(channel, "pets " + person); }</code><technical_language>!= 1</technical_language>

Target:
public void handle(Willie bot, Channel channel, User sender, String[] args) { if(args.length==0) { bot.sendAction(channel, "pets everyone!"); return; } else if(args.length==1){ bot.sendAction(channel, "pets " + args[0]); } else { bot.sendAction(channel, "Please use !pet or !pet <person>!"); } }
Source:
<code>public <T extends IResource> T update(T resource) { try { final URL endpoint = new URLBuilder(getBaseURL(), getTypeMappings()) .resource(resource) .addParmeter("namespace", resource.getNamespace()) .build(); String response = client.put(endpoint, IHttpClient.DEFAULT_READ_TIMEOUT, resource); LOGGER.debug(response); return factory.create(response); } catch (HttpClientException e){ <START> throw handleHttpClientException("Exception creating the resource", e); <END> } catch (SocketTimeoutException e) { throw new com.openshift.client.OpenShiftException(e, "SocketTimeout creating resource %", resource.getName()); } }</code><technical_language>@tomason Update error message(s) reflect operation (e.g. creating->update)</technical_language>

Target:
public <T extends IResource> T update(T resource) { try { final URL endpoint = new URLBuilder(getBaseURL(), getTypeMappings()) .resource(resource) .addParmeter("namespace", resource.getNamespace()) .build(); String response = client.put(endpoint, IHttpClient.DEFAULT_READ_TIMEOUT, resource); LOGGER.debug(response); return factory.create(response); } catch (HttpClientException e){ throw handleHttpClientException("Exception updating the resource", e); } catch (SocketTimeoutException e) { throw new com.openshift.client.OpenShiftException(e, "SocketTimeout updating resource %", resource.getName()); } }
Source:
<code>public void execute(DatastoreService ds, String[] args) throws Exception { Long surveyId = null; boolean doit = false; final List<Key> toBeRemoved = new ArrayList<>(); for (int i = 0; i < args.length; i++) { <START> if (args[i].equalsIgnoreCase("--doit")) { <END> doit = true; } else { surveyId = Long.parseLong(args[i]); } } if (surveyId == null) { System.out.println("No Survey id parameter given!"); return; } DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); df.setTimeZone(TimeZone.getTimeZone("UT")); try { Entity survey = ds.get(KeyFactory.createKey("SurveyGroup", surveyId)); toBeRemoved.add(survey.getKey()); if (! "PROJECT".equals(survey.getProperty("projectType"))) { System.out.println("Survey not found: " + surveyId); return; } List<Key> formList = formsOfSurvey(ds,surveyId); if (formList.size() > 0) { System.out.println("Survey " + surveyId + " not empty. Forms: " + formList); return; } if (doit) { System.out.println("Deleting survey " + surveyId); ds.delete(toBeRemoved); } else { System.out.println("Not deleting survey " + surveyId); } } catch (EntityNotFoundException e) { System.out.println("Survey not found: " + surveyId); return; } }</code><technical_language>interchangeability of arguments</technical_language>

Target:
public void execute(DatastoreService ds, String[] args) throws Exception { Long surveyId = null; boolean doit = false; final List<Key> toBeRemoved = new ArrayList<>(); for (int i = 0; i < args.length; i++) { if (args[i].equalsIgnoreCase("--doit")) { doit = true; } else { surveyId = Long.parseLong(args[i]); } } if (surveyId == null) { System.out.println("No Survey id parameter given!"); return; } DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); df.setTimeZone(TimeZone.getTimeZone("UT")); try { Entity survey = ds.get(KeyFactory.createKey("SurveyGroup", surveyId)); toBeRemoved.add(survey.getKey()); if (! "PROJECT".equals(survey.getProperty("projectType"))) { System.out.println("Survey not found: " + surveyId); return; } List<Key> formList = formsOfSurvey(ds,surveyId); if (formList.size() > 0) { System.out.println("Survey " + surveyId + " not empty. Forms: " + formList); return; } if (doit) { System.out.println("Deleting survey " + surveyId); DataUtils.batchDelete(ds,toBeRemoved); } else { System.out.println("Not deleting survey " + surveyId); } } catch (EntityNotFoundException e) { System.out.println("Survey not found: " + surveyId); return; } }
Source:
<code>public int canAdapt( final RepositoryBaseResource resource ) { int score = super.canAdapt( resource ); if ( score > 0 ) { <START> if ( "maven2".equals( resource.getProvider() ) ) <END> { score++; } } return score; }</code><technical_language>const instead of duplicating strings this</technical_language>

Target:
public int canAdapt( final RepositoryBaseResource resource ) { int score = super.canAdapt( resource ); if ( score > 0 ) { if ( JerseyMavenHostedRepository.PROVIDER.equals( resource.getProvider() ) ) { score++; } } return score; }
Source:
<code>public void accept( final Collection<Session> sessions, final ServerMessageEnvelope serverEventEnvelope) { log.info("Broadcasting: {}", serverEventEnvelope); <START> ImmutableSet.copyOf(sessions) <END> .parallelStream() .filter(Session::isOpen) .forEach(s -> messageSender.accept(s, serverEventEnvelope)); }</code><technical_language>want stick standard library here, i.e. Set#copyOf(Collection) same</technical_language>

Target:
public void accept( final Collection<Session> sessions, final ServerMessageEnvelope serverEventEnvelope) { log.info("Broadcasting: {}", serverEventEnvelope); Set.copyOf(sessions) .parallelStream() .filter(Session::isOpen) .forEach(s -> messageSender.accept(s, serverEventEnvelope)); }
Source:
<code>private void checkRequiredProperties(EPersonRest epersonRest) { MetadataRest metadataRest = epersonRest.getMetadata(); if (metadataRest != null) { List<MetadataValueRest> epersonFirstName = metadataRest.getMap().get("eperson.firstname"); List<MetadataValueRest> epersonLastName = metadataRest.getMap().get("eperson.lastname"); if (epersonFirstName == null || epersonLastName == null || <START> epersonFirstName.isEmpty() || epersonLastName.isEmpty()) { <END> throw new DSpaceBadRequestException("The eperson.firstname and eperson.lastname values need to be " + "filled in"); } } String password = epersonRest.getPassword(); if (!accountService.verifyPasswordStructure(password)) { throw new DSpaceBadRequestException("the password cannot be left blank"); } }</code><technical_language>This if simplified StringUtils.isNotBlank in other methods. checks for null empty</technical_language>

Target:
private void checkRequiredProperties(EPersonRest epersonRest) { MetadataRest metadataRest = epersonRest.getMetadata(); if (metadataRest != null) { List<MetadataValueRest> epersonFirstName = metadataRest.getMap().get("eperson.firstname"); List<MetadataValueRest> epersonLastName = metadataRest.getMap().get("eperson.lastname"); if (epersonFirstName == null || epersonLastName == null || epersonFirstName.isEmpty() || epersonLastName.isEmpty()) { throw new DSpaceBadRequestException("The eperson.firstname and eperson.lastname values need to be " + "filled in"); } } String password = epersonRest.getPassword(); if (!accountService.verifyPasswordStructure(password)) { throw new DSpaceBadRequestException("The given password is invalid"); } }
Source:
<code>public Double getOpening(int bp) { <START> if (bp < 0 || bp >= getPairingParameters().length) throw new IllegalArgumentException(); <END> return pairingParameters[bp][2]; }</code><technical_language>This check refactored a method instead of repeated times. if guava is classpath for this module, checkArgument</technical_language>

Target:
public Double getOpening(int bp) { checkArgument(bp); return pairingParameters[bp][2]; }
Source:
<code>protected synchronized void modified(Map<String, Object> properties) { if (properties != null) { String enabled = (String) properties.get("enabled"); if ("false".equalsIgnoreCase(enabled)) { this.enabled = false; } else if ("true".equalsIgnoreCase(enabled)) { this.enabled = true; } } if (enabled) { logger.info("Enabling channel item provider."); for (ProviderChangeListener<Item> listener : listeners) { for (Item item : getAll()) { listener.added(this, item); } } this.linkRegistry.addRegistryChangeListener(linkRegistryListener); this.itemRegistry.addRegistryChangeListener(itemRegistryListener); this.thingRegistry.addRegistryChangeListener(thingRegistryListener); } else { <START> logger.info("Disabling channel item provider."); <END> for (ProviderChangeListener<Item> listener : listeners) { for (Item item : getAll()) { listener.removed(this, item); } } removeRegistryChangeListeners(); } }</code><technical_language>change this debug</technical_language>

Target:
protected synchronized void modified(Map<String, Object> properties) { if (properties != null) { String enabled = (String) properties.get("enabled"); if ("false".equalsIgnoreCase(enabled)) { this.enabled = false; } else { this.enabled = true; } } if (enabled) { logger.debug("Enabling channel item provider."); for (ProviderChangeListener<Item> listener : listeners) { for (Item item : getAll()) { listener.added(this, item); } } this.linkRegistry.addRegistryChangeListener(linkRegistryListener); this.itemRegistry.addRegistryChangeListener(itemRegistryListener); this.thingRegistry.addRegistryChangeListener(thingRegistryListener); } else { logger.debug("Disabling channel item provider."); for (ProviderChangeListener<Item> listener : listeners) { for (Item item : getAll()) { listener.removed(this, item); } } removeRegistryChangeListeners(); } }
Source:
<code>public void testExecuteQuery() throws Exception { <START> try (Connection connection = createConnection(); <END> PreparedStatement statement = connection.prepareStatement( "SELECT ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?")) { setTestValues(statement); try (ResultSet rs = statement.executeQuery()) { assertTrue(rs.next()); assertTestValues(rs); assertFalse(rs.next()); } } }</code><technical_language>need for quiet</technical_language>

Target:
public void testExecuteQuery() throws Exception { try (Connection connection = createConnection(); PreparedStatement statement = connection.prepareStatement("SELECT ?, ?")) { statement.setInt(1, 123); statement.setString(2, "hello"); try (ResultSet rs = statement.executeQuery()) { assertTrue(rs.next()); assertEquals(rs.getInt(1), 123); assertEquals(rs.getString(2), "hello"); assertFalse(rs.next()); } assertTrue(statement.execute()); try (ResultSet rs = statement.getResultSet()) { assertTrue(rs.next()); assertEquals(rs.getInt(1), 123); assertEquals(rs.getString(2), "hello"); assertFalse(rs.next()); } } }