auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private InputStream filterClean(InputStream in, OperationType opType) throws IOException { in = handleAutoCRLF(in, opType); String filterCommand = getCleanFilterCommand(); if (filterCommand != null) { if (Repository.isRegistered(filterCommand)) { LocalFile buffer = new TemporaryBuffer.LocalFile(null); FilterCommand command = Repository.getCommand(filterCommand, repository, in, buffer); while (command.run() != -1) ; return buffer.openInputStream(); } else { FS fs = repository.getFS(); ProcessBuilder filterProcessBuilder = fs.runInShell(filterCommand, new String[0]); filterProcessBuilder.directory(repository.getWorkTree()); filterProcessBuilder.environment().put(Constants.GIT_DIR_KEY, repository.getDirectory().getAbsolutePath()); ExecutionResult result; try { result = fs.execute(filterProcessBuilder, in); } catch (IOException | InterruptedException e) { throw new IOException(new FilterFailedException(e, filterCommand, getEntryPathString())); } int rc = result.getRc(); if (rc != 0) { throw new IOException(new FilterFailedException(rc, filterCommand, getEntryPathString(), result.getStdout().toByteArray(MAX_EXCEPTION_TEXT_SIZE), RawParseUtils.decode(result.getStderr() .toByteArray(MAX_EXCEPTION_TEXT_SIZE)))); } return result.getStdout().openInputStream(); } } return in; }

Target:
private InputStream filterClean(InputStream in, OperationType opType) throws IOException { in = handleAutoCRLF(in, opType); String filterCommand = getCleanFilterCommand(); if (filterCommand != null) { if (Repository.isRegistered(filterCommand)) { LocalFile buffer = new TemporaryBuffer.LocalFile(null); FilterCommand command = Repository.getCommand(filterCommand, repository, in, buffer); while (command.run() != -1) { } return buffer.openInputStream(); } FS fs = repository.getFS(); ProcessBuilder filterProcessBuilder = fs.runInShell(filterCommand, new String[0]); filterProcessBuilder.directory(repository.getWorkTree()); filterProcessBuilder.environment().put(Constants.GIT_DIR_KEY, repository.getDirectory().getAbsolutePath()); ExecutionResult result; try { result = fs.execute(filterProcessBuilder, in); } catch (IOException | InterruptedException e) { throw new IOException(new FilterFailedException(e, filterCommand, getEntryPathString())); } int rc = result.getRc(); if (rc != 0) { throw new IOException(new FilterFailedException(rc, filterCommand, getEntryPathString(), result.getStdout().toByteArray(MAX_EXCEPTION_TEXT_SIZE), RawParseUtils.decode(result.getStderr() .toByteArray(MAX_EXCEPTION_TEXT_SIZE)))); } return result.getStdout().openInputStream(); } return in; }
Source:
public JmsConfiguration incomingOsgpCoreResponsesJmsConfiguration( final JmsConfigurationFactory jmsConfigurationFactory) { return jmsConfigurationFactory.initializeConfiguration("jms.incoming.osgp.core.responses", this.incomingOsgpCoreResponseMessageListener); }

Target:
public JmsConfiguration incomingOsgpCoreResponsesJmsConfiguration( final JmsConfigurationFactory jmsConfigurationFactory) { return jmsConfigurationFactory.initializeReceiveConfiguration("jms.incoming.osgp.core.responses", this.incomingOsgpCoreResponseMessageListener); }
Source:
public void setUp() throws IOException { InputStream input = InstrumentationRegistry.getContext().getResources() .openRawResource(com.bugsnag.android.test.R.raw.error); File fixtureFile = File.createTempFile("error", ".json"); OutputStream output = new FileOutputStream(fixtureFile); try { byte[] buffer = new byte[1024]; int read; while ((read = input.read(buffer)) != -1) { output.write(buffer, 0, read); } output.flush(); } finally { output.close(); } error = ErrorReader.readError(new Configuration("key"), fixtureFile); }

Target:
public static void setUp() throws IOException { InputStream input = InstrumentationRegistry.getContext().getResources() .openRawResource(com.bugsnag.android.test.R.raw.error); File fixtureFile = File.createTempFile("error", ".json"); OutputStream output = new FileOutputStream(fixtureFile); try { byte[] buffer = new byte[1024]; int read; while ((read = input.read(buffer)) != -1) { output.write(buffer, 0, read); } output.flush(); } finally { output.close(); } error = ErrorReader.readError(new Configuration("key"), fixtureFile); }
Source:
public synchronized void setupManager( String startPoint, String inputFile, String protocol, String host, int port, String extention, int ThreadNumber, boolean doDirs, boolean doFiles, boolean recursive, boolean blankExt, Vector extToUse) { totalDone = 0; this.startPoint = startPoint; this.inputFile = inputFile; this.firstPartOfURL = protocol + "://" + host + ":" + port; this.extention = extention; this.protocol = protocol; this.host = host; this.port = port; workerCount = ThreadNumber; this.doFiles = doFiles; this.doDirs = doDirs; this.recursive = recursive; this.blankExt = blankExt; this.extToUse = extToUse; URL url; try { url = new URL(firstPartOfURL + startPoint); } catch (MalformedURLException ex) { LOG.error("Bad URL", ex); } LOG.info("Starting dir/file list based brute forcing"); setpUpHttpClient(); createTheThreads(); workGen = new WorkerGenerator(this); }

Target:
public void setupManager( String startPoint, String inputFile, String protocol, String host, int port, String extention, int ThreadNumber, boolean doDirs, boolean doFiles, boolean recursive, boolean blankExt, Vector extToUse) { totalDone = 0; this.startPoint = startPoint; this.inputFile = inputFile; this.firstPartOfURL = protocol + "://" + host + ":" + port; this.extention = extention; this.protocol = protocol; this.host = host; this.port = port; workerCount = ThreadNumber; this.doFiles = doFiles; this.doDirs = doDirs; this.recursive = recursive; this.blankExt = blankExt; this.extToUse = extToUse; URL url; try { url = new URL(firstPartOfURL + startPoint); } catch (MalformedURLException ex) { LOG.error("Bad URL", ex); } LOG.info("Starting dir/file list based brute forcing"); setpUpHttpClient(); createTheThreads(); workGen = new WorkerGenerator(this); }
Source:
default void perform(@NonNull Run<?, ?> run, @NonNull FilePath workspace, @NonNull EnvVars env, @NonNull Launcher launcher, @NonNull TaskListener listener) throws InterruptedException, IOException { if (!Util.isOverridden(SimpleBuildStep.class, this.getClass(), "perform", Run.class, FilePath.class, Launcher.class, TaskListener.class)) { throw new AbstractMethodError(); } this.perform(run, workspace, launcher, listener); }

