auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) { Class<? extends SoftAssertionsProvider> type = getSupportedParameterType(parameterContext.getParameter()); if (type == null) { return false; } Executable executable = parameterContext.getDeclaringExecutable(); boolean isTestableMethod = executable instanceof Method && isAnnotated(executable, Testable.class); if (!isTestableMethod) { throw new ParameterResolutionException(format("Configuration error: cannot resolve SoftAssertionsProvider instances for [%s]. Only test methods are supported.", executable)); } if (Modifier.isAbstract(type.getModifiers())) { throw new ParameterResolutionException(format("Configuration error: cannot resolve abstract SoftAssertionsProvider instances [%s].", executable)); } return true; }

Target:
public boolean supportsParameter(ParameterContext parameterContext, ExtensionContext extensionContext) { if (isUnsupportedParameterType(parameterContext.getParameter())) return false; Executable executable = parameterContext.getDeclaringExecutable(); boolean isTestableMethod = executable instanceof Method && isAnnotated(executable, Testable.class); if (!isTestableMethod) { throw new ParameterResolutionException(format("Configuration error: cannot resolve SoftAssertionsProvider instances for [%s]. Only test methods are supported.", executable)); } Class<?> type = parameterContext.getParameter().getType(); if (Modifier.isAbstract(type.getModifiers())) { throw new ParameterResolutionException(format("Configuration error: the resolved SoftAssertionsProvider implementation [%s] is abstract and cannot be instantiated.", executable)); } try { type.getDeclaredConstructor(); } catch (Exception e) { throw new ParameterResolutionException(format("Configuration error: the resolved SoftAssertionsProvider implementation [%s] has no default constructor and cannot be instantiated.", executable)); } return true; }
Source:
private static String getUserId(Cause cause) { if (cause instanceof UserIdCause) { Cause.UserIdCause userIdCause = (UserIdCause) cause; return userIdCause.getUserId(); } return null; }

Target:
private static String getUserId(Cause cause) { if (cause instanceof UserIdCause) { Cause.UserIdCause userIdCause = (UserIdCause) cause; return userIdCause.getUserId(); } return ""; }
Source:
private GerritIndexWriterConfig(Version version, Config cfg, String name) { luceneConfig = new IndexWriterConfig(version, new StandardAnalyzer(version, CharArraySet.EMPTY_SET)); luceneConfig.setOpenMode(OpenMode.CREATE_OR_APPEND); double m = 1 << 20; luceneConfig.setRAMBufferSizeMB(cfg.getLong( "index", name, "ramBufferSize", (long) (IndexWriterConfig.DEFAULT_RAM_BUFFER_SIZE_MB * m)) / m); luceneConfig.setMaxBufferedDocs(cfg.getInt( "index", name, "maxBufferedDocs", IndexWriterConfig.DEFAULT_MAX_BUFFERED_DOCS)); try { if ((commitWithinMs = cfg.getLong("index", name, "commitWithin", 0)) >= 0) { commitWithinMs = ConfigUtil.getTimeUnit(cfg, "index", name, "commitWithin", MILLISECONDS.convert(5, MINUTES), MILLISECONDS); } } catch (IllegalArgumentException e) { commitWithinMs = ConfigUtil.getTimeUnit(cfg, "index", name, "commitWithin", MILLISECONDS.convert(5, MINUTES), MILLISECONDS); } }

Target:
private GerritIndexWriterConfig(Version version, Config cfg, String name) { luceneConfig = new IndexWriterConfig(version, new StandardAnalyzer(version, CharArraySet.EMPTY_SET)); luceneConfig.setOpenMode(OpenMode.CREATE_OR_APPEND); double m = 1 << 20; luceneConfig.setRAMBufferSizeMB(cfg.getLong( "index", name, "ramBufferSize", (long) (IndexWriterConfig.DEFAULT_RAM_BUFFER_SIZE_MB * m)) / m); luceneConfig.setMaxBufferedDocs(cfg.getInt( "index", name, "maxBufferedDocs", IndexWriterConfig.DEFAULT_MAX_BUFFERED_DOCS)); try { commitWithinMs = ConfigUtil.getTimeUnit(cfg, "index", name, "commitWithin", MILLISECONDS.convert(5, MINUTES), MILLISECONDS); } catch (IllegalArgumentException e) { commitWithinMs = cfg.getLong("index", name, "commitWithin", 0); } }
Source:
public UserKeyRecord getRecordForCurrentUser() { try { return getSession().getUserKeyRecord(); } catch (SessionUnavailableException e) { return null; } }

Target:
public UserKeyRecord getRecordForCurrentUser() throws SessionUnavailableException { return getSession().getUserKeyRecord(); }
Source:
protected GoodData(String hostname, String login, String password, int port, String protocol, GoodDataSettings settings) { notEmpty(hostname, "hostname"); notEmpty(login, "login"); notEmpty(password, "password"); notEmpty(protocol, "protocol"); final HttpClientBuilder httpClientBuilder = HttpClientBuilder.create() .setUserAgent(getUserAgent()); applySettings(settings, httpClientBuilder); restTemplate = createRestTemplate(login, password, hostname, httpClientBuilder, port, protocol); accountService = new AccountService(getRestTemplate()); projectService = new ProjectService(getRestTemplate(), accountService); metadataService = new MetadataService(getRestTemplate()); modelService = new ModelService(getRestTemplate()); gdcService = new GdcService(getRestTemplate()); dataStoreService = new DataStoreService(httpClientBuilder, gdcService, new HttpHost(hostname, port, protocol).toURI(), login, password); datasetService = new DatasetService(getRestTemplate(), dataStoreService); reportService = new ReportService(getRestTemplate()); processService = new ProcessService(getRestTemplate(), accountService, dataStoreService); warehouseService = new WarehouseService(getRestTemplate(), hostname, port); connectorService = new ConnectorService(getRestTemplate(), projectService); }

