auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected ResultSet executeQuery() throws SQLException { if (incrementingColumn != null && timestampColumn != null) { Timestamp startTime = new Timestamp(timestampOffset == null ? 0 : timestampOffset); Timestamp endTime = new Timestamp(new Date().getTime() - timestampDelay); stmt.setTimestamp(1, endTime, UTC_CALENDAR); stmt.setTimestamp(2, startTime, UTC_CALENDAR); stmt.setLong(3, (incrementingOffset == null ? -1 : incrementingOffset)); stmt.setTimestamp(4, startTime, UTC_CALENDAR); log.debug("Executing prepared statement with start time value = " + timestampOffset + " (" + startTime.toString() + ") " + " end time " + endTime.toString() + " and incrementing value = " + incrementingOffset); } else if (incrementingColumn != null) { stmt.setLong(1, (incrementingOffset == null ? -1 : incrementingOffset)); log.debug("Executing prepared statement with incrementing value = " + incrementingOffset); } else if (timestampColumn != null) { Timestamp startTime = new Timestamp(timestampOffset == null ? 0 : timestampOffset); Timestamp endTime = new Timestamp(new Date().getTime() - timestampDelay); stmt.setTimestamp(1, startTime, UTC_CALENDAR); stmt.setTimestamp(2, endTime, UTC_CALENDAR); log.debug("Executing prepared statement with timestamp value = " + timestampOffset + " (" + startTime.toString() + ") " + " end time " + endTime.toString()); } return stmt.executeQuery(); }

Target:
protected ResultSet executeQuery() throws SQLException { if (incrementingColumn != null && timestampColumn != null) { Timestamp startTime = new Timestamp(timestampOffset == null ? 0 : timestampOffset); Timestamp endTime = new Timestamp(JdbcUtils.getCurrentTimeOnDB(stmt.getConnection(), UTC_CALENDAR).getTime() - timestampDelay); stmt.setTimestamp(1, endTime, UTC_CALENDAR); stmt.setTimestamp(2, startTime, UTC_CALENDAR); stmt.setLong(3, (incrementingOffset == null ? -1 : incrementingOffset)); stmt.setTimestamp(4, startTime, UTC_CALENDAR); log.debug("Executing prepared statement with start time value = " + timestampOffset + " (" + startTime.toString() + ") " + " end time " + endTime.toString() + " and incrementing value = " + incrementingOffset); } else if (incrementingColumn != null) { stmt.setLong(1, (incrementingOffset == null ? -1 : incrementingOffset)); log.debug("Executing prepared statement with incrementing value = " + incrementingOffset); } else if (timestampColumn != null) { Timestamp startTime = new Timestamp(timestampOffset == null ? 0 : timestampOffset); Timestamp endTime = new Timestamp(JdbcUtils.getCurrentTimeOnDB(stmt.getConnection(), UTC_CALENDAR).getTime() - timestampDelay); stmt.setTimestamp(1, startTime, UTC_CALENDAR); stmt.setTimestamp(2, endTime, UTC_CALENDAR); log.debug("Executing prepared statement with timestamp value = " + timestampOffset + " (" + JdbcUtils.formatUTC(startTime) + ") " + " end time " + JdbcUtils.formatUTC(endTime)); } return stmt.executeQuery(); }
Source:
private ChromeCasts() { chromeCasts = Collections.synchronizedList(new ArrayList<ChromeCast>()); }

Target:
private ChromeCasts() { }
Source:
private void createActions(boolean forEditor) { fRenameAction = new CRenameAction(); fRenameAction.setActionDefinitionId(ICEditorActionDefinitionIds.RENAME_ELEMENT); fAllActions.add(fRenameAction); if (!forEditor) { fDeleteAction = new CDeleteAction(); fDeleteAction.setActionDefinitionId(ActionFactory.DELETE.getId()); fAllActions.add(fDeleteAction); } if (forEditor) { fExtractConstantAction= new ExtractConstantAction(); fExtractConstantAction.setActionDefinitionId(ICEditorActionDefinitionIds.EXTRACT_CONSTANT); fAllActions.add(fExtractConstantAction); fExtractLocalVariableAction= new ExtractLocalVariableAction(); fExtractLocalVariableAction.setActionDefinitionId(ICEditorActionDefinitionIds.EXTRACT_LOCAL_VARIABLE); fAllActions.add(fExtractLocalVariableAction); fExtractFunctionAction = new ExtractFunctionAction(); fExtractFunctionAction.setActionDefinitionId(ICEditorActionDefinitionIds.EXTRACT_FUNCTION); fAllActions.add(fExtractFunctionAction); fToggleFunctionAction = new ToggleFunctionAction(); fToggleFunctionAction.setActionDefinitionId(ICEditorActionDefinitionIds.TOGGLE_FUNCTION); fAllActions.add(fToggleFunctionAction); } fHideMethodAction = new HideMethodAction(); fHideMethodAction.setActionDefinitionId(ICEditorActionDefinitionIds.HIDE_METHOD); fAllActions.add(fHideMethodAction); }