Target:
default void perform(@NonNull Run<?, ?> run, @NonNull FilePath workspace, @NonNull EnvVars env, @NonNull Launcher launcher, @NonNull TaskListener listener) throws InterruptedException, IOException { if (Util.isOverridden(SimpleBuildStep.class, this.getClass(), "perform", Run.class, FilePath.class, Launcher.class, TaskListener.class)) { this.perform(run, workspace, launcher, listener); } else { throw new AbstractMethodError(); } }
Source:
public RabbitMQTaskQueue(Connection conn, String exchange, String queueName) { try { this.exchangeName = exchange; mqChannel = conn.createChannel(); mqChannel.queueBind(queueName, exchange, queueName); queueUrl = "RabbitMQ-" + conn.getAddress(); this.queueName = queueName; } catch (Exception ex) { log.error("Failed to estabilish connection to RabbitMQ with queue name and URL because {}", queueName, queueUrl, ex.getMessage()); throw new DuraCloudRuntimeException(ex); } }

Target:
public RabbitMQTaskQueue(Connection conn, String exchange, String queueName) { try { this.exchangeName = exchange; mqChannel = conn.createChannel(); mqChannel.queueBind(queueName, exchange, queueName); queueUrl = "(RabbitMQ) " + conn.getAddress(); this.queueName = queueName; } catch (Exception ex) { log.error("Failed to estabilish connection to RabbitMQ with queue name and URL because {}", queueName, queueUrl, ex.getMessage()); throw new DuraCloudRuntimeException(ex); } }
Source:
public ServiceBundle getServiceBundleByName(String serviceName) { Collection<ServiceBundle> serviceBundles = listServiceBundles(Lists.newArrayList(new QueryParam("name", serviceName))); if (serviceBundles.size() > 1) { LOG.warn("Multiple service bundles have same name: returning first match.", serviceName); return serviceBundles.iterator().next(); } else if (serviceBundles.size() == 1) { return serviceBundles.iterator().next(); } return null; }

Target:
public ServiceBundle getServiceBundleByName(String serviceName) { Collection<ServiceBundle> serviceBundles = listServiceBundles(Lists.newArrayList(new QueryParam("name", serviceName))); if (serviceBundles.size() > 1) { LOG.warn("Multiple service bundles with the same name: returning first match.", serviceName); return serviceBundles.iterator().next(); } else if (serviceBundles.size() == 1) { return serviceBundles.iterator().next(); } return null; }
Source:
public void addData(String guid, String classification, PageOrientation orientation) { DataRightEntry toAdd = new DataRightEntry(); toAdd.setClassification(classification); toAdd.setGuid(guid); toAdd.setOrientation(orientation); getData(); data.add(toAdd); }

Target:
public void addData(String guid, String classification, PageOrientation orientation) { DataRightEntry toAdd = new DataRightEntry(); toAdd.setClassification(classification); toAdd.setGuid(guid); toAdd.setOrientation(orientation); getData().add(toAdd); }
Source:
public Object visit(ASTMethodDeclaration node, Object data) { ASTCompilationUnit acu = node.getFirstParentOfType(ASTCompilationUnit.class); if (isJUnit5Class(acu) || isJUnit4Class(acu)) { return super.visit(node, data); } if (node.getArity() != 0) { return super.visit(node, data); } String name = node.getName(); if (!"setUp".equals(name) && "setup".equalsIgnoreCase(name)) { addViolation(data, node); } if (!"tearDown".equals(name) && "teardown".equalsIgnoreCase(name)) { addViolation(data, node); } return super.visit(node, data); }

Target:
public Object visit(ASTMethodDeclaration node, Object data) { if (isJUnit5Class || isJUnit4Class) { return super.visit(node, data); } if (node.getArity() != 0) { return super.visit(node, data); } String name = node.getName(); if (!"setUp".equals(name) && "setup".equalsIgnoreCase(name)) { addViolation(data, node); } if (!"tearDown".equals(name) && "teardown".equalsIgnoreCase(name)) { addViolation(data, node); } return super.visit(node, data); }
Source:
public Result apply(TableScanNode tableScanNode, Captures captures, Context context) { if (tableScanNode.getLayout().isPresent()) { return Result.empty(); } Optional<TableLayoutResult> layout = metadata.getLayout( context.getSession(), tableScanNode.getTable(), Constraint.alwaysTrue(), Optional.of(tableScanNode.getOutputSymbols().stream() .map(tableScanNode.getAssignments()::get) .collect(toImmutableSet()))); if (!layout.isPresent() || layout.get().getLayout().getPredicate().isNone()) { return Result.ofPlanNode(new ValuesNode(context.getIdAllocator().getNextId(), tableScanNode.getOutputSymbols(), ImmutableList.of())); } return Result.ofPlanNode(new TableScanNode( tableScanNode.getId(), tableScanNode.getTable(), tableScanNode.getOutputSymbols(), tableScanNode.getAssignments(), Optional.of(layout.get().getLayout().getHandle()), layout.get().getLayout().getPredicate(), TupleDomain.all())); }

Target:
public Result apply(TableScanNode tableScanNode, Captures captures, Context context) { if (tableScanNode.getTable().getLayout().isPresent()) { return Result.empty(); } TableLayoutResult layout = metadata.getLayout( context.getSession(), tableScanNode.getTable(), Constraint.alwaysTrue(), Optional.of(tableScanNode.getOutputSymbols().stream() .map(tableScanNode.getAssignments()::get) .collect(toImmutableSet()))); if (layout.getLayout().getPredicate().isNone()) { return Result.ofPlanNode(new ValuesNode(context.getIdAllocator().getNextId(), tableScanNode.getOutputSymbols(), ImmutableList.of())); } return Result.ofPlanNode(new TableScanNode( tableScanNode.getId(), layout.getLayout().getNewTableHandle(), tableScanNode.getOutputSymbols(), tableScanNode.getAssignments(), layout.getLayout().getPredicate(), TupleDomain.all())); }
Source:
private Map<String,String> getMappingTable() { Map<String,String> mappings = new HashMap<>(); if (hasMappingTable()) { ResultSet resultSet = session.execute("SELECT project_id,project_name FROM openshift_metrics.metrics_mappings;"); for (Row row: resultSet.all()) { mappings.put(row.getString("project_id"), row.getString("project_name")); } } return mappings; }

