auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public boolean hasPrivileges(SecurityContext sc, Privilege[] privileges) { boolean res = false; for (AccessControlEntryImpl ace : principals.values()) { if (ace.getPrincipal().getName().equals(SimplePrincipal.EVERYONE.getName())) { res |= ace.hasPrivileges(privileges); } if (ace.getPrincipal().getName().equals(sc.getUserName())) { res |= ace.hasPrivileges(privileges); } if (sc.hasRole(ace.getPrincipal().getName())) { res |= ace.hasPrivileges(privileges); } } return res; }

Target:
public boolean hasPrivileges(SecurityContext sc, Privilege[] privileges) { for (AccessControlEntryImpl ace : principals.values()) { if (ace.getPrincipal().getName().equals(SimplePrincipal.EVERYONE.getName())) { if (ace.hasPrivileges(privileges)) { return true; } } if (ace.getPrincipal().getName().equals(sc.getUserName())) { if (ace.hasPrivileges(privileges)) { return true; } } if (sc.hasRole(ace.getPrincipal().getName())) { if (ace.hasPrivileges(privileges)) { return true; } } } return false; }
Source:
public PlanNode visitAggregation(AggregationNode node, RewriteContext<Context> context) { context.get().variables.addAll(node.getGroupingKeys()); for (AggregationNode.Aggregation aggregation : node.getAggregations().values()) { aggregation.getArguments().forEach(expression -> subfieldExtractor.process(expression, context.get())); aggregation.getFilter().ifPresent(expression -> subfieldExtractor.process(expression, context.get())); aggregation.getOrderBy() .map(OrderingScheme::getOrderBy) .ifPresent(context.get().variables::addAll); aggregation.getMask().ifPresent(context.get().variables::add); } return context.defaultRewrite(node, context.get()); }

Target:
public PlanNode visitAggregation(AggregationNode node, RewriteContext<Context> context) { context.get().variables.addAll(node.getGroupingKeys()); for (AggregationNode.Aggregation aggregation : node.getAggregations().values()) { aggregation.getArguments().forEach(expression -> subfieldExtractor.process(castToExpression(expression), context.get())); aggregation.getFilter().ifPresent(expression -> subfieldExtractor.process(castToExpression(expression), context.get())); aggregation.getOrderBy() .map(OrderingScheme::getOrderBy) .ifPresent(context.get().variables::addAll); aggregation.getMask().ifPresent(context.get().variables::add); } return context.defaultRewrite(node, context.get()); }
Source:
public QualifierRangeFilter(String family) { range.setFamilyName(Preconditions.checkNotNull(family)); }

Target:
private QualifierRangeFilter(String family) { range.setFamilyName(Preconditions.checkNotNull(family)); }
Source:
public synchronized Slice2DIndex getSlice2DIndex(int imageIndex) throws IOException { long addressPosition = ADDRESS_POSITION + imageIndex * ADDRESS_SIZE; raf.seek(addressPosition); long dataPosition = raf.readLong(); long endDataPosition = raf.readLong(); raf.seek(dataPosition); int dimensions = raf.readInt(); int[] index = new int[dimensions]; for (int i = 0; i < dimensions; i++) { index[i] = raf.readInt(); } int stringSize = (int) (endDataPosition - raf.getFilePointer()); byte[] stringBytes = new byte[stringSize]; raf.read(stringBytes); String varName = new String(stringBytes); return new Slice2DIndex(index, varName); }

Target:
public synchronized Slice2DIndex getSlice2DIndex(int imageIndex) throws IOException { long addressPosition = ADDRESS_POSITION + imageIndex * ADDRESS_SIZE; raf.seek(addressPosition); long dataPosition = raf.readLong(); long endDataPosition = raf.readLong(); raf.seek(dataPosition); int nextValue = raf.readInt(); int[] index; if (nextValue < 0) { int dimensions = -nextValue; index = new int[dimensions]; for (int i = 0; i < dimensions; i++) { index[i] = raf.readInt(); } } else { index = new int[2]; index[VariableAdapter.T] = nextValue; index[VariableAdapter.Z] = raf.readInt(); } int stringSize = (int) (endDataPosition - raf.getFilePointer()); byte[] stringBytes = new byte[stringSize]; raf.read(stringBytes); String varName = new String(stringBytes); return new Slice2DIndex(index, varName); }
Source:
private TreeWalker(String namespace, JSTypeRegistry typeRegistry, Set<String> provides) { this.namespace = namespace; this.typeRegistry = typeRegistry; this.provides = provides; this.valueSymbolsWalked = 0; }

Target:
private TreeWalker(String namespace, JSTypeRegistry typeRegistry, Set<String> provides) { this.namespace = namespace; this.typeRegistry = typeRegistry; this.provides = provides; }
Source:
public void testProtectedBasicUserEndpointPrincipalIsNotAuthorized403() { try { RULE.getJerseyTest().target("/protected").request() .header(HttpHeaders.AUTHORIZATION, "Basic Z3Vlc3Q6c2VjcmV0") .get(String.class); failBecauseExceptionWasNotThrown(WebApplicationException.class); } catch (WebApplicationException e) { assertThat(e.getResponse().getStatus()).isEqualTo(403); } }

Target:
public void testProtectedBasicUserEndpointPrincipalIsNotAuthorized403() { try { RULE.getJerseyTest().target("/protected").request() .header(HttpHeaders.AUTHORIZATION, "Basic Z3Vlc3Q6c2VjcmV0") .get(String.class); failBecauseExceptionWasNotThrown(ForbiddenException.class); } catch (ForbiddenException e) { assertThat(e.getResponse().getStatus()).isEqualTo(403); } }
Source:
public boolean hasE() { return index() == 4; }

Target:
public boolean hasE() { return IndexOf.E.is(index()); }
Source:
public TransactionManagerElement getTransactionManagerInfo() throws JAXBException { String xml = httpRequest(new int[]{HttpURLConnection.HTTP_OK, HttpURLConnection.HTTP_UNSUPPORTED_TYPE}, txnMgr, "GET", TxMediaType.TX_STATUS_EXT_MEDIA_TYPE); if (status == HttpURLConnection.HTTP_UNSUPPORTED_TYPE ) return null; System.out.printf("Unmarshalling TransactionManagerElement%n%s", xml); JAXBContext jc = JAXBContext.newInstance(TransactionManagerElement.class.getPackage().getName() ); Unmarshaller u = jc.createUnmarshaller(); Object o = u.unmarshal( new StreamSource( new StringReader(xml))); if (o instanceof TransactionManagerElement) return (TransactionManagerElement)o; return (TransactionManagerElement)((JAXBElement)o).getValue(); }

