auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private List<FeedbackResponseAttributes> getViewableFeedbackResponsesForStudentForQuestion( FeedbackQuestionAttributes question, String studentEmail) { List<FeedbackResponseAttributes> viewableResponses = new ArrayList<FeedbackResponseAttributes>(); if (question.isResponseVisibleTo(FeedbackParticipantType.STUDENTS)) { addNewResponses(viewableResponses, getFeedbackResponsesForQuestion(question.getId())); return viewableResponses; } StudentAttributes student = studentsLogic.getStudentForEmail(question.courseId, studentEmail); if ((question.recipientType.isTeam() || question.recipientType == FeedbackParticipantType.CUSTOM && question.isFeedbackPathsRecipientTypeTeams()) && question.isResponseVisibleTo(FeedbackParticipantType.RECEIVER)) { addNewResponses( viewableResponses, getFeedbackResponsesForReceiverForQuestion( question.getId(), student.team)); } if (question.giverType == FeedbackParticipantType.TEAMS || question.isResponseVisibleTo(FeedbackParticipantType.OWN_TEAM_MEMBERS)) { addNewResponses(viewableResponses, getFeedbackResponsesFromTeamForQuestion( question.getId(), question.courseId, student.team)); } if (question .isResponseVisibleTo(FeedbackParticipantType.RECEIVER_TEAM_MEMBERS)) { addNewResponses( viewableResponses, getFeedbackResponsesForTeamMembersOfStudent( question.getId(), student)); } return viewableResponses; }

Target:
private List<FeedbackResponseAttributes> getViewableFeedbackResponsesForStudentForQuestion( FeedbackQuestionAttributes question, String studentEmail) { List<FeedbackResponseAttributes> viewableResponses = new ArrayList<FeedbackResponseAttributes>(); if (question.isResponseVisibleTo(FeedbackParticipantType.STUDENTS)) { addNewResponses(viewableResponses, getFeedbackResponsesForQuestion(question.getId())); return viewableResponses; } StudentAttributes student = studentsLogic.getStudentForEmail(question.courseId, studentEmail); if (question.isRecipientATeam() && question.isResponseVisibleTo(FeedbackParticipantType.RECEIVER)) { addNewResponses( viewableResponses, getFeedbackResponsesForReceiverForQuestion( question.getId(), student.team)); } if (question.giverType == FeedbackParticipantType.TEAMS || question.isResponseVisibleTo(FeedbackParticipantType.OWN_TEAM_MEMBERS)) { addNewResponses(viewableResponses, getFeedbackResponsesFromTeamForQuestion( question.getId(), question.courseId, student.team)); } if (question .isResponseVisibleTo(FeedbackParticipantType.RECEIVER_TEAM_MEMBERS)) { addNewResponses( viewableResponses, getFeedbackResponsesForTeamMembersOfStudent( question.getId(), student)); } return viewableResponses; }
Source:
public void decorateRequest(ClientRequestContext requestContext, Span span) { String uri = requestContext.getUri().toString(); String saltPath = StringUtils.substringAfterLast(uri, "/saltboot/"); Object entity = requestContext.getEntity(); StringBuilder operationName = new StringBuilder("Salt - ").append(saltPath); if (entity instanceof Pillar) { String resourcePath = ((Pillar) entity).getPath(); operationName.append(" ").append(resourcePath); } span.setOperationName(operationName.toString()); TracingUtil.setTagsFromMdc(span); }

Target:
public void decorateRequest(ClientRequestContext requestContext, Span span) { setOperationName(requestContext, span); setTags(requestContext, span); }
Source:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) { if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, MY_PERMISSIONS_REQUEST_READ_CONTACTS); } else { ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, MY_PERMISSIONS_REQUEST_READ_CONTACTS); } } setTitle(getName()); setContentView(R.layout.player_simple_frame_layout); EMBED = getIntent().getExtras().getString("embed_code"); PCODE = getIntent().getExtras().getString("pcode"); DOMAIN = getIntent().getExtras().getString("domain"); OoyalaPlayerLayout playerLayout = (OoyalaPlayerLayout) findViewById(R.id.ooyalaPlayer); Options options = new Options.Builder().setUseExoPlayer(true).build(); player = new OoyalaPlayer(PCODE, new PlayerDomain(DOMAIN), options); playerLayoutController = new OptimizedOoyalaPlayerLayoutController(playerLayout, player); player.addObserver(this); @SuppressWarnings("unused") OoyalaFreewheelManager fwManager = new OoyalaFreewheelManager(this, playerLayoutController); if (player.setEmbedCode(EMBED)) { } }

Target:
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.player_simple_frame_layout); completePlayerSetup(asked); }
Source:
private List<ColumnChunkMetaData> getColumnsInOrder(BlockMetaData rowGroup, boolean dropColumns) { return getColumnsInOrder(rowGroup, schema, dropColumns).stream() .map(Entry::getValue) .collect(Collectors.toList()); }

Target:
private List<ColumnChunkMetaData> getColumnsInOrder(BlockMetaData rowGroup, boolean dropColumns) { return getColumnsInOrder(rowGroup, schema, dropColumns); }
Source:
public Asset updateAssetInventory(String capitalAssetNumber, String conditionCode, String buildingCode, String roomNumber) { Asset asset = businessObjectService.findBySinglePrimaryKey(Asset.class, capitalAssetNumber); asset.setConditionCode(conditionCode); asset.setBuildingCode(buildingCode); asset.setBuildingRoomNumber(roomNumber); Timestamp currentTimestamp = new Timestamp(System.currentTimeMillis()); asset.setLastInventoryDate(currentTimestamp); asset.setLastUpdatedTimestamp(currentTimestamp); businessObjectService.save(asset); return asset; }

Target:
public Asset updateAssetInventory(String capitalAssetNumber, String conditionCode, String buildingCode, String roomNumber) { Asset asset = businessObjectService.findBySinglePrimaryKey(Asset.class, capitalAssetNumber); if (ObjectUtils.isNull(asset)) { return null; } asset.setConditionCode(conditionCode); asset.setBuildingCode(buildingCode); asset.setBuildingRoomNumber(roomNumber); Timestamp currentTimestamp = dateTimeService.getCurrentTimestamp(); asset.setLastInventoryDate(currentTimestamp); asset.setLastUpdatedTimestamp(currentTimestamp); return businessObjectService.save(asset); }
Source:
public boolean canEndTask(NuxeoPrincipal principal, Task task) { if (task != null) { return principal.isAdministrator() || principal.getName().equals(task.getInitiator()) || isTaskAssignedToUser(task, principal, true); } return false; }