Target:
private void createActions(boolean forEditor) { fRenameAction = new CRenameAction(); fRenameAction.setActionDefinitionId(ICEditorActionDefinitionIds.RENAME_ELEMENT); fAllActions.add(fRenameAction); if (forEditor) { fExtractConstantAction= new ExtractConstantAction(); fExtractConstantAction.setActionDefinitionId(ICEditorActionDefinitionIds.EXTRACT_CONSTANT); fAllActions.add(fExtractConstantAction); fExtractLocalVariableAction= new ExtractLocalVariableAction(); fExtractLocalVariableAction.setActionDefinitionId(ICEditorActionDefinitionIds.EXTRACT_LOCAL_VARIABLE); fAllActions.add(fExtractLocalVariableAction); fExtractFunctionAction = new ExtractFunctionAction(); fExtractFunctionAction.setActionDefinitionId(ICEditorActionDefinitionIds.EXTRACT_FUNCTION); fAllActions.add(fExtractFunctionAction); fToggleFunctionAction = new ToggleFunctionAction(); fToggleFunctionAction.setActionDefinitionId(ICEditorActionDefinitionIds.TOGGLE_FUNCTION); fAllActions.add(fToggleFunctionAction); } else { fDeleteAction = new CDeleteAction(); fDeleteAction.setActionDefinitionId(ICEditorActionDefinitionIds.DELETE_ELEMENT); fAllActions.add(fDeleteAction); } fHideMethodAction = new HideMethodAction(); fHideMethodAction.setActionDefinitionId(ICEditorActionDefinitionIds.HIDE_METHOD); fAllActions.add(fHideMethodAction); }
Source:
private void setupUI() { setContentView(R.layout.prompt_view); promptTitle = findViewById(R.id.prompt_title); actionButton = findViewById(R.id.action_button); doLaterButton = findViewById(R.id.do_later_button); imageCue = findViewById(R.id.image_cue); instructions = findViewById(R.id.instructions); if (getInstructionsStringKey() != null) { instructions.setText(Localization.get(getInstructionsStringKey())); } TextView helpText = findViewById(R.id.help_text); helpText.setText(Localization.get("prompt.help.text", getActionString())); doLaterButton.setOnClickListener(v -> PromptActivity.this.finish()); if (inForceMode()) { promptTitle.setTextColor(getResources().getColor(R.color.cc_attention_negative_color)); promptTitle.setTypeface(Typeface.DEFAULT_BOLD); } setUpTypeSpecificUIComponents(); updateVisibilities(); }

Target:
private void setupUI() { if (getInstructionsStringKey() != null) { instructions.setText(Localization.get(getInstructionsStringKey())); } helpText.setText(Localization.get(getHelpTextResource())); doLaterButton.setOnClickListener(v -> PromptActivity.this.finish()); if (inForceMode()) { promptTitle.setTextColor(getResources().getColor(R.color.cc_attention_negative_color)); promptTitle.setTypeface(Typeface.DEFAULT_BOLD); } setUpTypeSpecificUIComponents(); updateVisibilities(); }
Source:
public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { fAdditionalContentTypesIDs = new String[0]; if (data != null) { if (data instanceof String && data.toString().length() > 0) { fAdditionalContentTypesIDs = StringUtils.unpack(data.toString()); } } }

Target:
public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { fAdditionalContentTypesIDs = new String[0]; if (data instanceof String && data.toString().length() > 0) { fAdditionalContentTypesIDs = StringUtils.unpack(data.toString()); } }
Source:
public Predicate visit(BetweenPredicate predicate, Indexes indexes) { TypeConverter converter = indexes.getConverter(predicate.attributeName); if (converter == null) { return predicate; } Comparable from = converter.convert(predicate.from); Comparable to = converter.convert(predicate.to); Order order = compare(from, to); switch (order) { case LESS: return predicate; case EQUAL: return new EqualPredicate(predicate.attributeName, from); case GREATER: return Predicates.alwaysFalse(); default: throw new IllegalStateException("Unexpected order: " + order); } }

Target:
public Predicate visit(BetweenPredicate predicate, Indexes indexes) { TypeConverter converter = indexes.getConverter(predicate.attributeName); if (converter == null) { return predicate; } Comparable from = converter.convert(predicate.from); Comparable to = converter.convert(predicate.to); Order order = compare(from, to); switch (order) { case LESS: return predicate; case EQUAL: return Predicates.equal(predicate.attributeName, from); case GREATER: return Predicates.alwaysFalse(); default: throw new IllegalStateException("Unexpected order: " + order); } }
Source:
public boolean doPostCreateApplication(ServiceProvider serviceProvider, String tenantDomain, String userName) throws IdentityApplicationManagementException { if (isEnable()) { audit.info(String.format(AUDIT_MESSAGE, userName, "create", serviceProvider.getApplicationID(), serviceProvider.getApplicationName(), SUCCESS)); } return true; }

Target:
public boolean doPostCreateApplication(ServiceProvider serviceProvider, String tenantDomain, String userName) throws IdentityApplicationManagementException { int appId = -1; String name = "Undefined"; if (serviceProvider != null) { appId = serviceProvider.getApplicationID(); name = serviceProvider.getApplicationName(); } audit.info(String.format(AUDIT_MESSAGE, userName, "create", appId, name, SUCCESS)); return true; }
Source:
public void activateClearance(StorageDomain storageDomain){ storageDomain.setDomainStatus(StorageDomain.DomainStatus.ACTIVE); updateStorageDomain(storageDomain); }

Target:
private void activateClearance(StorageDomain storageDomain){ storageDomain.setDomainStatus(StorageDomain.DomainStatus.ACTIVE); updateStorageDomain(storageDomain); }
Source:
public void open_authPlain() throws Exception { settings.setAuthType(AuthType.PLAIN); MockImapServer server = new MockImapServer(); preAuthenticationDialog(server, "AUTH=PLAIN"); server.expect("2 AUTHENTICATE PLAIN"); server.output("+"); server.expect(ByteString.encodeUtf8("\000" + USERNAME + "\000" + PASSWORD).base64()); server.output("2 OK Success"); simplePostAuthenticationDialog(server, true); ImapConnection imapConnection = startServerAndCreateImapConnection(server); imapConnection.open(); server.verifyConnectionStillOpen(); server.verifyInteractionCompleted(); }

Target:
public void open_authPlain() throws Exception { settings.setAuthType(AuthType.PLAIN); MockImapServer server = new MockImapServer(); preAuthenticationDialog(server, "AUTH=PLAIN"); server.expect("2 AUTHENTICATE PLAIN"); server.output("+"); server.expect(ByteString.encodeUtf8("\000" + USERNAME + "\000" + PASSWORD).base64()); server.output("2 OK Success"); postAuthenticationDialogRequestingCapabilities(server); ImapConnection imapConnection = startServerAndCreateImapConnection(server); imapConnection.open(); server.verifyConnectionStillOpen(); server.verifyInteractionCompleted(); }
Source:
public Properties getProducerProperties(String outputChannelName) { Properties channelProducerProperties = new Properties(); BindingProperties bindingProperties = this.bindings.get(outputChannelName); if (bindingProperties != null) { if (Boolean.TRUE.equals(bindingProperties.isSyncProducer())) { channelProducerProperties.setProperty(BinderPropertyKeys.SYNC_PRODUCER, Boolean.toString(bindingProperties.isSyncProducer())); } } updateBatchProperties(outputChannelName, channelProducerProperties); updateProducerPartitionProperties(outputChannelName, channelProducerProperties); return channelProducerProperties; }

