auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private VaultToken initialToken() { final Client vgm = factory.newClient("vgm", StandardFeatureGroup.PLATFORM_INTERNAL); try { final VgmTokenResponse response = vgm.target(vgmTokenUri) .request(MediaType.APPLICATION_JSON) .post(Entity.json(Collections.singletonMap("task_id", appInfo.getTaskId())), VgmTokenResponse.class); LOG.info("VGM response: status '{}' token '{}'", response.isOk() ? "success" : "FAILURE", response.getStatus(), response.getToken()); return VaultToken.of(response.getToken()); } catch (WebApplicationException e) { final Response r = e.getResponse(); LOG.error("VGM cubbyhole authentication failure: {}", r.getStatusInfo(), r.readEntity(String.class)); return VaultToken.of("invalid"); } catch (ProcessingException e) { LOG.error("VGM cubbyhole authentication failure", e); return VaultToken.of("invalid"); } finally { vgm.close(); } }

Target:
private VaultToken initialToken() { final Client vgm = factory.newClient("vgm", StandardFeatureGroup.PLATFORM_INTERNAL); try { final VgmTokenResponse response = vgm.target(vgmTokenUri) .request(MediaType.APPLICATION_JSON) .post(Entity.json(Collections.singletonMap("task_id", appInfo.getTaskId())), VgmTokenResponse.class); LOG.info("VGM response: status '{}' token '{}'", response.isOk() ? "success" : "FAILURE", response.getStatus(), response.getToken()); return VaultToken.of(response.getToken()); } catch (WebApplicationException e) { final Response r = e.getResponse(); LOG.error("VGM cubbyhole authentication failure: {}", r.getStatusInfo(), r.readEntity(String.class)); return VaultToken.of("invalid"); } catch (Exception e) { LOG.error("VGM cubbyhole authentication failure", e); return VaultToken.of("invalid"); } finally { vgm.close(); } }
Source:
protected long getTime(Object event) { if (getter == null) { Class<?> fqcn = event.getClass(); Getter<Object, Date> getterTime = PojoUtils.createGetter(fqcn, timeExpression, Date.class); getter = getterTime; } return ((Date)getter.get(event)).getTime(); }

Target:
protected long getTime(Object event) { return ((Date)getter.get(event)).getTime(); }
Source:
public String toString() { return getName() + ": " + conditions.stream().map(Condition::toString).collect(joining(" or ")); }

Target:
public String toString() { String conditionsToString = conditions.stream().map(Condition::toString).collect(joining(" or ")); return String.format("%s: %s", getName(), conditionsToString); }
Source:
private void applyRefactoring(RefactoringSession session) { eventBus.fireEvent(new FileTrackingEvent(null, null, SUSPEND)); refactorService.applyRefactoring(session).then(new Operation<RefactoringResult>() { @Override public void apply(RefactoringResult arg) throws OperationException { if (arg.getSeverity() == OK) { view.hide(); refactoringUpdater.updateAfterRefactoring(arg.getChanges()); final Resource[] resources = refactorInfo != null ? refactorInfo.getResources() : null; Project project = null; if (resources != null && resources.length == 1) { final Optional<Project> optProject = resources[0].getRelatedProject(); if (optProject.isPresent()) { project = optProject.get(); } } else { final Resource resource = appContext.getResource(); if (resource != null) { final Optional<Project> optProject = resource.getRelatedProject(); if (optProject.isPresent()) { project = optProject.get(); } } } if (project != null) { refactorService.reindexProject(project.getLocation().toString()); } setEditorFocus(); } else { view.showErrorMessage(arg); } for (ChangeInfo change : arg.getChanges()) { final String path = change.getPath(); final String oldPath = change.getOldPath(); eventBus.fireEvent(new FileTrackingEvent(path, oldPath, MOVE)); } eventBus.fireEvent(new FileTrackingEvent(null, null, RESUME)); } }); }

Target:
private void applyRefactoring(RefactoringSession session) { eventBus.fireEvent(newFileTrackingSuspendEvent()); refactorService.applyRefactoring(session).then(new Operation<RefactoringResult>() { @Override public void apply(RefactoringResult arg) throws OperationException { if (arg.getSeverity() == OK) { view.hide(); refactoringUpdater.updateAfterRefactoring(arg.getChanges()); final Resource[] resources = refactorInfo != null ? refactorInfo.getResources() : null; Project project = null; if (resources != null && resources.length == 1) { final Optional<Project> optProject = resources[0].getRelatedProject(); if (optProject.isPresent()) { project = optProject.get(); } } else { final Resource resource = appContext.getResource(); if (resource != null) { final Optional<Project> optProject = resource.getRelatedProject(); if (optProject.isPresent()) { project = optProject.get(); } } } if (project != null) { refactorService.reindexProject(project.getLocation().toString()); } setEditorFocus(); } else { view.showErrorMessage(arg); } for (ChangeInfo change : arg.getChanges()) { final String path = change.getPath(); final String oldPath = change.getOldPath(); eventBus.fireEvent(newFileTrackingMoveEvent(path, oldPath)); } eventBus.fireEvent(newFileTrackingResumeEvent()); } }); }
Source:
private void checkRulesToRegisterAlumni(final Integer studentNumber, final String documentIdNumber) { Student student = Student.readStudentByNumber(studentNumber); if (student == null) { if (Person.findPersonByDocumentID(documentIdNumber).isEmpty()) { throw new DomainException("error.person.document.number", Unit.getInstitutionAcronym()); } else { throw new DomainException("error.person.no.student", Unit.getInstitutionAcronym()); } } if (!student.getPerson().getDocumentIdNumber().equals(documentIdNumber.trim())) { throw new DomainException("error.document.number.student.number.mismatch"); } if (!checkAlumni(student)) { if (!student.getRegistrationsSet().isEmpty()) { for (Registration registration : student.getRegistrationsSet()) { ProgramConclusion programConclusion = ProgramConclusion.conclusionsFor(registration).findAny().orElse(null); if (registration.isConcluded() || programConclusion != null) { return; } } throw new DomainException("error.no.concluded.registrations"); } else { throw new DomainException("error.no.registrations", Unit.getInstitutionAcronym(), Installation.getInstance() .getInstituitionalEmailAddress("alumni")); } } }