Target:
private Map<String,String> getMappingTable() { PreparedStatement findMappings = session.prepare( "SELECT project_id, project_name " + "FROM openshift_metrics.metrics_mappings " + "WHERE token(project_id) > ? AND token(project_id) <= ?"); Map<String,String> mappings = new HashMap<>(); if (hasMappingTable()) { for (TokenRange tokenRange : getTokenRanges()) { BoundStatement boundStatement = findMappings.bind().setToken(0, tokenRange.getStart()) .setToken(1, tokenRange.getEnd()); ResultSet resultSet = session.execute(boundStatement); resultSet.forEach(row -> mappings.put(row.getString(0), row.getString(1))); } } mappings.remove("%succeeded"); return mappings; }
Source:
public void validate(KerberosCredentials credentials, WebContext context) throws CredentialsException { logger.trace("Try to validate Kerberos Token:" + credentials.getKerberosTicketAsString()); KerberosTicketValidation ticketValidation = this.ticketValidator.validateTicket(credentials.getKerberosTicket()); logger.debug("Kerberos Token validated"); String subject = ticketValidation.username(); logger.debug("Succesfully validated " + subject); KerberosProfile profile = new KerberosProfile(); profile.setId(subject); profile.gssContext = ticketValidation.getGssContext(); credentials.setUserProfile(profile); if (!subject.contains(UserProfile.SEPARATOR)) { subject = KerberosProfile.class.getSimpleName() + UserProfile.SEPARATOR + subject; } logger.debug("Succesfully validated, updated subject: " + subject); }

Target:
public void validate(KerberosCredentials credentials, WebContext context) throws CredentialsException { init(context); logger.trace("Try to validate Kerberos Token:" + credentials.getKerberosTicketAsString()); KerberosTicketValidation ticketValidation = this.ticketValidator.validateTicket(credentials.getKerberosTicket()); logger.debug("Kerberos Token validated"); String subject = ticketValidation.username(); logger.debug("Succesfully validated " + subject); KerberosProfile profile = new KerberosProfile(); profile.setId(subject); profile.gssContext = ticketValidation.getGssContext(); credentials.setUserProfile(profile); }
Source:
protected List<OvfEntityData> getEntitiesFromStorageOvfDisk() { List<OvfEntityData> ovfEntitiesFromTar = Collections.emptyList(); List<Disk> unregisteredDisks = getBackend().runInternalQuery(VdcQueryType.GetUnregisteredDisks, new GetUnregisteredDisksQueryParameters(getParameters().getStorageDomainId(), getVds().getStoragePoolId())).getReturnValue(); if (!unregisteredDisks.isEmpty()) { Pair<DiskImage, Long> ovfDiskAndSize = getLatestOVFDisk(unregisteredDisks); DiskImage ovfDisk = ovfDiskAndSize.getFirst(); if (ovfDisk != null) { try { VDSReturnValue retrievedByteData = runVdsCommand(VDSCommandType.RetrieveImageData, new ImageHttpAccessVDSCommandParameters(getVdsId(), getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), ovfDisk.getId(), ovfDisk.getImage().getId(), ovfDiskAndSize.getSecond())); if (retrievedByteData.getSucceeded()) { ovfEntitiesFromTar = OvfUtils.getOvfEntities((byte[]) retrievedByteData.getReturnValue(), getParameters().getStorageDomainId()); } } catch (VdcBLLException e) { log.errorFormat("Image data could not be retrieved for disk id {0} in storage domain id {1}", ovfDisk.getId(), getParameters().getStorageDomainId()); } } } return ovfEntitiesFromTar; }

Target:
protected List<OvfEntityData> getEntitiesFromStorageOvfDisk() { List<OvfEntityData> ovfEntitiesFromTar = Collections.emptyList(); boolean isUnregisteredDisksRetrieved = false; List<Disk> unregisteredDisks = getBackend().runInternalQuery(VdcQueryType.GetUnregisteredDisks, new GetUnregisteredDisksQueryParameters(getParameters().getStorageDomainId(), getVds().getStoragePoolId())).getReturnValue(); if (!unregisteredDisks.isEmpty()) { Pair<DiskImage, Long> ovfDiskAndSize = getLatestOVFDisk(unregisteredDisks); DiskImage ovfDisk = ovfDiskAndSize.getFirst(); if (ovfDisk != null) { try { VDSReturnValue retrievedByteData = runVdsCommand(VDSCommandType.RetrieveImageData, new ImageHttpAccessVDSCommandParameters(getVdsId(), getParameters().getStoragePoolId(), getParameters().getStorageDomainId(), ovfDisk.getId(), ovfDisk.getImage().getId(), ovfDiskAndSize.getSecond())); if (retrievedByteData.getSucceeded()) { ovfEntitiesFromTar = OvfUtils.getOvfEntities((byte[]) retrievedByteData.getReturnValue(), getParameters().getStorageDomainId()); isUnregisteredDisksRetrieved = true; } } catch (VdcBLLException e) { log.errorFormat("Image data could not be retrieved for disk id {0} in storage domain id {1}", ovfDisk.getId(), getParameters().getStorageDomainId()); } } } if (!isUnregisteredDisksRetrieved) { AuditLogDirector.log(this, AuditLogType.RETRIEVE_OVF_STORE_FAILED); } return ovfEntitiesFromTar; }
Source:
private void waitForInitialNodes() { int initialClusterSize = configuration.transport().initialClusterSize(); if (initialClusterSize > 1) { while (channel.getView().getMembers().size() < initialClusterSize) { try { log.debugf("Waiting for %d nodes, current view has %d", initialClusterSize, channel.getView().getMembers().size()); waitForView(viewId + 1); } catch (InterruptedException e) { log.interruptedWaitingForCoordinator(e); Thread.currentThread().interrupt(); } } log.debugf("Initial cluster size of %d nodes reached", initialClusterSize); } }