Target:
public Properties getProducerProperties(String outputChannelName) { Properties channelProducerProperties = new Properties(); updateBatchProperties(outputChannelName, channelProducerProperties); updateProducerPartitionProperties(outputChannelName, channelProducerProperties); return channelProducerProperties; }
Source:
public void setVirtualHost(String virtualHost) { this.virtualHost = (virtualHost == null || virtualHost.isEmpty()) ? "/" : virtualHost; }

Target:
public void setVirtualHost(String virtualHost) { this.virtualHost = StringUtils.hasLength(virtualHost) ? virtualHost : "/"; }
Source:
public void beginFormat(Format format, Map<String, String> parameters) { if (this.previousFormatParameters != null) { if (parameters.isEmpty()) { } else if (!this.previousFormatParameters.equals(parameters)) { this.previousFormatParameters = null; printParameters(parameters, false); } else { this.previousFormatParameters = null; } } else if (this.previousFormatParameters == null) { printParameters(parameters, false); } switch (format) { case BOLD: if (this.previousFormatParameters != null) { getPrinter().print("(%%)"); this.previousFormatParameters = null; } getXWikiPrinter().printBeginBold(); break; case ITALIC: if (this.previousFormatParameters != null) { getPrinter().print("(%%)"); this.previousFormatParameters = null; } getXWikiPrinter().printBeginItalic(); break; case STRIKEDOUT: print("--"); break; case UNDERLINED: print("__"); break; case SUPERSCRIPT: print("^^"); break; case SUBSCRIPT: print(",,"); break; case MONOSPACE: print("##"); break; case NONE: break; } }

Target:
public void beginFormat(Format format, Map<String, String> parameters) { if (this.previousFormatParameters != null) { if (parameters.isEmpty()) { print("(%%)"); this.previousFormatParameters = null; } else if (!this.previousFormatParameters.equals(parameters)) { this.previousFormatParameters = null; printParameters(parameters, false); } else { this.previousFormatParameters = null; } } else if (this.previousFormatParameters == null) { printParameters(parameters, false); } switch (format) { case BOLD: if (this.previousFormatParameters != null) { getPrinter().print("(%%)"); this.previousFormatParameters = null; } getXWikiPrinter().printBeginBold(); break; case ITALIC: if (this.previousFormatParameters != null) { getPrinter().print("(%%)"); this.previousFormatParameters = null; } getXWikiPrinter().printBeginItalic(); break; case STRIKEDOUT: print("--"); break; case UNDERLINED: print("__"); break; case SUPERSCRIPT: print("^^"); break; case SUBSCRIPT: print(",,"); break; case MONOSPACE: print("##"); break; case NONE: break; } }
Source:
private static int integerLiteral(char[] value) { int i = 0; char c = value[i++]; if (c == '0' && i < value.length) { c = value[i]; switch ((c | 0x20)) { case 'x': return probablyHex(value, i); case 'b': return probablyBinary(value, i); case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': while (i < value.length) { if (isOctal(c)) { c = value[++i]; } else if (c == '\'') { i++; continue; } else { break; } } break; case '.': return afterDecimalPoint(value, i); } if (c == '8' || c == '9') { c = value[i]; while (Character.isDigit(c) && i < value.length) { c = value[++i]; } } return handleDecimalOrExponent(value, c, i); } else if (Character.isDigit(c)) { c = value[i]; while (i < value.length) { if (Character.isDigit(c)) { c = value[++i]; } else if (c == '\'') { i++; continue; } else { break; } } return handleDecimalOrExponent(value, c, i); } else { assert false; } return i; }