Target:
private void checkRulesToRegisterAlumni(final Integer studentNumber, final String documentIdNumber) { Student student = Student.readStudentByNumber(studentNumber); if (student == null) { if (Person.findPersonByDocumentID(documentIdNumber).isEmpty()) { throw new DomainException("error.person.document.number", Unit.getInstitutionAcronym()); } else { throw new DomainException("error.person.no.student", Unit.getInstitutionAcronym()); } } if (!student.getPerson().getDocumentIdNumber().equals(documentIdNumber.trim())) { throw new DomainException("error.document.number.student.number.mismatch"); } if (!checkAlumni(student)) { if (!student.getRegistrationsSet().isEmpty()) { for (Registration registration : student.getRegistrationsSet()) { if (registration.isConcluded() || ProgramConclusion.conclusionsFor(registration).findAny().isPresent()) { return; } } throw new DomainException("error.no.concluded.registrations"); } else { throw new DomainException("error.no.registrations", Unit.getInstitutionAcronym(), Installation.getInstance() .getInstituitionalEmailAddress("alumni")); } } }
Source:
public DTableModel compileAll( DMNFEELHelper feel, DMNCompilerContext ctx ) { CompilerContext feelctx = feel.newCompilerContext(); feelctx.setDoCompile( true ); ctx.getVariables().forEach( (k, v) -> feelctx.addInputVariableType( k, ((BaseDMNTypeImpl ) v).getFeelType() ) ); initInputs(feel, feelctx); initRows(feel, feelctx); initOutputs(feel, feelctx); return this; }

Target:
public DTableModel compileAll( DMNFEELHelper feel, DMNCompilerContext ctx ) { CompilerContext feelctx = feel.newCompilerContext(); feelctx.setDoCompile( true ); ctx.getVariables().forEach( (k, v) -> feelctx.addInputVariableType( k, ((BaseDMNTypeImpl ) v).getFeelType() ) ); initInputClauses(feel, feelctx); initRows(feel, feelctx); initOutputClauses(feel, feelctx); return this; }
Source:
public int findRangeId(long value) { for (int i = 0; i < _rangeStartArray.length - 1; i++) { if (value >= _rangeStartArray[i].longValue() && value < _rangeStartArray[i + 1].longValue()) { return i; } } return _rangeStartArray.length - 1; }

Target:
public int findRangeId(long value) { for (int i = 0; i < _rangeStartArray.length; i++) { if (value < _rangeStartArray[i].longValue()) { return i - 1; } } if (value <= _lastRangeEnd.longValue()) { return _rangeStartArray.length - 1; } return -1; }
Source:
public KeyValueColumnExpression(PColumn column) { super(column); this.cf = column.getFamilyName().getBytes(); this.cq = column.getName().getBytes(); this.maxLength = column.getMaxLength(); this.scale = column.getScale(); }

Target:
public KeyValueColumnExpression(PColumn column) { super(column); this.cf = column.getFamilyName().getBytes(); this.cq = column.getName().getBytes(); }
Source:
private boolean execute(GdbLaunch launch, final IDebugCommandRequest request) { try { fExecutor.execute(new DsfRunnable() { @Override public void run() { final IGDBControl commandControl = fTracker.getService(IGDBControl.class); if (commandControl != null) { commandControl.terminate(new ImmediateRequestMonitor() { @Override protected void handleCompleted() { if (!getStatus().isOK()) { request.setStatus(getStatus()); request.done(); } else { WaitForTerminationJob job = new WaitForTerminationJob(fSession.getId(), request); job.schedule(); } }; }); } else { request.done(); } } }); } catch (RejectedExecutionException e) { request.done(); } return false; }

Target:
private boolean execute(GdbLaunch launch, final IDebugCommandRequest request) { try { fExecutor.execute(new DsfRunnable() { @Override public void run() { final IGDBControl commandControl = fTracker.getService(IGDBControl.class); if (commandControl != null) { commandControl.terminate(new ImmediateRequestMonitor() { @Override protected void handleCompleted() { if (!isSuccess()) { request.setStatus(getStatus()); request.done(); } else { WaitForTerminationJob job = new WaitForTerminationJob(fSession.getId(), request); job.schedule(); } }; }); } else { request.done(); } } }); } catch (RejectedExecutionException e) { request.done(); } return false; }
Source:
public boolean equals(final Object o) { boolean isEqual = false; final Customer customer = (Customer) o; if (getId() == customer.getId()) { isEqual = true; } return isEqual; }

Target:
public boolean equals(final Object o) { boolean isEqual = false; if (this == o) { isEqual = true; } else if (o != null && (getClass() == o.getClass())) { final Customer customer = (Customer) o; if (getId() == customer.getId()) isEqual = true; } return isEqual; }
Source:
public ContentDTO createContent(String ownerKey, ContentDTO content) { Owner owner = this.getOwnerByKey(ownerKey); Content entity = this.createContentImpl(owner, content); ownerManager.refreshOwnerForContentAccess(owner); return this.translator.translate(entity, ContentDTO.class); }

Target:
public ContentDTO createContent(String ownerKey, ContentDTO content) { this.validator.validateConstraints(content); this.validator.validateCollectionElementsNotNull(content::getModifiedProductIds); Owner owner = this.getOwnerByKey(ownerKey); Content entity = this.createContentImpl(owner, content); ownerManager.refreshOwnerForContentAccess(owner); return this.translator.translate(entity, ContentDTO.class); }
Source:
public OrganizationDto getOrganization(DbSession dbSession, ComponentDto component) { String organizationUuid = component.getOrganizationUuid(); return dbClient.organizationDao().selectByUuid(dbSession, organizationUuid) .orElseThrow(() -> new NotFoundException(format("Organization with uuid '%s' not found", organizationUuid))); }

Target:
public OrganizationDto getOrganization(DbSession dbSession, ComponentDto component) { String organizationUuid = component.getOrganizationUuid(); java.util.Optional<OrganizationDto> organizationDto = dbClient.organizationDao().selectByUuid(dbSession, organizationUuid); return checkFoundWithOptional(organizationDto, "Organization with uuid '%s' not found", organizationUuid); }
Source:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateSignalEventCatching emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertSignalEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, NON_CANCELLING, ""); assertDataIOSet(emptySubprocessEvent.getDataIOSet(), EMPTY_VALUE); }