Target:
protected GoodData(String hostname, String login, String password, int port, String protocol, GoodDataSettings settings) { notEmpty(hostname, "hostname"); notEmpty(login, "login"); notEmpty(password, "password"); notEmpty(protocol, "protocol"); final HttpClientBuilder httpClientBuilder = createHttpClientBuilder(settings); restTemplate = createRestTemplate(login, password, hostname, httpClientBuilder, port, protocol); accountService = new AccountService(getRestTemplate()); projectService = new ProjectService(getRestTemplate(), accountService); metadataService = new MetadataService(getRestTemplate()); modelService = new ModelService(getRestTemplate()); gdcService = new GdcService(getRestTemplate()); dataStoreService = new DataStoreService(httpClientBuilder, gdcService, new HttpHost(hostname, port, protocol).toURI(), login, password); datasetService = new DatasetService(getRestTemplate(), dataStoreService); reportService = new ReportService(getRestTemplate()); processService = new ProcessService(getRestTemplate(), accountService, dataStoreService); warehouseService = new WarehouseService(getRestTemplate(), hostname, port); connectorService = new ConnectorService(getRestTemplate(), projectService); }
Source:
public List<Descriptor<ListViewColumn>> getColumnsDescriptors() { StaplerRequest request = Stapler.getCurrentRequest(); View view = request.findAncestorObject(clazz); return view == null ? DescriptorVisibilityFilter.applyType(clazz, ListViewColumn.all()) : DescriptorVisibilityFilter.apply(view, ListViewColumn.all()); }

Target:
public List<Descriptor<ListViewColumn>> getColumnsDescriptors() { StaplerRequest request = Stapler.getCurrentRequest(); if (request != null) { View view = request.findAncestorObject(clazz); return view == null ? DescriptorVisibilityFilter.applyType(clazz, ListViewColumn.all()) : DescriptorVisibilityFilter.apply(view, ListViewColumn.all()); } return ListViewColumn.all(); }
Source:
private Optional<Channel> channelFor(String guid) { long channelId = codec.decode(guid).longValue(); Optional<Channel> channelMaybe = channelResolver.fromId(channelId).toOptional(); if(!channelMaybe.isPresent()) { LOGGER.error("There is missing channel for this channel id: " + guid); return Optional.empty(); } return channelMaybe; }

Target:
private Optional<Channel> channelFor(String guid) { long channelId; try { channelId = codec.decode(guid).longValue(); } catch(IllegalArgumentException e) { LOGGER.error("{} was not valid for decoding", guid, e); return Optional.empty(); } Optional<Channel> channelMaybe = channelResolver.fromId(channelId).toOptional(); if(!channelMaybe.isPresent()) { LOGGER.error("There is missing channel for this channel id: {}", guid); return Optional.empty(); } return channelMaybe; }
Source:
private boolean isTitleValid() { String templateTitle = this.template.getTitle(); if (StringUtils.isNotBlank(templateTitle)) { try { long count = ServiceManager.getTemplateService().countTemplatesWithTitleAndClient(templateTitle, ServiceManager.getUserService().getSessionClientId()); if (count > 1) { Helper.setErrorMessage(INCOMPLETE_DATA, TITLE_USED); return false; } else if (count == 1) { if (Objects.nonNull(this.template.getId())) { return true; } Helper.setErrorMessage(INCOMPLETE_DATA, TITLE_USED); return false; } return true; } catch (DAOException e) { Helper.setErrorMessage(INCOMPLETE_DATA, TITLE_USED); return false; } } Helper.setErrorMessage(INCOMPLETE_DATA, "templateTitleEmpty"); return false; }

Target:
private boolean isTitleValid() { String templateTitle = this.template.getTitle(); if (StringUtils.isNotBlank(templateTitle)) { List<Template> templates = ServiceManager.getTemplateService().getTemplatesWithTitleAndClient(templateTitle, this.template.getClient().getId()); int count = templates.size(); if (count > 1) { Helper.setErrorMessage(INCOMPLETE_DATA, TITLE_USED); return false; } else if (count == 1) { Integer templateId = this.template.getId(); if (Objects.nonNull(templateId) && templates.get(0).getId().equals(templateId)) { return true; } Helper.setErrorMessage(INCOMPLETE_DATA, TITLE_USED); return false; } return true; } Helper.setErrorMessage(INCOMPLETE_DATA, "templateTitleEmpty"); return false; }
Source:
private List<String> collectCommandReturnsFromHosts( List<CompletableFuture<CommandReturn>> futureList, List<String> hosts) { List<CommandReturn> results; try { results = collectAllFutures(futureList).get(); System.out.format("Results collected from %d hosts%n", results.size()); } catch (InterruptedException | ExecutionException e) { System.err.format("Failed to collect the results. Error is %s%n", e.getMessage()); LOG.error("Error: %s", e); return Collections.EMPTY_LIST; } if (results.size() != hosts.size()) { System.out.format("Error occurred while collecting information on %d/%d hosts%n", hosts.size() - results.size()); return Collections.EMPTY_LIST; } else { List<String> successfulHosts = new ArrayList<>(); for (int i = 0; i < hosts.size(); i++) { CommandReturn c = results.get(i); String host = hosts.get(i); if (c.getExitCode() != 0) { System.out.format("Execution failed on host %s%n", host); System.out.println(c.getFormattedOutput()); continue; } successfulHosts.add(host); } System.out.format("Command successful on %d/%d hosts.%n", successfulHosts.size(), hosts.size()); return successfulHosts; } }

Target:
private List<String> collectCommandReturnsFromHosts( List<CompletableFuture<CommandReturn>> futureList, List<String> hosts) { List<CommandReturn> results; try { results = collectAllFutures(futureList).get(); System.out.format("Results collected from %d hosts%n", results.size()); } catch (InterruptedException | ExecutionException e) { System.err.format("Failed to collect the results. Error is %s%n", e.getMessage()); LOG.error("Error: %s", e); return Collections.EMPTY_LIST; } if (results.size() != hosts.size()) { System.out.format("Error occurred while collecting information on %d/%d hosts%n", hosts.size() - results.size()); return Collections.EMPTY_LIST; } else { List<String> successfulHosts = new ArrayList<>(); for (int i = 0; i < hosts.size(); i++) { CommandReturn c = results.get(i); String host = hosts.get(i); if (c.getExitCode() != 0) { System.out.format("Execution failed on host %s%n", host); System.out.println(c.getFormattedOutput()); continue; } successfulHosts.add(host); } System.out.format("Command executed successfully on %d/%d hosts.", successfulHosts.size(), hosts.size()); return successfulHosts; } }
Source:
public static void main( String[] args ) throws InterruptedException, IOException { FileSystemAbstraction fs = new DefaultFileSystemAbstraction(); File indexFile = new File( "index" ); Runtime.getRuntime().addShutdownHook( new Thread( () -> fs.deleteFile( indexFile ) ) ); new GBPTreePlayground( fs, indexFile ).run(); }