Target:
public boolean canEndTask(NuxeoPrincipal principal, Task task) { return isTaskActive(task) && checkPermissions(principal, task); }
Source:
public @NonNull String getHelpText() { return "End time of the segment"; }

Target:
public @NonNull String getHelpText() { return Messages.getString("SegmentEndTimeAspect.endDescription"); }
Source:
protected Page computeNext() { while (!pageBuilder.isFull()) { PagePositionIterator iterator = queue.poll(); if (iterator == null) { break; } iterator.appendNextTo(pageBuilder); if (iterator.hasNext()) { queue.add(iterator); } } if (pageBuilder.isEmpty()) { return endOfData(); } Page page = pageBuilder.build(); pageBuilder.reset(); return page; }

Target:
protected Page computeNext() { while (!pageBuilder.isFull() && pagePositions.hasNext()) { pagePositions.next().appendTo(pageBuilder); } if (pageBuilder.isEmpty()) { return endOfData(); } Page page = pageBuilder.build(); pageBuilder.reset(); return page; }
Source:
public void initialize(InputSplit genericSplit, TaskAttemptContext context) throws IOException, InterruptedException { FileSplit split = (FileSplit) genericSplit; Configuration job = context.getConfiguration(); file = split.getPath(); FileSystem fs = file.getFileSystem(job); fileIn = fs.open(split.getPath()); String sheetName = job.get(SHEET_NAME); int sheetIndx = job.getInt(SHEET_NO, -1); Sheet sheet = null; try { Workbook workbook = WorkbookFactory.create(fileIn); if (sheetIndx < 0 && sheetName != null && !sheetName.isEmpty()) { sheet = workbook.getSheet(sheetName); } else { sheet = workbook.getSheetAt(sheetIndx); } } catch (Exception e) { throw new IllegalArgumentException("Exception while reading excel sheet. " + e.getMessage(), e); } fileRowLimitMap.put(file.getName(), job.getInt(ROWS_LIMIT, sheet.getPhysicalNumberOfRows())); rows = sheet.iterator(); lastRowNum = sheet.getLastRowNum(); rowIdx = 0; boolean skipFirstRow = job.getBoolean(SKIP_FIRST_ROW, false); if (skipFirstRow) { if (rows.hasNext()) { rowIdx = 1; } rows.next(); } }

Target:
public void initialize(InputSplit genericSplit, TaskAttemptContext context) throws IOException, InterruptedException { FileSplit split = (FileSplit) genericSplit; Configuration job = context.getConfiguration(); file = split.getPath(); FileSystem fs = file.getFileSystem(job); fileIn = fs.open(split.getPath()); String sheet = job.get(SHEET); String sheetValue = job.get(SHEET_VALUE); Sheet workSheet = null; try { Workbook workbook = WorkbookFactory.create(fileIn); if (sheet.equalsIgnoreCase(SHEET_NAME)) { workSheet = workbook.getSheet(sheetValue); } else { workSheet = workbook.getSheetAt(Integer.parseInt(sheetValue)); } } catch (Exception e) { throw new IllegalArgumentException("Exception while reading excel sheet. " + e.getMessage(), e); } rowCount = job.getInt(ROWS_LIMIT, workSheet.getPhysicalNumberOfRows()); rows = workSheet.iterator(); lastRowNum = workSheet.getLastRowNum(); rowIdx = 0; boolean skipFirstRow = job.getBoolean(SKIP_FIRST_ROW, false); if (skipFirstRow) { if (rows.hasNext()) { rowIdx = 1; } rows.next(); } }
Source:
public void testFileOpen() throws IOException { Uri uri = Uri.parse("file:/ doReturn(mContentResolver).when(mContext).getContentResolver(); doReturn(mFileInputStream).when(mContentResolver).openInputStream(uri); doReturn(10, -1).when(mFileInputStream).read(any(), eq(0), eq(4096)); BluetoothOppSendFileInfo sendFileInfo = BluetoothOppSendFileInfo.generateFileInfo( mContext, uri, "text/plain", false); assertThat(sendFileInfo).isNotEqualTo(BluetoothOppSendFileInfo.SEND_FILE_INFO_ERROR); assertThat(sendFileInfo.mFileName).isEqualTo("OppTestFile.txt"); assertThat(sendFileInfo.mMimetype).isEqualTo("text/plain"); assertThat(sendFileInfo.mLength).isEqualTo(10); assertThat(sendFileInfo.mInputStream).isEqualTo(mFileInputStream); assertThat(sendFileInfo.mStatus).isEqualTo(0); }

Target:
public void testFileOpen() throws IOException { Uri uri = Uri.parse("file:/ doReturn(mContentResolver).when(mContext).getContentResolver(); doReturn(mFileInputStream).when(mContentResolver).openInputStream(uri); doReturn(TEST_FILE_SIZE, -1).when(mFileInputStream).read(any(), eq(0), eq(4096)); BluetoothOppSendFileInfo sendFileInfo = BluetoothOppSendFileInfo.generateFileInfo( mContext, uri, "text/plain", false); assertThat(sendFileInfo).isNotEqualTo(BluetoothOppSendFileInfo.SEND_FILE_INFO_ERROR); assertThat(sendFileInfo.mFileName).isEqualTo("OppTestFile.txt"); assertThat(sendFileInfo.mMimetype).isEqualTo("text/plain"); assertThat(sendFileInfo.mLength).isEqualTo(10); assertThat(sendFileInfo.mInputStream).isEqualTo(mFileInputStream); assertThat(sendFileInfo.mStatus).isEqualTo(0); }
Source:
public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_language_list_entry, parent, false); } PageTitle langLink = (PageTitle) getItem(position); String wikiCode = langLink.getSite().getLanguage(); int langIndex = app.findWikiIndex(wikiCode); String localName = app.localNameFor(langIndex); TextView langLocalNameText = (TextView) convertView.findViewById(R.id.language_local_name); TextView articleLocalNameText = (TextView) convertView.findViewById(R.id.article_local_name); langLocalNameText.setText(localName); articleLocalNameText.setText(langLink.getText()); LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); Bidi bidi = new Bidi(localName, Bidi.DIRECTION_DEFAULT_LEFT_TO_RIGHT); if (bidi.getBaseLevel() == 0) { params.gravity = Gravity.LEFT; } else { params.gravity = Gravity.RIGHT; } langLocalNameText.setLayoutParams(params); articleLocalNameText.setLayoutParams(params); return convertView; }