Target:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_CATCHING_INTERMEDIATE_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); IntermediateSignalEventCatching emptySubprocessEvent = getCatchingIntermediateNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, HAS_NO_INCOME_EDGE, HAS_NO_OUTGOING_EDGE); assertGeneralSet(emptySubprocessEvent.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertSignalEventExecutionSet(emptySubprocessEvent.getExecutionSet(), EMPTY_VALUE, NON_CANCELLING, EMPTY_VALUE); assertDataIOSet(emptySubprocessEvent.getDataIOSet(), EMPTY_VALUE); }
Source:
public void testGetInvalidityInfoForInstituteName_invalid_returnSpecificErrorString() { String invalidInstituteName = StringHelper.generateStringOfLength(INSTITUTE_NAME_MAX_LENGTH + 1); String actual = validator.getInvalidityInfoForInstituteName(invalidInstituteName); assertEquals("Invalid institute name (too long) should return error message that is specific to institute name", "\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\" is not " + "acceptable to TEAMMATES as a/an institute name because it is too long. The value " + "of a/an institute name should be no longer than 64 characters. It should not be " + "empty.", actual); }

Target:
public void testGetInvalidityInfoForInstituteName_invalid_returnSpecificErrorString() { String invalidInstituteName = StringHelper.generateStringOfLength(INSTITUTE_NAME_MAX_LENGTH + 1); String actual = validator.getInvalidityInfoForInstituteName(invalidInstituteName); assertEquals("Invalid institute name (too long) should return error message that is specific to institute name", "\"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\" is not " + "acceptable to TEAMMATES as a/an institute name because it is too long. The value " + "of a/an institute name should be no longer than 64 characters. It should not be empty.", actual); }
Source:
public SearchResult searchByGeocode(final String geocode, final String guid, final CancellableHandler handler) { CancellableHandler.sendLoadProgressDetail(handler, R.string.cache_dialog_loading_details_status_loadpage); final Geocache cache = ECApi.searchByGeoCode(geocode); if (cache == null) { return null; } final SearchResult searchResult = new SearchResult(cache); return searchResult; }

Target:
public SearchResult searchByGeocode(final String geocode, final String guid, final CancellableHandler handler) { CancellableHandler.sendLoadProgressDetail(handler, R.string.cache_dialog_loading_details_status_loadpage); final Geocache cache = ECApi.searchByGeoCode(geocode); return cache != null ? new SearchResult(cache) : null; }
Source:
public String[] getPeerSupportedSignatureAlgorithms() { return new String[0]; }

Target:
public String[] getPeerSupportedSignatureAlgorithms() { return EmptyArrays.EMPTY_STRINGS; }
Source:
public synchronized void bumpTimestamp(long newTimestamp) throws TimestampIOException { if (newTimestamp > _timestampCounter.get()) { timestampBlockManager.reserveNextBlock(newTimestamp); _maxReservedTimestamp = newTimestamp; _timestampCounter.updateAndGet(oldTS -> Math.max(oldTS, newTimestamp)); } }

Target:
public synchronized void bumpTimestamp(long newTimestamp) throws TimestampIOException { newTimestamp = roundUp(newTimestamp); if (newTimestamp > _timestampCounter.get()) { if (newTimestamp> _maxReservedTimestamp) { reserveNextBlock(newTimestamp); } long currentTimestampCounter; while ((currentTimestampCounter = _timestampCounter.get()) < newTimestamp) { if (_timestampCounter.compareAndSet(currentTimestampCounter, newTimestamp)) { break; } } } }
Source:
private synchronized void createTable() { long ts = fCurrentTimestamp; if (fTrace == null) { return; } fTree.getDisplay().asyncExec(new Runnable() { @Override public void run() { fTree.setItemCount(0); } }); for (final ITmfTrace currentTrace : TmfTraceManager.getTraceSet(fTrace)) { final Map<String, ITmfStateSystem> sss = currentTrace.getStateSystems(); final Map<String, List<ITmfStateInterval>> fullStates = new LinkedHashMap<String, List<ITmfStateInterval>>(); for (Map.Entry<String, ITmfStateSystem> entry : sss.entrySet()) { String ssName = entry.getKey(); ITmfStateSystem ss = entry.getValue(); ss.waitUntilBuilt(); ts = (ts == -1 ? ss.getStartTime() : ts); try { fullStates.put(ssName, ss.queryFullState(ts)); } catch (TimeRangeException e) { throw new RuntimeException(); } catch (StateSystemDisposedException e) { return; } } fTree.getDisplay().asyncExec(new Runnable() { @Override public void run() { TreeItem traceRoot = new TreeItem(fTree, SWT.NONE); traceRoot.setText(ATTRIBUTE_NAME_COL, currentTrace.getName()); for (Map.Entry<String, ITmfStateSystem> entry : sss.entrySet()) { String ssName = entry.getKey(); ITmfStateSystem ss = entry.getValue(); List<ITmfStateInterval> fullState = fullStates.get(ssName); TreeItem item = new TreeItem(traceRoot, SWT.NONE); item.setText(ATTRIBUTE_NAME_COL, ssName); addChildren(ss, fullState, -1, item); } for (TreeItem item : fTree.getItems()) { item.setExpanded(true); } packColumns(); if (filterStatus) { filterChildren(traceRoot); } } }); } }

Target:
private synchronized void createTable() { long ts = fCurrentTimestamp; if (fTrace == null) { return; } fTree.getDisplay().asyncExec(new Runnable() { @Override public void run() { fTree.setItemCount(0); } }); for (final ITmfTrace currentTrace : TmfTraceManager.getTraceSet(fTrace)) { final Map<String, ITmfStateSystem> sss = currentTrace.getStateSystems(); final Map<String, List<ITmfStateInterval>> fullStates = new LinkedHashMap<String, List<ITmfStateInterval>>(); for (Map.Entry<String, ITmfStateSystem> entry : sss.entrySet()) { String ssName = entry.getKey(); ITmfStateSystem ss = entry.getValue(); ss.waitUntilBuilt(); if (ts == -1 || ts < ss.getStartTime() || ts > ss.getCurrentEndTime()) { ts = ss.getStartTime(); } try { fullStates.put(ssName, ss.queryFullState(ts)); } catch (TimeRangeException e) { throw new RuntimeException(); } catch (StateSystemDisposedException e) { return; } } fTree.getDisplay().asyncExec(new Runnable() { @Override public void run() { TreeItem traceRoot = new TreeItem(fTree, SWT.NONE); traceRoot.setText(ATTRIBUTE_NAME_COL, currentTrace.getName()); for (Map.Entry<String, ITmfStateSystem> entry : sss.entrySet()) { String ssName = entry.getKey(); ITmfStateSystem ss = entry.getValue(); List<ITmfStateInterval> fullState = fullStates.get(ssName); TreeItem item = new TreeItem(traceRoot, SWT.NONE); item.setText(ATTRIBUTE_NAME_COL, ssName); addChildren(ss, fullState, -1, item); } for (TreeItem item : fTree.getItems()) { item.setExpanded(true); } packColumns(); if (filterStatus) { filterChildren(traceRoot); } } }); } }
Source:
public void waitForDialogVisible() { waitForElementByElement(dialog); waitForElementVisibleByElement(dialog); }