Target:
public static void main( String[] args ) throws InterruptedException, IOException { File indexFile; if ( args.length > 0 ) { indexFile = new File( args[0] ); } else { indexFile = new File( "index" ); } FileSystemAbstraction fs = new DefaultFileSystemAbstraction(); new GBPTreePlayground( fs, indexFile ).run(); }
Source:
public SASTokenProvider getSASTokenProvider() throws AzureBlobFileSystemException { AuthType authType = getEnum(FS_AZURE_ACCOUNT_AUTH_TYPE_PROPERTY_NAME, AuthType.SharedKey); if (authType != AuthType.SAS) { throw new SASTokenProviderException(String.format( "Invalid auth type: %s is being used, expecting SAS", authType)); } try { String configKey = FS_AZURE_SAS_TOKEN_PROVIDER_TYPE; Class<? extends SASTokenProvider> sasTokenProviderClass = getClass(configKey, null, SASTokenProvider.class); if (sasTokenProviderClass == null) { throw new IllegalArgumentException( String.format("The configuration value for \"%s\" is invalid.", configKey)); } SASTokenProvider sasTokenProvider = ReflectionUtils .newInstance(sasTokenProviderClass, rawConfig); if (sasTokenProvider == null) { throw new IllegalArgumentException("Failed to initialize " + sasTokenProviderClass); } LOG.trace("Initializing {}", sasTokenProviderClass.getName()); sasTokenProvider.initialize(rawConfig, accountName); LOG.trace("{} init complete", sasTokenProviderClass.getName()); return sasTokenProvider; } catch(IllegalArgumentException e) { throw e; } catch (Exception e) { throw new TokenAccessProviderException("Unable to load SAS token provider class: " + e, e); } }

Target:
public SASTokenProvider getSASTokenProvider() throws AzureBlobFileSystemException { AuthType authType = getEnum(FS_AZURE_ACCOUNT_AUTH_TYPE_PROPERTY_NAME, AuthType.SharedKey); if (authType != AuthType.SAS) { throw new SASTokenProviderException(String.format( "Invalid auth type: %s is being used, expecting SAS", authType)); } try { String configKey = FS_AZURE_SAS_TOKEN_PROVIDER_TYPE; Class<? extends SASTokenProvider> sasTokenProviderClass = getClass(configKey, null, SASTokenProvider.class); Preconditions.checkArgument(sasTokenProviderClass != null, String.format("The configuration value for \"%s\" is invalid.", configKey)); SASTokenProvider sasTokenProvider = ReflectionUtils .newInstance(sasTokenProviderClass, rawConfig); Preconditions.checkArgument(sasTokenProvider != null, String.format("Failed to initialize %s", sasTokenProviderClass)); LOG.trace("Initializing {}", sasTokenProviderClass.getName()); sasTokenProvider.initialize(rawConfig, accountName); LOG.trace("{} init complete", sasTokenProviderClass.getName()); return sasTokenProvider; } catch (Exception e) { throw new TokenAccessProviderException("Unable to load SAS token provider class: " + e, e); } }
Source:
public static String encodeFileUri(String fileUriStr, String fileChecksum, String encodedSubDir) throws IOException { if (instance == null) { throw new IOException("Uninitialized ReplChangeManager instance."); } String encodedUri = fileUriStr; if ((fileChecksum != null) && (cmroot != null)) { encodedUri = encodedUri + URI_FRAGMENT_SEPARATOR + fileChecksum + URI_FRAGMENT_SEPARATOR + FileUtils.makeQualified(cmroot, conf); } else { encodedUri = encodedUri + URI_FRAGMENT_SEPARATOR + URI_FRAGMENT_SEPARATOR; } encodedUri = encodedUri + URI_FRAGMENT_SEPARATOR + ((encodedSubDir != null) ? encodedSubDir : ""); LOG.debug("Encoded URI: " + encodedUri); return encodedUri; }

Target:
public static String encodeFileUri(String fileUriStr, String fileChecksum, String encodedSubDir) throws IOException { if (instance == null) { throw new IllegalStateException("Uninitialized ReplChangeManager instance."); } String encodedUri = fileUriStr; if ((fileChecksum != null) && (cmroot != null)) { encodedUri = encodedUri + URI_FRAGMENT_SEPARATOR + fileChecksum + URI_FRAGMENT_SEPARATOR + FileUtils.makeQualified(cmroot, conf); } else { encodedUri = encodedUri + URI_FRAGMENT_SEPARATOR + URI_FRAGMENT_SEPARATOR; } encodedUri = encodedUri + URI_FRAGMENT_SEPARATOR + ((encodedSubDir != null) ? encodedSubDir : ""); LOG.debug("Encoded URI: " + encodedUri); return encodedUri; }
Source:
private InterpreterResult getMetaData(String propertyKey, String cmd, InterpreterContext interpreterContext) { Connection connection; String user = interpreterContext.getAuthenticationInfo().getUser(); DatabaseMetaData dataBaseMetaData; ResultSet resultSet = null; ResultSetMetaData resultSetMetaData = null; String tableName = cmd.substring(7).trim(); String results; try { connection = getConnection(propertyKey, interpreterContext); if (connection == null) { return new InterpreterResult(Code.ERROR, "Prefix not found."); } try { dataBaseMetaData = connection.getMetaData(); if (tableName.equals("")) { resultSet = dataBaseMetaData.getTables(null, null, "%", TABLE_TYPES); } else { resultSet = dataBaseMetaData.getColumns(null, null, tableName, null); } results = getResults(resultSet, true); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } } if (connection != null) { try { connection.close(); } catch (SQLException e) { } } } return new InterpreterResult(Code.SUCCESS, results); } catch (Exception e) { logger.error("Cannot fetch metadata.", e); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos); e.printStackTrace(ps); String errorMsg = new String(baos.toByteArray(), StandardCharsets.UTF_8); try { closeDBPool(user, propertyKey); } catch (SQLException e1) { e1.printStackTrace(); } return new InterpreterResult(Code.ERROR, errorMsg); } }