Target:
public TransactionManagerElement getTransactionManagerInfo() throws JAXBException { String xml = httpRequest(new int[]{HttpURLConnection.HTTP_OK, HttpURLConnection.HTTP_UNSUPPORTED_TYPE}, txnMgr, "GET", TxMediaType.TX_STATUS_EXT_MEDIA_TYPE); if (status == HttpURLConnection.HTTP_UNSUPPORTED_TYPE ) return null; if (log.isTraceEnabled()) log.tracef("Unmarshalling TransactionManagerElement%n%s", xml); JAXBContext jc = JAXBContext.newInstance(TransactionManagerElement.class.getPackage().getName() ); Unmarshaller u = jc.createUnmarshaller(); Object o = u.unmarshal( new StreamSource( new StringReader(xml))); if (o instanceof TransactionManagerElement) return (TransactionManagerElement)o; return (TransactionManagerElement)((JAXBElement)o).getValue(); }
Source:
public void writeToParcel(Parcel parcel, int flags) { parcel.writeString(namespace); parcel.writeString(text); parcel.writeString(fragment); parcel.writeParcelable(site, flags); if (hasProperties()) { parcel.writeParcelable(properties, flags); } parcel.writeString(thumbUrl); parcel.writeString(description); }

Target:
public void writeToParcel(Parcel parcel, int flags) { parcel.writeString(namespace); parcel.writeString(text); parcel.writeString(fragment); parcel.writeParcelable(site, flags); parcel.writeParcelable(properties, flags); parcel.writeString(thumbUrl); parcel.writeString(description); }
Source:
private List<String> getDeployedModules(String containerId) { try { CuratorFramework client = zkConnection.getClient(); if (null != client.checkExists().forPath(Paths.build(Paths.CONTAINERS, containerId))) { return client.getChildren().forPath(path(containerId)); } } catch (Exception e) { throw ZooKeeperUtils.wrapThrowable(e); } return Collections.emptyList(); }

Target:
private List<String> getDeployedModules(String containerId) { try { CuratorFramework client = zkConnection.getClient(); if (null != client.checkExists().forPath(Paths.build(Paths.CONTAINERS, containerId))) { return client.getChildren().forPath(path(containerId)); } } catch (Exception e) { ZooKeeperUtils.wrapAndThrowIgnoring(e, NoNodeException.class); } return Collections.emptyList(); }
Source:
public static void main(String[] args) { new Log(); String[] levels = { "/level/3.txt"}; new Launcher().start(levels); }

Target:
public static void main(String[] args) { new Log(); String[] levels = {"/level/1.txt", "/level/2.txt", "/level/3.txt"}; new Launcher().start(levels); }
Source:
public Flux<Payload> requestChannel(Payload payload, Publisher<Payload> payloads) { try { return responderRSocket.requestChannel(payloads); } catch (Throwable t) { return Flux.error(t); } }

Target:
public Flux<Payload> requestChannel(Payload payload, Publisher<Payload> payloads) { try { return responderRSocket.requestChannel(payload, payloads); } catch (Throwable t) { return Flux.error(t); } }
Source:
public static void GetClusterByServiceList(AsyncQuery aQuery, Guid dataCenterId, final boolean supportsVirtService, final boolean supportsGlusterService) { aQuery.converterCallback = new IAsyncConverter() { @Override public Object Convert(Object source, AsyncQuery _asyncQuery) { if (source == null) { return new ArrayList<VDSGroup>(); } final ArrayList<VDSGroup> list = (ArrayList<VDSGroup>) source; final ArrayList<VDSGroup> filteredList = new ArrayList<VDSGroup>(); for(VDSGroup cluster : list) { if ((supportsVirtService && cluster.supportsVirtService()) || (supportsGlusterService && cluster.supportsGlusterService())) { filteredList.add(cluster); } } Collections.sort(filteredList, new Linq.VdsGroupByNameComparer()); return filteredList; } }; Frontend.RunQuery(VdcQueryType.GetVdsGroupsByStoragePoolId, new StoragePoolQueryParametersBase(dataCenterId), aQuery); }

Target:
public static void GetClusterByServiceList(AsyncQuery aQuery, Guid dataCenterId, final boolean supportsVirtService, final boolean supportsGlusterService) { aQuery.converterCallback = new IAsyncConverter() { @Override public Object Convert(Object source, AsyncQuery _asyncQuery) { if (source == null) { return new ArrayList<VDSGroup>(); } final ArrayList<VDSGroup> list = (ArrayList<VDSGroup>) source; return getClusterByServiceList(list, supportsVirtService, supportsGlusterService); } }; Frontend.RunQuery(VdcQueryType.GetVdsGroupsByStoragePoolId, new StoragePoolQueryParametersBase(dataCenterId), aQuery); }
Source:
public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game); for (Permanent perm : permanents) { List<String> cardSubType = perm.getSubtype(game); if (!cardSubType.contains("Sliver") && perm.getOwnerId() == player.getId()) { cardSubType.add("Sliver"); } } return true; }

Target:
public boolean apply(Game game, Ability source) { Player player = game.getPlayer(source.getControllerId()); List<Permanent> permanents = game.getBattlefield().getActivePermanents(filter, source.getControllerId(), game); for (Permanent perm : permanents) { List<String> cardSubType = perm.getSubtype(game); if (!cardSubType.contains("Sliver") && perm.getOwnerId().equals(player.getId())) { cardSubType.add("Sliver"); } } return true; }
Source:
public void testAggregationPushdownThroughOuterJoinNotFiringInCorrelatedAggregatesLeftSide() { assertQuery("SELECT max(x) from (SELECT * from (VALUES 1) t(x) LEFT JOIN (VALUES 1) t2(y) ON t.x = t2.y) GROUP BY x", "VALUES 1"); }