Target:
public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_language_list_entry, parent, false); } PageTitle langLink = (PageTitle) getItem(position); String wikiCode = langLink.getSite().getLanguage(); int langIndex = app.findWikiIndex(wikiCode); String localName = app.localNameFor(langIndex); TextView langLocalNameText = (TextView) convertView.findViewById(R.id.language_local_name); TextView articleLocalNameText = (TextView) convertView.findViewById(R.id.article_local_name); langLocalNameText.setText(localName); articleLocalNameText.setText(langLink.getText()); return convertView; }
Source:
public Attribute setLabelAttribute(Boolean isLabelAttr) { set(IS_LABEL_ATTRIBUTE, isLabelAttr); if (isLabelAttr != null && isLabelAttr) { setNillable(false); } return this; }

Target:
public Attribute setLabelAttribute(Boolean isLabelAttr) { set(IS_LABEL_ATTRIBUTE, isLabelAttr); return this; }
Source:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.display_parameters: AnalyticsHelper.sendEventHit("Filters", AnalyticsHelper.CLICK, "YES"); createDialog(); default: return super.onOptionsItemSelected(item); } }

Target:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Intent i = getParentActivityIntent().putExtra("forceMainMenu", true); NavUtils.navigateUpTo(this, i); return super.onOptionsItemSelected(item); case R.id.display_parameters: AnalyticsHelper.sendEventHit("Filters", AnalyticsHelper.CLICK, "YES"); createDialog(); default: return super.onOptionsItemSelected(item); } }
Source:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Kind.STRING_LITERAL, ctx -> { PyStringLiteralTree tree = (PyStringLiteralTree) ctx.syntaxNode(); String stringLiteral = tree.trimmedQuotesValue().toLowerCase(); if (UNIX_WRITABLE_DIRECTORIES.stream().anyMatch(stringLiteral::startsWith) || WINDOWS_WRITABLE_DIRECTORIES.matcher(stringLiteral).matches()) { ctx.addIssue(tree, MESSAGE); } }); context.registerSyntaxNodeConsumer(Kind.CALL_EXPR, ctx -> { PyCallExpressionTree tree = (PyCallExpressionTree) ctx.syntaxNode(); if (isOsEnvironCall(tree, ctx.symbolTable().getSymbol(tree)) && tree.arguments().stream().anyMatch(this::isNonCompliantOsEnvironArgument)) { ctx.addIssue(tree, MESSAGE); } }); context.registerSyntaxNodeConsumer(Kind.SUBSCRIPTION, ctx -> { PySubscriptionExpressionTree tree = (PySubscriptionExpressionTree) ctx.syntaxNode(); if (isOsEnvironQualifiedExpression(tree.object()) && tree.subscripts().expressions().stream().anyMatch(this::isNonCompliantOsEnvironArgument)) { ctx.addIssue(tree, MESSAGE); } }); }

Target:
public void initialize(Context context) { context.registerSyntaxNodeConsumer(Kind.STRING_LITERAL, ctx -> { PyStringLiteralTree tree = (PyStringLiteralTree) ctx.syntaxNode(); String stringLiteral = tree.trimmedQuotesValue().toLowerCase(Locale.ENGLISH); if (UNIX_WRITABLE_DIRECTORIES.stream().anyMatch(dir -> containsDirectory(stringLiteral, dir)) || WINDOWS_WRITABLE_DIRECTORIES.matcher(stringLiteral).matches()) { ctx.addIssue(tree, MESSAGE); } }); context.registerSyntaxNodeConsumer(Kind.CALL_EXPR, ctx -> { PyCallExpressionTree tree = (PyCallExpressionTree) ctx.syntaxNode(); if (isOsEnvironGetter(tree.callee(), ctx.symbolTable()) && tree.arguments().stream().map(PyArgumentTree::expression) .anyMatch(PubliclyWritableDirectoriesCheck::isNonCompliantOsEnvironArgument)) { ctx.addIssue(tree, MESSAGE); } }); context.registerSyntaxNodeConsumer(Kind.SUBSCRIPTION, ctx -> { PySubscriptionExpressionTree tree = (PySubscriptionExpressionTree) ctx.syntaxNode(); if (isOsEnvironQualifiedExpression(tree.object(), ctx.symbolTable()) && tree.subscripts().expressions().stream() .anyMatch(PubliclyWritableDirectoriesCheck::isNonCompliantOsEnvironArgument)) { ctx.addIssue(tree, MESSAGE); } }); }
Source:
public static void main(String[] args) throws Exception { final NiftyBootstrap bootstrap = Guice.createInjector( Stage.PRODUCTION, new NiftyModule() { @Override protected void configureNifty() { bind().toInstance(new ThriftServerDefBuilder() .listen(8080) .withProcessor(new scribe.Processor<scribe .Iface>(new scribe.Iface() { @Override public ResultCode Log(List<LogEntry> messages) throws TException { for (LogEntry message : messages) { log.info("%s: %s", message.getCategory(), message.getMessage()); } return ResultCode.OK; } })) .withSSLConfiguration( new SSLServerConfiguration.Builder() .certFile("nifty-examples/certs/rsa.crt") .keyFile("nifty-examples/certs/rsa.key") .build()) .build() ); withNettyServerConfig(NettyConfigProvider.class); } } ).getInstance(NiftyBootstrap.class); bootstrap.start(); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { bootstrap.stop(); } }); }