Target:
private InterpreterResult getMetaData(String propertyKey, String cmd, InterpreterContext interpreterContext) { Connection connection; String user = interpreterContext.getAuthenticationInfo().getUser(); DatabaseMetaData dataBaseMetaData; ResultSet resultSet = null; String tableName = null; String results; if (cmd.split(" +").length > 1) { tableName = cmd.split(" +")[1]; } try { connection = getConnection(propertyKey, interpreterContext); if (connection == null) { return new InterpreterResult(Code.ERROR, "Prefix not found."); } try { dataBaseMetaData = connection.getMetaData(); if (tableName == null) { resultSet = dataBaseMetaData.getTables(null, null, "%", TABLE_TYPES); } else { resultSet = dataBaseMetaData.getColumns(null, null, tableName, null); } results = getResults(resultSet, true); } finally { if (resultSet != null) { try { resultSet.close(); } catch (SQLException e) { } } if (connection != null) { try { connection.close(); } catch (SQLException e) { } } } return new InterpreterResult(Code.SUCCESS, results); } catch (Exception e) { logger.error("Cannot fetch metadata.", e); ByteArrayOutputStream baos = new ByteArrayOutputStream(); PrintStream ps = new PrintStream(baos); e.printStackTrace(ps); String errorMsg = new String(baos.toByteArray(), StandardCharsets.UTF_8); try { closeDBPool(user, propertyKey); } catch (SQLException e1) { e1.printStackTrace(); } return new InterpreterResult(Code.ERROR, errorMsg); } }
Source:
public AjaxTinyMCEPage() { ta = new TextArea("ta"); ta.setVisible(false); ta.setOutputMarkupPlaceholderTag(true); ta.add(new TinyMceBehavior()); add(ta); add(new AjaxLink<Void>("toggle") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { visible = !visible; ta.setVisible(visible); target.add(ta); } }); }

Target:
public AjaxTinyMCEPage() { ta = new TextArea<>("ta"); ta.setVisible(false); ta.setOutputMarkupPlaceholderTag(true); ta.add(new TinyMceBehavior()); add(ta); add(new AjaxLink<Void>("toggle") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { visible = !visible; ta.setVisible(visible); target.add(ta); } }); }
Source:
private void handleLogRequest(VoltMessage message) { Iv2RepairLogRequestMessage req = (Iv2RepairLogRequestMessage)message; int deadHostId = req.getDeadHostId(); if (deadHostId != Integer.MAX_VALUE) { if (m_messenger.canCompleteRepair(deadHostId)) { req.disableDeadHostCheck(); deliver(message); } else { if (req.getRepairRetryCount() > 100 && req.getRepairRetryCount() % 100 == 0) { hostLog.warn("Repair Request for dead host " + deadHostId + " has not been processed yet because connection has not closed"); if (req.getRepairRetryCount() == 60 * 100) { hostLog.warn("Connection to dead host " + deadHostId + " has not been closed for 60 seconds, stop blocking repair request."); m_messenger.markPicoZombieHost(deadHostId); } } Runnable retryRepair = new Runnable() { @Override public void run() { InitiatorMailbox.this.deliver(message); } }; VoltDB.instance().scheduleWork(retryRepair, 10, -1, TimeUnit.MILLISECONDS); } return; } List<Iv2RepairLogResponseMessage> logs = m_repairLog.contents(req.getRequestId(), req.isMPIRequest()); if (req.isMPIRequest()) { m_scheduler.cleanupTransactionBacklogOnRepair(); } for (Iv2RepairLogResponseMessage log : logs) { send(message.m_sourceHSId, log); } }

Target:
private void handleLogRequest(VoltMessage message) { Iv2RepairLogRequestMessage req = (Iv2RepairLogRequestMessage)message; int deadHostId = req.getDeadHostId(); if (deadHostId != Integer.MAX_VALUE) { if (req.getRepairRetryCount() == 60 * 100) { hostLog.warn("Connection to dead host " + deadHostId + " has not been closed for 60 seconds, stop blocking repair request."); m_messenger.markPicoZombieHost(deadHostId); } if (m_messenger.canCompleteRepair(deadHostId)) { req.disableDeadHostCheck(); deliver(message); } else { if (req.getRepairRetryCount() > 100 && req.getRepairRetryCount() % 100 == 0) { hostLog.warn("Repair Request for dead host " + deadHostId + " has not been processed yet because connection has not closed"); } Runnable retryRepair = new Runnable() { @Override public void run() { InitiatorMailbox.this.deliver(message); } }; VoltDB.instance().scheduleWork(retryRepair, 10, -1, TimeUnit.MILLISECONDS); } return; } List<Iv2RepairLogResponseMessage> logs = m_repairLog.contents(req.getRequestId(), req.isMPIRequest()); if (req.isMPIRequest()) { m_scheduler.cleanupTransactionBacklogOnRepair(); } for (Iv2RepairLogResponseMessage log : logs) { send(message.m_sourceHSId, log); } }
Source:
private void flipQA (JSONObject template) { try { String qfmt = template.getString("qfmt"); String afmt = template.getString("afmt"); Matcher m = Pattern.compile("(?s)(.+)<hr id=answer>(.+)").matcher(afmt); if (!m.find()) { template.put("qfmt", afmt.replace("{{FrontSide}}","")); } else { template.put("qfmt",m.group(2).trim()); } template.put("afmt","{{FrontSide}}\n\n<hr id=answer>\n\n" + qfmt); } catch (JSONException e) { throw new RuntimeException(e); } }

Target:
private void flipQA (JSONObject template) { String qfmt = template.getString("qfmt"); String afmt = template.getString("afmt"); Matcher m = Pattern.compile("(?s)(.+)<hr id=answer>(.+)").matcher(afmt); if (!m.find()) { template.put("qfmt", afmt.replace("{{FrontSide}}","")); } else { template.put("qfmt",m.group(2).trim()); } template.put("afmt","{{FrontSide}}\n\n<hr id=answer>\n\n" + qfmt); }
Source:
public static < A, B > RandomAccessiblePair< A, B > pair( final RandomAccessible< A > sourceA, final RandomAccessible< B > sourceB ) { return new RandomAccessiblePair< A, B >( sourceA, sourceB ); }