Target:
public void testAggregationPushdownThroughOuterJoinNotFiringInCorrelatedAggregatesLeftSide() { assertQuery("SELECT max(x) FROM" + "(SELECT * from (VALUES 1) t(x) LEFT JOIN (VALUES 1) t2(y) ON t.x = t2.y)" + "GROUP BY x", "VALUES 1"); }
Source:
public static ResourceSchema getResourceSchema(final Configuration configuration, Dependencies dependencies) throws IOException { final ResourceSchema schema = new ResourceSchema(); try { List<ColumnInfo> columns = null; final SchemaType schemaType = PhoenixConfigurationUtil.getSchemaType(configuration); if(SchemaType.QUERY.equals(schemaType)) { final String sqlQuery = PhoenixConfigurationUtil.getSelectStatement(configuration); Preconditions.checkNotNull(sqlQuery, "No Sql Query exists within the configuration"); final SqlQueryToColumnInfoFunction function = new SqlQueryToColumnInfoFunction(configuration); columns = function.apply(sqlQuery); } else if (SchemaType.TABLE.equals(schemaType)) { columns = dependencies.getSelectColumnMetadataList(configuration); } ResourceFieldSchema fields[] = new ResourceFieldSchema[columns.size()]; int i = 0; for(ColumnInfo cinfo : columns) { int sqlType = cinfo.getSqlType(); PDataType phoenixDataType = PDataType.fromTypeId(sqlType); byte pigType = TypeUtil.getPigDataTypeForPhoenixType(phoenixDataType); ResourceFieldSchema field = new ResourceFieldSchema(); field.setType(pigType).setName(cinfo.getDisplayName()); fields[i++] = field; } schema.setFields(fields); } catch(SQLException sqle) { LOG.error(String.format("Error: SQLException [%s] ",sqle.getMessage())); throw new IOException(sqle); } return schema; }

Target:
public static ResourceSchema getResourceSchema(final Configuration configuration, Dependencies dependencies) throws IOException { final ResourceSchema schema = new ResourceSchema(); try { List<ColumnInfo> columns = null; final SchemaType schemaType = PhoenixConfigurationUtil.getSchemaType(configuration); if(schemaType == SchemaType.QUERY) { final String sqlQuery = PhoenixConfigurationUtil.getSelectStatement(configuration); Preconditions.checkNotNull(sqlQuery, "No Sql Query exists within the configuration"); final SqlQueryToColumnInfoFunction function = new SqlQueryToColumnInfoFunction(configuration); columns = function.apply(sqlQuery); } else if (schemaType == SchemaType.TABLE) { columns = dependencies.getSelectColumnMetadataList(configuration); } ResourceFieldSchema fields[] = new ResourceFieldSchema[columns.size()]; int i = 0; for(ColumnInfo cinfo : columns) { int sqlType = cinfo.getSqlType(); PDataType phoenixDataType = PDataType.fromTypeId(sqlType); byte pigType = TypeUtil.getPigDataTypeForPhoenixType(phoenixDataType); ResourceFieldSchema field = new ResourceFieldSchema(); field.setType(pigType).setName(cinfo.getDisplayName()); fields[i++] = field; } schema.setFields(fields); } catch(SQLException sqle) { LOG.error(String.format("Error: SQLException [%s] ",sqle.getMessage())); throw new IOException(sqle); } return schema; }
Source:
public void add(final SampleResult sample) { synchronized (buffer) { buffer.add(sample); dataChanged = true; CorrelationRecorder.setBuffer(buffer); } }