Target:
public static void main(String[] args) throws Exception { final NiftyBootstrap bootstrap = Guice.createInjector( Stage.PRODUCTION, new NiftyModule() { @Override protected void configureNifty() { SessionTicketKey[] keys = { createFakeSessionTicketKey() }; bind().toInstance(new ThriftServerDefBuilder() .listen(8080) .withProcessor(new scribe.Processor<scribe.Iface>(new scribe.Iface() { @Override public ResultCode Log(List<LogEntry> messages) throws TException { for (LogEntry message : messages) { log.info("%s: %s", message.getCategory(), message.getMessage()); } return ResultCode.OK; } })).withSSLConfiguration( OpenSslServerConfiguration.newBuilder() .certFile(new File(getClass().getResource("/rsa.crt").getFile())) .keyFile(new File(getClass().getResource("/rsa.key").getFile())) .allowPlaintext(true) .ticketKeys(keys) .build()) .build() ); withNettyServerConfig(NettyConfigProvider.class); } } ).getInstance(NiftyBootstrap.class); bootstrap.start(); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { bootstrap.stop(); } }); }
Source:
public WorkflowResponse execute(WorkflowDTO workflowDTO) throws WorkflowException { if (log.isDebugEnabled()) { log.debug("Executing Subscription Creation Webservice Workflow.. "); } SubscriptionWorkflowDTO subsWorkflowDTO = (SubscriptionWorkflowDTO) workflowDTO; String callBackURL = subsWorkflowDTO.getCallbackUrl(); String message="Approve API ["+ subsWorkflowDTO.getApiName()+" - "+subsWorkflowDTO.getApiVersion()+ "] subscription creation request from subscriber - "+subsWorkflowDTO.getSubscriber()+ " for the application - "+subsWorkflowDTO.getApplicationName(); workflowDTO.setWorkflowDescription(message); workflowDTO.setMetadata("apiName", subsWorkflowDTO.getApiName()); workflowDTO.setMetadata("apiVersion", subsWorkflowDTO.getApiVersion()); workflowDTO.setMetadata("apiContext", subsWorkflowDTO.getApiContext()); workflowDTO.setMetadata("apiProvider", subsWorkflowDTO.getApiProvider()); workflowDTO.setMetadata("apiSubscriber", subsWorkflowDTO.getSubscriber()); workflowDTO.setMetadata("applicationName", subsWorkflowDTO.getApplicationName()); workflowDTO.setMetadata("TierName", subsWorkflowDTO.getTierName()); workflowDTO.setMetadata("workflowExternalRef", subsWorkflowDTO.getExternalWorkflowReference()); workflowDTO.setMetadata("callBackURL", callBackURL != null ? callBackURL : "?"); workflowDTO.setProperties("Workflow Process","Subscription Creation"); super.execute(workflowDTO); return new GeneralWorkflowResponse(); }

Target:
public WorkflowResponse execute(WorkflowDTO workflowDTO) throws WorkflowException { if (log.isDebugEnabled()) { log.debug("Executing Subscription Creation Webservice Workflow.. "); } SubscriptionWorkflowDTO subsWorkflowDTO = (SubscriptionWorkflowDTO) workflowDTO; String callBackURL = subsWorkflowDTO.getCallbackUrl(); String message = "Approve API [" + subsWorkflowDTO.getApiName() + " - " + subsWorkflowDTO.getApiVersion() + "] subscription creation request from subscriber - " + subsWorkflowDTO.getSubscriber() + " for the application - " + subsWorkflowDTO.getApplicationName(); workflowDTO.setWorkflowDescription(message); super.execute(workflowDTO); return new GeneralWorkflowResponse(); }
Source:
protected void verifyProcessor(@NonNull MethodTree method, @NonNull final List<? extends VariableTree> parameters) { final List<? extends ExpressionTree> exceptions = method.getThrows(); if(exceptions.size() > 0){ for(ExpressionTree exp : exceptions){ String name = ((JCTree.JCIdent)exp).getName().toString(); if(name.contains("Connector")){ addError(null, "Exception '%s' in processor '%s' should be renamed without the 'Connector' part", name, method.getName().toString()); } } } }

Target:
protected void verifyProcessor(@NonNull MethodTree method, @NonNull final List<? extends VariableTree> parameters) { final List<? extends ExpressionTree> exceptions = method.getThrows(); if (exceptions.size() > 0) { for (ExpressionTree exp : exceptions) { String name = ((JCTree.JCIdent) exp).getName().toString(); if (name.contains("Connector")) { String newName = name.replace("Connector", ""); addError(null, "Exception '%s' in processor '%s' should be renamed to %s", name, method.getName().toString(), newName); } } } }
Source:
public void OnTimer() { try { log.info("Start deleteAgedOutAuditLogs"); DateTime latestTimeToKeep = DateTime.getNow().AddDays( Config.<Integer> GetValue(ConfigValues.AuditLogAgingThreashold) * -1); DbFacade.getInstance().getAuditLogDao().removeAllBeforeDate(latestTimeToKeep); } catch (RuntimeException e) { log.error("deleteAgedOutAuditLog failed with exception", e); } }

Target:
public void OnTimer() { try { log.info("Start deleteAgedOutAuditLogs"); DateTime latestTimeToKeep = DateTime.getNow().AddDays( Config.<Integer> GetValue(ConfigValues.AuditLogAgingThreashold) * -1); DbFacade.getInstance().getAuditLogDao().removeAllBeforeDate(latestTimeToKeep); log.info("Finished deleteAgedOutAuditLogs"); } catch (RuntimeException e) { log.error("deleteAgedOutAuditLog failed with exception", e); } }
Source:
public List<FeedItem> filter(List<FeedItem> items) { if(mProperties.length == 0) return items; List<FeedItem> result = new ArrayList<>(); if (showPlayed && showUnplayed) return result; if (showQueued && showNotQueued) return result; if (showDownloaded && showNotDownloaded) return result; for(FeedItem item : items) { if (showPlayed && !item.isPlayed()) continue; if (showUnplayed && item.isPlayed()) continue; if (showPaused && item.getState() != FeedItem.State.IN_PROGRESS) continue; boolean queued = DBReader.getQueueIDList().contains(item.getId()); if (showQueued && !queued) continue; if (showNotQueued && queued) continue; boolean downloaded = item.getMedia() != null & item.getMedia().isDownloaded(); if (showDownloaded && !downloaded) continue; if (showNotDownloaded && downloaded) continue; result.add(item); } return result; }

Target:
public List<FeedItem> filter(List<FeedItem> items) { if(mProperties.length == 0) return items; List<FeedItem> result = new ArrayList<>(); if (showPlayed && showUnplayed) return result; if (showQueued && showNotQueued) return result; if (showDownloaded && showNotDownloaded) return result; for(FeedItem item : items) { if (showPlayed && !item.isPlayed()) continue; if (showUnplayed && item.isPlayed()) continue; if (showPaused && item.getState() != FeedItem.State.IN_PROGRESS) continue; boolean queued = DBReader.getQueueIDList().contains(item.getId()); if (showQueued && !queued) continue; if (showNotQueued && queued) continue; boolean downloaded = item.getMedia() != null && item.getMedia().isDownloaded(); if (showDownloaded && !downloaded) continue; if (showNotDownloaded && downloaded) continue; result.add(item); } return result; }
Source:
private void attemptXoauth2(String username) throws MessagingException, IOException { CommandResponse response = executeSimpleCommandWithResponse("AUTH XOAUTH2 " + Authentication.computeXoauth(username, oauthTokenProvider.getToken(username, OAuth2TokenProvider.OAUTH2_TIMEOUT)), true); if(response.replyCode == 334) { retryXoauthWithNewToken = XOAuth2ChallengeParser.shouldRetry( response.message, mHost); Log.i(LOG_TAG, "Challenge response: "+ new Base64().decode(response.message)); executeSimpleCommandWithResponse("", false); } }