Target:
public void waitForDialogVisible() { waitForElementVisibleByElement(dialog); }
Source:
public boolean onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == RC_SAVE) { if (resultCode != Activity.RESULT_OK) { Log.e(TAG, "SAVE: Canceled by user"); } mPendingResolutionLiveData.setValue(null); setSuccess(mPendingIdpResponse); return true; } return false; }

Target:
public boolean onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == RC_SAVE) { if (resultCode != Activity.RESULT_OK) { Log.e(TAG, "SAVE: Canceled by user"); } setSuccess(mPendingIdpResponse); return true; } return false; }
Source:
public DecisionNode getDecisionByName(String name) { if ( name == null ) { return null; } for ( DecisionNode dn : this.decisions.values() ) { if (dn.getName() != null && name.equals(dn.getName())) { return dn; } } return null; }

Target:
public DecisionNode getDecisionByName(String name) { if ( name == null ) { return null; } for ( DecisionNode dn : this.decisions.values() ) { if (Objects.equals(name, dn.getName())) { return dn; } } return null; }
Source:
private void pushDataToImporters(int count, int loops) throws Exception { CountDownLatch latch = asyncPushDataToImporters(count, loops); latch.await(); }

Target:
private void pushDataToImporters(int count, int loops) throws Exception { asyncPushDataToImporters(count, loops); waitForData(); }
Source:
public static void propagateIfFatal(Throwable throwable) { if (throwable instanceof InterruptedException) throw new RuntimeInterruptedException((InterruptedException) throwable); if (throwable instanceof ExecutionException) propagateIfFatal(throwable.getCause()); if (throwable instanceof Error) throw (Error) throwable; }

Target:
public static void propagateIfFatal(Throwable throwable) { if (throwable instanceof InterruptedException) throw new RuntimeInterruptedException((InterruptedException) throwable); if (throwable instanceof Error) throw (Error) throwable; }
Source:
public void clickInstallButton() { waitForElementVisibleByElement(bannerButton); if (bannerButton.getText().contains("Install")) { bannerButton.click(); PageObjectLogging.log("clickInstallButton", "Install button was clicked", true); } else { PageObjectLogging.log("clickInstallButton", "Install button were not visible", false, driver); } }

Target:
public void clickInstallButton() { waitForElementVisibleByElement(bannerButton); if (bannerButton.getText().contains("Install")) { bannerButton.click(); PageObjectLogging.log("clickInstallButton", "Install button was clicked", true); } else { PageObjectLogging.log("clickInstallButton", "Install button was not visible", false, driver); } }
Source:
public void initialize() { INIConfiguration config = Utilities.parseConfig(abstractEntryClient.getConfigFile()); String cromwellVersion = config.getString("cromwell-version", DEFAULT_CROMWELL_VERSION); String cromwellLocation = "<LINK_0>" + cromwellVersion + "/cromwell-" + cromwellVersion + ".jar"; if (!Objects.equals(DEFAULT_CROMWELL_VERSION, cromwellVersion)) { System.out.println("Running with Cromwell " + cromwellVersion + " , Dockstore tests with " + DEFAULT_CROMWELL_VERSION); } String libraryLocation = System.getProperty("user.home") + File.separator + ".dockstore" + File.separator + "libraries" + File.separator; URL cromwellURL; String cromwellFileName; try { cromwellURL = new URL(cromwellLocation); cromwellFileName = new File(cromwellURL.toURI().getPath()).getName(); } catch (MalformedURLException | URISyntaxException e) { throw new RuntimeException("Could not create " + LAUNCHER_NAME + " location", e); } String cromwellTarget = libraryLocation + cromwellFileName; File cromwellTargetFile = new File(cromwellTarget); if (!cromwellTargetFile.exists()) { try { FileUtils.copyURLToFile(cromwellURL, cromwellTargetFile); } catch (IOException e) { throw new RuntimeException("Could not download " + LAUNCHER_NAME + " location", e); } } exectionFile = cromwellTargetFile; }