Target:
public void add(final SampleResult sample) { synchronized (buffer) { buffer.add(sample); dataChanged = true; } }
Source:
public void testExceptionalCases() { ______TS("Case where more than 1 question with same question number"); FeedbackQuestionAttributes question = testData.feedbackQuestions.get("qn2InSession4"); assertEquals(2, question.questionNumber); FeedbackQuestionAttributes questionFromDatastore = BackDoor.getFeedbackQuestion(question.courseId, question.feedbackSessionName, question.questionNumber); assertEquals(question, questionFromDatastore); questionFromDatastore.questionNumber = 1; BackDoor.editFeedbackQuestion(questionFromDatastore); resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.instr", "Session with errors"); resultsPage.waitForPanelsToCollapse(); resultsPage.verifyHtmlMainContent("/instructorFeedbackResultsPageWithDuplicateQuestionNumber.html"); }

Target:
public void testExceptionalCases() { ______TS("Case where more than 1 question with same question number"); FeedbackQuestionAttributes firstQuestion = testData.feedbackQuestions.get("qn1InSession4"); assertEquals(1, firstQuestion.questionNumber); FeedbackQuestionAttributes firstQuestionFromDatastore = BackDoor.getFeedbackQuestion(firstQuestion.courseId, firstQuestion.feedbackSessionName, firstQuestion.questionNumber); FeedbackQuestionAttributes secondQuestion = testData.feedbackQuestions.get("qn2InSession4"); assertEquals(2, secondQuestion.questionNumber); FeedbackQuestionAttributes secondQuestionFromDatastore = BackDoor.getFeedbackQuestion(secondQuestion.courseId, secondQuestion.feedbackSessionName, secondQuestion.questionNumber); assertEquals(secondQuestion, secondQuestionFromDatastore); secondQuestionFromDatastore.questionNumber = 1; BackDoor.editFeedbackQuestion(secondQuestionFromDatastore); resultsPage = loginToInstructorFeedbackResultsPage("CFResultsUiT.instr", "Session with errors"); resultsPage.waitForPanelsToCollapse(); By firstQuestionPanel = By.xpath(" + firstQuestionFromDatastore.getId() + "']]"); resultsPage.verifyHtmlPart(firstQuestionPanel, "/instructorFeedbackResultsDuplicateQuestionNumberPanel1.html"); By secondQuestionPanel = By.xpath(" + secondQuestionFromDatastore.getId() + "']]"); resultsPage.verifyHtmlPart(secondQuestionPanel, "/instructorFeedbackResultsDuplicateQuestionNumberPanel2.html"); }
Source:
public void drawTitle(GameContainer container) { if (won) { typeFontTitle.drawString( container.getWidth() / 2 - typeFontTitle.getWidth(gameOverText) / 2, container.getHeight() / 8, gameWonText, Color.yellow); } else { typeFontTitle.drawString( container.getWidth() / 2 - typeFontTitle.getWidth(gameOverText) / 2, container.getHeight() / 8, gameOverText, Color.yellow); } }

Target:
private void drawTitle(GameContainer container) { if (won) { gameTitleText = "GAME COMPLETED"; } else { gameTitleText = "GAME LOST"; } typeFontTitle.drawString( container.getWidth() / 2 - typeFontTitle.getWidth(gameTitleText) / 2, container.getHeight() / 8, gameTitleText, Color.yellow); }
Source:
private List<LookupBean> getLookupListFromCoordinator(String tier) { try { final FullResponseHolder response = fetchLookupsForTier(tier); List<LookupBean> lookupBeanList = new ArrayList<>(); if (!response.getStatus().equals(HttpResponseStatus.OK)) { LOG.error( "Error while fetching lookup code from Coordinator with status[%s] and content[%s]", response.getStatus(), response.getContent() ); return null; } else { if (response.getContent().startsWith("[")) { return null; } else { Map<String, LookupExtractorFactoryContainer> lookupMap = jsonMapper.readValue( response.getContent(), LOOKUPS_ALL_REFERENCE ); if (!lookupMap.isEmpty()) { for (Map.Entry<String, LookupExtractorFactoryContainer> e : lookupMap.entrySet()) { lookupBeanList.add(new LookupBean(e.getKey(), null, e.getValue())); } } } } return lookupBeanList; } catch (ISE ise) { LOG.error(ise, "Coordinator is unavailable"); return null; } catch (Exception e) { LOG.error(e, "Error while parsing lookup code for tier [%s] from response", tier); return null; } }

Target:
private List<LookupBean> getLookupListFromCoordinator(String tier) { try { final FullResponseHolder response = fetchLookupsForTier(tier); List<LookupBean> lookupBeanList = new ArrayList<>(); if (!response.getStatus().equals(HttpResponseStatus.OK)) { LOG.error( "Error while fetching lookup code from Coordinator with status[%s] and content[%s]", response.getStatus(), response.getContent() ); return null; } if (response.getContent().startsWith("[")) { LOG.info("Failed to retrieve lookup information from coordinator. Attempting to load lookups using snapshot instead"); return null; } else { Map<String, LookupExtractorFactoryContainer> lookupMap = jsonMapper.readValue( response.getContent(), LOOKUPS_ALL_REFERENCE ); lookupMap.forEach((k, v) -> lookupBeanList.add(new LookupBean(k, null, v))); } return lookupBeanList; } catch (Exception e) { LOG.error(e, "Error while trying to get lookup list from coordinator for tier[%s]", tier); return null; } }
Source:
public void testListPath() throws Exception { Configuration config = new Configuration(this.getRawConfiguration()); config.set("fs.azure.list.max.results", "5000"); final AzureBlobFileSystem fs = (AzureBlobFileSystem) FileSystem .newInstance(getFileSystem().getUri(), config); final List<Future<Void>> tasks = new ArrayList<>(); ExecutorService es = Executors.newFixedThreadPool(10); for (int i = 0; i < TEST_FILES_NUMBER; i++) { final Path fileName = new Path("/test" + i); Callable<Void> callable = new Callable<Void>() { @Override public Void call() throws Exception { touch(fileName); return null; } }; tasks.add(es.submit(callable)); } for (Future<Void> task : tasks) { task.get(); } es.shutdownNow(); FileStatus[] files = fs.listStatus(new Path("/")); assertEquals(TEST_FILES_NUMBER, files.length ); }

Target:
public void testListPath() throws Exception { Configuration config = new Configuration(this.getRawConfiguration()); config.set(AZURE_LIST_MAX_RESULTS, "5000"); final AzureBlobFileSystem fs = (AzureBlobFileSystem) FileSystem .newInstance(getFileSystem().getUri(), config); final List<Future<Void>> tasks = new ArrayList<>(); ExecutorService es = Executors.newFixedThreadPool(10); for (int i = 0; i < TEST_FILES_NUMBER; i++) { final Path fileName = new Path("/test" + i); Callable<Void> callable = new Callable<Void>() { @Override public Void call() throws Exception { touch(fileName); return null; } }; tasks.add(es.submit(callable)); } for (Future<Void> task : tasks) { task.get(); } es.shutdownNow(); FileStatus[] files = fs.listStatus(new Path("/")); assertEquals(TEST_FILES_NUMBER, files.length ); }
Source:
public List<TriggeredNotification> evaluate(Notification notification) { List<? extends Person> subjects = NotificationCalculator.resolveGroupMembers( notification.getSubjects(), notification.getSchoolId(), manager); NotificationCalculator calculator; switch(notification.getMeasure()) { case GPA: calculator = new GpaCalc(); break; case SECTION_GRADE: calculator = new SectionGradeCalc(); break; case ASSIGNMENT_GRADE: calculator = new AssignmentGradeCalc(); break; case BEHAVIOR_SCORE: calculator = new BehaviorScoreCalc(); break; case HOMEWORK_COMPLETION: calculator = new HwCompletionCalc(); break; case SCHOOL_ABSENCE: calculator = new SchoolAbsenceCalc(); break; case SCHOOL_TARDY: calculator = new SchoolTardyCalc(); break; case SECTION_ABSENCE: calculator = new SectionAbsenceCalc(); break; case SECTION_TARDY: calculator = new SectionTardyCalc(); break; case GOAL_CREATED: calculator = new GoalCreatedCalc(); break; case GOAL_APPROVED: calculator = new GoalApprovedCalc(); break; case GOAL_MET: calculator = new GoalMetCalc(); break; case GOAL_UNMET: calculator = new GoalUnmetCalc(); break; default: LOGGER.warn("A notification with ID: " + notification.getId() + " has an an unsupported type: " + notification.getMeasure() + " and could not be evaluated for this reason"); calculator = null; break; } if (notification.getOneTime() && notification.getTriggered()) { return null; } if(null != calculator) { return calculator.calculate(subjects, notification, manager); } return null; }

Target:
public List<TriggeredNotification> evaluate(Notification notification) { if (notification.getOneTime() && notification.getTriggered()) { return null; } List<? extends Person> subjects = NotificationCalculator.resolveGroupMembers( notification.getSubjects(), notification.getSchoolId(), manager); NotificationCalculator calculator; switch(notification.getMeasure()) { case GPA: calculator = new GpaCalc(); break; case SECTION_GRADE: calculator = new SectionGradeCalc(); break; case ASSIGNMENT_GRADE: calculator = new AssignmentGradeCalc(); break; case BEHAVIOR_SCORE: calculator = new BehaviorScoreCalc(); break; case HOMEWORK_COMPLETION: calculator = new HwCompletionCalc(); break; case SCHOOL_ABSENCE: calculator = new SchoolAbsenceCalc(); break; case SCHOOL_TARDY: calculator = new SchoolTardyCalc(); break; case SECTION_ABSENCE: calculator = new SectionAbsenceCalc(); break; case SECTION_TARDY: calculator = new SectionTardyCalc(); break; case GOAL_CREATED: calculator = new GoalCreatedCalc(); break; case GOAL_APPROVED: calculator = new GoalApprovedCalc(); break; case GOAL_MET: calculator = new GoalMetCalc(); break; case GOAL_UNMET: calculator = new GoalUnmetCalc(); break; default: LOGGER.warn("A notification with ID: " + notification.getId() + " has an an unsupported type: " + notification.getMeasure() + " and could not be evaluated for this reason"); calculator = null; break; } if(null != calculator) { return calculator.calculate(subjects, notification, manager); } return null; }
Source:
protected void endActionOnVmConfiguration() { if (getVm().getstatus() == VMStatus.ImageLocked) { VmHandler.unlockVm(getVm(), getCompensationContext()); } UpdateVmInSpm(getVm().getstorage_pool_id(), Arrays.asList(getVm())); setSucceeded(true); }

Target:
protected void endActionOnVmConfiguration() { if (getVm() != null) { if (getVm().getstatus() == VMStatus.ImageLocked) { VmHandler.unlockVm(getVm(), getCompensationContext()); } UpdateVmInSpm(getVm().getstorage_pool_id(), Arrays.asList(getVm())); } else { setCommandShouldBeLogged(false); log.warn("VmCommand::EndVmCommand: Vm is null - not performing EndAction on Vm"); } setSucceeded(true); }
Source:
public ValidationResult isReadOnlyPropertyCompatibleWithLunInterface() { if (Boolean.TRUE.equals(disk.getReadOnly()) && disk.getDiskInterface() == DiskInterface.VirtIO_SCSI) { return new ValidationResult( VdcBllMessages.ACTION_TYPE_FAILED_VIRT_IO_SCSI_INTERFACE_FOR_LUN_TARGETS_DOES_NOT_SUPPORT_READ_ONLY_ATTR); } return ValidationResult.VALID; }

Target:
public ValidationResult isReadOnlyPropertyCompatibleWithLunInterface() { if (Boolean.TRUE.equals(disk.getReadOnly()) && disk.getDiskInterface() == DiskInterface.VirtIO_SCSI) { return new ValidationResult( VdcBllMessages.ACTION_TYPE_FAILED_VIRT_IO_SCSI_INTERFACE_FOR_LUN_DISKS_DOES_NOT_SUPPORT_READ_ONLY_ATTR); } return ValidationResult.VALID; }
Source:
public void setUp() throws Exception { Person person1 = new Person(); person1.addName(new PersonName("givenName", "middleName", "familyName")); user1 = new User(person1); Person person2 = new Person(); person2.addName(new PersonName("givenName", "middleNamf", "familyName")); user2 = new User(person2); nullUser = null; }

Target:
public void setUp() throws Exception { Person person1 = new Person(); person1.addName(new PersonName("givenName", "middleName", "familyName")); user1 = new User(person1); Person person2 = new Person(); person2.addName(new PersonName("givenName", "middleNamf", "familyName")); user2 = new User(person2); Person person3 = new Person(); person3.addName(new PersonName("givenName", "middleNamf", "familyNaae")); user3 = new User(person3); nullUser1 = null; nullUser2 = null; }
Source:
void shutdown() { List<NGSession> allSessions; synchronized(lock) { done = true; allSessions = Stream.concat(workingPool.stream(), idlePool.stream()).collect(Collectors.toList()); idlePool.clear(); workingPool.clear(); } for (NGSession session : allSessions) { session.shutdown(); } for (NGSession session : allSessions) { try { session.join(); } catch (InterruptedException ex) { } } }

Target:
void shutdown() throws InterruptedException { List<NGSession> allSessions; synchronized (lock) { done = true; allSessions = Stream.concat(workingPool.stream(), idlePool.stream()).collect(Collectors.toList()); idlePool.clear(); workingPool.clear(); } for (NGSession session : allSessions) { session.shutdown(); } long start = System.nanoTime(); for (NGSession session : allSessions) { long timeout = NGConstants.SESSION_TERMINATION_TIMEOUT_MILLIS - TimeUnit.NANOSECONDS.convert(System.nanoTime() - start, TimeUnit.MILLISECONDS); if (timeout < 1) { timeout = 1; } session.join(timeout); if (session.isAlive()) { throw new IllegalStateException( "NGSession has not completed in " + NGConstants.SESSION_TERMINATION_TIMEOUT_MILLIS + " ms"); } } }
Source:
private void storeValues() { if (fCharsetEditor.presentsDefaultValue()) { InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).remove(ICDebugConstants.PREF_DEBUG_CHARSET); } else { fCharsetEditor.store(); InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).put(ICDebugConstants.PREF_DEBUG_CHARSET, fCharsetEditor.getPreferenceStore().getString(ICDebugConstants.PREF_DEBUG_CHARSET)); } if (fWideCharsetEditor.presentsDefaultValue()) { InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).remove(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET); } else { fWideCharsetEditor.store(); InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).put(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, fWideCharsetEditor.getPreferenceStore().getString(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET)); } InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).putBoolean( CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, fShowBinarySourceFilesButton.getSelection()); InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).putBoolean( CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR, fShowSourceNotFoundEditor.getSelection()); if (Platform.getPreferencesService().getBoolean(CCorePlugin.PLUGIN_ID, CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR, true, null)) { InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).putBoolean( CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR_ALL_TIME, fShowSourceNotFoundAllTime.getSelection()); } }