Target:
private void attemptXoauth2(String username) throws MessagingException, IOException { CommandResponse response = executeSimpleCommandWithResponse("AUTH XOAUTH2 " + Authentication.computeXoauth(username, oauthTokenProvider.getToken(username, OAuth2TokenProvider.OAUTH2_TIMEOUT)), true); if(response.replyCode == SMTP_CONTINUE_REQUEST) { retryXoauthWithNewToken = XOAuth2ChallengeParser.shouldRetry( response.message, mHost); executeSimpleCommandWithResponse("", false); } }
Source:
public void orderingIsUnstable() { List<Integer> numbers = IntStream.range(0, 1000000).boxed().collect(Collectors.toList()); Iterable<Integer> numbersIterable = new UnstableOrderedIterable<>(numbers); List<Integer> iterationOrder = Lists.newArrayList(); numbersIterable.iterator().forEachRemaining(iterationOrder::add); List<Integer> secondIterationOrder = Lists.newArrayList(); numbersIterable.iterator().forEachRemaining(secondIterationOrder::add); assertThat(iterationOrder).isNotEqualTo(secondIterationOrder); assertThat(ImmutableSet.copyOf(iterationOrder)).isEqualTo(ImmutableSet.copyOf(numbers)); }

Target:
public void orderingIsUnstable() { Iterable<Integer> numbers = UnstableOrderedIterable.create(ImmutableList.of(1, 2), Comparator.naturalOrder()); assertThat(ImmutableList.copyOf(numbers)).containsExactly(1, 2); assertThat(ImmutableList.copyOf(numbers)).containsExactly(2, 1); assertThat(ImmutableList.copyOf(numbers)).containsExactly(1, 2); }
Source:
public FeedbackSubmissionEditQuestion(FeedbackQuestionAttributes questionAttributes, int qnIndx, boolean isModeratedQuestion) { courseId = questionAttributes.courseId; questionNumber = questionAttributes.questionNumber; this.qnIndx = qnIndx; questionId = questionAttributes.getId(); questionText = questionAttributes.getQuestionDetails().questionText; visibilityMessages = questionAttributes.getVisibilityMessage(); questionType = questionAttributes.questionType; numberOfEntitiesToGiveFeedbackTo = questionAttributes.numberOfEntitiesToGiveFeedbackTo; this.isModeratedQuestion = isModeratedQuestion; isRecipientNameHidden = questionAttributes.isRecipientNameHidden(); isTeamQuestion = (questionAttributes.giverType.equals(FeedbackParticipantType.TEAMS)); }

Target:
public FeedbackSubmissionEditQuestion(FeedbackQuestionAttributes questionAttributes, int qnIndx, boolean isModeratedQuestion) { courseId = questionAttributes.courseId; questionNumber = questionAttributes.questionNumber; this.qnIndx = qnIndx; questionId = questionAttributes.getId(); questionText = questionAttributes.getQuestionDetails().questionText; visibilityMessages = questionAttributes.getVisibilityMessage(); questionType = questionAttributes.questionType; numberOfEntitiesToGiveFeedbackTo = questionAttributes.numberOfEntitiesToGiveFeedbackTo; this.isModeratedQuestion = isModeratedQuestion; isRecipientNameHidden = questionAttributes.isRecipientNameHidden(); isTeamQuestion = questionAttributes.giverType.equals(FeedbackParticipantType.TEAMS); }
Source:
public static List<String> getMatchingJobNames(Pattern pattern, int maxJobs) { Iterator<Job> jobs = Items.allItems(Jenkins.getInstance(), Job.class).iterator(); List<String> matchingJobNames = new ArrayList<>(); while(jobs.hasNext() && matchingJobNames.size() < maxJobs) { Job job = jobs.next(); Matcher m = pattern.matcher(job.getDisplayName()); if(m.matches()) { matchingJobNames.add(job.getDisplayName()); } } return matchingJobNames; }

Target:
public static List<String> getMatchingJobNames(Pattern pattern, int maxJobs) { Iterator<Job> jobs = Items.allItems(Jenkins.getInstance(), Job.class).iterator(); List<String> matchingJobNames = new ArrayList<>(); while(jobs.hasNext() && matchingJobNames.size() < maxJobs) { Job job = jobs.next(); String jobName = job.getFullName(); Matcher m = pattern.matcher(jobName); if(m.matches()) { matchingJobNames.add(jobName); } } return matchingJobNames; }
Source:
public Object format(ServiceDiscoveryConfigItem item, Object valueToTransform) { if (item.getDockerName().equalsIgnoreCase(ServiceDiscoveryConfigItem.CERTIFICATES.getDockerName())) { List<Number> certificateIds = (List<Number>) valueToTransform; List<String> certificateNames = new ArrayList<>(); for (Number certificateId : certificateIds) { String certName = getCertName(certificateId); if (StringUtils.isNotBlank(certName)) { certificateNames.add(getCertName(certificateId)); } } return certificateNames; } else if (item.getDockerName().equals(ServiceDiscoveryConfigItem.DEFAULT_CERTIFICATE.getDockerName())) { Integer defaultCertId = (Integer) valueToTransform; return getCertName(defaultCertId); } else { return null; } }

Target:
public Object format(ServiceDiscoveryConfigItem item, Object valueToTransform) { if (item.getDockerName().equalsIgnoreCase(ServiceDiscoveryConfigItem.CERTIFICATES.getDockerName())) { List<Number> certificateIds = (List<Number>) valueToTransform; List<String> certificateNames = new ArrayList<>(); for (Number certificateId : certificateIds) { String certName = getCertName(certificateId); if (StringUtils.isNotBlank(certName)) { certificateNames.add(certName); } } return certificateNames; } else if (item.getDockerName().equals(ServiceDiscoveryConfigItem.DEFAULT_CERTIFICATE.getDockerName())) { Integer defaultCertId = (Integer) valueToTransform; return getCertName(defaultCertId); } else { return null; } }
Source:
protected void configure(HttpSecurity http) throws Exception { http.httpBasic() .and() .authorizeRequests() .antMatchers(HttpMethod.GET, "/user/**") .hasRole("USER") .and() .logout() .logoutUrl("/user/logout") .addLogoutHandler(logoutHandler) .logoutSuccessHandler((new HttpStatusReturningLogoutSuccessHandler(HttpStatus.OK))) .permitAll() .and() .csrf() .disable() .formLogin() .disable(); }