Target:
private void waitForInitialNodes() { int initialClusterSize = configuration.transport().initialClusterSize(); if (initialClusterSize > 1) { long timeout = configuration.transport().initialClusterTimeout(); while (channel.getView().getMembers().size() < initialClusterSize) { try { log.debugf("Waiting for %d nodes, current view has %d", initialClusterSize, channel.getView().getMembers().size()); if(!waitForView(viewId + 1, timeout, TimeUnit.MILLISECONDS)) { throw log.timeoutWaitingForInitialNodes(initialClusterSize, channel.getView().getMembers()); } } catch (InterruptedException e) { log.interruptedWaitingForCoordinator(e); Thread.currentThread().interrupt(); } } log.debugf("Initial cluster size of %d nodes reached", initialClusterSize); } }
Source:
public void remoteAdd(RemoteAddRequest request) throws GitException { String remoteName = request.getName(); if (remoteName == null || remoteName.isEmpty()) { throw new IllegalArgumentException(ERROR_ADD_REMOTE_NAME_MISSING); } StoredConfig config = repository.getConfig(); Set<String> remoteNames = config.getSubsections("remote"); if (remoteNames.contains(remoteName)) { throw new IllegalArgumentException(String.format(ERROR_REMOTE_NAME_ALREADY_EXISTS, remoteName)); } String url = request.getUrl(); if (url == null || url.isEmpty()) { throw new IllegalArgumentException(ERROR_REMOTE_URL_MISSING); } RemoteConfig remoteConfig; try { remoteConfig = new RemoteConfig(config, remoteName); } catch (URISyntaxException exception) { throw new GitException(exception.getMessage(), exception); } try { remoteConfig.addURI(new URIish(url)); } catch (URISyntaxException exception) { throw new IllegalArgumentException("Remote url " + url + " is invalid. "); } List<String> branches = request.getBranches(); if (branches.isEmpty()) { remoteConfig.addFetchRefSpec( new RefSpec(Constants.R_HEADS + "*" + ":" + Constants.R_REMOTES + remoteName + "/*").setForceUpdate(true)); } else { for (String branch : branches) { remoteConfig.addFetchRefSpec(new RefSpec(Constants.R_HEADS + branch + ":" + Constants.R_REMOTES + remoteName + "/" + branch) .setForceUpdate(true)); } } remoteConfig.update(config); try { config.save(); } catch (IOException exception) { throw new GitException(exception.getMessage(), exception); } }

Target:
public void remoteAdd(RemoteAddRequest request) throws GitException { String remoteName = request.getName(); if (isNullOrEmpty(remoteName)) { throw new IllegalArgumentException(ERROR_ADD_REMOTE_NAME_MISSING); } StoredConfig config = repository.getConfig(); Set<String> remoteNames = config.getSubsections("remote"); if (remoteNames.contains(remoteName)) { throw new IllegalArgumentException(String.format(ERROR_REMOTE_NAME_ALREADY_EXISTS, remoteName)); } String url = request.getUrl(); if (isNullOrEmpty(url)) { throw new IllegalArgumentException(ERROR_REMOTE_URL_MISSING); } RemoteConfig remoteConfig; try { remoteConfig = new RemoteConfig(config, remoteName); } catch (URISyntaxException exception) { throw new GitException(exception.getMessage(), exception); } try { remoteConfig.addURI(new URIish(url)); } catch (URISyntaxException exception) { throw new IllegalArgumentException("Remote url " + url + " is invalid. "); } List<String> branches = request.getBranches(); if (branches.isEmpty()) { remoteConfig.addFetchRefSpec( new RefSpec(Constants.R_HEADS + "*" + ":" + Constants.R_REMOTES + remoteName + "/*").setForceUpdate(true)); } else { for (String branch : branches) { remoteConfig.addFetchRefSpec(new RefSpec(Constants.R_HEADS + branch + ":" + Constants.R_REMOTES + remoteName + "/" + branch) .setForceUpdate(true)); } } remoteConfig.update(config); try { config.save(); } catch (IOException exception) { throw new GitException(exception.getMessage(), exception); } }
Source:
private void testPreparedQuery(GrillQueryCommands qCom) throws Exception { String sql = "cube select id, name from dim_table"; String result = qCom.getAllPreparedQueries(); Assert.assertEquals("No prepared queries", result); String qh = qCom.prepare(sql); result = qCom.getAllPreparedQueries(); Assert.assertEquals(qh, result); result = qCom.getPreparedStatus(qh); Assert.assertTrue(result.contains("User query:cube select id, name from dim_table")); Assert.assertTrue(result.contains(qh)); result = qCom.executePreparedQuery(qh, false); LOG.debug("Prepared query sync result is " + result); Assert.assertTrue(result.contains("1\tfirst")); String handle = qCom.executePreparedQuery(qh, true); LOG.debug("Perpared query handle is " + handle); String status = qCom.getStatus(handle); while (status.contains("RUNNING") || status.contains("LAUNCHED") || status.contains("QUEUED") || status.contains("NEW")) { Thread.sleep(5000); status = qCom.getStatus(handle); } status = qCom.getStatus(handle); LOG.debug("Prepared Query Status is " + status); Assert.assertTrue(status.contains("Status : SUCCESSFUL")); result = qCom.getQueryResults(handle); LOG.debug("Prepared Query Result is " + result); Assert.assertTrue(result.contains("1\tfirst")); result = qCom.destroyPreparedQuery(qh); LOG.debug("destroy result is " + result); Assert.assertEquals("Successfully destroyed " + qh, result); result = qCom.explainAndPrepare(sql); Assert.assertTrue(result.contains(explainPlan)); }