Target:
private void storeValues() { if (fCharsetEditor.presentsDefaultValue()) { InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).remove(ICDebugConstants.PREF_DEBUG_CHARSET); } else { fCharsetEditor.store(); InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).put(ICDebugConstants.PREF_DEBUG_CHARSET, fCharsetEditor.getPreferenceStore().getString(ICDebugConstants.PREF_DEBUG_CHARSET)); } if (fWideCharsetEditor.presentsDefaultValue()) { InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).remove(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET); } else { fWideCharsetEditor.store(); InstanceScope.INSTANCE.getNode(CDebugCorePlugin.PLUGIN_ID).put(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET, fWideCharsetEditor.getPreferenceStore().getString(ICDebugConstants.PREF_DEBUG_WIDE_CHARSET)); } InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).putBoolean( CCorePreferenceConstants.SHOW_SOURCE_FILES_IN_BINARIES, fShowBinarySourceFilesButton.getSelection()); InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).putBoolean( CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR, !fShowSourceNotFoundEditor.getSelection()); InstanceScope.INSTANCE.getNode(CCorePlugin.PLUGIN_ID).putBoolean( CCorePreferenceConstants.SHOW_SOURCE_NOT_FOUND_EDITOR_ALL_TIME, fShowSourceNotFoundAllTime.getSelection()); }
Source:
public void testItemNotExistObject() { abvsResult.reset(); try { ob.reset(abvsResult); ob.finish(); } catch (IOException e) { Assert.fail("Test failed to write the Object pointable."); } tvp.set(abvsResult); tvp.getValue(op); try { getTaggedValuePointable("key", tvpKey1); op.getValue(tvpKey1, tvpValue1); } catch (IOException | SystemException e) { Assert.fail("Test failed to write the object pointable."); } XDMConstants.setFalse(tvp); if (!FunctionHelper.arraysEqual(tvp, tvpValue1)) { Assert.fail("Value is incorrect for the given key. Expected: false with valuetag: " + ValueTag.XS_BOOLEAN_TAG + " Got valuetag: " + tvp.getTag()); } try { ob.reset(abvsResult); getTaggedValuePointable("name", tvpKey1); getTaggedValuePointable("A green door", tvpValue1); ob.addItem(tvpKey1, tvpValue1); getTaggedValuePointable("price", tvpKey2); getTaggedValuePointable(12.5, tvpValue2); ob.addItem(tvpKey2, tvpValue2); ob.finish(); } catch (IOException e) { Assert.fail("Test failed to write the object pointable."); } tvp.set(abvsResult); tvp.getValue(op); try { getTaggedValuePointable("key", tvpKey3); op.getValue(tvpKey3, tvpValue3); } catch (IOException | SystemException e) { Assert.fail("Test failed to write the object pointable."); } XDMConstants.setFalse(tvp); if (!FunctionHelper.arraysEqual(tvp, tvpValue3)) { Assert.fail("Value is incorrect for the given key. Expected: false with valuetag: " + ValueTag.XS_BOOLEAN_TAG + " Got valuetag: " + tvp.getTag()); } }