Target:
public static < A, B > RandomAccessible< Pair< A, B > > pair( final RandomAccessible< A > sourceA, final RandomAccessible< B > sourceB ) { return new RandomAccessiblePair< A, B >( sourceA, sourceB ); }
Source:
public String getSubjectKeyID() { if (subjectKeyID == null) { byte[] subjectKeyId = x509Cert.getExtensionValue(SUBJECT_KEY_ID); try { if (subjectKeyId != null) { DERDecoder extVal = new DERDecoder(subjectKeyId); extVal.expect(DERDecoder.TYPE_OCTET_STRING); extVal.getLength(); extVal.expect(DERDecoder.TYPE_OCTET_STRING); int keyIDLen = extVal.getLength(); subjectKeyID = Hex.encodeHexString(extVal.getBytes(keyIDLen)); } } catch (WSSecurityException e) { LOG.error("Unable to convert SKI into human readable {}", e.getLocalizedMessage(), e); } } return StringUtils.isEmpty(subjectKeyID) ? EMPTY_FIELD : subjectKeyID; }

Target:
public String getSubjectKeyID() { return subjectKeyID; }
Source:
public URI getURI() { return this.uri; }

Target:
public URI getURI() { if (this.uri == null) { this.uri = URI.create(String.format("%s:%s", getScheme(), getReference())); } return this.uri; }
Source:
public void addCustomizedStateRootChangeListener(CustomizedStateRootChangeListener listener, String instanceName) throws Exception { PropertyKey propertyKey = _dataAccessor.keyBuilder().customizedStatesRoot(instanceName); if (_zkclient.exists(propertyKey.getPath())) { addListener(listener, new Builder(_clusterName).customizedStatesRoot(instanceName), ChangeType.CUSTOMIZED_STATE_ROOT, new EventType[]{EventType.NodeChildrenChanged}); } }

Target:
public void addCustomizedStateRootChangeListener(CustomizedStateRootChangeListener listener, String instanceName) throws Exception { addListener(listener, new Builder(_clusterName).customizedStatesRoot(instanceName), ChangeType.CUSTOMIZED_STATE_ROOT, new EventType[]{EventType.NodeChildrenChanged}); }
Source:
public String getHeader(CharSequence headerName) { return headers().get(headerName.toString()); }

Target:
public String getHeader(CharSequence headerName) { return headers().get(headerName); }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + getTitle().hashCode(); result = prime * result + super.hashCode(); return result; }

Target:
public int hashCode() { final int prime = 31; int result = super.hashCode(); result = prime * result + ((getEntity() == null) ? 0 : getEntity().hashCode()); result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode()); return result; }
Source:
public boolean testDouble(double value) { if (!lowerUnbounded) { if (value < lower) { return false; } if (lowerExclusive && lower == value) { return false; } } if (!upperUnbounded) { if (value > upper) { return false; } if (upperExclusive && value == upper) { return false; } } return !Double.isNaN(value) && !Double.isNaN(lower) && !Double.isNaN(upper); }

Target:
public boolean testDouble(double value) { if (Double.isNaN(value)) { return false; } if (!lowerUnbounded) { if (value < lower) { return false; } if (lowerExclusive && lower == value) { return false; } } if (!upperUnbounded) { if (value > upper) { return false; } if (upperExclusive && value == upper) { return false; } } return true; }
Source:
public NullStatisticsReporter() { super( FileUtils.getFile( FileUtils.getTempDirectory(), RandomStringUtils.randomAlphabetic( 24 ) ) ); }

Target:
private NullStatisticsReporter() { super( null, null, null ); }
Source:
public void sendMessageToElastic() throws Exception { Server server = Server.builder().setHost("host").setPort("123").build(); Query query = Query.builder().build(); Result result = new Result(1, "attributeName", "className", "objDomain", "classNameAlias", "typeName", ImmutableMap.of("key", (Object)1)); ElasticWriter writer = createElasticWriter(); when(mockClient.execute(Matchers.isA(IndicesExists.class))).thenReturn(jestResultFalse); when(mockClient.execute(Matchers.isA(PutMapping.class))).thenReturn(jestResultTrue); writer.setJestClient(mockClient); writer.start(); writer.doWrite(server, query, ImmutableList.of(result)); writer.stop(); Mockito.verify(mockClient, atLeast(2)).execute(Matchers.<Action<JestResult>>any()); }

Target:
public void sendMessageToElastic() throws Exception { when(mockClient.execute(Matchers.isA(IndicesExists.class))).thenReturn(jestResultFalse); when(mockClient.execute(Matchers.isA(PutMapping.class))).thenReturn(jestResultTrue); when(mockClient.execute(Matchers.isA(Index.class))).thenReturn(jestResultTrue); writer.start(); writer.doWrite(server, query, ImmutableList.of(result)); writer.stop(); Mockito.verify(mockClient, times(4)).execute(Matchers.<Action<JestResult>>any()); }
Source:
public static void getModel(String projectId, String computeRegion, String modelId) throws IOException { try (AutoMlClient client = AutoMlClient.create()) { ModelName modelFullId = ModelName.of(projectId, computeRegion, modelId); Model model = client.getModel(modelFullId); System.out.format("Model name: %s%n", model.getName()); System.out.format( "Model Id: %s\n", model.getName().split("/")[model.getName().split("/").length - 1]); System.out.format("Model display name: %s%n", model.getDisplayName()); System.out.format("Dataset Id: %s%n", model.getDatasetId()); System.out.println("Tables Model Metadata: "); System.out.format( "\tTraining budget: %s%n", model.getTablesModelMetadata().getTrainBudgetMilliNodeHours()); System.out.format( "\tTraining cost: %s%n", model.getTablesModelMetadata().getTrainBudgetMilliNodeHours()); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); String createTime = dateFormat.format(new java.util.Date(model.getCreateTime().getSeconds() * 1000)); System.out.format("Model create time: %s%n", createTime); System.out.format("Model deployment state: %s%n", model.getDeploymentState()); for (TablesModelColumnInfo info : model.getTablesModelMetadata().getTablesModelColumnInfoList()) { System.out.format( "Column: %s - Importance: %.2f%n", info.getColumnDisplayName(), info.getFeatureImportance()); } } }