Target:
private void testPreparedQuery(GrillQueryCommands qCom) throws Exception { String sql = "cube select id, name from dim_table"; String result = qCom.getAllPreparedQueries(); Assert.assertEquals("No prepared queries", result); String qh = qCom.prepare(sql); result = qCom.getAllPreparedQueries(); Assert.assertEquals(qh, result); result = qCom.getPreparedStatus(qh); Assert.assertTrue(result.contains("User query:cube select id, name from dim_table")); Assert.assertTrue(result.contains(qh)); result = qCom.executePreparedQuery(qh, false); LOG.warn("XXXXXX Prepared query sync result is " + result); Assert.assertTrue(result.contains("1\tfirst")); String handle = qCom.executePreparedQuery(qh, true); LOG.debug("Perpared query handle is " + handle); while(!client.getQueryStatus(handle).isFinished()) { Thread.sleep(5000); } String status = qCom.getStatus(handle); LOG.debug("Prepared Query Status is " + status); Assert.assertTrue(status.contains("Status : SUCCESSFUL")); result = qCom.getQueryResults(handle); LOG.debug("Prepared Query Result is " + result); Assert.assertTrue(result.contains("1\tfirst")); result = qCom.destroyPreparedQuery(qh); LOG.debug("destroy result is " + result); Assert.assertEquals("Successfully destroyed " + qh, result); result = qCom.explainAndPrepare(sql); Assert.assertTrue(result.contains(explainPlan)); qh = qCom.getAllPreparedQueries(); Assert.assertTrue(result.contains("Prepare handle:"+ qh)); result = qCom.destroyPreparedQuery(qh); Assert.assertEquals("Successfully destroyed " + qh, result); }
Source:
public void displayNewPage(final PageTitle title, final HistoryEntry entry, boolean allowStateLoss) { ACRA.getErrorReporter().putCustomData("api", title.getSite().getApiDomain()); ACRA.getErrorReporter().putCustomData("title", title.toString()); if (drawerLayout.isDrawerOpen(Gravity.START)) { drawerLayout.closeDrawer(Gravity.START); } if (title.isSpecial()) { Utils.visitInExternalBrowser(this, Uri.parse(title.getMobileUri())); return; } resetFragments(allowStateLoss); fragmentContainerView.post(new Runnable() { @Override public void run() { PageViewFragmentInternal frag = getCurPageFragment(); if (frag == null) { return; } if (frag.getTitle() != null && frag.getTitle().equals(title)) { if (!TextUtils.isEmpty(title.getFragment())) { frag.scrollToSection(title.getFragment()); } return; } frag.closeFindInPage(); boolean loadFromCache = entry.getSource() != HistoryEntry.SOURCE_MAIN_PAGE && entry.getSource() != HistoryEntry.SOURCE_LANGUAGE_LINK; frag.displayNewPage(title, entry, loadFromCache, true); app.getSessionFunnel().pageViewed(entry); } }); }

Target:
public void displayNewPage(final PageTitle title, final HistoryEntry entry, boolean allowStateLoss) { ACRA.getErrorReporter().putCustomData("api", title.getSite().getApiDomain()); ACRA.getErrorReporter().putCustomData("title", title.toString()); if (drawerLayout.isDrawerOpen(Gravity.START)) { drawerLayout.closeDrawer(Gravity.START); } if (title.isSpecial()) { Utils.visitInExternalBrowser(this, Uri.parse(title.getMobileUri())); return; } resetFragments(allowStateLoss); fragmentContainerView.post(new Runnable() { @Override public void run() { PageViewFragmentInternal frag = getCurPageFragment(); if (frag == null) { return; } if (frag.getTitle() != null && frag.getTitle().equals(title)) { if (!TextUtils.isEmpty(title.getFragment())) { frag.scrollToSection(title.getFragment()); } return; } frag.closeFindInPage(); frag.displayNewPage(title, entry, false, true); app.getSessionFunnel().pageViewed(entry); } }); }
Source:
public SetConfigurationObjectResponse getSetConfigurationObjectResponse( @OrganisationIdentification final String organisationIdentification, @RequestPayload final SetConfigurationObjectAsyncRequest request) throws OsgpException { final MeterResponseData meterResponseData = this.configurationService .dequeueSetConfigurationObjectResponse(request.getCorrelationUid()); final SetConfigurationObjectResponse response = new SetConfigurationObjectResponse(); if (meterResponseData != null) { response.setResult(OsgpResultType.fromValue(meterResponseData.getResultType().getValue())); if (meterResponseData.getMessageData() instanceof String) { response.setDescription((String) meterResponseData.getMessageData()); } } else { response.setResult(OsgpResultType.NOT_FOUND); } return response; }

Target:
public SetConfigurationObjectResponse getSetConfigurationObjectResponse( @OrganisationIdentification final String organisationIdentification, @RequestPayload final SetConfigurationObjectAsyncRequest request) { final SetConfigurationObjectResponse response = new SetConfigurationObjectResponse(); try { final MeterResponseData meterResponseData = this.configurationService .dequeueSetConfigurationObjectResponse(request.getCorrelationUid()); response.setResult(OsgpResultType.fromValue(meterResponseData.getResultType().getValue())); if (meterResponseData.getMessageData() instanceof String) { response.setDescription((String) meterResponseData.getMessageData()); } } catch (final FunctionalException e) { if (e.getExceptionType() == FunctionalExceptionType.UNKNOWN_CORRELATION_UID) { response.setResult(OsgpResultType.NOT_FOUND); } else { response.setResult(OsgpResultType.NOT_OK); } } return response; }
Source:
public void testCreate() throws IOException, StripeException { final Account account = Account.retrieve(ACCOUNT_ID, null); LoginLinkCollection stubbedCollection = new LoginLinkCollection(); stubbedCollection.setURL(String.format("/v1/accounts/%s/login_links", account.getId())); account.setLoginLinks(stubbedCollection); stubRequest( APIResource.RequestMethod.POST, String.format("/v1/accounts/%s/login_links", account.getId()), null, LoginLink.class, getResourceAsString("/api_fixtures/login_link.json") ); final LoginLink link = account.getLoginLinks().create(); assertNotNull(link); verifyRequest( APIResource.RequestMethod.POST, String.format("/v1/accounts/%s/login_links", account.getId()) ); }

Target:
public void testCreate() throws IOException, StripeException { final Account account = Account.retrieve(ACCOUNT_ID, null); final LoginLinkCollection stubbedCollection = new LoginLinkCollection(); stubbedCollection.setURL(String.format("/v1/accounts/%s/login_links", account.getId())); account.setLoginLinks(stubbedCollection); stubRequest( APIResource.RequestMethod.POST, String.format("/v1/accounts/%s/login_links", account.getId()), null, LoginLink.class, getResourceAsString("/api_fixtures/login_link.json") ); final LoginLink link = account.getLoginLinks().create(); assertNotNull(link); verifyRequest( APIResource.RequestMethod.POST, String.format("/v1/accounts/%s/login_links", account.getId()) ); }
Source:
public void onLoaded() { logger.info("Starting Settings Migration Process"); ItemConfigMigrator migrator = new ItemConfigMigrator(); Jenkins j = Jenkins.getInstance(); if (j == null) { throw new IllegalStateException(); } List<Item> items = j.getAllItems(); if (null != items) { for (Item item : items) { if (!migrator.migrate(item)) { logger.info(String.format("Skipping job \"%s\" with type %s", item.getName(), item.getClass().getName())); continue; } } } logger.info("Completed Settings Migration Process"); }