Target:
public void testItemNotExistObject() { abvsResult.reset(); try { ob.reset(abvsResult); ob.finish(); } catch (IOException e) { Assert.fail("Test failed to write the Object pointable."); } tvp.set(abvsResult); tvp.getValue(op); try { getTaggedValuePointable("key", false, tvpKey1); if (op.getValue(tvpKey1, tvp)) { Assert.fail("key not in object. Expected: false Got: true"); } } catch (IOException e) { Assert.fail("Test failed to write the object pointable."); } try { abvsResult.reset(); ob.reset(abvsResult); getTaggedValuePointable("name", false, tvpKey1); getTaggedValuePointable("A green door", tvpValue1); ob.addItem(tvpKey1, tvpValue1); getTaggedValuePointable("price", false, tvpKey2); getTaggedValuePointable(12.5, tvpValue2); ob.addItem(tvpKey2, tvpValue2); ob.finish(); } catch (IOException e) { Assert.fail("Test failed to write the object pointable."); } tvp.set(abvsResult); tvp.getValue(op); try { getTaggedValuePointable("key", false, tvpKey3); if (op.getValue(tvpKey3, tvp)) { Assert.fail("key not in object. Expected: false Got: true"); } if (!op.getValue(tvpKey1, tvp)) { Assert.fail("key in object. Expected: true Got: false"); } } catch (IOException e) { Assert.fail("Test failed to write the object pointable."); } }
Source:
public String toString() { return "FilterSupportStatus{" + "isSupported=" + isSupported + ", reason='" + reason + '\'' + '}'; }

Target:
public String toString() { return String.format( "FilterSupportStatus{isSupported=%s, reason='%s'}", isSupported, reason); }
Source:
public String getClientInfo() { return clientInfo.orElse(null); }

Target:
public Optional<String> getClientInfo() { return clientInfo; }
Source:
public void testDeleteBackupRelatedAlerts() { AuditLog entry = dao.getByOriginAndCustomEventId(ORIGIN, CUSTOM_BAKUP_EVENT_ID); assertFalse(entry.isDeleted()); dao.deleteBackupRelatedAlerts(); entry = dao.getByOriginAndCustomEventId(ORIGIN, CUSTOM_BAKUP_EVENT_ID); assertTrue(entry.isDeleted()); }

Target:
public void testDeleteBackupRelatedAlerts() { AuditLog entry = dao.getByOriginAndCustomEventId(ORIGIN, CUSTOM_BAKUP_EVENT_ID); assertNotNull(entry); assertFalse(entry.isDeleted()); dao.deleteBackupRelatedAlerts(); entry = dao.getByOriginAndCustomEventId(ORIGIN, CUSTOM_BAKUP_EVENT_ID); assertNotNull(entry); assertTrue(entry.isDeleted()); }
Source:
public void shouldSupportCustomPoliciesOutOfTestContainersPackage() { try ( GenericContainer<?> container = new GenericContainer<>("hello-world:latest") .withImagePullPolicy(new AbstractImagePullPolicy() { @Override protected boolean shouldPullCached(DockerImageName imageName, ImageData localImageData) { return true; } }) ) { container.withStartupCheckStrategy(new OneShotStartupCheckStrategy()); container.start(); } }

Target:
public void shouldSupportCustomPoliciesOutOfTestContainersPackage() { try ( GenericContainer<?> container = new GenericContainer<>() .withImagePullPolicy(new AbstractImagePullPolicy() { @Override protected boolean shouldPullCached(DockerImageName imageName, ImageData localImageData) { return false; } }) ) { container.withStartupCheckStrategy(new OneShotStartupCheckStrategy()); container.start(); } }
Source:
private void validateExpiry(int expiry) { if (expiry < 1 || expiry > DEFAULT_EXPIRY_TIME) { throw new IllegalArgumentException( "expires must be in range of 1 to " + DEFAULT_EXPIRY_TIME); } }

Target:
private void validateExpiry(int expiry) { if (expiry < 1 || expiry > DEFAULT_EXPIRY_TIME) { throw new IllegalArgumentException( "expiry must be minimum 1 second to maximum " + TimeUnit.SECONDS.toDays(DEFAULT_EXPIRY_TIME) + " days"); } }
Source:
public void run() { try { final byte[] buf = new byte[BUFFER_SIZE]; int flushCountBeforeRead = 0; boolean readInterrupted = false; for (;;) { try { if (readInterrupted) { synchronized (writeLock) { boolean interruptedAgain = Thread.interrupted(); dst.flush(); if (interruptedAgain) { interrupt(); } } readInterrupted = false; if (!flushCount.compareAndSet(flushCountBeforeRead, 0)) { interrupt(); } } if (done) break; flushCountBeforeRead = flushCount.get(); final int n; try { n = src.read(buf); } catch (InterruptedIOException wakey) { readInterrupted = true; continue; } if (n < 0) break; synchronized (writeLock) { if (Thread.interrupted()) { interrupt(); continue; } boolean writeInterrupted = false; for (;;) { try { dst.write(buf, 0, n); } catch (InterruptedIOException wakey) { writeInterrupted = true; continue; } if (writeInterrupted || flushCount.get() > 0) interrupt(); break; } } } catch (IOException e) { break; } } } finally { try { src.close(); } catch (IOException e) { } try { dst.close(); } catch (IOException e) { } } }