Target:
protected void configure(HttpSecurity http) throws Exception { http.httpBasic() .and() .authorizeRequests() .antMatchers(HttpMethod.GET, "/user/**") .hasRole("USER") .and() .logout() .logoutUrl("/user/logout") .addLogoutHandler(logoutHandler) .logoutSuccessHandler(new HttpStatusReturningLogoutSuccessHandler(HttpStatus.OK)) .permitAll() .and() .csrf() .disable() .formLogin() .disable(); }
Source:
private void setupLoggerFromProperties(final Properties props) { final String driverLogLevel = PGProperty.LOGGER_LEVEL.get(props); if (driverLogLevel == null) { return; } if ("OFF".equalsIgnoreCase(driverLogLevel)) { PARENT_LOGGER.setLevel(Level.OFF); return; } else if ("DEBUG".equalsIgnoreCase(driverLogLevel)) { PARENT_LOGGER.setLevel(Level.FINE); } else if ("TRACE".equalsIgnoreCase(driverLogLevel)) { PARENT_LOGGER.setLevel(Level.FINEST); } final String driverLogFile = PGProperty.LOGGER_FILE.get(props); if (driverLogFile != null && driverLogFile.equals(loggerHandlerFile)) { return; } for (java.util.logging.Handler handlers : PARENT_LOGGER.getHandlers()) { handlers.close(); PARENT_LOGGER.removeHandler(handlers); loggerHandlerFile = null; } java.util.logging.Handler handler = new java.util.logging.ConsoleHandler(); if (driverLogFile != null) { try { handler = new java.util.logging.FileHandler(driverLogFile); loggerHandlerFile = driverLogFile; } catch (Exception ex) { System.err.println("Cannot enable FileHandler, fallback to ConsoleHandler."); } } handler.setFormatter(new java.util.logging.SimpleFormatter()); PARENT_LOGGER.setUseParentHandlers(false); PARENT_LOGGER.addHandler(handler); }

Target:
private void setupLoggerFromProperties(final Properties props) { final String driverLogLevel = PGProperty.LOGGER_LEVEL.get(props); if (driverLogLevel == null) { return; } if ("OFF".equalsIgnoreCase(driverLogLevel)) { PARENT_LOGGER.setLevel(Level.OFF); return; } else if ("DEBUG".equalsIgnoreCase(driverLogLevel)) { PARENT_LOGGER.setLevel(Level.FINE); } else if ("TRACE".equalsIgnoreCase(driverLogLevel)) { PARENT_LOGGER.setLevel(Level.FINEST); } ExpressionProperties exprProps = new ExpressionProperties(props, System.getProperties()); final String driverLogFile = PGProperty.LOGGER_FILE.get(exprProps); if (driverLogFile != null && driverLogFile.equals(loggerHandlerFile)) { return; } for (java.util.logging.Handler handlers : PARENT_LOGGER.getHandlers()) { handlers.close(); PARENT_LOGGER.removeHandler(handlers); loggerHandlerFile = null; } java.util.logging.Handler handler = new java.util.logging.ConsoleHandler(); if (driverLogFile != null) { try { handler = new java.util.logging.FileHandler(driverLogFile); loggerHandlerFile = driverLogFile; } catch (Exception ex) { System.err.println("Cannot enable FileHandler, fallback to ConsoleHandler."); } } handler.setFormatter(new java.util.logging.SimpleFormatter()); PARENT_LOGGER.setUseParentHandlers(false); PARENT_LOGGER.addHandler(handler); }
Source:
protected void updateData() { List<T> items = getModel().getItems() == null ? null : new ArrayList<T>(getModel().getItems()); if (items != null) { if (!getModel().hasItemsSorted()) { Collections.sort(items, getDefaultItemComparator()); } updateDataProvider(items); } }

Target:
protected void updateData() { List<T> items = getModel().getItems() == null ? null : new ArrayList<T>(getModel().getItems()); if (items != null) { if (!getModel().hasItemsSorted()) { items.sort(getDefaultItemComparator()); } updateDataProvider(items); } }
Source:
public Object thenReturn(InvocationContext ctx, VisitableCommand command, Object returnValue) { if (future.isDone()) { try { future.getNow(null); return returnValue; } catch (Throwable t) { return this; } } return new SimpleAsyncInvocationStage(future.thenApply(o -> returnValue)); }

Target:
public Object thenReturn(InvocationContext ctx, VisitableCommand command, Object returnValue) { if (future.isDone()) { return future.isCompletedExceptionally() ? this : returnValue; } return new QueueAsyncInvocationStage(ctx, command, future, (InvocationSuccessFunction) (rCtx, rCommand, rv) -> returnValue); }
Source:
synchronized void shutdown() { m_isShutdown = true; try { int waitFor = 1 - Math.min(m_inFlight.availablePermits(), -4); for (int i = 0; i < waitFor; ++i) { try { if (m_inFlight.tryAcquire(1, TimeUnit.SECONDS)) { m_inFlight.release(); break; } } catch (InterruptedException e) { break; } } m_ecryptgw.die(); } finally { m_inFlight.drainPermits(); m_inFlight.release(); } }

Target:
void shutdown() { m_isShutdown = true; try { int waitFor = 1 - Math.min(m_inFlight.availablePermits(), -4); for (int i = 0; i < waitFor; ++i) { try { if (m_inFlight.tryAcquire(1, TimeUnit.SECONDS)) { m_inFlight.release(); break; } } catch (InterruptedException e) { break; } } m_ecryptgw.die(); } finally { m_inFlight.drainPermits(); m_inFlight.release(); } }
Source:
CorfuRecord<V, M> create(@Nonnull final K key, @Nullable final V value, @Nullable final M metadata) { boolean beganNewTxn = false; try { beganNewTxn = TxBegin(); return corfuTable.put(key, new CorfuRecord<>(value, metadata)); } finally { if (beganNewTxn) { TxEnd(); } } }

Target:
CorfuRecord<V, M> create(@Nonnull final K key, @Nullable final V value, @Nullable final M metadata) { boolean beganNewTxn = false; try { beganNewTxn = TxBegin(); CorfuRecord<V, M> previous = corfuTable.get(key); if (previous != null) { throw new RuntimeException("Cannot create a record on existing key."); } M newMetadata = null; if (metadataOptions.isMetadataEnabled()) { if (metadata == null) { throw new RuntimeException("Table::create needs non-null metadata"); } M metadataDefaultInstance = (M) getMetadataOptions().getDefaultMetadataInstance(); newMetadata = getNewMetadata(metadataDefaultInstance, metadata); } return corfuTable.put(key, new CorfuRecord<>(value, newMetadata)); } finally { if (beganNewTxn) { TxEnd(); } } }
Source:
public String getName() { StringBuilder name = new StringBuilder(); for (int i = 0; i < (input.length - 1); i++) { name.append(input[i].getName() + "/"); } name.append(input[input.length - 1].getName()); return name.toString(); }