Target:
public void initialize() { INIConfiguration config = Utilities.parseConfig(abstractEntryClient.getConfigFile()); String cromwellVersion = config.getString("cromwell-version", DEFAULT_CROMWELL_VERSION); String cromwellLocation = "<LINK_0>" + cromwellVersion + "/cromwell-" + cromwellVersion + ".jar"; if (!Objects.equals(DEFAULT_CROMWELL_VERSION, cromwellVersion)) { System.out.println("Running with Cromwell " + cromwellVersion + " , Dockstore tests with " + DEFAULT_CROMWELL_VERSION); } String libraryLocation = System.getProperty("user.home") + File.separator + ".dockstore" + File.separator + "libraries" + File.separator; URL cromwellURL; String cromwellFileName; try { cromwellURL = new URL(cromwellLocation); cromwellFileName = new File(cromwellURL.toURI().getPath()).getName(); } catch (MalformedURLException | URISyntaxException e) { throw new RuntimeException("Could not create " + launcherName + " location", e); } String cromwellTarget = libraryLocation + cromwellFileName; File cromwellTargetFile = new File(cromwellTarget); if (!cromwellTargetFile.exists()) { try { FileUtils.copyURLToFile(cromwellURL, cromwellTargetFile); } catch (IOException e) { throw new RuntimeException("Could not download " + launcherName + " location", e); } } executionFile = cromwellTargetFile; }
Source:
public void enqueue(Lifespan lifespan, List<SerializedPage> pages) { checkState(!Thread.holdsLock(this), "Can not enqueue pages while holding a lock on this"); requireNonNull(pages, "page is null"); if (!state.get().canAddPages()) { return; } long bytesAdded = pages.stream().mapToLong(SerializedPage::getRetainedSizeInBytes).sum(); memoryManager.updateMemoryUsage(bytesAdded); long rowCount = pages.stream().mapToLong(SerializedPage::getPositionCount).sum(); totalRowsAdded.addAndGet(rowCount); totalPagesAdded.addAndGet(pages.size()); outstandingPagePerLifespan.computeIfAbsent(lifespan, ignore -> new AtomicLong()).addAndGet(pages.size()); List<SerializedPageReference> serializedPageReferences = pages.stream() .map(pageSplit -> new SerializedPageReference( pageSplit, 1, () -> { long oustandingPage = outstandingPagePerLifespan.get(lifespan).decrementAndGet(); Consumer<Lifespan> callback = lifespanFinishedCallback; if (oustandingPage == 0 && callback != null && noMorePagesForLifespan.contains(lifespan)) { callback.accept(lifespan); } memoryManager.updateMemoryUsage(-pageSplit.getRetainedSizeInBytes()); })) .collect(toImmutableList()); masterBuffer.addPages(serializedPageReferences); for (ClientBuffer clientBuffer : safeGetBuffersSnapshot()) { if (masterBuffer.isEmpty()) { break; } clientBuffer.loadPagesIfNecessary(masterBuffer); } }

Target:
public void enqueue(Lifespan lifespan, List<SerializedPage> pages) { checkState(!Thread.holdsLock(this), "Can not enqueue pages while holding a lock on this"); requireNonNull(lifespan, "lifespan is null"); requireNonNull(pages, "page is null"); checkState(lifespanCompletionCallback != null, "lifespanCompletionCallback must be set before enqueueing data"); if (!state.get().canAddPages() || noMorePagesForLifespan.contains(lifespan)) { return; } long bytesAdded = pages.stream().mapToLong(SerializedPage::getRetainedSizeInBytes).sum(); memoryManager.updateMemoryUsage(bytesAdded); long rowCount = pages.stream().mapToLong(SerializedPage::getPositionCount).sum(); totalRowsAdded.addAndGet(rowCount); totalPagesAdded.addAndGet(pages.size()); outstandingPageCountPerLifespan.computeIfAbsent(lifespan, ignored -> new AtomicLong()).addAndGet(pages.size()); List<SerializedPageReference> serializedPageReferences = pages.stream() .map(pageSplit -> new SerializedPageReference( pageSplit, 1, () -> dereferencePage(pageSplit, lifespan))) .collect(toImmutableList()); masterBuffer.addPages(serializedPageReferences); for (ClientBuffer clientBuffer : safeGetBuffersSnapshot()) { if (masterBuffer.isEmpty()) { break; } clientBuffer.loadPagesIfNecessary(masterBuffer); } }
Source:
public void testGetBalance() throws Exception { client.getBalance(); verify(client.balance).execute(); }

Target:
public void testGetBalance() throws Exception { BalanceResponse response = client.getBalance(); verify(client.balance).execute(); Assert.assertEquals(sentinel, response); }
Source:
public void testCounts(String acc, int numberAlignments, int numberUnalignments) { if (!SRAAccession.isSupported()) return; SamReader reader = SamReaderFactory.make().validationStringency(ValidationStringency.SILENT).open( SamInputResource.of(new SRAAccession(acc)) ); final SAMRecordIterator samRecordIterator = reader.iterator(); int countAlignments = 0, countUnalignments = 0; while (true) { boolean hasRecord = samRecordIterator.hasNext(); SAMRecord record = null; try { record = samRecordIterator.next(); Assert.assertTrue(hasRecord); } catch (NoSuchElementException e) { Assert.assertFalse(hasRecord); } Assert.assertEquals(hasRecord, record != null); if (record == null) { break; } if (record.getReadUnmappedFlag()) { countUnalignments++; } else { countAlignments++; } } Assert.assertEquals(numberAlignments, countAlignments); Assert.assertEquals(numberUnalignments, countUnalignments); }

Target:
public void testCounts(String acc, int numberAlignments, int numberUnalignments) { if (!SRAAccession.isSupported()) return; SamReader reader = SamReaderFactory.make().validationStringency(ValidationStringency.SILENT).open( SamInputResource.of(new SRAAccession(acc)) ); final SAMRecordIterator samRecordIterator = reader.iterator(); checkAlignedUnalignedCountsByIterator(samRecordIterator, numberAlignments, numberUnalignments); }
Source:
public void testIncorrectProperty() { final String content = DOCKSTORE12_YAML.replaceFirst("workflows", "workflow"); try { DockstoreYamlHelper.readAsDockstoreYaml12(content); } catch (DockstoreYamlHelper.DockstoreYamlException e) { Assert.assertTrue(e.getMessage().contains("Error reading .dockstore.yml:")); } }

Target:
public void testIncorrectProperty() { final String content = DOCKSTORE12_YAML.replaceFirst("workflows", "workflow"); try { DockstoreYamlHelper.readAsDockstoreYaml12(content); TestCase.fail("Should not be able to validate .dockstore.yml"); } catch (DockstoreYamlHelper.DockstoreYamlException e) { Assert.assertTrue(e.getMessage().contains("Error reading .dockstore.yml: Cannot create property=workflow")); } catch (Exception e) { TestCase.fail("Should have seen a DockstoreYamlException"); } }
Source:
private List<Broker> fetchBrokers() { final List<Broker> brokers = new ArrayList<Broker>(); try { final CuratorFramework curator = zkFactory.get(); for (final String brokerId : curator.getChildren().forPath(_BROKERS_IDS_PATH)) { try { final byte[] brokerData = curator.getData().forPath(_BROKERS_IDS_PATH + "/" + brokerId); brokers.add(getBroker(brokerData)); } catch (Exception e) { LOG.info("Failed to fetch connection string for broker {}: {}", brokerId, e); } } } catch (Exception e) { LOG.error("Failed to fetch list of brokers from ZooKeeper: {}", e); } brokers.sort(null); return brokers; }