Target:
public void run() { try { final byte[] buf = new byte[BUFFER_SIZE]; int flushCountBeforeRead = 0; boolean readInterrupted = false; for (;;) { try { if (readInterrupted) { synchronized (writeLock) { boolean interruptedAgain = Thread.interrupted(); dst.flush(); if (interruptedAgain) { interrupt(); } } readInterrupted = false; if (!flushCount.compareAndSet(flushCountBeforeRead, 0)) { interrupt(); } } if (done) break; flushCountBeforeRead = flushCount.get(); final int n; try { n = src.read(buf); } catch (InterruptedIOException wakey) { readInterrupted = true; continue; } if (n < 0) break; synchronized (writeLock) { if (isInterrupted()) { continue; } boolean writeInterrupted = false; for (;;) { try { dst.write(buf, 0, n); } catch (InterruptedIOException wakey) { writeInterrupted = true; continue; } if (writeInterrupted || flushCount.get() > 0) interrupt(); break; } } } catch (IOException e) { break; } } } finally { try { src.close(); } catch (IOException e) { } try { dst.close(); } catch (IOException e) { } } }
Source:
private void putMetricData(List<Metric> batch) { DynamicCounter.increment(METRICS_COUNTER, batch.size()); final Stopwatch s = DynamicTimer.start(PUTS_TIMER); try { cloudWatch.putMetricData(createPutRequest(batch)); } catch (AmazonServiceException e) { final Tag error = new BasicTag("error", e.getErrorCode()); DynamicCounter.increment(ERRORS_COUNTER.withAdditionalTag(error)); } catch (Exception e) { final Tag error = new BasicTag("error", e.getClass().getSimpleName()); DynamicCounter.increment(ERRORS_COUNTER.withAdditionalTag(error)); LOG.error("Error while submitting data for metrics : " + batch, e); } finally { s.stop(); } }

Target:
private void putMetricData(List<Metric> batch) { METRICS_COUNTER.increment(batch.size()); final Stopwatch s = PUTS_TIMER.start(); try { cloudWatch.putMetricData(createPutRequest(batch)); } catch (AmazonServiceException e) { final Tag error = new BasicTag("error", e.getErrorCode()); DynamicCounter.increment(ERRORS_COUNTER_ID.withAdditionalTag(error)); } catch (Exception e) { final Tag error = new BasicTag("error", e.getClass().getSimpleName()); DynamicCounter.increment(ERRORS_COUNTER_ID.withAdditionalTag(error)); LOG.error("Error while submitting data for metrics : " + batch, e); } finally { s.stop(); } }
Source:
private Map<String, Object> loadYamlConfig(String configFile) { Path configPath = Paths.get(configFile); if (!resources.exists(configPath)) { return emptyMap(); } try { return YamlParser.INSTANCE.parseMap(resources.sourceFile(configPath)); } catch (IOException e) { throw new IllegalStateException("Unable to read " + configFile, e); } }

Target:
private Map<String, Object> loadYamlConfig(String configFile) { return emptyMap(); }
Source:
public void testHasClone() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(NoCloneCheck.class); final String[] expected = { "10: " + getCheckMessage(MSG_KEY), "27: " + getCheckMessage(MSG_KEY), "35: " + getCheckMessage(MSG_KEY), "39: " + getCheckMessage(MSG_KEY), "52: " + getCheckMessage(MSG_KEY), "60: " + getCheckMessage(MSG_KEY), "98: " + getCheckMessage(MSG_KEY), }; verify(checkConfig, getPath("InputNoCloneClones.java"), expected); }

Target:
public void testHasClone() throws Exception { final DefaultConfiguration checkConfig = createCheckConfig(NoCloneCheck.class); final String[] expected = { "10: " + getCheckMessage(MSG_KEY), "27: " + getCheckMessage(MSG_KEY), "35: " + getCheckMessage(MSG_KEY), "39: " + getCheckMessage(MSG_KEY), "52: " + getCheckMessage(MSG_KEY), "60: " + getCheckMessage(MSG_KEY), "98: " + getCheckMessage(MSG_KEY), }; verify(checkConfig, getPath("InputNoClone.java"), expected); }
Source:
@Override public void save(D d, String path) { ObjectOutputStream outStream = null; try { outStream = new ObjectOutputStream(new FileOutputStream(path)); outStream.writeObject(d); } catch (IOException e) { if (log != null) log.error("Error opening file", e); } finally { try { if (outStream != null) outStream.close(); } catch (IOException e) { if (log != null) log.error("Error closing file", e); } } }

Target:
@Override public void save(D d, String path) { try (FileOutputStream fos = new FileOutputStream(path)){ try (ObjectOutputStream outStream = new ObjectOutputStream(fos)){ outStream.writeObject(d); } } catch (IOException e) { if (log != null) log.error("Error opening file.", e); } }
Source:
private List<Parameter> getFilterParameters() { String typeName = dictionary.getJsonAliasFor(type); List<String> attributeNames = dictionary.getAttributes(type); List<Parameter> params = new ArrayList<>(); params.add(new QueryParameter() .type("string") .name("filter[" + typeName + "]") .description("Filters the collection of " + typeName + " using a 'disjoint' RSQL expression")); if (lineage.isEmpty()) { params.add(new QueryParameter() .type("string") .name("filter") .description("Filters the collection of " + typeName + " using a 'joined' RSQL expression")); } if (supportLegacyDialect) { for (Operator op : filterOperators) { attributeNames.forEach((name) -> { Class<?> attributeClass = dictionary.getType(type, name); if (attributeClass.isPrimitive() || String.class.isAssignableFrom(attributeClass)) { params.add(new QueryParameter() .type("string") .name("filter[" + typeName + "." + name + "][" + op.getNotation() + "]") .description("Filters the collection of " + typeName + " by the attribute " + name + " " + "using the operator " + op.getNotation())); } }); } } return params; }