Target:
public String getName() { StringBuilder name = new StringBuilder(); for (int i = 0; i < (input.length - 1); i++) { name.append(input[i].getName()).append("/"); } name.append(input[input.length - 1].getName()); return name.toString(); }
Source:
public List<EnsemblTranscript> fetchEnsemblTranscriptsByProteinIdsPOST( @ApiParam(value = "List of Ensembl protein IDs. For example [\"ENSP00000439985\",\"ENSP00000478460\",\"ENSP00000346196\"]", required = true, allowMultiple = true) @RequestBody List<String> proteinIds) { List<EnsemblTranscript> transcripts = new ArrayList<>(); for (String proteinId : proteinIds) { try { transcripts.addAll(this.ensemblService.getEnsemblTranscriptsByProteinId(proteinId)); } catch (EnsemblTranscriptNotFoundException e) { e.printStackTrace(); } } return transcripts; }

Target:
public List<EnsemblTranscript> fetchEnsemblTranscriptsByProteinIdsPOST( @ApiParam(value = "List of Ensembl protein IDs. For example [\"ENSP00000439985\",\"ENSP00000478460\",\"ENSP00000346196\"]", required = true, allowMultiple = true) @RequestBody List<String> proteinIds) { List<EnsemblTranscript> transcripts = new ArrayList<>(); for (String proteinId : proteinIds) { transcripts.addAll(this.ensemblService.getEnsemblTranscriptsByProteinId(proteinId)); } return transcripts; }
Source:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } ForEachStatement actualStatement = (ForEachStatement) tree; Type variableType = actualStatement.variable().type().symbolType(); Type collectionItemType = getCollectionItemType(actualStatement.expression()); if (collectionItemType != null && !isMostPreciseType(variableType, collectionItemType)) { DownCastVisitor downCastVisitor = new DownCastVisitor(actualStatement.variable().symbol()); actualStatement.accept(downCastVisitor); if (downCastVisitor.hasDownCastOfLoopVariable) { List<JavaFileScannerContext.Location> locations = Collections.singletonList( new JavaFileScannerContext.Location(String.format(SECONDARY_MESSAGE, collectionItemType.name()), actualStatement.expression())); reportIssue(actualStatement.variable().type(), String.format(PRIMARY_MESSAGE, variableType.name()), locations, 0); } } }

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } ForEachStatement actualStatement = (ForEachStatement) tree; Type variableType = actualStatement.variable().type().symbolType(); Type collectionItemType = getCollectionItemType(actualStatement.expression()); if (collectionItemType != null && !isMostPreciseType(variableType, collectionItemType)) { DownCastVisitor downCastVisitor = new DownCastVisitor(actualStatement.variable().symbol()); actualStatement.statement().accept(downCastVisitor); if (downCastVisitor.hasDownCastOfLoopVariable) { List<JavaFileScannerContext.Location> locations = Collections.singletonList( new JavaFileScannerContext.Location(String.format(SECONDARY_MESSAGE, collectionItemType.name()), actualStatement.expression())); reportIssue(actualStatement.variable().type(), String.format(PRIMARY_MESSAGE, variableType.name()), locations, 0); } } }
Source:
public void init(IEditorSite site, IEditorInput input) throws PartInitException { super.init(site, input); IEditorInput editorInput = this.getEditorInput(); IFile sessionResourceFile = ((FileEditorInput) editorInput).getFile(); final URI sessionResourceURI = URI.createPlatformResourceURI(sessionResourceFile.getFullPath().toOSString(), true); try { PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { SubMonitor subMonitor = SubMonitor.convert(monitor, 1); subMonitor.beginTask(MessageFormat.format(Messages.UI_SessionEditor_session_loading_task_title, new Object[0]), 1); session = SessionManager.INSTANCE.getSession(sessionResourceURI, subMonitor); if (!session.isOpen()) { session.open(monitor); } subMonitor.worked(1); subMonitor.done(); } }); } catch (InvocationTargetException e) { ErrorDialog.openError(getSite().getShell(), MessageFormat.format(Messages.UI_SessionEditor_session_loading_error_message, new Object[0]), e.getMessage(), Status.CANCEL_STATUS); } catch (InterruptedException e) { ErrorDialog.openError(getSite().getShell(), MessageFormat.format(Messages.UI_SessionEditor_session_loading_error_message, new Object[0]), e.getMessage(), Status.CANCEL_STATUS); } }

Target:
public void init(IEditorSite site, IEditorInput input) throws PartInitException { super.init(site, input); IEditorInput editorInput = this.getEditorInput(); IFile sessionResourceFile = ((FileEditorInput) editorInput).getFile(); final URI sessionResourceURI = URI.createPlatformResourceURI(sessionResourceFile.getFullPath().toOSString(), true); try { PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() { @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { SubMonitor subMonitor = SubMonitor.convert(monitor, 1); subMonitor.beginTask(MessageFormat.format(Messages.UI_SessionEditor_session_loading_task_title, new Object[0]), 1); session = SessionManager.INSTANCE.getSession(sessionResourceURI, subMonitor); if (!session.isOpen()) { session.open(monitor); } subMonitor.worked(1); subMonitor.done(); } }); } catch (InvocationTargetException | InterruptedException e) { ErrorDialog.openError(getSite().getShell(), MessageFormat.format(Messages.UI_SessionEditor_session_loading_error_message, new Object[0]), e.getMessage(), Status.CANCEL_STATUS); } }
Source:
void fireEvent(Event event, ICluster cluster) { listeners.stream().forEach(listener -> { switch (event) { case CLUSTER_ADDED: listener.clusterAdded(this, cluster); break; case CLUSTER_REMOVED: listener.clusterRemoved(this, cluster); break; } }); }