Target:
public void onLoaded() { logger.info("Starting Settings Migration Process"); ItemConfigMigrator migrator = new ItemConfigMigrator(); Jenkins jenkins = Jenkins.getActiveInstance(); List<Item> items = jenkins.getAllItems(); if (null != items) { for (Item item : items) { if (!migrator.migrate(item)) { logger.info(String.format("Skipping job \"%s\" with type %s", item.getName(), item.getClass().getName())); continue; } } } logger.info("Completed Settings Migration Process"); }
Source:
public void run() { try { try { onClose(); } catch (Exception e) { getLogger().severe(format("Failed to call 'onClose' on channel [%s]", this), e); } try { socketChannel.close(); } catch (IOException e) { getLogger().severe(format("Failed to close [%s]", this), e); } finally { for (ChannelCloseListener closeListener : closeListeners) { try { closeListener.onClose(AbstractChannel.this); } catch (Exception e) { getLogger().severe(format("Failed to process closeListener [%s] on channel [%s]", closeListener, this), e); } } } } finally { System.out.println("Closed channel:" + AbstractChannel.this); } }

Target:
public void run() { try { onClose(); } catch (Exception e) { getLogger().severe(format("Failed to call 'onClose' on channel [%s]", this), e); } try { socketChannel.close(); } catch (IOException e) { getLogger().severe(format("Failed to close [%s]", this), e); } finally { for (ChannelCloseListener closeListener : closeListeners) { try { closeListener.onClose(AbstractChannel.this); } catch (Exception e) { getLogger().severe(format("Failed to process closeListener [%s] on channel [%s]", closeListener, this), e); } } } }
Source:
public void testCreateFileUpload() throws StripeException, InterruptedException, URISyntaxException { File file = new File(getClass().getResource("minimal.pdf").toURI()); Map<String, Object> fileUploadParams = new HashMap<String, Object>(); fileUploadParams.put("purpose", "dispute_evidence"); fileUploadParams.put("file", file); FileUpload fileUpload = FileUpload.create(fileUploadParams); assertEquals(768, fileUpload.getSize().intValue()); assertEquals("application/pdf", fileUpload.getMimeType()); FileUpload retrievedUpload = FileUpload.retrieve(fileUpload.getId()); assertEquals(fileUpload.getId(), retrievedUpload.getId()); assertEquals(768, retrievedUpload.getSize().intValue()); assertEquals("application/pdf", retrievedUpload.getMimeType()); }

Target:
public void testCreateFileUpload() throws StripeException, InterruptedException, URISyntaxException { URL url = getClass().getResource("minimal.pdf"); File file = new File(url.getPath()); Map<String, Object> fileUploadParams = new HashMap<String, Object>(); fileUploadParams.put("purpose", "dispute_evidence"); fileUploadParams.put("file", file); FileUpload fileUpload = FileUpload.create(fileUploadParams); assertEquals(file.length(), fileUpload.getSize().longValue()); assertEquals("application/pdf", fileUpload.getMimeType()); FileUpload retrievedUpload = FileUpload.retrieve(fileUpload.getId()); assertEquals(fileUpload.getId(), retrievedUpload.getId()); assertEquals(file.length(), retrievedUpload.getSize().longValue()); assertEquals("application/pdf", retrievedUpload.getMimeType()); }
Source:
protected void updateData(final long start, final long end, int nb, @Nullable IProgressMonitor monitor) { Collection<ISegment> data = fDisplayData; final int dataSize = (nb == 0) ? data.size() : nb; if (dataSize == 0 || end == start) { return; } List<Double> xSeries = new ArrayList<>(); List<Double> ySeries = new ArrayList<>(); Iterator<ISegment> modelIter = data.iterator(); for (int i = 0; i < dataSize; i++) { ISegment segment = Iterators.<@Nullable ISegment> getNext(modelIter, null); if (segment != null) { xSeries.add((double) (segment.getStart() - start)); ySeries.add((double) segment.getLength()); } } setXAxis(Doubles.toArray(xSeries)); setSeries(Messages.SegmentStoreScatterGraphViewer_legend, Doubles.toArray(ySeries)); updateDisplay(); }

Target:
protected void updateData(final long start, final long end, int nb, @Nullable IProgressMonitor monitor) { Collection<ISegment> data = fDisplayData; final int dataSize = (nb == 0) ? data.size() : nb; if (dataSize == 0 || end == start) { return; } List<Double> xSeries = new ArrayList<>(dataSize); List<Double> ySeries = new ArrayList<>(dataSize); Iterator<ISegment> modelIter = data.iterator(); while(modelIter.hasNext()) { ISegment segment = modelIter.next(); if (segment != null) { xSeries.add((double) (segment.getStart() - start)); ySeries.add((double) segment.getLength()); } } setXAxis(Doubles.toArray(xSeries)); setSeries(Messages.SegmentStoreScatterGraphViewer_legend, Doubles.toArray(ySeries)); updateDisplay(); }
Source:
public RocksDBOptionsFactory configure(ReadableConfig configuration) { this.backgroundJobs = configuration.get( ConfigOptions.key(BACKGROUND_JOBS_OPTION) .intType() .defaultValue(DEFAULT_BACKGROUND_JOBS)); return this; }

Target:
public RocksDBOptionsFactory configure(ReadableConfig configuration) { this.backgroundJobs = configuration.get(BACKGROUND_JOBS_OPTION); return this; }
Source:
public static Dictionary<String, Object> configureValidationMarkerPlugin( List<String> enforcedValidators, boolean enforceErrors, boolean enforceWarnings, AdminConfig configAdmin) throws IOException { Dictionary<String, Object> properties = new DictionaryMap<>(); properties.put("enforcedMetacardValidators", enforcedValidators); properties.put("enforceErrors", String.valueOf(enforceErrors)); properties.put("enforceWarnings", String.valueOf(enforceWarnings)); return configureValidationMarkerPlugin(properties, configAdmin); }

Target:
public static Dictionary<String, Object> configureValidationMarkerPlugin( List<String> enforcedValidators, boolean enforceErrors, boolean enforceWarnings, AdminConfig configAdmin) throws IOException { Dictionary<String, Object> properties = new DictionaryMap<>(); properties.put("enforcedMetacardValidators", enforcedValidators); properties.put("enforceErrors", enforceErrors); properties.put("enforceWarnings", enforceWarnings); return configureValidationMarkerPlugin(properties, configAdmin); }
Source:
private String getStringValue(Map<String, Object> dataMap, String key) { return dataMap.containsKey(key) ? (String) dataMap.get(key) : null; }