Target:
public static void getModel(String projectId, String computeRegion, String modelId) throws IOException, StatusRuntimeException { try (AutoMlClient client = AutoMlClient.create()) { ModelName modelFullId = ModelName.of(projectId, computeRegion, modelId); Model model = client.getModel(modelFullId); System.out.format("Model name: %s%n", model.getName()); System.out.format( "Model Id: %s\n", model.getName().split("/")[model.getName().split("/").length - 1]); System.out.format("Model display name: %s%n", model.getDisplayName()); System.out.format("Dataset Id: %s%n", model.getDatasetId()); System.out.println("Tables Model Metadata: "); System.out.format( "\tTraining budget: %s%n", model.getTablesModelMetadata().getTrainBudgetMilliNodeHours()); System.out.format( "\tTraining cost: %s%n", model.getTablesModelMetadata().getTrainBudgetMilliNodeHours()); DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); String createTime = dateFormat.format(new java.util.Date(model.getCreateTime().getSeconds() * 1000)); System.out.format("Model create time: %s%n", createTime); System.out.format("Model deployment state: %s%n", model.getDeploymentState()); for (TablesModelColumnInfo info : model.getTablesModelMetadata().getTablesModelColumnInfoList()) { System.out.format( "Column: %s - Importance: %.2f%n", info.getColumnDisplayName(), info.getFeatureImportance()); } } }
Source:
public static String extractTelecom(PRPAMT201306UV02ParameterList params) { LOG.trace("Entering HL7Parser201305.ExtractTelecom method..."); String telecom = null; if (CollectionUtils.isNotEmpty(params.getPatientTelecom()) && params.getPatientTelecom().get(0) != null) { PRPAMT201306UV02PatientTelecom patientTelecom = params.getPatientTelecom().get(0); if (CollectionUtils.isNotEmpty(patientTelecom.getValue()) && patientTelecom.getValue().get(0) != null) { TELExplicit telecomValue = patientTelecom.getValue().get(0); LOG.info("Found patientTelecom in query parameters = " + telecomValue.getValue()); telecom = telecomValue.getValue(); if (telecom != null && !telecom.startsWith("tel:")) { telecom = null; LOG.info("Found patientTelecom in query parameters is not in the correct uri format"); } } else { LOG.info("message does not contain a patientTelecom"); } } else { LOG.info("message does not contain a patientTelecom"); } LOG.trace("Exiting HL7Parser201305.ExtractTelecom method..."); return telecom; }

Target:
public static String extractTelecom(PRPAMT201306UV02ParameterList params) { LOG.trace("Entering HL7Parser201305.ExtractTelecom method..."); String telecom = null; if (CollectionUtils.isNotEmpty(params.getPatientTelecom()) && params.getPatientTelecom().get(0) != null) { PRPAMT201306UV02PatientTelecom patientTelecom = params.getPatientTelecom().get(0); if (CollectionUtils.isNotEmpty(patientTelecom.getValue()) && patientTelecom.getValue().get(0) != null) { TELExplicit telecomValue = patientTelecom.getValue().get(0); LOG.info("Found patientTelecom in query parameters = " + telecomValue.getValue()); telecom = telecomValue.getValue(); if (!StringUtils.startsWith(telecom, "tel:")) { telecom = null; LOG.info("Found patientTelecom in query parameters is not in the correct uri format"); } } else { LOG.info("message does not contain a patientTelecom"); } } else { LOG.info("message does not contain a patientTelecom"); } LOG.trace("Exiting HL7Parser201305.ExtractTelecom method..."); return telecom; }
Source:
public static void setUp() throws IOException, TimeoutException, InterruptedException { createFileHandler(FILE_HANDLER_ADDRESS, "tests_hal1.log"); administration.reloadIfRequired(); createFileHandler(FILE_HANDLER_TB_REMOVED_ADDRESS, "tests_hal2.log"); administration.reloadIfRequired(); }

Target:
public static void setUp() throws IOException, TimeoutException, InterruptedException { createFileHandler(FILE_HANDLER_ADDRESS, "tests_hal1.log"); createFileHandler(FILE_HANDLER_TB_REMOVED_ADDRESS, "tests_hal2.log"); administration.reloadIfRequired(); }
Source:
public Response doImport(Action action) { validateParameters(action, "storageDomain.id|name"); ImportRepoImageParameters importParameters = new ImportRepoImageParameters(); importParameters.setSourceRepoImageId(id); importParameters.setSourceStorageDomainId(getStorageDomainId()); importParameters.setStoragePoolId(getDataCenterId(getStorageDomainId(action))); importParameters.setStorageDomainId(getStorageDomainId(action)); if (action.isSetImportAsTemplate()) { if (action.isImportAsTemplate()) { validateParameters(action, "cluster.id|name"); importParameters.setClusterId(getClusterId(action)); if (action.isSetTemplate() && action.getTemplate().isSetName()) { importParameters.setTemplateName(action.getTemplate().getName()); } } importParameters.setImportAsTemplate(action.isImportAsTemplate()); } if (action.isSetDisk()) { if (action.getDisk().isSetAlias()) { importParameters.setDiskAlias(action.getDisk().getAlias()); } if (action.getDisk().isSetName()) { importParameters.setDiskAlias(action.getDisk().getName()); } } return doAction(VdcActionType.ImportRepoImage, importParameters, action); }

Target:
public Response doImport(Action action) { validateParameters(action, "storageDomain.id|name"); ImportRepoImageParameters importParameters = new ImportRepoImageParameters(); importParameters.setSourceRepoImageId(id); importParameters.setSourceStorageDomainId(getStorageDomainId()); importParameters.setStoragePoolId(getDataCenterId(getStorageDomainId(action))); importParameters.setStorageDomainId(getStorageDomainId(action)); if (action.isSetImportAsTemplate()) { if (action.isImportAsTemplate()) { validateParameters(action, "cluster.id|name"); importParameters.setClusterId(getClusterId(action)); if (action.isSetTemplate() && action.getTemplate().isSetName()) { importParameters.setTemplateName(action.getTemplate().getName()); } } importParameters.setImportAsTemplate(action.isImportAsTemplate()); } if (action.isSetDisk()) { if (action.getDisk().isSetName()) { importParameters.setDiskAlias(action.getDisk().getName()); } if (action.getDisk().isSetAlias()) { importParameters.setDiskAlias(action.getDisk().getAlias()); } } return doAction(VdcActionType.ImportRepoImage, importParameters, action); }
Source:
default void checkCanCreateViewWithSelectFromTable(ConnectorTransactionHandle transactionHandle, Identity identity, SchemaTableName tableName) { denyCreateViewWithSelect(tableName.toString()); }