Target:
private List<Parameter> getFilterParameters() { String typeName = dictionary.getJsonAliasFor(type); List<String> attributeNames = dictionary.getAttributes(type); List<Parameter> params = new ArrayList<>(); if (supportRSQLDialect) { params.add(new QueryParameter() .type("string") .name("filter[" + typeName + "]") .description("Filters the collection of " + typeName + " using a 'disjoint' RSQL expression")); if (lineage.isEmpty()) { params.add(new QueryParameter() .type("string") .name("filter") .description("Filters the collection of " + typeName + " using a 'joined' RSQL expression")); } } if (supportLegacyDialect) { for (Operator op : filterOperators) { attributeNames.forEach((name) -> { Class<?> attributeClass = dictionary.getType(type, name); if (attributeClass.isPrimitive() || String.class.isAssignableFrom(attributeClass)) { params.add(new QueryParameter() .type("string") .name("filter[" + typeName + "." + name + "][" + op.getNotation() + "]") .description("Filters the collection of " + typeName + " by the attribute " + name + " " + "using the operator " + op.getNotation())); } }); } } return params; }
Source:
public static boolean isNotNullishIgnoreSpace(String value) { return (value != null && !value.trim().isEmpty()); }

Target:
public static boolean isNotNullishIgnoreSpace(String value) { return value != null && !value.trim().isEmpty(); }
Source:
while ((line = br.readLine()) != null) { if (!pythonProcess.isAlive()) { break; } if (line.equals("Python Ready")) { handlePythonReadinessChange(true); LOG.info("Python Ready"); } else { LOG.error("> " + line); } }

Target:
while ((line = br.readLine()) != null) { if (!pythonProcess.isAlive()) { break; } LOG.error("> " + line); }
Source:
private static DetailAST skipVariableAssign(final DetailAST currentAST) { DetailAST result = currentAST; if (currentAST.getType() == TokenTypes.ASSIGN) { result = currentAST.getFirstChild().getNextSibling(); } return result; }

Target:
private static DetailAST skipVariableAssign(final DetailAST currentAST) { DetailAST result = currentAST; while (result.getType() == TokenTypes.LPAREN) { result = result.getNextSibling(); } if (result.getType() == TokenTypes.ASSIGN) { result = result.getFirstChild().getNextSibling(); } return result; }
Source:
public static boolean isPresent(String klass) { try { Class.forName(klass); return true; } catch (ReflectiveOperationException e) { return false; } }

Target:
public static boolean isPresent(String klass) { try { Class.forName(klass); return true; } catch (ReflectiveOperationException ignored) { return false; } }
Source:
public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String studentEmail = getNonNullRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); if (student == null) { return new JsonResult("No student with given email in given course.", HttpStatus.SC_NOT_FOUND); } InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, userInfo.id); gateKeeper.verifyAccessible(instructor, logic.getCourse(courseId), student.section, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS); boolean hasSection = false; try { hasSection = logic.hasIndicatedSections(courseId); } catch (EntityDoesNotExistException e) { return new JsonResult("No course with given id.", HttpStatus.SC_NOT_FOUND); } StudentProfileAttributes studentProfile = null; if (!"".equals(student.googleId)) { studentProfile = logic.getStudentProfile(student.googleId); } student.googleId = null; student.key = null; if (studentProfile != null) { studentProfile.googleId = null; studentProfile.modifiedDate = null; } StudentInfo output = new StudentInfo(student, studentProfile, hasSection); return new JsonResult(output); }

Target:
public ActionResult execute() { String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String studentEmail = getNonNullRequestParamValue(Const.ParamsNames.STUDENT_EMAIL); StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail); if (student == null) { return new JsonResult("No student with given email in given course.", HttpStatus.SC_NOT_FOUND); } InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, userInfo.id); gateKeeper.verifyAccessible(instructor, logic.getCourse(courseId), student.section, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS); boolean hasSection = false; try { hasSection = logic.hasIndicatedSections(courseId); } catch (EntityDoesNotExistException e) { return new JsonResult("No course with given id.", HttpStatus.SC_NOT_FOUND); } StudentProfileAttributes studentProfile = null; if (student.isRegistered()) { studentProfile = logic.getStudentProfile(student.googleId); } student.googleId = null; student.key = null; if (studentProfile != null) { studentProfile.googleId = null; studentProfile.modifiedDate = null; } StudentInfo output = new StudentInfo(student, studentProfile, hasSection); return new JsonResult(output); }
Source:
public List<String> getQueries() { Attribute queryAttr = this.getAttribute(Associations.RELATED); return queryAttr == null ? new ArrayList<>() : queryAttr.getValues().stream().map(String.class::cast).collect(Collectors.toList()); }

Target:
public List<String> getQueries() { Attribute queryAttr = this.getAttribute(WorkspaceConstants.WORKSPACE_QUERIES); return queryAttr == null ? new ArrayList<>() : queryAttr .getValues() .stream() .filter(String.class::isInstance) .map(String.class::cast) .collect(Collectors.toList()); }
Source:
private void reloadUrl(String url, @Nullable String pdfFilePath) { if (mPdfAndroidJavascriptBridge != null) { mPdfAndroidJavascriptBridge.cleanUp(); mWebView.removeJavascriptInterface("PdfAndroidJavascriptBridge"); } if (pdfFilePath != null && isPdfRenderingSupported() && TextUtils.equals(PDF_LOADER_URL, url)) { mPdfAndroidJavascriptBridge = new PdfAndroidJavascriptBridge(getContext(), pdfFilePath); mWebView.addJavascriptInterface(mPdfAndroidJavascriptBridge, "PdfAndroidJavascriptBridge"); mWebView.setInitialScale(1); } mWebView.reloadUrl(url); }

Target:
private void reloadUrl(String url, @Nullable String pdfFilePath) { if (mPdfAndroidJavascriptBridge != null) { mPdfAndroidJavascriptBridge.cleanUp(); mWebView.removeJavascriptInterface("PdfAndroidJavascriptBridge"); } if (pdfFilePath != null && isPdfRenderingSupported() && TextUtils.equals(PDF_LOADER_URL, url)) { mPdfAndroidJavascriptBridge = new PdfAndroidJavascriptBridge(pdfFilePath, this::offerExternalApp); mWebView.addJavascriptInterface(mPdfAndroidJavascriptBridge, "PdfAndroidJavascriptBridge"); mWebView.setInitialScale(1); } mWebView.reloadUrl(url); }