Target:
private List<Broker> fetchBrokers() { final List<Broker> brokers = new ArrayList<Broker>(); try { final CuratorFramework curator = zkFactory.get(); for (final String brokerId : curator.getChildren().forPath(_BROKERS_IDS_PATH)) { try { final byte[] brokerData = curator.getData().forPath(_BROKERS_IDS_PATH + "/" + brokerId); brokers.add(Broker.fromByteJson(brokerData)); } catch (Exception e) { LOG.info(String.format("Failed to fetch connection string for broker %s", brokerId), e); } } } catch (Exception e) { LOG.error("Failed to fetch list of brokers from ZooKeeper", e); } return brokers; }
Source:
public int[] readSensor() throws InvalidSensorException { ByteBuffer rawData = super.readBuffer(); if (rawData != null && rawData.remaining() > 7) { rawData.rewind(); long data = Long.reverseBytes(rawData.getLong()); values[0] = (int) data & 0xFFFFFFFF; values[1] = (int) (data >> 32) & 0xFFFFFFFF; age = System.currentTimeMillis(); return values; } if (System.currentTimeMillis() - age > MAX_AGE) { throw new InvalidSensorException("CAN data oudated For CAN sensor " + getName()); } LogKitten.v("Cached Sensor Value Used\n"); return values; }

Target:
public int[] readSensor() throws InvalidSensorException { ByteBuffer rawData = super.readBuffer(); if (rawData != null && rawData.remaining() >= 8) { rawData.rewind(); long data = Long.reverseBytes(rawData.getLong()); values[0] = (int) data & 0xFFFFFFFF; values[1] = (int) (data >> 32) & 0xFFFFFFFF; lastRead = System.currentTimeMillis(); return values; } if (System.currentTimeMillis() - lastRead > CANSensor.MAX_AGE) { throw new InvalidSensorException("CAN data oudated For CAN sensor " + getName()); } LogKitten.v("Cached Sensor Value Used\n"); return values; }
Source:
public InternalFetchConnection(PackTransport transport, final UploadPackFactory<C> uploadPackFactory, final C req, final Repository remote) throws TransportException { super(transport); final PipedInputStream in_r; final PipedOutputStream in_w; final PipedInputStream out_r; final PipedOutputStream out_w; try { in_r = new PipedInputStream(); in_w = new PipedOutputStream(in_r); out_r = new PipedInputStream() { { buffer = new byte[MIN_CLIENT_BUFFER]; } }; out_w = new PipedOutputStream(out_r); } catch (IOException err) { remote.close(); throw new TransportException(uri, JGitText.get().cannotConnectPipes, err); } worker = new Thread("JGit-Upload-Pack") { @Override public void run() { try { final UploadPack rp = uploadPackFactory.create(req, remote); rp.upload(out_r, in_w, null); } catch (ServiceNotEnabledException | ServiceNotAuthorizedException e) { } catch (IOException | RuntimeException err) { err.printStackTrace(); } finally { try { out_r.close(); } catch (IOException e2) { } try { in_w.close(); } catch (IOException e2) { } remote.close(); } } }; worker.start(); init(in_r, out_w); readAdvertisedRefs(); }

Target:
public InternalFetchConnection(PackTransport transport, final UploadPackFactory<C> uploadPackFactory, final C req, final Repository remote) throws TransportException { super(transport); final PipedInputStream in_r; final PipedOutputStream in_w; final PipedInputStream out_r; final PipedOutputStream out_w; try { in_r = new PipedInputStream(); in_w = new PipedOutputStream(in_r); out_r = new PipedInputStream() { { buffer = new byte[MIN_CLIENT_BUFFER]; } }; out_w = new PipedOutputStream(out_r); } catch (IOException err) { remote.close(); throw new TransportException(uri, JGitText.get().cannotConnectPipes, err); } worker = new Thread("JGit-Upload-Pack") { @Override public void run() { try { final UploadPack rp = uploadPackFactory.create(req, remote); rp.upload(out_r, in_w, null); } catch (ServiceNotEnabledException | ServiceNotAuthorizedException e) { } catch (IOException err) { err.printStackTrace(); } catch (RuntimeException err) { err.printStackTrace(); } finally { try { out_r.close(); } catch (IOException e2) { } try { in_w.close(); } catch (IOException e2) { } remote.close(); } } }; worker.start(); init(in_r, out_w); readAdvertisedRefs(); }
Source:
public static boolean isDefault(final String type) { return Stream .of(BuiltInType.values()) .anyMatch(dataType -> Objects.equals(upperCase(dataType.getName()), upperCase(type))); }

Target:
public static boolean isDefault(final String type) { return builtInTypeNames() .anyMatch(builtInTypeName -> Objects.equals(upperCase(builtInTypeName), upperCase(type))); }
Source:
public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; if (errorMessageText != null && !errorMessageText.isDisposed()) { errorMessageText.setText(errorMessage == null ? " \n " : errorMessage); boolean isNotEmpty = !StringConverter.removeWhiteSpaces(errorMessage).isEmpty(); boolean hasError = errorMessage != null && !isNotEmpty; errorMessageText.setEnabled(hasError); errorMessageText.setVisible(hasError); errorMessageText.getParent().update(); Control button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(errorMessage == null); } } }

Target:
public void setErrorMessage(String errorMessage) { this.errorMessage = errorMessage; if (errorMessageText != null && !errorMessageText.isDisposed()) { errorMessageText.setText(errorMessage == null ? " \n " : errorMessage); boolean hasError = errorMessage != null && (StringConverter.removeWhiteSpaces(errorMessage)).length() > 0; errorMessageText.setEnabled(hasError); errorMessageText.setVisible(hasError); errorMessageText.getParent().update(); Control button = getButton(IDialogConstants.OK_ID); if (button != null) { button.setEnabled(errorMessage == null); } } }
Source:
private void importDatabase() { new AlertDialog.Builder(getActivity()) .setTitle(R.string.database_import_label) .setMessage(R.string.database_import_warning) .setNegativeButton(R.string.no, null) .setPositiveButton(R.string.confirm_label, (dialog, which) -> { if (Build.VERSION.SDK_INT >= 19) { Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT) .setType("* *"); startActivityForResult(Intent.createChooser(intent, getString(R.string.import_select_file)), REQUEST_CODE_RESTORE_DATABASE); } }) .show(); }