Target:
private String getStringValue(Map<String, Object> dataMap, String key) { return (String) dataMap.get(key); }
Source:
public EventStack(final long firstEventTime) { this.eventStack = new Stack<>(); this.firstEventTime = firstEventTime; this.emitable = true; this.includeLast = true; }

Target:
public EventStack(final long firstEventTime) { this.eventStack = new Stack<>(); this.firstEventTime = firstEventTime; this.isEmitted = true; this.includeLast = true; }
Source:
public static HashMap<String, String> createEnvironment(IServer server, String password) { Map<String, String> launchEnv = null; try { ILaunchConfiguration wc = server.getLaunchConfiguration(false, new NullProgressMonitor()); launchEnv = wc.getAttribute(IExternalLaunchConstants.ENVIRONMENT_VARS_KEY, (Map)null); } catch(CoreException ce) { CDKCoreActivator.pluginLog().logWarning("Unable to load environment for vagrant status call. System environment will be used instead."); } HashMap<String,String> systemEnv = new HashMap<String,String>(System.getenv()); if( launchEnv != null ) { Iterator<String> it = launchEnv.keySet().iterator(); String k = null; while(it.hasNext()) { k = it.next(); systemEnv.put(k, launchEnv.get(k)); } } CDKServer cdkServer = (CDKServer)server.loadAdapter(CDKServer.class, new NullProgressMonitor()); boolean passCredentials = cdkServer.getServer().getAttribute(CDKServer.PROP_PASS_CREDENTIALS, false); if( passCredentials ) { String userKey = cdkServer.getServer().getAttribute(CDKServer.PROP_USER_ENV_VAR, CDKConstants.CDK_ENV_SUB_USERNAME); String passKey = cdkServer.getServer().getAttribute(CDKServer.PROP_PASS_ENV_VAR, CDKConstants.CDK_ENV_SUB_PASSWORD); systemEnv.put(userKey, cdkServer.getUsername()); systemEnv.put(passKey, password); } return systemEnv; }

Target:
public static Map<String, String> createEnvironment(IServer server, String password) { Map<String, String> launchEnv = null; try { ILaunchConfiguration wc = server.getLaunchConfiguration(false, new NullProgressMonitor()); launchEnv = wc.getAttribute(IExternalLaunchConstants.ENVIRONMENT_VARS_KEY, (Map<String,String>) null); } catch (CoreException ce) { CDKCoreActivator.pluginLog().logWarning( "Unable to load environment for vagrant status call. System environment will be used instead."); } HashMap<String, String> systemEnv = new HashMap<String, String>(System.getenv()); if (launchEnv != null) { Iterator<String> it = launchEnv.keySet().iterator(); String k = null; while (it.hasNext()) { k = it.next(); systemEnv.put(k, launchEnv.get(k)); } } CDKServer cdkServer = (CDKServer) server.loadAdapter(CDKServer.class, new NullProgressMonitor()); boolean passCredentials = cdkServer.getServer().getAttribute(CDKServer.PROP_PASS_CREDENTIALS, false); if (passCredentials) { String userKey = cdkServer.getServer().getAttribute(CDKServer.PROP_USER_ENV_VAR, CDKConstants.CDK_ENV_SUB_USERNAME); String passKey = cdkServer.getServer().getAttribute(CDKServer.PROP_PASS_ENV_VAR, CDKConstants.CDK_ENV_SUB_PASSWORD); systemEnv.put(userKey, cdkServer.getUsername()); systemEnv.put(passKey, password); } return systemEnv; }
Source:
private void attachSlavesToJenkins(Jenkins jenkins, List<EC2AbstractSlave> slaves, SlaveTemplate t) throws IOException { for (final EC2AbstractSlave slave : slaves) { if (slave == null) { LOGGER.warning("Can't raise node for " + t); continue; } Computer c = slave.toComputer(); if (slave.getStopOnTerminate() && c != null) { c.connect(false); } jenkins.addNode(slave); } }

Target:
private static void attachSlavesToJenkins(Jenkins jenkins, List<EC2AbstractSlave> slaves, SlaveTemplate t) throws IOException { for (final EC2AbstractSlave slave : slaves) { if (slave == null) { LOGGER.warning("Can't raise node for " + t); continue; } Computer c = slave.toComputer(); if (slave.getStopOnTerminate() && c != null) { c.connect(false); } jenkins.addNode(slave); } }
Source:
private CalculationParameters(Map<Class<? extends CalculationParameter>, CalculationParameter> parameters) { JodaBeanUtils.notNull(parameters, "parameters"); this.parameters = ImmutableMap.copyOf(parameters); ImmutableMap.Builder<Class<? extends CalculationParameter>, Class<? extends CalculationParameter>> aliases = ImmutableMap.builder(); for (Class<? extends CalculationParameter> type : parameters.keySet()) { Class<?>[] interfaces = type.getInterfaces(); for (Class<?> iface : interfaces) { if (iface != CalculationParameter.class && CalculationParameter.class.isAssignableFrom(iface) && !parameters.containsKey(iface)) { aliases.put(iface.asSubclass(CalculationParameter.class), type); } } } this.aliases = aliases.build(); }

Target:
private CalculationParameters(Map<Class<? extends CalculationParameter>, CalculationParameter> parameters) { JodaBeanUtils.notNull(parameters, "parameters"); this.parameters = ImmutableMap.copyOf(parameters); Map<Class<? extends CalculationParameter>, Class<? extends CalculationParameter>> aliases = new HashMap<>(); for (Class<? extends CalculationParameter> type : parameters.keySet()) { Class<?>[] interfaces = type.getInterfaces(); for (Class<?> iface : interfaces) { if (iface != CalculationParameter.class && CalculationParameter.class.isAssignableFrom(iface) && !parameters.containsKey(iface)) { Class<? extends CalculationParameter> aliasType = iface.asSubclass(CalculationParameter.class); aliases.putIfAbsent(aliasType, type); } } } this.aliases = ImmutableMap.copyOf(aliases); }
Source:
public void testEmpty() { Observable<String> source = Observable.empty(); final AtomicBoolean wasCalled = new AtomicBoolean(false); source.doOnEmpty(new Action0() { @Override public void call() { wasCalled.set(true); } }).subscribe(); assert(wasCalled.get()); }