Target:
private static int integerLiteral(char[] value) { int i = 0; char c = value[i++]; if (c == '0' && i < value.length) { c = value[i]; switch ((c | 0x20)) { case 'x': return probablyHex(value, i); case 'b': return probablyBinary(value, i); case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': while (isOctalOrSeparator(c) && i < value.length) { c = value[++i]; } break; case '.': return afterDecimalPoint(value, i); } if (c == '8' || c == '9') { c = value[i]; while (Character.isDigit(c) && i < value.length) { c = value[++i]; } } return handleDecimalOrExponent(value, c, i); } else if (Character.isDigit(c)) { c = value[i]; while (isDigitOrSeparator(c) && i < value.length) { c = value[++i]; } return handleDecimalOrExponent(value, c, i); } else { assert false; } return i; }
Source:
public void testVerticalScrollingDown() { Assert.assertTrue(driver.findElementByXPath(" try { findElement(verView2); Assert.fail("shouldn't find element" + verView2); } catch (NoSuchElementException e) { } try { findElement(verView3); Assert.fail("shouldn't find element" + verView3); } catch (NoSuchElementException e) { } ((RemoteUIAScrollView) driver.findElementByXPath(" waitForElement(driver, By.xpath(" Assert.assertTrue(driver.findElementByXPath(" try { findElement(verView1); Assert.fail("shouldn't find element" + verView1); } catch (NoSuchElementException e) { } try { findElement(verView3); Assert.fail("shouldn't find element" + verView3); } catch (NoSuchElementException e) { } ((RemoteUIAScrollView) driver.findElementByXPath(" }

Target:
public void testVerticalScrollingDown() { Assert.assertTrue(driver.findElementByXPath(" Assert.assertFalse(elementExists(verView2)); Assert.assertFalse(elementExists(verView3)); ((RemoteUIAScrollView) driver.findElementByXPath(" waitForElement(driver, By.xpath(" Assert.assertTrue(driver.findElementByXPath(" Assert.assertFalse(elementExists(verView1)); Assert.assertFalse(elementExists(verView3)); ((RemoteUIAScrollView) driver.findElementByXPath(" }
Source:
public static String encrypt(String utf8StrToEncrypt, Cipher cipher) { try { if (cipher != null) { return Base64.getEncoder().encodeToString(cipher.doFinal(utf8StrToEncrypt.getBytes("UTF-8"))); } else { throw new Exception("Must provide chiper"); } } catch (Exception e) { System.out.println("Error while encrypting: " + e.toString()); } return null; }

Target:
public static String encrypt(String utf8StrToEncrypt, Cipher cipher) { try { if (cipher != null) { return Base64.getEncoder().encodeToString(cipher.doFinal(utf8StrToEncrypt.getBytes("UTF-8"))); } else { throw new Exception("Must provide cipher"); } } catch (Exception e) { System.out.println("Error while encrypting: " + e.toString()); } return null; }
Source:
public void runMiniBatch(final Collection<NeuralNetworkData> miniBatchData, final MiniBatchInfo miniBatchInfo) { for (final NeuralNetworkData data : miniBatchData) { if (data.isValidation()) { continue; } final Matrix input = dataParser.asMatrix(data.getInstances()); final int[] labels = data.getLabels(); if (input.getColumns() != labels.length) { throw new RuntimeException("Invalid data: the number of inputs is not equal to the number of labels"); } neuralNetwork.train(input, labels); MatrixUtils.free(input); } neuralNetwork.updateParameters(); }

Target:
public void runMiniBatch(final Collection<NeuralNetworkData> miniBatchData, final MiniBatchInfo miniBatchInfo) { for (final NeuralNetworkData data : miniBatchData) { if (data.isValidation()) { continue; } final Matrix input = dataParser.asMatrix(data.getInstances()); final int[] labels = data.getLabels(); if (input.getColumns() != labels.length) { throw new RuntimeException("Invalid data: the number of inputs is not equal to the number of labels"); } neuralNetwork.train(input, labels); MatrixUtils.free(input); } }
Source:
public SimpleXMLConverter() { serializer = new Persister(); }

Target:
public SimpleXMLConverter() { this(new Persister()); }
Source:
public void testEnvironmentVariableOverrides() { Map<String, String> overrideVariables = new HashMap<>(); overrideVariables.put("HS_ACCESS_GROUP", "test"); overrideVariables.put("STARTED_BY_USER", "notTestUser"); SingularityRunNowRequest runNowRequest = new SingularityRunNowRequestBuilder() .environmentVariables(overrideVariables) .build(); final SingularityRequest request = new SingularityRequestBuilder("test", RequestType.WORKER) .build(); final SingularityDeploy deploy = new SingularityDeployBuilder("test", "1") .setCommand(Optional.of("/bin/echo hi")) .setRunImmediately(Optional.of(runNowRequest)) .build(); final SingularityTaskRequest taskRequest = new SingularityTaskRequest(request, deploy, pendingTask); final SingularityTask task = builder.buildTask(offerHolder, null, taskRequest, taskResources, executorResources); Map<String, String> environmentVariables = task.getMesosTask() .getCommand() .getEnvironment() .getVariablesList() .stream() .collect(Collectors.toMap(Variable::getName, Variable::getValue)); for (String key : overrideVariables.keySet()) { assertEquals( "Environment variable " + key + " not overridden.", environmentVariables.get(key), overrideVariables.get(key)); } }

Target:
public void testEnvironmentVariableOverrides() { Map<String, String> overrideVariables = new HashMap<>(); overrideVariables.put("MY_NEW_ENV_VAR", "test"); overrideVariables.put("STARTED_BY_USER", "notTestUser"); final SingularityRequest request = new SingularityRequestBuilder("test", RequestType.WORKER) .build(); final SingularityDeploy deploy = new SingularityDeployBuilder("test", "1") .setCommand(Optional.of("/bin/echo hi")) .build(); final SingularityPendingTask pendingTask = new SingularityPendingTaskBuilder() .setPendingTaskId(new SingularityPendingTaskId("test", "1", 0, 1, PendingType.IMMEDIATE, 0)) .setUser(user) .setEnvOverrides(overrideVariables) .build(); final SingularityTaskRequest taskRequest = new SingularityTaskRequest(request, deploy, pendingTask); final TaskInfo task = builder.buildTask(offerHolder, null, taskRequest, taskResources, executorResources).getMesosTask(); Map<String, String> environmentVariables = task .getCommand() .getEnvironment() .getVariablesList() .stream() .collect(Collectors.toMap(Variable::getName, Variable::getValue)); for (String key : overrideVariables.keySet()) { assertEquals( "Environment variable " + key + " not overridden.", environmentVariables.get(key), overrideVariables.get(key)); } }
Source:
public synchronized String getFieldString(Date d) { StringBuffer buffer = new StringBuffer(255); if (d != null) { calendar.setTime(d); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH) + 1; int day = calendar.get(Calendar.DAY_OF_MONTH); if (year < 1000) { if (year >= 100) { buffer.append("0"); } else if (year >= 10) { buffer.append("00"); } else { buffer.append("000"); } } buffer.append(year); if (month < 10) { buffer.append("0"); } buffer.append(month); if (day < 10) { buffer.append("0"); } buffer.append(day); } else { buffer.setLength(8); buffer.replace(0, 8, emptyString); } buffer.setLength(8); return buffer.toString(); }

Target:
public String getFieldString(Date d) { if (d != null) { buffer.delete(0, buffer.length()); calendar.setTime(d); int year = calendar.get(Calendar.YEAR); int month = calendar.get(Calendar.MONTH) + 1; int day = calendar.get(Calendar.DAY_OF_MONTH); if (year < 1000) { if (year >= 100) { buffer.append("0"); } else if (year >= 10) { buffer.append("00"); } else { buffer.append("000"); } } buffer.append(year); if (month < 10) { buffer.append("0"); } buffer.append(month); if (day < 10) { buffer.append("0"); } buffer.append(day); } else { buffer.setLength(8); buffer.replace(0, 8, emptyString); } buffer.setLength(8); return buffer.toString(); }
Source:
private void dispatchInternal(ChannelStateWriteRequest request) throws Exception { if (request instanceof CheckpointStartRequest) { Preconditions.checkState(!writers.containsKey(request.getCheckpointId())); writers.put(request.getCheckpointId(), buildWriter((CheckpointStartRequest) request)); } else if (request instanceof CheckpointInProgressRequest) { ChannelStateCheckpointWriter writer = writers.get(request.getCheckpointId()); CheckpointInProgressRequest req = (CheckpointInProgressRequest) request; if (writer == null) { req.onWriterMissing(); } else { req.execute(writer); } } else { throw new IllegalArgumentException("unknown request type: " + request); } }

Target:
private void dispatchInternal(ChannelStateWriteRequest request) throws Exception { if (request instanceof CheckpointStartRequest) { checkState(!writers.containsKey(request.getCheckpointId()), "writer not found for request " + request); writers.put(request.getCheckpointId(), buildWriter((CheckpointStartRequest) request)); } else if (request instanceof CheckpointInProgressRequest) { ChannelStateCheckpointWriter writer = writers.get(request.getCheckpointId()); CheckpointInProgressRequest req = (CheckpointInProgressRequest) request; if (writer == null) { req.onWriterMissing(); } else { req.execute(writer); } } else { throw new IllegalArgumentException("unknown request type: " + request); } }
Source:
private void edit() { if (getWindow() != null) { return; } AffinityGroup affinityGroup = getSelectedItem(); if (affinityGroup == null) { return; } sortVms(affinityGroup); AffinityGroupModel model = new EditAffinityGroupModel(affinityGroup, this, getClusterResolver()); model.init(); setWindow(model); }

Target:
private void edit() { if (getWindow() != null) { return; } AffinityGroup affinityGroup = getSelectedItem(); if (affinityGroup == null) { return; } AffinityGroupModel model = new EditAffinityGroupModel(affinityGroup, this, getClusterResolver()); model.init(); setWindow(model); }
Source:
public GremlinServer(final ServerGremlinExecutor<EventLoopGroup> serverGremlinExecutor) { this.serverGremlinExecutor = serverGremlinExecutor; this.settings = serverGremlinExecutor.getSettings(); this.isLinuxOS = settings.useEpollEventLoop && SystemUtils.IS_OS_LINUX; Runtime.getRuntime().addShutdownHook(new Thread(() -> this.stop().join(), SERVER_THREAD_PREFIX + "shutdown")); final ThreadFactory threadFactoryBoss = ThreadFactoryUtil.create("boss-%d"); if(isLinuxOS) { bossGroup = new EpollEventLoopGroup(settings.threadPoolBoss, threadFactoryBoss); } else{ bossGroup = new NioEventLoopGroup(settings.threadPoolBoss, threadFactoryBoss); } workerGroup = serverGremlinExecutor.getScheduledExecutorService(); gremlinExecutorService = serverGremlinExecutor.getGremlinExecutorService(); }

Target:
public GremlinServer(final ServerGremlinExecutor<EventLoopGroup> serverGremlinExecutor) { this.serverGremlinExecutor = serverGremlinExecutor; this.settings = serverGremlinExecutor.getSettings(); this.isEpollEnabled = settings.useEpollEventLoop && SystemUtils.IS_OS_LINUX; if(settings.useEpollEventLoop && !SystemUtils.IS_OS_LINUX){ logger.warn("cannot use epoll in non-linux env, falling back to NIO"); } Runtime.getRuntime().addShutdownHook(new Thread(() -> this.stop().join(), SERVER_THREAD_PREFIX + "shutdown")); final ThreadFactory threadFactoryBoss = ThreadFactoryUtil.create("boss-%d"); if(isEpollEnabled) { bossGroup = new EpollEventLoopGroup(settings.threadPoolBoss, threadFactoryBoss); } else{ bossGroup = new NioEventLoopGroup(settings.threadPoolBoss, threadFactoryBoss); } workerGroup = serverGremlinExecutor.getScheduledExecutorService(); gremlinExecutorService = serverGremlinExecutor.getGremlinExecutorService(); }
Source:
public LogicalPlanner(Session session, List<PlanOptimizer> planOptimizers, PlanSanityChecker planSanityChecker, PlanNodeIdAllocator idAllocator, Metadata metadata, SqlParser sqlParser, StatsCalculator statsCalculator, CostCalculator costCalculator) { requireNonNull(session, "session is null"); requireNonNull(planOptimizers, "planOptimizers is null"); requireNonNull(planSanityChecker, "planSanityChecker is null"); requireNonNull(idAllocator, "idAllocator is null"); requireNonNull(metadata, "metadata is null"); requireNonNull(sqlParser, "sqlParser is null"); requireNonNull(statsCalculator, "statsCalculator is null"); requireNonNull(costCalculator, "costCalculator is null"); this.session = session; this.planOptimizers = planOptimizers; this.planSanityChecker = planSanityChecker; this.idAllocator = idAllocator; this.metadata = metadata; this.sqlParser = sqlParser; this.statisticsAggregationPlanner = new StatisticsAggregationPlanner(symbolAllocator, metadata); this.statsCalculator = statsCalculator; this.costCalculator = costCalculator; }

Target:
public LogicalPlanner(Session session, List<PlanOptimizer> planOptimizers, PlanSanityChecker planSanityChecker, PlanNodeIdAllocator idAllocator, Metadata metadata, SqlParser sqlParser, StatsCalculator statsCalculator, CostCalculator costCalculator) { this.session = requireNonNull(session, "session is null"); this.planOptimizers = requireNonNull(planOptimizers, "planOptimizers is null"); this.planSanityChecker = requireNonNull(planSanityChecker, "planSanityChecker is null"); this.idAllocator = requireNonNull(idAllocator, "idAllocator is null"); this.metadata = requireNonNull(metadata, "metadata is null"); this.sqlParser = requireNonNull(sqlParser, "sqlParser is null"); this.statisticsAggregationPlanner = new StatisticsAggregationPlanner(symbolAllocator, metadata); this.statsCalculator = requireNonNull(statsCalculator, "statsCalculator is null"); this.costCalculator = requireNonNull(costCalculator, "costCalculator is null"); }
Source:
protected FS() { gitSystemConfig = new Holder<File>(discoverGitSystemConfig()); }

Target:
protected FS() { }
Source:
public long hash(Object value) { ByteBuffer plain; if (value instanceof Binary) { return hashFunction.hashBytes(((Binary) value).getBytes()); } if (value instanceof Integer) { plain = ByteBuffer.allocate(Integer.SIZE/Byte.SIZE); plain.order(ByteOrder.LITTLE_ENDIAN).putInt(((Integer)value)); } else if (value instanceof Long) { plain = ByteBuffer.allocate(Long.SIZE/Byte.SIZE); plain.order(ByteOrder.LITTLE_ENDIAN).putLong(((Long)value)); } else if (value instanceof Float) { plain = ByteBuffer.allocate(Float.SIZE/Byte.SIZE); plain.order(ByteOrder.LITTLE_ENDIAN).putFloat(((Float)value)); } else if (value instanceof Double) { plain = ByteBuffer.allocate(Double.SIZE/ Byte.SIZE); plain.order(ByteOrder.LITTLE_ENDIAN).putDouble(((Double)value)); } else { throw new RuntimeException("Parquet Bloom filter: Not supported type"); } return hashFunction.hashByteBuffer(plain); }

Target:
public long hash(Object value) { if (value instanceof Binary) { return hashFunction.hashBytes(((Binary) value).getBytes()); } if (value instanceof Integer) { cacheBuffer.putInt((Integer)value); } else if (value instanceof Long) { cacheBuffer.putLong((Long)value); } else if (value instanceof Float) { cacheBuffer.putFloat((Float)value); } else if (value instanceof Double) { cacheBuffer.putDouble((Double) value); } else { throw new RuntimeException("Parquet Bloom filter: Not supported type"); } return doHash(); }
Source:
public void process(Exchange exchange) throws Exception { XChangeEndpoint endpoint = getEndpoint(); String method = endpoint.getConfiguration().getMethod(); if (METHOD_CURRENCY_METADATA.equals(method)) { Currency curr = exchange.getIn().getHeader(HEADER_CURRENCY, Currency.class); Object body = endpoint.getCurrencyMetaData(curr); exchange.getOut().setBody(body); } else if (METHOD_CURRENCY_PAIR_METADATA.equals(method)) { CurrencyPair pair = exchange.getIn().getHeader(HEADER_CURRENCY_PAIR, CurrencyPair.class); Object body = endpoint.getCurrencyPairMetaData(pair); exchange.getOut().setBody(body); } }

Target:
public void process(Exchange exchange) throws Exception { XChangeEndpoint endpoint = getEndpoint(); XChangeMethod method = endpoint.getConfiguration().getMethod(); if (XChangeMethod.currencies == method) { Object body = endpoint.getCurrencies(); exchange.getMessage().setBody(body); } else if (XChangeMethod.currencyPairs == method) { Object body = endpoint.getCurrencyPairs(); exchange.getMessage().setBody(body); } else if (XChangeMethod.currencyMetaData == method) { Currency curr = exchange.getMessage().getHeader(HEADER_CURRENCY, Currency.class); curr = curr != null ? curr : exchange.getMessage().getBody(Currency.class); Object body = endpoint.getCurrencyMetaData(curr); exchange.getMessage().setBody(body); } else if (XChangeMethod.currencyPairMetaData == method) { CurrencyPair pair = exchange.getIn().getHeader(HEADER_CURRENCY_PAIR, CurrencyPair.class); pair = pair != null ? pair : exchange.getMessage().getBody(CurrencyPair.class); Object body = endpoint.getCurrencyPairMetaData(pair); exchange.getMessage().setBody(body); } }
Source:
public static void main(String args[]) { URI uri = null; if (args.length > 0) { try { uri = new URI(args[0]); } catch (URISyntaxException e) { System.err.println("Invalid URI: " + e.getMessage()); System.exit(-1); } CoapClient client = new CoapClient(uri); CoapResponse response = client.get(); if (response!=null) { System.out.println(response.getCode()); System.out.println(response.getOptions()); if (args.length > 1) { try (FileOutputStream out = new FileOutputStream(args[1])) { out.write(response.getPayload()); } catch (IOException e) { e.printStackTrace(); } } else { System.out.println(response.getResponseText()); System.out.println("\nADVANCED\n"); System.out.println(Utils.prettyPrint(response)); } } else { System.out.println("No response received."); } } else { System.out.println("Californium (Cf) GET Client"); System.out.println("(c) 2014, Institute for Pervasive Computing, ETH Zurich"); System.out.println(); System.out.println("Usage : " + GETClient.class.getSimpleName() + " URI [file]"); System.out.println(" URI : The CoAP URI of the remote resource to GET"); System.out.println(" file: optional filename to save the received payload"); } }

Target:
public static void main(String args[]) { URI uri = null; if (args.length > 0) { try { uri = new URI(args[0]); } catch (URISyntaxException e) { System.err.println("Invalid URI: " + e.getMessage()); System.exit(-1); } CoapClient client = new CoapClient(uri); CoapResponse response = client.get(); if (response!=null) { System.out.println(response.getCode()); System.out.println(response.getOptions()); if (args.length > 1) { try (FileOutputStream out = new FileOutputStream(args[1])) { out.write(response.getPayload()); } catch (IOException e) { e.printStackTrace(); } } else { System.out.println(response.getResponseText()); System.out.println(System.lineSeparator() + "ADVANCED" + System.lineSeparator()); System.out.println(Utils.prettyPrint(response)); } } else { System.out.println("No response received."); } } else { System.out.println("Californium (Cf) GET Client"); System.out.println("(c) 2014, Institute for Pervasive Computing, ETH Zurich"); System.out.println(); System.out.println("Usage : " + GETClient.class.getSimpleName() + " URI [file]"); System.out.println(" URI : The CoAP URI of the remote resource to GET"); System.out.println(" file: optional filename to save the received payload"); } }
Source:
public void visitFile(AstNode node) { Set<Symbol> symbols = getContext().symbolTable().symbols(node); isUsingDjangoModel = symbols.stream().anyMatch(s -> s.qualifiedName().contains("django.db.models")); isUsingDjangoDBConnection = symbols.stream().anyMatch(s -> s.qualifiedName().contains("django.db.connection")); isUsingDjangoDBConnections = symbols.stream().anyMatch(s -> s.qualifiedName().contains("django.db.connections")); }

Target:
public void visitFile(AstNode node) { isUsingDjangoModel = false; isUsingDjangoDBConnection = false; for (Symbol symbol : getContext().symbolTable().symbols(node)) { String qualifiedName = symbol.qualifiedName(); if (qualifiedName.contains("django.db.models")) { isUsingDjangoModel = true; } if (qualifiedName.contains("django.db.connection")) { isUsingDjangoDBConnection = true; } } }
Source:
public final Subscription subscribe(final Action1<? super Throwable> onError, final Action0 onComplete) { requireNonNull(onError); requireNonNull(onComplete); final MultipleAssignmentSubscription mad = new MultipleAssignmentSubscription(); subscribe(new CompletableSubscriber() { @Override public void onCompleted() { mad.unsubscribe(); try { onComplete.call(); } catch (Throwable e) { onError(e); } } @Override public void onError(Throwable e) { mad.unsubscribe(); try { onError.call(e); } catch (Throwable ex) { e = new CompositeException(Arrays.asList(e, ex)); ERROR_HANDLER.handleError(e); } } @Override public void onSubscribe(Subscription d) { mad.set(d); } }); return mad; }

Target:
public final Subscription subscribe(final Action1<? super Throwable> onError, final Action0 onComplete) { requireNonNull(onError); requireNonNull(onComplete); final MultipleAssignmentSubscription mad = new MultipleAssignmentSubscription(); subscribe(new CompletableSubscriber() { @Override public void onCompleted() { try { onComplete.call(); } catch (Throwable e) { onError(e); return; } mad.unsubscribe(); } @Override public void onError(Throwable e) { try { onError.call(e); } catch (Throwable ex) { e = new CompositeException(Arrays.asList(e, ex)); ERROR_HANDLER.handleError(e); } mad.unsubscribe(); } @Override public void onSubscribe(Subscription d) { mad.set(d); } }); return mad; }
Source:
public void testProcessQueryJsonApi() throws NoHttpResponseException, URISyntaxException { String query = "/group?sort=commonName&fields%5Bgroup%5D=commonName,description"; ElideResponse response = mock(ElideResponse.class); when(queryObj.getQuery()).thenReturn(query); when(queryObj.getQueryType()).thenReturn(QueryType.JSONAPI_V1_0); when(elide.get(anyString(), any(), any(), anyString())).thenReturn(response); when(response.getResponseCode()).thenReturn(200); when(response.getBody()).thenReturn("ResponseBody"); }

Target:
public void testProcessQueryJsonApi() throws NoHttpResponseException, URISyntaxException { AsyncQuery queryObj = new AsyncQuery(); ElideResponse response = new ElideResponse(200, "ResponseBody"); String query = "/group?sort=commonName&fields%5Bgroup%5D=commonName,description"; String id = "edc4a871-dff2-4054-804e-d80075cf827d"; queryObj.setId(id); queryObj.setQuery(query); queryObj.setQueryType(QueryType.JSONAPI_V1_0); when(elide.get(anyString(), any(), any(), anyString())).thenReturn(response); AsyncQueryThread queryThread = new AsyncQueryThread(queryObj, user, elide, runner, asyncQueryDao, "v1"); queryResultObj = queryThread.processQuery(); assertEquals(queryResultObj.getResponseBody(), "ResponseBody"); assertEquals(queryResultObj.getHttpStatus(), 200); }
Source:
public void setAssignees(Collection<GHUser> assignees) throws IOException { root.retrieve() .method("POST") .with(ASSIGNEES, getLogins(assignees)) .method("PATCH") .withUrlPath(getIssuesApiRoute()) .to(); }

Target:
public void setAssignees(Collection<GHUser> assignees) throws IOException { root.createRequest() .method("PATCH") .with(ASSIGNEES, getLogins(assignees)) .withUrlPath(getIssuesApiRoute()) .send(); }
Source:
public IReviewRemoteFactoryProvider createFactoryProvider(TaskRepository repository) { GerritClient client = getClient(repository); return new GerritRemoteFactoryProvider(client); }

Target:
public IReviewRemoteFactoryProvider createFactoryProvider(TaskRepository repository) { return new GerritRemoteFactoryProvider(getClient(repository)); }
Source:
public void testDecoder(String testName, DataComplex dataComplex, boolean enableFixedLengthFloatDoubles) throws Exception { ProtobufDataCodec codec = new ProtobufDataCodec( new ProtobufCodecOptions.Builder().setEnableFixedLengthFloatDoubles(enableFixedLengthFloatDoubles) .setEnableASCIIOnlyStrings(false).build()); byte[] bytes = TestUtil.dataComplexToBytes(codec, dataComplex); DataComplex decodedDataComplex = decode(bytes); assertEquals(TestUtil.dataComplexToBytes(codec, decodedDataComplex), bytes); codec = new ProtobufDataCodec( new ProtobufCodecOptions.Builder().setEnableFixedLengthFloatDoubles(enableFixedLengthFloatDoubles) .setEnableASCIIOnlyStrings(true).build()); bytes = TestUtil.dataComplexToBytes(codec, dataComplex); decodedDataComplex = decode(bytes); assertEquals(TestUtil.dataComplexToBytes(codec, decodedDataComplex), bytes); }

Target:
public void testDecoder(String testName, DataComplex dataComplex, boolean enableFixedLengthFloatDoubles) throws Exception { ProtobufDataCodec codec = new ProtobufDataCodec( new ProtobufCodecOptions.Builder().setEnableFixedLengthFloatDoubles(enableFixedLengthFloatDoubles) .setEnableASCIIOnlyStrings(true).build()); byte[] bytes = TestUtil.dataComplexToBytes(codec, dataComplex); DataComplex decodedDataComplex = decode(bytes, 20); assertEquals(TestUtil.dataComplexToBytes(codec, decodedDataComplex), bytes); }
Source:
private boolean pickJumpPoint(DateTime now) { if(currentSystem.isZenithCharge(now) && !currentSystem.isNadirCharge(now)) { return true; } if(!currentSystem.isZenithCharge(now) && currentSystem.isNadirCharge(now)) { return false; } return Compute.randomInt(1)==1; }

Target:
private boolean pickJumpPoint(DateTime now) { if(currentSystem.isZenithCharge(now) && !currentSystem.isNadirCharge(now)) { return true; } if(!currentSystem.isZenithCharge(now) && currentSystem.isNadirCharge(now)) { return false; } return Compute.randomInt(2)==1; }
Source:
public void unvoidPatient_shouldReturnNullWhenPatientIsNull() throws Exception { PatientService patientService = Context.getPatientService(); Patient unVoidedPatient = patientService.unvoidPatient(null); Assert.assertNull(unVoidedPatient); }

Target:
public void unvoidPatient_shouldReturnNullWhenPatientIsNull() throws Exception { assertNull(patientService.unvoidPatient(null)); }
Source:
public boolean getAndRelease() { ByteBufAllocator alloc = PooledByteBufAllocator.DEFAULT; ByteBuf buf = alloc.directBuffer(size); if (tokens > 0) { Blackhole.consumeCPU(tokens); } return buf.release(); }

Target:
public boolean getAndRelease() { ByteBuf buf = allocator.directBuffer(size); if (tokens > 0) { Blackhole.consumeCPU(tokens); } return buf.release(); }
Source:
public void addObjectsToCollection(Cursor cursor, Collection<M> collection) { try { if (cursor.getCount() > 0) { cursor.moveToFirst(); do { collection.add(modelFactory.fromCursor(cursor)); } while (cursor.moveToNext()); } } finally { cursor.close(); } }

Target:
protected void addObjectsToCollection(Cursor cursor, Collection<M> collection) { try { if (cursor.getCount() > 0) { cursor.moveToFirst(); do { collection.add(modelFactory.fromCursor(cursor)); } while (cursor.moveToNext()); } } finally { cursor.close(); } }
Source:
public byte[] serialize(PendingSplitsCheckpoint<HiveSourceSplit> checkpoint) throws IOException { Preconditions.checkArgument(checkpoint.getClass() == ContinuousHivePendingSplitsCheckpoint.class, "Only supports %s", ContinuousHivePendingSplitsCheckpoint.class.getName()); ContinuousHivePendingSplitsCheckpoint hiveCheckpoint = (ContinuousHivePendingSplitsCheckpoint) checkpoint; PendingSplitsCheckpoint<HiveSourceSplit> superCP = PendingSplitsCheckpoint.fromCollectionSnapshot( hiveCheckpoint.getSplits(), hiveCheckpoint.getAlreadyProcessedPaths()); byte[] superBytes = superSerDe.serialize(superCP); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try (ObjectOutputStream outputStream = new ObjectOutputStream(byteArrayOutputStream)) { outputStream.writeInt(superBytes.length); outputStream.write(superBytes); outputStream.writeObject(hiveCheckpoint.getCurrentReadOffset()); outputStream.writeInt(hiveCheckpoint.getSeenPartitions().size()); for (List<String> partition : hiveCheckpoint.getSeenPartitions()) { outputStream.writeObject(partition); } } return byteArrayOutputStream.toByteArray(); }

Target:
public byte[] serialize(PendingSplitsCheckpoint<HiveSourceSplit> checkpoint) throws IOException { Preconditions.checkArgument(checkpoint.getClass() == ContinuousHivePendingSplitsCheckpoint.class, "Only supports %s", ContinuousHivePendingSplitsCheckpoint.class.getName()); ContinuousHivePendingSplitsCheckpoint hiveCheckpoint = (ContinuousHivePendingSplitsCheckpoint) checkpoint; PendingSplitsCheckpoint<HiveSourceSplit> superCP = PendingSplitsCheckpoint.fromCollectionSnapshot( hiveCheckpoint.getSplits(), hiveCheckpoint.getAlreadyProcessedPaths()); byte[] superBytes = superSerDe.serialize(superCP); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try (DataOutputViewStreamWrapper outputWrapper = new DataOutputViewStreamWrapper(byteArrayOutputStream)) { outputWrapper.writeInt(superBytes.length); outputWrapper.write(superBytes); readOffsetSerDe.serialize(hiveCheckpoint.getCurrentReadOffset(), outputWrapper); outputWrapper.writeInt(hiveCheckpoint.getSeenPartitionsSinceOffset().size()); for (List<String> partition : hiveCheckpoint.getSeenPartitionsSinceOffset()) { partitionSerDe.serialize(partition, outputWrapper); } } return byteArrayOutputStream.toByteArray(); }
Source:
public long getMinEnd() { return fMinEnd != null ? fMinEnd : getNodeStart() + 1; }

Target:
public long getMinEnd() { return fMinEnd; }
Source:
public NetworkTemplateListModel() { setTitle(ConstantsManager.getInstance().getConstants().templatesTitle()); setHashName("templates"); setRemoveCommand(new UICommand("SetupNetworks", this)); updateActionAvailability(); }

Target:
public NetworkTemplateListModel() { setTitle(ConstantsManager.getInstance().getConstants().templatesTitle()); setHashName("templates"); setRemoveCommand(new UICommand("Remove", this)); updateActionAvailability(); }
Source:
public void start(StartContext context) throws StartException { String relativeTo = this.relativeTo.getOptionalValue(); String keytabFile = relativeTo == null ? path : relativeTo + "/" + path; try { clientConfiguration = createConfiguration(false, keytabFile); serverConfiguration = createConfiguration(true, keytabFile); } catch (MalformedURLException e) { throw SECURITY_LOGGER.invalidKeytab(e); } }

Target:
public void start(StartContext context) throws StartException { String file = path; if (relativeTo != null) { PathManager pm = pathManager.getValue(); file = pm.resolveRelativePathEntry(file, relativeTo); pm.registerCallback(relativeTo, new org.jboss.as.controller.services.path.PathManager.Callback() { @Override public void pathModelEvent(PathEventContext eventContext, String name) { if (eventContext.isResourceServiceRestartAllowed() == false) { eventContext.reloadRequired(); } } @Override public void pathEvent(Event event, PathEntry pathEntry) { } }, Event.REMOVED, Event.UPDATED); } try { clientConfiguration = createConfiguration(false, file); serverConfiguration = createConfiguration(true, file); } catch (MalformedURLException e) { throw SECURITY_LOGGER.invalidKeytab(e); } }