Target:
private void importDatabase() { final AlertDialog.Builder alert = new AlertDialog.Builder(getActivity()); alert.setTitle(R.string.database_import_label); alert.setMessage(R.string.database_import_warning); alert.setNegativeButton(R.string.no, null); alert.setPositiveButton(R.string.confirm_label, (dialog, which) -> { if (Build.VERSION.SDK_INT >= 19) { Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); intent.setType("* *"); startActivityForResult(Intent.createChooser(intent, getString(R.string.import_select_file)), REQUEST_CODE_RESTORE_DATABASE); } } ); alert.show(); }
Source:
public ExternalIdPConfig getIdPConfigByRealm(String realm, String tenantDomain) { ExternalIdPConfig externalIdPConfig = null; IdentityProvider idpDO = null; if (log.isDebugEnabled()) { log.debug("Trying to find the IdP for realm: " + realm); } try { IdentityProviderManager idpManager = IdentityProviderManager.getInstance(); idpDO = idpManager .getEnabledIdPByRealmId(realm, tenantDomain); if (idpDO != null) { if (log.isDebugEnabled()) { log.debug("A registered IdP was found"); } externalIdPConfig = new ExternalIdPConfig(idpDO); } else { if (log.isDebugEnabled()) { log.debug("A registered IdP was not found the given realm"); } } } catch (IdentityProviderManagementException e) { log.error("Exception while getting IdP by realm", e); } return externalIdPConfig; }

Target:
public ExternalIdPConfig getIdPConfigByRealm(String realm, String tenantDomain) throws IdentityProviderManagementException { ExternalIdPConfig externalIdPConfig = null; IdentityProvider idpDO = null; if (log.isDebugEnabled()) { log.debug("Trying to find the IdP for realm: " + realm); } try { IdentityProviderManager idpManager = IdentityProviderManager.getInstance(); idpDO = idpManager .getEnabledIdPByRealmId(realm, tenantDomain); if (idpDO != null) { if (log.isDebugEnabled()) { log.debug("A registered IdP was found"); } externalIdPConfig = new ExternalIdPConfig(idpDO); } else { if (log.isDebugEnabled()) { log.debug("A registered IdP was not found the given realm"); } } } catch (IdentityProviderManagementException e) { throw new IdentityProviderManagementException("Exception while getting IdP by realm", e); } return externalIdPConfig; }
Source:
public static int handleTwitterError(Twitter twitter, Exception exception) { if(exception instanceof TwitterException) { TwitterException e = (TwitterException)exception; if(e.exceededRateLimitation()) { LOGGER.warn("Rate Limit Exceeded"); try { Thread.sleep(retry); } catch (InterruptedException e1) return 1; } else if(e.isCausedByNetworkIssue()) { LOGGER.info("Twitter Network Issues Detected. Backing off..."); LOGGER.info("{} - {}", e.getExceptionCode(), e.getLocalizedMessage()); try { Thread.sleep(retry); } catch (InterruptedException e1) return 1; } else if(e.isErrorMessageAvailable()) { if(e.getMessage().toLowerCase().contains("does not exist")) { LOGGER.warn("User does not exist..."); return 100; } else { return 1; } } else { if(e.getExceptionCode().equals("ced778ef-0c669ac0")) { return 5; } else { LOGGER.warn("Unknown Twitter Exception..."); LOGGER.warn(" Account: {}", twitter); LOGGER.warn(" Access: {}", e.getAccessLevel()); LOGGER.warn(" Code: {}", e.getExceptionCode()); LOGGER.warn(" Message: {}", e.getLocalizedMessage()); return 1; } } } else if(exception instanceof RuntimeException) { LOGGER.warn("TwitterGrabber: Unknown Runtime Error", exception.getMessage()); return 1; } else { LOGGER.info("Completely Unknown Exception: {}", exception); return 1; } }

Target:
public static int handleTwitterError(Twitter twitter, Exception exception) { if(exception instanceof TwitterException) { TwitterException e = (TwitterException)exception; if(e.exceededRateLimitation()) { LOGGER.warn("Rate Limit Exceeded"); try { Thread.sleep(retry); } catch (InterruptedException e1) { Thread.currentThread().interrupt(); } return 1; } else if(e.isCausedByNetworkIssue()) { LOGGER.info("Twitter Network Issues Detected. Backing off..."); LOGGER.info("{} - {}", e.getExceptionCode(), e.getLocalizedMessage()); try { Thread.sleep(retry); } catch (InterruptedException e1) { Thread.currentThread().interrupt(); } return 1; } else if(e.isErrorMessageAvailable()) { if(e.getMessage().toLowerCase().contains("does not exist")) { LOGGER.warn("User does not exist..."); return 100; } else { return 1; } } else { if(e.getExceptionCode().equals("ced778ef-0c669ac0")) { return 5; } else { LOGGER.warn("Unknown Twitter Exception..."); LOGGER.warn(" Account: {}", twitter); LOGGER.warn(" Access: {}", e.getAccessLevel()); LOGGER.warn(" Code: {}", e.getExceptionCode()); LOGGER.warn(" Message: {}", e.getLocalizedMessage()); return 1; } } } else if(exception instanceof RuntimeException) { LOGGER.warn("TwitterGrabber: Unknown Runtime Error", exception.getMessage()); return 1; } else { LOGGER.info("Completely Unknown Exception: {}", exception); return 1; } }
Source:
public List<QualifiedObjectName> listTables(Session session, QualifiedTablePrefix prefix) { requireNonNull(prefix, "prefix is null"); Optional<CatalogMetadata> catalog = getOptionalCatalogMetadata(session, prefix.getCatalogName()); Set<QualifiedObjectName> tables = new LinkedHashSet<>(); if (catalog.isPresent()) { CatalogMetadata catalogMetadata = catalog.get(); Optional<String> schemaName = prefix.getSchemaName(); for (ConnectorId connectorId : catalogMetadata.listConnectorIds()) { ConnectorMetadata metadata = catalogMetadata.getMetadataFor(connectorId); ConnectorSession connectorSession = session.toConnectorSession(connectorId); metadata.listTables(connectorSession, schemaName).stream() .map(convertFromSchemaTableName(prefix.getCatalogName())::apply) .forEach(tables::add); } } return ImmutableList.copyOf(tables); }