Target:
default void checkCanCreateViewWithSelectFromTable(ConnectorTransactionHandle transactionHandle, Identity identity, SchemaTableName tableName) { checkCanCreateViewWithSelectFromColumns(transactionHandle, identity, tableName, emptySet()); }
Source:
public void testLogMessage() throws IllegalArgumentException, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException { Method m = ReflectionUtils.getStaticTestMethod(Logger.class, "getLogMessage", String.class, String.class, ADALError.class); String msg = (String)m.invoke(null, "a", "b", ADALError.AUTH_FAILED); assertEquals("Empty message is expected", ADALError.AUTH_FAILED.name()+":a b", msg); msg = (String)m.invoke(null, "a", null, ADALError.AUTH_FAILED); assertEquals("Empty message is expected", ADALError.AUTH_FAILED.name()+":a", msg); }

Target:
public void testLogMessage() throws IllegalArgumentException, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException { Method m = ReflectionUtils.getStaticTestMethod(Logger.class, "getLogMessage", String.class, String.class, ADALError.class); String msg = (String)m.invoke(null, "logMsg", "logAdditionalMsg", ADALError.AUTH_FAILED); assertEquals("Empty message is expected", ADALError.AUTH_FAILED.name()+":logMsg logAdditionalMsg", msg); msg = (String)m.invoke(null, "logMsg", null, ADALError.AUTH_FAILED); assertEquals("Empty message is expected", ADALError.AUTH_FAILED.name()+":logMsg", msg); }
Source:
private static Iterator<Node> singleStep(Graph graph, boolean forward, Node node, Node property) { Iter<Node> iter2 = null ; if ( forward ) return G.find(graph, node, property, Node.ANY).mapWith(Triple::getObject); else return G.find(graph, Node.ANY, property, node).mapWith(Triple::getSubject); }

Target:
private static Iterator<Node> singleStep(Graph graph, boolean forward, Node node, Node property) { if ( forward ) return G.find(graph, node, property, Node.ANY).mapWith(Triple::getObject); else return G.find(graph, Node.ANY, property, node).mapWith(Triple::getSubject); }
Source:
private Template getRequestTemplate(final Ds3Request ds3Request) throws IOException { if (isGetObjectRequest(ds3Request)) { return config.getTemplate("request/get_object_request.ftl"); } if (isBulkPutRequest(ds3Request)) { return config.getTemplate("request/bulk_put_request.ftl"); } if (isBulkGetRequest(ds3Request)) { return config.getTemplate("request/bulk_get_request.ftl"); } if (isCreateObjectRequest(ds3Request)) { return config.getTemplate("request/put_object_request.ftl"); } if (isCreateMultiPartUploadPartRequest(ds3Request)) { return config.getTemplate("request/stream_request_payload.ftl"); } if (isEjectStorageDomainBlobsRequest(ds3Request)) { return config.getTemplate("request/eject_storage_domain.ftl"); } if (isPhysicalPlacementRequest(ds3Request)) { return config.getTemplate("request/objects_request_payload.ftl"); } if (isMultiFileDeleteRequest(ds3Request)) { return config.getTemplate("request/multi_file_delete_request.ftl"); } if (hasStringRequestPayload(ds3Request)) { return config.getTemplate("request/string_request_payload.ftl"); } return config.getTemplate("request/request_template.ftl"); }

Target:
private Template getRequestTemplate(final Ds3Request ds3Request) throws IOException { if (isGetObjectRequest(ds3Request)) { return config.getTemplate("request/get_object_request.ftl"); } if (isBulkPutRequest(ds3Request)) { return config.getTemplate("request/bulk_put_request.ftl"); } if (isBulkGetRequest(ds3Request)) { return config.getTemplate("request/bulk_get_request.ftl"); } if (isCreateObjectRequest(ds3Request)) { return config.getTemplate("request/put_object_request.ftl"); } if (isCreateMultiPartUploadPartRequest(ds3Request)) { return config.getTemplate("request/stream_request_payload.ftl"); } if (isEjectStorageDomainBlobsRequest(ds3Request)) { return config.getTemplate("request/eject_storage_domain_blobs.ftl"); } if (isPhysicalPlacementRequest(ds3Request)) { return config.getTemplate("request/objects_request_payload.ftl"); } if (isMultiFileDeleteRequest(ds3Request)) { return config.getTemplate("request/multi_file_delete_request.ftl"); } if (hasStringRequestPayload(ds3Request)) { return config.getTemplate("request/string_request_payload.ftl"); } return config.getTemplate("request/request_template.ftl"); }
Source:
private Estimate calculateNullsFraction(Map<String, PartitionStatistics> statisticsByPartitionName, String column, Estimate totalRowsCount) { Estimate totalNullsCount = summarizePartitionStatistics( statisticsByPartitionName.values(), column, columnStatistics -> { if (columnStatistics.getNullsCount().isPresent()) { return OptionalDouble.of(columnStatistics.getNullsCount().getAsLong()); } else { return OptionalDouble.empty(); } }, nullsCountStream -> { double nullsCount = 0; long partitionsWithStatisticsCount = 0; for (PrimitiveIterator.OfDouble nullsCountIterator = nullsCountStream.iterator(); nullsCountIterator.hasNext(); ) { nullsCount += nullsCountIterator.nextDouble(); partitionsWithStatisticsCount++; } if (partitionsWithStatisticsCount == 0) { return OptionalDouble.empty(); } else { int allPartitionsCount = statisticsByPartitionName.size(); return OptionalDouble.of(allPartitionsCount / partitionsWithStatisticsCount * nullsCount); } }); if (totalNullsCount.isValueUnknown() || totalRowsCount.isValueUnknown()) { return Estimate.unknownValue(); } if (totalRowsCount.getValue() == 0.0) { return new Estimate(0.0); } return new Estimate(totalNullsCount.getValue() / totalRowsCount.getValue()); }