Target:
public void testEmpty() { Observable<String> source = Observable.empty(); final AtomicBoolean wasCalled = new AtomicBoolean(false); source.doOnEmpty(new Action0() { @Override public void call() { wasCalled.set(true); } }).subscribe(); assertTrue(wasCalled.get()); }
Source:
public @ResponseBody Map<String, Object> getJsonSchema(@PathVariable String className) { try { JsonSchema json = modelDescriptionService.getJsonSchema(className); return ResultSet.success(json); } catch (Exception e) { return ResultSet.error("Could not get description for " + className + " " + e.getMessage()); } }

Target:
public @ResponseBody Map<String, Object> getJsonSchema(@PathVariable String className) { try { JsonSchema json = modelDescriptionService.getJsonSchema(className); if (json == null) { return ResultSet.error("Modeldescription (json) for model " + className + "is null."); } return ResultSet.success(json); } catch (Exception e) { return ResultSet.error("Could not get description for " + className + " " + e.getMessage()); } }
Source:
public List<Resource> getFileLocations() throws IOException { List<Resource> configurationFiles = new ArrayList<>(); GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class); if (loader != null) { Resource f = getConfigurationFile(loader); configurationFiles.add(f); } else if (fw != null && fw.getResource() != null) { configurationFiles.add(fw.getResource()); } return configurationFiles; }

Target:
public List<Resource> getFileLocations() throws IOException { List<Resource> configurationFiles = new ArrayList<>(); if (loader != null) { Resource f = getConfigurationFile(loader); configurationFiles.add(f); } else if (fw != null && fw.getResource() != null) { configurationFiles.add(fw.getResource()); } return configurationFiles; }
Source:
private boolean tooManyLooseObjects() { int auto = repo.getConfig().getInt(ConfigConstants.CONFIG_GC_SECTION, ConfigConstants.CONFIG_KEY_AUTO, 6700); if (auto <= 0) { return false; } int n = 0; int threshold = (auto + 255) / 256; Path dir = repo.getObjectsDirectory().toPath().resolve("17"); if (!Files.exists(dir)) { return false; } try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, new DirectoryStream.Filter<Path>() { public boolean accept(Path file) throws IOException { return Files.isRegularFile(file) && PATTERN_LOOSE_OBJECT .matcher(file.getFileName().toString()) .matches(); } })) { Iterator<Path> iter = stream.iterator(); while (iter.hasNext()) { if (n++ > threshold) { return true; } } } catch (IOException e) { LOG.error(e.getMessage(), e); } return false; }

Target:
private boolean tooManyLooseObjects() { int auto = repo.getConfig().getInt(ConfigConstants.CONFIG_GC_SECTION, ConfigConstants.CONFIG_KEY_AUTO, DEFAULT_AUTOLIMIT); if (auto <= 0) { return false; } int n = 0; int threshold = (auto + 255) / 256; Path dir = repo.getObjectsDirectory().toPath().resolve("17"); if (!Files.exists(dir)) { return false; } try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, new DirectoryStream.Filter<Path>() { public boolean accept(Path file) throws IOException { return Files.isRegularFile(file) && PATTERN_LOOSE_OBJECT .matcher(file.getFileName().toString()) .matches(); } })) { Iterator<Path> iter = stream.iterator(); while (iter.hasNext()) { if (n++ > threshold) { return true; } } } catch (IOException e) { LOG.error(e.getMessage(), e); } return false; }
Source:
public List<Address> getAddresses() { if (isValidPatientId()) { return loadTestDataService.getAllAddressesBy(getPatientId()); } else { return new ArrayList<>(); } }

Target:
public List<Address> getAddresses() { return loadTestDataService.getAllAddressesBy(getPatientId()); }
Source:
protected EntityMemento getMementoWithProperties(Map<String,?> props) { EntityMemento memento = MementosGenerators.newEntityMementoBuilder(entity).customFields(props).build(); if (LOG.isTraceEnabled()) LOG.trace("Creating memento for entity {}({}): parent={}; children={}; locations={}; "+ "policies={}; members={}; config={}; attributes={}; customProperties={}", new Object[] {memento.getType(), memento.getId(), memento.getParent(), memento.getChildren(), memento.getLocations(), memento.getPolicies(), memento.getMembers(), sanitize(memento.getConfig()), sanitize(memento.getAttributes()), sanitize(memento.getCustomFields())}); return memento; }

Target:
protected EntityMemento getMementoWithProperties(Map<String,?> props) { EntityMemento memento = MementosGenerators.newEntityMementoBuilder(entity).customFields(props).build(); if (LOG.isTraceEnabled()) LOG.trace("Creating memento for entity: {}", memento.toVerboseString()); return memento; }
Source:
private ValidTxnList getValidTxnList(Connection dbConn, String fullTableName, Long writeId) throws MetaException, SQLException { PreparedStatement pst = null; ResultSet rs = null; try { String[] names = TxnUtils.getDbTableName(fullTableName); String s = "select t2w_txnid from TXN_TO_WRITE_ID where t2w_database = ? and t2w_table = ? and t2w_writeid = ?"; pst = dbConn.prepareStatement(sqlGenerator.addEscapeCharacters(s)); pst.setString(1, names[0]); pst.setString(2, names[1]); pst.setLong(3, writeId); LOG.debug("Going to execute query <" + s.replaceAll("\\?", "{}") + ">", quoteString(names[0]), quoteString(names[1]), writeId); rs = pst.executeQuery(); if (rs.next()) { return TxnCommonUtils.createValidReadTxnList(getOpenTxns(), rs.getLong(1)); } throw new MetaException("invalid write id " + writeId + " for table " + fullTableName); } finally { close(rs); if (pst != null) { pst.close(); } } }

Target:
private ValidTxnList getValidTxnList(Connection dbConn, String fullTableName, Long writeId) throws MetaException, SQLException { PreparedStatement pst = null; ResultSet rs = null; try { String[] names = TxnUtils.getDbTableName(fullTableName); assert names.length == 2; String s = "select t2w_txnid from TXN_TO_WRITE_ID where t2w_database = ? and t2w_table = ? and t2w_writeid = ?"; pst = dbConn.prepareStatement(sqlGenerator.addEscapeCharacters(s)); pst.setString(1, names[0]); pst.setString(2, names[1]); pst.setLong(3, writeId); LOG.debug("Going to execute query <" + s.replaceAll("\\?", "{}") + ">", quoteString(names[0]), quoteString(names[1]), writeId); rs = pst.executeQuery(); if (rs.next()) { return TxnCommonUtils.createValidReadTxnList(getOpenTxns(), rs.getLong(1)); } throw new MetaException("invalid write id " + writeId + " for table " + fullTableName); } finally { close(rs, pst, null); } }