Target:
public List<QualifiedObjectName> listTables(Session session, QualifiedTablePrefix prefix) { requireNonNull(prefix, "prefix is null"); Optional<CatalogMetadata> catalog = getOptionalCatalogMetadata(session, prefix.getCatalogName()); Set<QualifiedObjectName> tables = new LinkedHashSet<>(); if (catalog.isPresent()) { CatalogMetadata catalogMetadata = catalog.get(); for (ConnectorId connectorId : catalogMetadata.listConnectorIds()) { ConnectorMetadata metadata = catalogMetadata.getMetadataFor(connectorId); ConnectorSession connectorSession = session.toConnectorSession(connectorId); metadata.listTables(connectorSession, prefix.getSchemaName()).stream() .map(convertFromSchemaTableName(prefix.getCatalogName())) .filter(prefix::matches) .forEach(tables::add); } } return ImmutableList.copyOf(tables); }
Source:
public boolean isSpider(String userAgent) { return spiderPattern.matcher(userAgent).find() && ! wikimediaBotPattern.matcher(userAgent).find(); }

Target:
public boolean isSpider(String userAgent) { if ("-".equals(userAgent)) return true; else return spiderPattern.matcher(userAgent).find() && ! wikimediaBotPattern.matcher(userAgent).find(); }
Source:
protected void checkFile(@NotNull GoFile file, @NotNull ProblemsHolder problemsHolder) { if (!GoUtil.allowed(file)) { return; } GoPackageClause packageClause = file.getPackage(); if (packageClause != null) { String packageName = file.getPackageName(); if (packageName == null || packageName.equals(GoConstants.DOCUMENTATION)){ return; } PsiDirectory dir = file.getContainingDirectory(); Collection<String> packages = GoUtil.getAllPackagesInDirectory(dir); packages.remove(GoConstants.DOCUMENTATION); if (packages.size() > 1) { problemsHolder.registerProblem(packageClause, "Multiple packages in directory", new GoMultiplePackagesQuickFix(packageClause, packages, problemsHolder.isOnTheFly())); } } }

Target:
protected void checkFile(@NotNull GoFile file, @NotNull ProblemsHolder problemsHolder) { if (!GoUtil.allowed(file)) { return; } GoPackageClause packageClause = file.getPackage(); if (packageClause != null) { String packageName = file.getPackageName(); if (packageName == null || packageName.equals(GoConstants.DOCUMENTATION)){ return; } PsiDirectory dir = file.getContainingDirectory(); Collection<String> packages = GoUtil.getAllPackagesInDirectory(dir); packages.remove(GoConstants.DOCUMENTATION); if (packages.size() > 1) { ArrayList<LocalQuickFix> fixes = new ArrayList<LocalQuickFix>(); if (problemsHolder.isOnTheFly()) { fixes.add(new GoMultiplePackagesQuickFix(packageClause, packageName, packages, true)); } else { for (String name : packages) { fixes.add(new GoMultiplePackagesQuickFix(packageClause, name, packages, false)); } } problemsHolder.registerProblem(packageClause, "Multiple packages in directory", fixes.toArray(new LocalQuickFix[fixes.size()])); } } }
Source:
public IServer createEAP5Server(String homeDir) { IServer s = null; try { s = createRemoteServer(IJBossToolingConstants.EAP_50, host, homeDir, "default"); } catch(CoreException ce) { fail(ce.getMessage()); } if( s == null ) { fail("Server not created."); } return s; }

Target:
public IServer createEAP5Server(String homeDir) { IServer s = null; try { s = createRemoteServer(IJBossToolingConstants.EAP_50, host, homeDir, "default"); } catch(CoreException ce) { fail("Server not created: " + ce.getMessage()); } if( s == null ) { fail("Server not created."); } return s; }
Source:
private String transformToHeaderValue(Directive... directives) { final StringBuilder sb = new StringBuilder(); for (int i = 0; i < directives.length - 1; i++) { sb.append(directives[i].headerValue).append(", "); } sb.append(directives[directives.length - 1].headerValue); return sb.toString(); }

Target:
private String transformToHeaderValue(Directive... directives) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < directives.length - 1; i++) { sb.append(directives[i].headerValue).append(", "); } sb.append(directives[directives.length - 1].headerValue); return sb.toString(); }
Source:
public void testBuilderWithDefaultValues() { AccountAttributes observedAccountAttributes = AccountAttributes.builder().build(); assertEquals(null, observedAccountAttributes.createdAt); assertEquals(null, observedAccountAttributes.getEmail()); assertEquals(null, observedAccountAttributes.getGoogleId()); assertEquals(null, observedAccountAttributes.getInstitute()); assertFalse(observedAccountAttributes.isInstructor()); assertEquals(null, observedAccountAttributes.getName()); assertEquals(null, observedAccountAttributes.studentProfile); }

Target:
public void testBuilderWithDefaultValues() { AccountAttributes observedAccountAttributes = AccountAttributes.builder().build(); assertNull(observedAccountAttributes.createdAt); assertNull(observedAccountAttributes.getEmail()); assertNull(observedAccountAttributes.getGoogleId()); assertNull(observedAccountAttributes.getInstitute()); assertFalse(observedAccountAttributes.isInstructor()); assertNull(observedAccountAttributes.getName()); assertNull(observedAccountAttributes.studentProfile); }
Source:
public VelocityEngine getVelocityEngine(@VelocityProperties String velocityProperties, Logger logger) throws UnableToCompleteException { InputStream inputStream = null; Properties properties = new Properties(); try { inputStream = this.getClass().getClassLoader().getResourceAsStream(velocityProperties); properties.load(inputStream); return new VelocityEngine(properties); } catch (Exception e) { logger.die("Cannot load velocity properties from " + velocityProperties); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { logger.die("Cannot load velocity properties from " + velocityProperties); } } } return null; }

Target:
public VelocityEngine getVelocityEngine(@VelocityProperties String velocityProperties, Logger logger) throws UnableToCompleteException { try { InputStream inputStream = null; try { inputStream = this.getClass().getClassLoader().getResourceAsStream(velocityProperties); Properties properties = new Properties(); properties.load(inputStream); return new VelocityEngine(properties); } finally { if (inputStream != null) { inputStream.close(); } } } catch (Exception e) { logger.die("Cannot load velocity properties from " + velocityProperties); return null; } }