Target:
void fireEvent(Event event, ICluster cluster) { listeners.forEach(listener -> { switch (event) { case CLUSTER_ADDED: listener.clusterAdded(this, cluster); break; case CLUSTER_REMOVED: listener.clusterRemoved(this, cluster); break; } }); }
Source:
public void setup() { GerritConnector connector = new GerritConnector(); TasksUiPlugin.getRepositoryManager().addRepositoryConnector(connector); TaskRepository repo = new TaskRepository(connector.getConnectorKind(), MOCK_REPO_URL); repo.setProperty(GerritConnector.CONNECTOR_KIND + ".usageType", "WITH_TASK_TOOL"); TaskRepository repoAlone = new TaskRepository(connector.getConnectorKind(), MOCK_REPO_URL_ALONE); repoAlone.setProperty(GerritConnector.CONNECTOR_KIND + ".usageType", "ALONE"); TasksUiPlugin.getRepositoryManager().addRepository(repo); TasksUiPlugin.getRepositoryManager().addRepository(repoAlone); reviewTask = getGerritTask(); localTask = getLocalTask(); TasksUiPlugin.getTaskList().addTask(reviewTask); TasksUiPlugin.getTaskList().addTask(localTask); forceTaskReviewLink(reviewTask, localTask); }

Target:
public void setup() { connector = new GerritConnector(); TasksUiPlugin.getRepositoryManager().addRepositoryConnector(connector); repo = new TaskRepository(connector.getConnectorKind(), MOCK_REPO_URL); repo.setProperty(GerritConnector.CONNECTOR_KIND + ".usageType", "WITH_TASK_TOOL"); repoAlone = new TaskRepository(connector.getConnectorKind(), MOCK_REPO_URL_ALONE); repoAlone.setProperty(GerritConnector.CONNECTOR_KIND + ".usageType", "ALONE"); TasksUiPlugin.getRepositoryManager().addRepository(repo); TasksUiPlugin.getRepositoryManager().addRepository(repoAlone); reviewTask = getGerritTask(); localTask = getLocalTask(); TasksUiPlugin.getTaskList().addTask(reviewTask); TasksUiPlugin.getTaskList().addTask(localTask); forceTaskReviewLink(reviewTask, localTask); }
Source:
protected Pool createPool(Owner owner, Product product, Long quantity, Date startDate, Date endDate, String contractNr) { Pool pool = new Pool( owner, product, new HashSet<Product>(), quantity, startDate, endDate, contractNr, DEFAULT_ACCOUNT, DEFAULT_ORDER ); pool.setSourceSubscription(new SourceSubscription(Util.generateDbUUID(), "master")); return poolCurator.create(pool); }

Target:
protected Pool createPool(Owner owner, Product product, Long quantity, Date startDate, Date endDate, String contractNr) { Pool pool = createPool(owner, product, quantity, startDate, endDate); pool.setContractNumber(contractNr); return poolCurator.merge(pool); }
Source:
public void addToSlot(Object slot, PresenterWidget<?> child) { if (child == null || (child.slot == slot && child.parent == this)) { return; } adoptChild(slot, child); if (!child.isPopup()) { getView().addToSlot(slot, child); } else { monitorCloseEvent((PresenterWidget<? extends PopupView>) child); } if (isVisible()) { child.internalReveal(); } }

Target:
public void addToSlot(Object slot, PresenterWidget<?> child) { assert child != null : "cannot add null to a slot"; if (child.slot == slot && child.parent == this) { return; } adoptChild(slot, child); if (child.isPopup()) { monitorCloseEvent((PresenterWidget<? extends PopupView>) child); } else { getView().addToSlot(slot, child); } if (isVisible()) { child.internalReveal(); } }
Source:
public String validate(String parameterValue, ModelValidatorContext context) throws ValidationException { try { return new URI(parameterValue).toString(); } catch (URISyntaxException e) { throw new ValidationException(parameterValue + " is not a valid uri", e); } }

Target:
public String validate(String parameterValue, ModelValidatorContext context) throws ValidationException { try { return new URI(parameterValue).toString(); } catch (URISyntaxException e) { throw new ValidationException(parameterValue + " is not a valid URI.", e); } }
Source:
public void setUp() throws Exception { dimensions = new ArrayList<String>(); dimensions.add("item1"); dimensions.add("item2"); dimensions.add("time"); testCaseSupplier = new TestCaseSupplier( "{\"item1\":\"value1\"," + "\"item2\":2," + "\"time\":1372121562 }" ); UpdateStreamFactory updateStreamFactory = new UpdateStreamFactory(testCaseSupplier, null, "time"); webbie = new WebFirehoseFactory(updateStreamFactory, "posix"); firehose = webbie.connect(); if (firehose.hasMore()) { inputRow = firehose.nextRow(); } else { throw new RuntimeException("queue is empty"); } }

Target:
public void setUp() throws Exception { dimensions.add("item1"); dimensions.add("item2"); dimensions.add("time"); webbie = new WebFirehoseFactory( new UpdateStreamFactory() { @Override public UpdateStream build() { return new MyUpdateStream(ImmutableMap.<String,Object>of("item1", "value1", "item2", 2, "time", "1372121562")); } }, "posix" ); webbie1 = new WebFirehoseFactory( new UpdateStreamFactory() { @Override public UpdateStream build() { return new MyUpdateStream(ImmutableMap.<String,Object>of("item1", "value1", "item2", 2, "time", "1373241600000")); } }, "auto" ); }
Source:
public void testCheckAccessNullThread() { carbonSecurityManager = mock(CarbonSecurityManager.class); Thread thread = null; assertNull(thread); carbonSecurityManager.checkAccess(thread); }

Target:
public void testCheckAccessNullThread() { System.setProperty("denied.system.properties", "mockDeniedProperty"); carbonSecurityManager = new CarbonSecurityManager(); Thread thread = null; assertNull(thread); carbonSecurityManager.checkAccess(thread); }
Source:
public FusedLocationProviderApiImpl() { }

Target:
public FusedLocationProviderApiImpl() { connectionCallbacks = new HashSet<>(); }
Source:
synchronized Slice stealWork() { for (;;) { DeltaTask maxTask = null; Slice maxSlice = null; int maxWork = 0; for (DeltaTask task : tasks) { Slice s = task.remaining(); if (s != null && maxWork < s.size()) { maxTask = task; maxSlice = s; maxWork = s.size(); } } if (maxTask == null) break; if (maxTask.tryStealWork(maxSlice)) return maxSlice; } return null; }

Target:
synchronized Slice stealWork() { for (;;) { DeltaTask maxTask = null; Slice maxSlice = null; int maxWork = 0; for (DeltaTask task : tasks) { Slice s = task.remaining(); if (s != null && maxWork < s.size()) { maxTask = task; maxSlice = s; maxWork = s.size(); } } if (maxTask == null) return null; if (maxTask.tryStealWork(maxSlice)) return maxSlice; } }