Target:
private Estimate calculateNullsFraction(Map<String, PartitionStatistics> statisticsByPartitionName, String column, Estimate totalRowsCount) { Estimate totalNullsCount = summarizePartitionStatistics( statisticsByPartitionName.values(), column, columnStatistics -> { if (columnStatistics.getNullsCount().isPresent()) { return OptionalDouble.of(columnStatistics.getNullsCount().getAsLong()); } else { return OptionalDouble.empty(); } }, nullsCountStream -> { double nullsCount = 0; long partitionsWithStatisticsCount = 0; for (PrimitiveIterator.OfDouble nullsCountIterator = nullsCountStream.iterator(); nullsCountIterator.hasNext(); ) { nullsCount += nullsCountIterator.nextDouble(); partitionsWithStatisticsCount++; } if (partitionsWithStatisticsCount == 0) { return OptionalDouble.empty(); } else { int allPartitionsCount = statisticsByPartitionName.size(); return OptionalDouble.of(allPartitionsCount / partitionsWithStatisticsCount * nullsCount); } }); if (totalNullsCount.isValueUnknown() || totalRowsCount.isValueUnknown()) { return Estimate.unknownValue(); } if (totalRowsCount.getValue() == 0.0) { return Estimate.zeroValue(); } return new Estimate(totalNullsCount.getValue() / totalRowsCount.getValue()); }
Source:
public static Matrix4f getMatrix(EnumFacing facing) { Matrix4f ret = new Matrix4f(); switch(facing) { case DOWN: ret = ModelRotation.X90_Y0.getMatrix(); break; case UP: ret = ModelRotation.X270_Y0.getMatrix(); break; case NORTH: ret = ModelRotation.X0_Y0.getMatrix(); break; case SOUTH: ret = ModelRotation.X0_Y180.getMatrix(); break; case WEST: ret = ModelRotation.X0_Y270.getMatrix(); break; case EAST: ret = ModelRotation.X0_Y90.getMatrix(); break; default: ret.setIdentity(); } return ret; }

Target:
public static Matrix4f getMatrix(EnumFacing facing) { switch(facing) { case DOWN: return ModelRotation.X90_Y0.getMatrix(); case UP: return ModelRotation.X270_Y0.getMatrix(); case NORTH: return TRSRTransformation.identity.matrix; case SOUTH: return ModelRotation.X0_Y180.getMatrix(); case WEST: return ModelRotation.X0_Y270.getMatrix(); case EAST: return ModelRotation.X0_Y90.getMatrix(); default: return new Matrix4f(); } }
Source:
private static void enablePlugin(PluginManager manager, String shortName) throws IOException { PluginWrapper plugin = manager.getPlugin(shortName); if (plugin == null) throw new IllegalArgumentException(Messages.EnablePluginCommand_NoSuchPlugin(shortName)); if (plugin.isEnabled()) return; for (PluginWrapper.Dependency dependency : plugin.getDependencies()) { enablePlugin(manager, dependency.shortName); } plugin.enable(); }

Target:
private void enablePlugin(PluginManager manager, String shortName) throws IOException { PluginWrapper plugin = manager.getPlugin(shortName); if (plugin == null) { throw new IllegalArgumentException(Messages.EnablePluginCommand_NoSuchPlugin(shortName)); } if (plugin.isEnabled()) { return; } stdout.println(String.format("Enabling plugin `%s' (%s)", plugin.getShortName(), plugin.getVersion())); enableDependencies(manager, plugin); plugin.enable(); stdout.println(String.format("Plugin `%s' was enabled.", plugin.getShortName())); }
Source:
public void run() { List<Diff> differences = newArrayList(); differences.addAll(getDifferencesToMerge()); differences.addAll(getDifferencesToReject()); ICompareCopyCommand mergeCommand = editingDomain.createCopyCommand(differences, leftToRight, mergerRegistry, mergeRunnable); editingDomain.getCommandStack().execute(mergeCommand); if (navigatable != null) { navigatable.selectChange(Navigatable.NEXT_UNRESOLVED_CHANGE); } }

Target:
public void run() { computeDifferencesToMerge(); computeRequiredDifferencesToReject(); ICompareCopyCommand mergeCommand = editingDomain.createCopyCommand(differencesToMerge, leftToRight, mergerRegistry, mergeRunnable); editingDomain.getCommandStack().execute(mergeCommand); if (navigatable != null) { navigatable.selectChange(Navigatable.NEXT_UNRESOLVED_CHANGE); } }
Source:
public void testToJson() throws Exception { String expected = MAPPER.writeValueAsString( MAPPER.readValue(FixtureHelpers.fixture("fixtures/email.json"), Email.class)); Assertions.assertEquals(expected, MAPPER.writeValueAsString(email)); }

Target:
public void testToJson() throws Exception { String expected = MAPPER.writeValueAsString( MAPPER.readValue(FixtureHelpers.fixture("fixtures/email.json"), Email.class)); assertEquals(expected, MAPPER.writeValueAsString(email)); }
Source:
private CompletionStage<String> completeTransaction(LocalTransaction localTx, boolean commit, Xid xid) { CompletionStage<?> stage; Function<Throwable, String> errorTranslation; if (commit) { localTx.clearLookedUpEntries(); stage = txCoordinator.prepare(localTx, true) .thenCompose(ignore -> txCoordinator.commit(localTx, false)); errorTranslation = t -> { log.warnCouldNotCommitLocalTx(localTx, t); return "Could not commit transaction " + xid + " : " + t.getMessage(); }; } else { stage = txCoordinator.rollback(localTx); errorTranslation = t -> { log.warnCouldNotRollbackLocalTx(localTx, t); return "Could not rollback transaction " + xid + " : " + t.getMessage(); }; } return stage.thenCompose(ignore -> removeRecoveryInformation(null, xid, localTx.getGlobalTransaction(), false) .thenApply(ignore2 -> commit ? "Commit successful!" : "Rollback successful") ).exceptionally(errorTranslation); }

Target:
private CompletionStage<String> completeTransaction(LocalTransaction localTx, boolean commit, Xid xid) { GlobalTransaction gtx = localTx.getGlobalTransaction(); if (commit) { localTx.clearLookedUpEntries(); return txCoordinator.prepare(localTx, true) .thenCompose(ignore -> txCoordinator.commit(localTx, false)) .thenCompose(ignore -> removeRecoveryInformation(null, xid, gtx, false)) .thenApply(ignore -> "Commit successful!") .exceptionally(t -> { log.warnCouldNotCommitLocalTx(localTx, t); return "Could not commit transaction " + xid + " : " + t.getMessage(); }); } else { return txCoordinator.rollback(localTx) .thenCompose(ignore -> removeRecoveryInformation(null, xid, gtx, false)) .thenApply(ignore -> "Rollback successful") .exceptionally(t -> { log.warnCouldNotRollbackLocalTx(localTx, t); return "Could not rollback transaction " + xid + " : " + t.getMessage(); }); } }