auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void define(WebService.NewController context) { NewAction action = context.createAction(ACTION_SUGGESTIONS) .setDescription( "Internal WS for the top-right search engine. The result will contain component search results, grouped by their qualifiers.<p>" + "Each result contains:" + "<ul>" + "<li>the organization key</li>" + "<li>the component key</li>" + "<li>the component's name (unescaped)</li>" + "<li>optionally a display name, which puts emphasis to matching characters (this text contains html tags and parts of the html-escaped name)</li>" + "</ul>") .setSince("4.2") .setInternal(true) .setHandler(this) .setResponseExample(Resources.getResource(this.getClass(), "components-example-suggestions.json")); action.createParam(URL_PARAM_QUERY) .setRequired(true) .setDescription("Search query with a minimum of two characters. Can contain several search tokens, separated by spaces." + "Search tokens with only one character will be ignored.") .setExampleValue("sonar"); action.createParam(URL_PARAM_MORE) .setDescription("Category, for which to display " + EXTENDED_LIMIT + " instead of " + DEFAULT_LIMIT + " results") .setPossibleValues(stream(SuggestionCategory.values()).map(SuggestionCategory::getName).toArray(String[]::new)) .setSince("6.4"); action.createParam(URL_PARAM_RECENTLY_BROWSED) .setDescription("Comma separated list of component keys, that have recently been browsed by the user.") .setSince("6.4") .setExampleValue("org.sonarsource:sonarqube,some.other:project") .setInternal(true) .setRequired(false); }

Target:
public void define(WebService.NewController context) { NewAction action = context.createAction(ACTION_SUGGESTIONS) .setDescription( "Internal WS for the top-right search engine. The result will contain component search results, grouped by their qualifiers.<p>" + "Each result contains:" + "<ul>" + "<li>the organization key</li>" + "<li>the component key</li>" + "<li>the component's name (unescaped)</li>" + "<li>optionally a display name, which puts emphasis to matching characters (this text contains html tags and parts of the html-escaped name)</li>" + "</ul>") .setSince("4.2") .setInternal(true) .setHandler(this) .setResponseExample(Resources.getResource(this.getClass(), "components-example-suggestions.json")); action.createParam(PARAM_QUERY) .setRequired(true) .setDescription("Search query with a minimum of two characters. Can contain several search tokens, separated by spaces. " + "Search tokens with only one character will be ignored.") .setExampleValue("sonar"); action.createParam(PARAM_MORE) .setDescription("Category, for which to display " + EXTENDED_LIMIT + " instead of " + ComponentIndexQuery.DEFAULT_LIMIT + " results") .setPossibleValues(stream(SuggestionCategory.values()).map(SuggestionCategory::getName).toArray(String[]::new)) .setSince("6.4"); action.createParam(PARAM_RECENTLY_BROWSED) .setDescription("Comma separated list of component keys, that have recently been browsed by the user. Only the first " + MAXIMUM_RECENTLY_BROWSED + " items will be used. Order is not taken into account.") .setSince("6.4") .setExampleValue("org.sonarsource:sonarqube,some.other:project") .setRequired(false); }
Source:
public void testIteratorCloses() throws Exception { Kabob bob = db.getJdbi().onDemand(Kabob.class); Iterator<Something> itty = bob.iterateAll(); assertThat(itty.hasNext()).isFalse(); }

Target:
public void testIteratorCloses() throws Exception { Kabob bob = db.getJdbi().onDemand(Kabob.class); Iterator<Something> itty = bob.iterateAll(); itty.hasNext(); }
Source:
public void processResponse(XBeeResponse response) { if(response.getApiId() == ApiId.ZNET_RX_RESPONSE) { final ZNetRxResponse rxResponse = (ZNetRxResponse) response; final String message = ByteUtils.toString(rxResponse.getData()); final String remoteAddress = FormatUtil.readableAddress(rxResponse.getRemoteAddress64().getAddress()); final String[] lines = message.split("\\r\\n"); for (final String line : lines) { logger.debug("received message: '" + line + " from '" + remoteAddress + "'"); final int idxEquals = line.indexOf('='); if(idxEquals > 0) { final String key = line.substring(0, idxEquals); final String value = line.substring(idxEquals + 1, line.length()); boolean updated = false; for (final DiyOnXBeeBindingProvider provider : providers) { for (final String itemName : provider.getItemNames()) { final String id = provider.getId(itemName); final String remote = provider.getRemote(itemName); if(key.equals(id) && remote.equals(remoteAddress)) { final List<Class<? extends State>> availableTypes = provider.getAvailableItemTypes(itemName); final State state = parseState(value, availableTypes); if(state != null) { updated = true; eventPublisher.postUpdate(itemName, state); } } } } if(!updated) { logger.warn("unmatched item: key='" + key + "', value='" + value + "' from " + remoteAddress); } } } } }

Target:
public void processResponse(XBeeResponse response) { if (response.getApiId() == ApiId.ZNET_RX_RESPONSE) { final ZNetRxResponse rxResponse = (ZNetRxResponse) response; final String message = ByteUtils.toString(rxResponse.getData()); final String remoteAddress = FormatUtil.readableAddress(rxResponse.getRemoteAddress64().getAddress()); final String[] lines = message.split("\\r\\n"); for (final String line : lines) { logger.debug("received message: '{}' from '{}'", line, remoteAddress); final int idxEquals = line.indexOf('='); if (idxEquals > 0) { final String key = line.substring(0, idxEquals); final String value = line.substring(idxEquals + 1, line.length()); boolean updated = false; for (final DiyOnXBeeBindingProvider provider : providers) { for (final String itemName : provider.getItemNames()) { final String id = provider.getId(itemName); final String remote = provider.getRemote(itemName); if (key.equals(id) && remote.equals(remoteAddress)) { final List<Class<? extends State>> availableTypes = provider .getAvailableItemTypes(itemName); final State state = parseState(value, availableTypes, provider, itemName); if (state != null) { updated = true; eventPublisher.postUpdate(itemName, state); } } } } if (!updated) { logger.warn("unmatched item: key='{}', value='{}' from '{}'", key, value, remoteAddress); } } } } }
Source:
public PortableInfoboxObject clickGalleryImage(int index) { Assertion.assertFalse(galleryImageList.isEmpty()); wait.forElementClickable(galleryImageList.get(index)); galleryImageList.get(index).click(); return this; }

Target:
public PortableInfoboxObject clickGalleryImage(int index) { wait.forElementClickable(galleryImageList.get(index)).click(); return this; }
Source:
protected boolean validateImageTransfer() { DiskImage diskImage = getDiskImage(); DiskValidator diskValidator = getDiskValidator(diskImage); DiskImagesValidator diskImagesValidator = getDiskImagesValidator(diskImage); StorageDomainValidator storageDomainValidator = getStorageDomainValidator( storageDomainDao.getForStoragePool(diskImage.getStorageIds().get(0), diskImage.getStoragePoolId())); return validate(diskValidator.isDiskExists()) && validate(diskValidator.isDiskPluggedToAnyNonDownVm(false, false)) && validate(diskImagesValidator.diskImagesNotIllegal()) && validate(diskImagesValidator.diskImagesNotLocked()) && validate(storageDomainValidator.isDomainExistAndActive()); }

Target:
protected boolean validateImageTransfer() { DiskImage diskImage = getDiskImage(); DiskValidator diskValidator = getDiskValidator(diskImage); DiskImagesValidator diskImagesValidator = getDiskImagesValidator(diskImage); StorageDomainValidator storageDomainValidator = getStorageDomainValidator( storageDomainDao.getForStoragePool(diskImage.getStorageIds().get(0), diskImage.getStoragePoolId())); return validate(diskValidator.isDiskExists()) && validateActiveDiskPluggedToAnyNonDownVm(diskImage, diskValidator) && validate(diskImagesValidator.diskImagesNotIllegal()) && validate(diskImagesValidator.diskImagesNotLocked()) && validate(storageDomainValidator.isDomainExistAndActive()); }
Source:
public boolean processInParallel() { return true; }

Target:
public boolean processInParallel() { return false; }
Source:
protected void submitCallback(int code) { if (BKException.Code.OK == code) { numPendingEntries--; if (numPendingEntries != 0) { return; } } if (!complete.compareAndSet(false, true)) { return; } long latencyNanos = MathUtils.elapsedNanos(requestTimeNanos); if (code != BKException.Code.OK) { long firstUnread = LedgerHandle.INVALID_ENTRY_ID; for (LedgerEntryRequest req : seq) { if (!req.isComplete()) { firstUnread = req.getEntryId(); break; } } LOG.error("Read of ledger entry failed: L{} E{}-E{}, Heard from {}. First unread entry is {}", new Object[] { lh.getId(), startEntryId, endEntryId, heardFromHostsBitSet, firstUnread }); readOpLogger.registerFailedEvent(latencyNanos, TimeUnit.NANOSECONDS); } else { readOpLogger.registerSuccessfulEvent(latencyNanos, TimeUnit.NANOSECONDS); } cancelSpeculativeTask(true); cb.readComplete(code, lh, PendingReadOp.this, PendingReadOp.this.ctx); cb = null; }

Target:
protected void submitCallback(int code) { if (BKException.Code.OK == code) { numPendingEntries--; if (numPendingEntries != 0) { return; } } if (!complete.compareAndSet(false, true)) { return; } long latencyNanos = MathUtils.elapsedNanos(requestTimeNanos); if (code != BKException.Code.OK) { long firstUnread = LedgerHandle.INVALID_ENTRY_ID; for (LedgerEntryRequest req : seq) { if (!req.isComplete()) { firstUnread = req.getEntryId(); break; } } LOG.error("Read of ledger entry failed: L{} E{}-E{}, Heard from : bitset = {}. First unread entry is {}", new Object[] { lh.getId(), startEntryId, endEntryId, heardFromHosts, heardFromHostsBitSet, firstUnread }); readOpLogger.registerFailedEvent(latencyNanos, TimeUnit.NANOSECONDS); } else { readOpLogger.registerSuccessfulEvent(latencyNanos, TimeUnit.NANOSECONDS); } cancelSpeculativeTask(true); cb.readComplete(code, lh, PendingReadOp.this, PendingReadOp.this.ctx); cb = null; }
Source:
private void buildIncludeList() { includes = new ArrayList<IncludeHierarchy>(); includes.add(includeHierarchy); stack = new Stack<>(); stackIterator = new Stack<Iterator<IncludeHierarchy>>(); pushIteratorForOneLevel(includeHierarchy); IncludeHierarchy include = nextHierarchyFromCurrentIterator(); while (include != null) { includes.add(include); include = nextHierarchyFromCurrentIterator(); } iterator = includes.iterator(); }

Target:
private void buildIncludeList() { includes = new ArrayList<IncludeHierarchy>(); includes.add(includeHierarchy); stackIterator = new Stack<Iterator<IncludeHierarchy>>(); pushIteratorForOneLevel(includeHierarchy); IncludeHierarchy include = nextHierarchyFromCurrentIterator(); while (include != null) { includes.add(include); include = nextHierarchyFromCurrentIterator(); } iterator = includes.iterator(); }
Source:
private void reportTree(MethodInvocationTree mit) { ExpressionTree methodSelect = mit.methodSelect(); if (methodSelect.is(Tree.Kind.MEMBER_SELECT)) { reportTree(((MemberSelectExpressionTree) methodSelect).identifier()); } else { reportTree(methodSelect); } }

Target:
private void reportTree(MethodInvocationTree mit) { reportTree(ExpressionUtils.methodName(mit)); }
Source:
public static void getThreadExecutionState(final DSFSessionState sessionState, final ICPUDMContext cpuContext, final ICoreDMContext coreContext, final IMIExecutionDMContext execContext, final IThreadDMData threadData, final DSFDebugModelListener listener, final Object arg) { IRunControl runControl = sessionState.getService(IRunControl.class); if (runControl == null) { listener.getThreadExecutionStateDone(cpuContext, coreContext, execContext, threadData, null, null, arg); return; } if (runControl.isSuspended(execContext) == false) { listener.getThreadExecutionStateDone(cpuContext, coreContext, execContext, threadData, null, VisualizerExecutionState.RUNNING, arg); } else { final IStack stackService = sessionState.getService(IStack.class); stackService.getTopFrame(execContext, new ImmediateDataRequestMonitor<IFrameDMContext>(null) { @Override protected void handleCompleted() { IFrameDMContext targetFrameContext = getData(); if (targetFrameContext!= null) { stackService.getFrameData(targetFrameContext, new ImmediateDataRequestMonitor<IFrameDMData>(null) { @Override protected void handleCompleted() { IFrameDMData frameData = getData(); getThreadSuspendReason(sessionState, cpuContext, coreContext, execContext, threadData, frameData, listener, arg); super.handleCompleted(); } }); } else { getThreadSuspendReason(sessionState, cpuContext, coreContext, execContext, threadData, null, listener, arg); } super.handleCompleted(); } }); } }

Target:
public static void getThreadExecutionState(final DSFSessionState sessionState, final ICPUDMContext cpuContext, final ICoreDMContext coreContext, final IMIExecutionDMContext execContext, final IThreadDMData threadData, final DSFDebugModelListener listener, final Object arg) { IRunControl runControl = sessionState.getService(IRunControl.class); if (runControl == null) { listener.getThreadExecutionStateDone(cpuContext, coreContext, execContext, threadData, null, null, arg); return; } if (runControl.isSuspended(execContext) == false) { listener.getThreadExecutionStateDone(cpuContext, coreContext, execContext, threadData, null, VisualizerExecutionState.RUNNING, arg); } else { final IStack stackService = sessionState.getService(IStack.class); if (stackService != null) { stackService.getTopFrame(execContext, new ImmediateDataRequestMonitor<IFrameDMContext>(null) { @Override protected void handleCompleted() { IFrameDMContext targetFrameContext = null; if (isSuccess()) { targetFrameContext = getData(); } if (targetFrameContext!= null) { stackService.getFrameData(targetFrameContext, new ImmediateDataRequestMonitor<IFrameDMData>(null) { @Override protected void handleCompleted() { IFrameDMData frameData = null; if (isSuccess()) { frameData = getData(); } getThreadSuspendReason(sessionState, cpuContext, coreContext, execContext, threadData, frameData, listener, arg); } }); } else { getThreadSuspendReason(sessionState, cpuContext, coreContext, execContext, threadData, null, listener, arg); } } }); } else { getThreadSuspendReason(sessionState, cpuContext, coreContext, execContext, threadData, null, listener, arg); } } }
Source:
public static Optional<ChronoUnit> getChronoUnitFromURI(URI durationURI) { if (isValidDurationType(durationURI)) { return Optional.of(DURATION_MAP.get(durationURI)); } return Optional.empty(); }

Target:
public static Optional<ChronoUnit> getChronoUnitFromURI(URI durationURI) { return Optional.ofNullable(DURATION_MAP.get(durationURI)); }
Source:
public void browserAcceptHeader_should_include_default_if_browser_accept_header_not_provided(@Nullable String browserAcceptHeader) { authCardDetails.setAcceptHeader(browserAcceptHeader); List<NameValuePair> result = epdqPayloadDefinitionFor3ds2NewOrder.extract(epdqTemplateData); assertThat(result, hasItem(new BasicNameValuePair(BROWSER_ACCEPT_HEADER, "*/*"))); }

Target:
public void browserAcceptHeader_should_include_default_if_browser_accept_header_not_provided(@Nullable String browserAcceptHeader) { authCardDetails.setAcceptHeader(browserAcceptHeader); List<NameValuePair> result = epdqPayloadDefinitionFor3ds2NewOrder.extract(epdqTemplateData); assertThat(result, is(aParameterBuilder().withBrowserAcceptHeader(DEFAULT_BROWSER_ACCEPT_HEADER).build())); }
Source:
public void testExceptionWithTableGenerator() throws Exception { thrown.expect( HibernateException.class ); thrown.expectMessage( "OGM001109: Counter is not defined and cannot be created. Global persistent-location is missing in the Infinispan configuration" ); OgmEntityManagerFactory emFactory = ( (OgmEntityManagerFactory) getFactory() ); SessionFactoryImplementor sessionFactory = emFactory.getSessionFactory(); IdentifierGenerator generator = sessionFactory.getIdentifierGenerator( GlobalConfigNotEnabledTableGenerationTest.EntityWithTableGenerator.class.getName() ); IdSourceKeyMetadata tableMetadata = ( (OgmTableGenerator) generator ).getGeneratorKeyMetadata(); IdSourceKey generatorKey = IdSourceKey.forTable( tableMetadata, TABLE_ROW_KEY_NAME ); dialect.nextValue( new NextValueRequest( generatorKey, 1, 0 ) ); fail( "expected exception on next value invocation was not raised" ); }

Target:
public void testExceptionWithTableGenerator() throws Exception { thrown.expect( HibernateException.class ); thrown.expectMessage( "OGM001109: Counter is not defined and cannot be created. Global persistent-location is missing in the Infinispan configuration" ); SessionFactoryImplementor sessionFactory = getFactory().unwrap( SessionFactoryImplementor.class ); IdentifierGenerator generator = sessionFactory.getIdentifierGenerator( GlobalConfigNotEnabledTableGenerationTest.EntityWithTableGenerator.class.getName() ); IdSourceKeyMetadata tableMetadata = ( (OgmTableGenerator) generator ).getGeneratorKeyMetadata(); IdSourceKey generatorKey = IdSourceKey.forTable( tableMetadata, TABLE_ROW_KEY_NAME ); dialect.nextValue( new NextValueRequest( generatorKey, 1, 0 ) ); fail( "expected exception on next value invocation was not raised" ); }
Source:
public void testIssue15() throws Exception { OpenAPI oas = getConvertedOpenAPIFromJsonFile(ISSUE_15_JSON); assertNotNull(oas); Info info = oas.getInfo(); assertNotNull(info.getExtensions().get("x-apis-json")); assertNotNull(info.getLicense().getExtensions().get("x-notes")); assertNotNull(oas.getExternalDocs().getExtensions().get("x-docs-extension")); assertNotNull(oas.getTags().get(0).getExtensions().get("x-tag-extension")); assertNotNull(oas.getTags().get(0).getExternalDocs().getExtensions().get("x-tag-docs-extension")); PathItem pathItem = oas.getPaths().get("/something"); assertNotNull(pathItem.getExtensions().get("x-path-item-extension")); Operation get = pathItem.getGet(); assertNotNull(get.getExtensions().get("x-version")); assertNotNull(get.getExternalDocs().getExtensions().get("x-operation-docs-extension")); assertNotNull(get.getResponses().get("200").getExtensions().get("x-response-extension")); ArraySchema schema = (ArraySchema) get.getParameters().get(0).getSchema(); assertNotNull(schema.getItems().getExtensions().get("x-example")); Map<String, SecurityScheme> securitySchemes = oas.getComponents().getSecuritySchemes(); assertNotNull(securitySchemes); assertNotNull(securitySchemes.get("OAuth2Implicit").getExtensions().get("x-auth-extension")); }

Target:
public void testIssue15() throws Exception { OpenAPI oas = getConvertedOpenAPIFromJsonFile(ISSUE_15_JSON); assertNotNull(oas); Info info = oas.getInfo(); assertNotNull(info.getExtensions().get("x-apis-json")); assertNotNull(info.getLicense().getExtensions().get("x-notes")); assertNotNull(oas.getExternalDocs().getExtensions().get("x-docs-extension")); assertNotNull(oas.getTags().get(0).getExtensions().get("x-tag-extension")); assertNotNull(oas.getTags().get(0).getExternalDocs().getExtensions().get("x-tag-docs-extension")); PathItem pathItem = oas.getPaths().get("/something"); assertNotNull(pathItem.getExtensions().get("x-path-item-extension")); Operation get = pathItem.getGet(); assertNotNull(get.getExtensions().get("x-version")); assertNotNull(get.getExternalDocs().getExtensions().get("x-operation-docs-extension")); assertNotNull(get.getResponses().get("200").getExtensions().get("x-response-extension")); ArraySchema schema = (ArraySchema) get.getParameters().get(0).getSchema(); assertNull(schema.getItems().getExtensions().get("x-example")); Map<String, SecurityScheme> securitySchemes = oas.getComponents().getSecuritySchemes(); assertNotNull(securitySchemes); assertNotNull(securitySchemes.get("OAuth2Implicit").getExtensions().get("x-auth-extension")); }
Source:
public List<Message> validateProperties(Object object, String... properties) { logger.warn("You are willing to validate an object, but there is no bean validation engine " + "registered. Please add the jars of some implementation of Bean Validator."); return Collections.emptyList(); }

Target:
public List<Message> validateProperties(Object object, String... properties) { return validate(object); }
Source:
public int getCountContentletsReferencingStep(WorkflowStep step) throws DotDataException{ final DotConnect db = new DotConnect(); db.setSQL(sql.SELECT_COUNT_CONTENTLES_BY_STEP); db.addParam(step.getId()); Map<String,Object> res = db.loadObjectResults().get(0); return Integer.parseInt(String.valueOf(res.get("count"))); }

Target:
public int getCountContentletsReferencingStep(WorkflowStep step) throws DotDataException{ final DotConnect db = new DotConnect(); db.setSQL(sql.SELECT_COUNT_CONTENTLES_BY_STEP); db.addParam(step.getId()); Map<String,Object> res = db.loadObjectResults().get(0); return ConversionUtils.toInt(res.get("count"), 0); }
Source:
private <K extends Exception> void logNumberOfAttempts(Exception ex, int numberOfAttempts) throws K { if (numberOfAttempts > 1) { log.debug("Error occurred talking to cassandra. Attempt of {}. Exception message was: : {}", SafeArg.of("numTries", numberOfAttempts), SafeArg.of("maxTotalTries", maxTriesTotal), SafeArg.of("exceptionClass", ex.getClass().getTypeName()), UnsafeArg.of("exceptionMessage", ex.getMessage())); } else { log.debug("Error occurred talking to cassandra. Attempt of {}.", SafeArg.of("numTries", numberOfAttempts), SafeArg.of("maxTotalTries", maxTriesTotal), ex); } }

Target:
private <K extends Exception> void logNumberOfAttempts(Exception ex, int numberOfAttempts) throws K { if (numberOfAttempts > 1) { log.debug("Error occurred talking to cassandra. Attempt of {}. Exception message was: : {}", SafeArg.of("numTries", numberOfAttempts), SafeArg.of("maxTotalTries", maxTriesTotal.get()), SafeArg.of("exceptionClass", ex.getClass().getTypeName()), UnsafeArg.of("exceptionMessage", ex.getMessage())); } else { log.debug("Error occurred talking to cassandra. Attempt of {}.", SafeArg.of("numTries", numberOfAttempts), SafeArg.of("maxTotalTries", maxTriesTotal.get()), ex); } }
Source:
public URL getRuleset() throws CheckstylePluginException, CoreException { String configLocation = this.getConfigLocation(); URL ruleset = null; if (CHECKSTYLE_DEFAULT_CONFIG_FILE_NAME.equals(configLocation)) { ruleset = getInlineRules(); } if (ruleset == null) { ruleset = resolveLocation(this.getConfigLocation()); } if (ruleset == null) { throw new CheckstylePluginException( "Failed to resolve RuleSet from configLocation,SKIPPING Eclipse checkstyle configuration"); } return ruleset; }

Target:
public URL getRuleset() throws CheckstylePluginException, CoreException { final String configLocation = this.getConfigLocation(); URL ruleset = getInlineRules(); if (ruleset != null && !CHECKSTYLE_DEFAULT_CONFIG_FILE_NAME.equals(configLocation)) { throw new CheckstylePluginException("If you use inline configuration for rules, don't specify a configLocation"); } if (ruleset == null) { ruleset = resolveLocation(this.getConfigLocation()); } if (ruleset == null) { throw new CheckstylePluginException( "Failed to resolve RuleSet from inlineConfig or configLocation,SKIPPING Eclipse checkstyle configuration"); } return ruleset; }
Source:
public GitClient subGit(String subdir) { return new CliGitAPIImpl(gitExe, new File(workspace, subdir), listener, environment, null); }

Target:
public GitClient subGit(String subdir) { return new CliGitAPIImpl(gitExe, new File(workspace, subdir), listener, environment, launcher); }
Source:
private void addToZip(String path, String srcFile, ZipOutputStream zip) { File folder = new File(srcFile); if (folder.isDirectory()) { addFolderToZip(path, srcFile, zip); } else { byte[] buf = new byte[1024]; int len; try { FileInputStream in = new FileInputStream(srcFile); if (path.trim().equals("")) { zip.putNextEntry(new ZipEntry(folder.getName())); } else { zip.putNextEntry(new ZipEntry(path + "/" + folder.getName())); } while ((len = in.read(buf)) > 0) { zip.write(buf, 0, len); } in.close(); } catch (Exception ex) { getLog().error("Error occurred while creating CAR file. " + ex); } } }

Target:
private void addToZip(String path, String srcFile, ZipOutputStream zip) throws ArchiveException { File folder = new File(srcFile); if (folder.isDirectory()) { addFolderToZip(path, srcFile, zip); } else { byte[] buf = new byte[1024]; int len; try (FileInputStream in = new FileInputStream(srcFile)) { if (path.trim().equals(Constants.EMPTY_STRING)) { zip.putNextEntry(new ZipEntry(folder.getName())); } else { zip.putNextEntry(new ZipEntry(path + File.separator + folder.getName())); } while ((len = in.read(buf)) > 0) { zip.write(buf, 0, len); } } catch (IOException ex) { throw new ArchiveException(Constants.ARCHIVE_EXCEPTION_MSG, ex); } } }
Source:
private void checkFullMessage(GridDhtPartitionsFullMessage msg) { Map<Integer, Integer> dupPartsData = getFieldValue(msg, "dupPartsData"); assertNotNull(dupPartsData); checkFullMessage(AFF1_CACHE1, AFF1_CACHE2, dupPartsData, msg); checkFullMessage(AFF4_FILTER_CACHE1, AFF4_FILTER_CACHE2, dupPartsData, msg); assertFalse(dupPartsData.containsKey(CU.cacheId(AFF3_CACHE1))); Map<Integer, CachePartitionFullCountersMap> partCntrs = getFieldValue(getFieldValue(msg, "partCntrs2"), "map"); if (partCntrs != null) { for (CachePartitionFullCountersMap cntrs : partCntrs.values()) { long[] initialUpdCntrs = getFieldValue(cntrs, "initialUpdCntrs"); long[] updCntrs = getFieldValue(cntrs, "updCntrs"); int partCnt = getFieldValue(cntrs, "partsCnt"); if(initialUpdCntrs == null && updCntrs == null) { return; } for (int i = 0; i < partCnt; i++) { if(initialUpdCntrs!=null) { assertEquals(0, initialUpdCntrs[i]); } if(updCntrs != null) { assertEquals(0, updCntrs[i]); } } } } }

Target:
private void checkFullMessage(GridDhtPartitionsFullMessage msg) { Map<Integer, Integer> dupPartsData = getFieldValue(msg, "dupPartsData"); assertNotNull(dupPartsData); checkFullMessage(AFF1_CACHE1, AFF1_CACHE2, dupPartsData, msg); checkFullMessage(AFF4_FILTER_CACHE1, AFF4_FILTER_CACHE2, dupPartsData, msg); assertFalse(dupPartsData.containsKey(CU.cacheId(AFF3_CACHE1))); Map<Integer, CachePartitionFullCountersMap> partCntrs = getFieldValue(getFieldValue(msg, "partCntrs2"), "map"); if (partCntrs != null) { for (CachePartitionFullCountersMap cntrs : partCntrs.values()) { long[] initialUpdCntrs = getFieldValue(cntrs, "initialUpdCntrs"); long[] updCntrs = getFieldValue(cntrs, "updCntrs"); int partCnt = getFieldValue(cntrs, "partsCnt"); if (initialUpdCntrs == null && updCntrs == null) return; for (int i = 0; i < partCnt; i++) { if (initialUpdCntrs != null) assertEquals(0, initialUpdCntrs[i]); if (updCntrs != null) assertEquals(0, updCntrs[i]); } } } }
Source:
public static EventCluster merge(EventCluster cluster1, EventCluster cluster2) { if (cluster1.getEventType() != cluster2.getEventType()) { throw new IllegalArgumentException("event clusters are not compatible: they have different types"); } if (!cluster1.getDescription().equals(cluster2.getDescription())) { throw new IllegalArgumentException("event clusters are not compatible: they have different descriptions"); } Interval spanningInterval = IntervalUtils.span(cluster1.span, cluster2.span); Set<Long> idsUnion = Sets.union(cluster2.getEventIDs(), cluster2.getEventIDs()); Set<Long> hashHitsUnion = Sets.union(cluster2.getEventIDsWithHashHits(), cluster2.getEventIDsWithHashHits()); Set<Long> taggedUnion = Sets.union(cluster2.getEventIDsWithTags(), cluster2.getEventIDsWithTags()); return new EventCluster(spanningInterval, cluster1.getEventType(), idsUnion, hashHitsUnion, taggedUnion, cluster1.getDescription(), cluster1.lod); }

Target:
public static EventCluster merge(EventCluster cluster1, EventCluster cluster2) { if (cluster1.getEventType() != cluster2.getEventType()) { throw new IllegalArgumentException("event clusters are not compatible: they have different types"); } if (!cluster1.getDescription().equals(cluster2.getDescription())) { throw new IllegalArgumentException("event clusters are not compatible: they have different descriptions"); } Interval spanningInterval = IntervalUtils.span(cluster1.span, cluster2.span); Set<Long> idsUnion = Sets.union(cluster1.getEventIDs(), cluster2.getEventIDs()); Set<Long> hashHitsUnion = Sets.union(cluster1.getEventIDsWithHashHits(), cluster2.getEventIDsWithHashHits()); Set<Long> taggedUnion = Sets.union(cluster1.getEventIDsWithTags(), cluster2.getEventIDsWithTags()); return new EventCluster(spanningInterval, cluster1.getEventType(), idsUnion, hashHitsUnion, taggedUnion, cluster1.getDescription(), cluster1.lod); }
Source:
public void instrumentationSmokeTest() throws IOException { getTimestampService(CLIENT_1).getFreshTimestamp(); getLockService(CLIENT_1).currentTimeMillis(); JsonNode metrics = getMetricsOutput(); System.out.println(new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT).writeValueAsString(metrics)); assertContainsTimer(metrics, "com.palantir.atlasdb.timelock.AsyncTimelockService.test.getFreshTimestamp"); assertContainsTimer(metrics, "com.palantir.lock.RemoteLockService.test.currentTimeMillis"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosLearner.learn"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosAcceptor.accept"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosProposer.propose"); assertContainsTimer(metrics, "com.palantir.leader.PingableLeader.ping"); assertContainsTimer(metrics, "com.palantir.leader.LeaderElectionService.blockOnBecomingLeader"); assertContainsTimer(metrics, "com.palantir.timestamp.TimestampBoundStore.test.getUpperLimit"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosLearner.test.getGreatestLearnedValue"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosAcceptor.test.accept"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosProposer.test.propose"); }

Target:
public void instrumentationSmokeTest() throws IOException { getTimestampService(CLIENT_1).getFreshTimestamp(); getLockService(CLIENT_1).currentTimeMillis(); JsonNode metrics = getMetricsOutput(); assertContainsTimer(metrics, "com.palantir.atlasdb.timelock.AsyncTimelockService.test.getFreshTimestamp"); assertContainsTimer(metrics, "com.palantir.lock.RemoteLockService.test.currentTimeMillis"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosLearner.learn"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosAcceptor.accept"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosProposer.propose"); assertContainsTimer(metrics, "com.palantir.leader.PingableLeader.ping"); assertContainsTimer(metrics, "com.palantir.leader.LeaderElectionService.blockOnBecomingLeader"); assertContainsTimer(metrics, "com.palantir.timestamp.TimestampBoundStore.test.getUpperLimit"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosLearner.test.getGreatestLearnedValue"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosAcceptor.test.accept"); assertContainsTimer(metrics, "com.palantir.paxos.PaxosProposer.test.propose"); }
Source:
public InputStream stream() throws IOException { return new UncheckedInput(new InputOf(this.bytes.value())).stream(); }

Target:
public InputStream stream() throws IOException { return this.response.body(); }
Source:
protected AbstractSessionPresenter(final SessionManager sessionManager, final SessionPresenter.View view, final Optional<? extends ToolbarFactory<S>> toolbarFactory, final Optional<PaletteWidgetFactory<DefinitionSetPalette, ?>> paletteFactory, final NotificationsObserver notificationsObserver) { this.sessionManager = sessionManager; this.toolbarFactory = toolbarFactory.orElse(null); this.paletteFactory = paletteFactory.orElse(null); this.notificationsObserver = notificationsObserver; this.view = view; this.hasToolbar = true; this.hasPalette = true; }

Target:
protected AbstractSessionPresenter(final SessionManager sessionManager, final SessionPresenter.View view, final Optional<? extends ToolbarFactory<S>> toolbarFactory, final Optional<PaletteWidgetFactory<DefinitionSetPalette, ?>> paletteFactory, final NotificationsObserver notificationsObserver) { this.sessionManager = sessionManager; this.toolbarFactory = (Optional<ToolbarFactory<S>>) toolbarFactory; this.paletteFactory = paletteFactory; this.notificationsObserver = notificationsObserver; this.view = view; this.hasToolbar = true; this.hasPalette = true; }
Source:
private void initiallySelectTags(Object[] tagNodes, CheckboxTableViewer tagsTable) { List<TagNode> checkedTags = new ArrayList<TagNode>(); for (Object node : tagNodes) { if (node instanceof TagNode) { TagNode tagNode = (TagNode) node; Ref ref = tagNode.getObject(); if (tagRefNamesToSelect.contains(ref.getName())) checkedTags.add(tagNode); } } TagNode[] checkedTagsArray = checkedTags .toArray(new TagNode[checkedTags.size()]); tagsTable.setCheckedElements(checkedTagsArray); tagsTable.setSelection(StructuredSelection.EMPTY); if (checkedTagsArray.length > 0) { tagsTable.reveal(checkedTagsArray[0]); } setSelectedTags(checkedTagsArray); }

Target:
private void initiallySelectTags(Object[] tagNodes, CheckboxTableViewer tagsTable) { List<TagNode> checkedTags = new ArrayList<TagNode>(); for (Object node : tagNodes) { if (node instanceof TagNode) { TagNode tagNode = (TagNode) node; Ref ref = tagNode.getObject(); if (tagRefNamesToSelect.contains(ref.getName())) checkedTags.add(tagNode); } } TagNode[] checkedTagsArray = checkedTags .toArray(new TagNode[checkedTags.size()]); tagsTable.setCheckedElements(checkedTagsArray); tagsTable.setSelection(StructuredSelection.EMPTY); if (checkedTagsArray.length > 0) tagsTable.reveal(checkedTagsArray[0]); setSelectedTags(checkedTagsArray); }
Source:
private int lookup( KijiTableReader reader, KijiDataRequest request, EntityId entityId, Map<FamilyLayout, List<String>> mapTypeFamilies, Map<FamilyLayout, List<ColumnLayout>> groupTypeColumns) { getPrintStream().println( "Looking up entity: " + ToolUtils.formatEntityId(entityId) + " from kiji table: " + mURI); try { final KijiRowData row = reader.get(entityId, request); ToolUtils.printRow(row, mapTypeFamilies, groupTypeColumns, getPrintStream()); } catch (IOException ioe) { LOG.error(ioe.getMessage()); return 1; } return 0; }

Target:
private int lookup( KijiTableReader reader, KijiDataRequest request, EntityId entityId, Map<FamilyLayout, List<String>> mapTypeFamilies, Map<FamilyLayout, List<ColumnLayout>> groupTypeColumns) { getPrintStream().println( "Looking up entity: " + ToolUtils.formatEntityId(entityId) + " from kiji table: " + mURI); try { final KijiRowData row = reader.get(entityId, request); ToolUtils.printRow(row, mapTypeFamilies, groupTypeColumns, getPrintStream()); } catch (IOException ioe) { LOG.error(ioe.getMessage()); return FAILURE; } return SUCCESS; }
Source:
public void rename(String newName) { newNameInput.clear(); newNameInput.sendKeys(newName); submitRename.click(); PageObjectLogging.log("ArticleRenamed", "Article renamed", true); }

Target:
public ArticlePageObject rename(String newName) { newNameInput.clear(); newNameInput.sendKeys(newName); submitRename.click(); PageObjectLogging.log("ArticleRenamed", "Article renamed", true); return new ArticlePageObject(driver); }
Source:
protected IServerSession lookupScoutServerSessionOnHttpSession(HttpServletRequest req, HttpServletResponse res, Subject subject, UserAgent userAgent) throws ProcessingException, ServletException { synchronized (SERVICES.getService(ICacheStoreService.class)) { IServerSession serverSession = (IServerSession) SERVICES.getService(ICacheStoreService.class).getClientAttributeAndTouch(req, res, IServerSession.class.getName()); if (serverSession == null) { serverSession = SERVICES.getService(IServerSessionRegistryService.class).newServerSession(m_serverSessionClass, subject, userAgent); serverSession.setSessionId(SERVICES.getService(IClientIdentificationService.class).getClientId(req, res)); SERVICES.getService(ICacheStoreService.class).setClientAttribute(req, res, IServerSession.class.getName(), serverSession); } return serverSession; } }

Target:
protected IServerSession lookupScoutServerSessionOnHttpSession(HttpServletRequest req, HttpServletResponse res, Subject subject, UserAgent userAgent) throws ProcessingException, ServletException { synchronized (m_cacheServiceLock) { IServerSession serverSession = (IServerSession) SERVICES.getService(ICacheStoreService.class).getClientAttributeAndTouch(req, res, IServerSession.class.getName()); if (serverSession == null) { serverSession = SERVICES.getService(IServerSessionRegistryService.class).newServerSession(m_serverSessionClass, subject, userAgent); serverSession.setSessionId(SERVICES.getService(IClientIdentificationService.class).getClientId(req, res)); SERVICES.getService(ICacheStoreService.class).setClientAttribute(req, res, IServerSession.class.getName(), serverSession); } return serverSession; } }
Source:
private void adjustDisksImageConfiguration(Collection<DiskImage> diskImages) { for (DiskImage diskImage : diskImages) { if (destStorages.get(diskInfoDestinationMap.get(diskImage.getId()).getStorageIds().get(0)).getStorageStaticData().getStorageType().isBlockDomain() && diskImage.getVolumeFormat().equals(VolumeFormat.RAW)) { diskImage.setvolumeFormat(VolumeFormat.COW); } } }

Target:
private void adjustDisksImageConfiguration(Collection<DiskImage> diskImages) { for (DiskImage diskImage : diskImages) { if (destStorages.get(diskInfoDestinationMap.get(diskImage.getId()).getStorageIds().get(0)).getStorageStaticData().getStorageType().isBlockDomain() && diskImage.getVolumeType().equals(VolumeType.Sparse) && diskImage.getVolumeFormat().equals(VolumeFormat.RAW)) { diskImage.setvolumeFormat(VolumeFormat.COW); } } }
Source:
private boolean handleUndo() { return getParameters().getManagedBlockStorageDisks() .stream() .allMatch(disk -> { TransactionSupport.executeInNewTransaction(() -> { managedBlockStorageDiskUtil.updateOldImageAsActive(Snapshot.SnapshotType.PREVIEW, true, disk); return null; }); return removeDisk(disk); }); }

Target:
private boolean handleUndo() { List<Guid> failedToRemoveDisks = new ArrayList<>(); getParameters().getManagedBlockStorageDisks() .stream() .forEach(disk -> { TransactionSupport.executeInNewTransaction(() -> { managedBlockStorageDiskUtil.updateOldImageAsActive(Snapshot.SnapshotType.PREVIEW, true, disk); return null; }); if (!removeDisk(disk)) { failedToRemoveDisks.add(disk.getImageId()); } }); if (!failedToRemoveDisks.isEmpty()) { addCustomValue("DiskGuids", StringUtils.join(failedToRemoveDisks, ", ")); auditLogDirector.log(this, AuditLogType.UNDO_SNAPSHOT_FAILURE_PARTIAL); return false; } return true; }
Source:
private Update updateExistingFirewallForNewTargets(GcpContext context, AuthenticatedContext auth, Group group) throws java.io.IOException { Firewall firewall = context.getCompute().firewalls().get(context.getProjectId(), group.getSecurity().getCloudSecurityId()).execute(); String groupTypeTag = GcpStackUtil.getGroupTypeTag(group.getType()); if (firewall.getTargetTags() == null) { firewall.setTargetTags(List.of(groupTypeTag)); } else if (firewall.getTargetTags().stream().filter(e -> e.equals(groupTypeTag)).collect(Collectors.toSet()).isEmpty()) { firewall.getTargetTags().add(groupTypeTag); } return context.getCompute().firewalls().update(context.getProjectId(), firewall.getName(), firewall); }

Target:
private Update updateExistingFirewallForNewTargets(GcpContext context, AuthenticatedContext auth, Group group) throws java.io.IOException { Firewall firewall = context.getCompute().firewalls().get(context.getProjectId(), group.getSecurity().getCloudSecurityId()).execute(); String groupTypeTag = GcpStackUtil.getGroupTypeTag(group.getType()); if (firewall.getTargetTags() == null) { firewall.setTargetTags(List.of(groupTypeTag)); } else if (firewallTagsDoesNotContainsTargetAlready(firewall, groupTypeTag)) { firewall.getTargetTags().add(groupTypeTag); } return context.getCompute().firewalls().update(context.getProjectId(), firewall.getName(), firewall); }
Source:
public UserProfileParameters() { profile.setId(Guid.newGuid()); }

Target:
public UserProfileParameters() { }
Source:
public void listenToDebugMessages( ListenerCommand command ) throws IOException { switch (command) { case START: if ( this.debugConsumerTag != null ) { this.logger.finer( "The DM is already listening to its debug queue." ); return; } if ( this.channel != null && this.channel.isOpen() ) { QueueingConsumer debugConsumer = new QueueingConsumer( this.channel ); debugConsumerTag = this.channel.basicConsume( DEBUG_QUEUE_NAME, false, DEBUG_QUEUE_NAME, false, false, null, debugConsumer ); this.logger.fine( "The DM starts listening to its debug queue" ); new ListeningThread( "Roboconf - Debug queue listener", this.logger, debugConsumer, this.messageQueue, "The DM (debug)" ).start(); } else { this.logger.warning( "Cannot start listening to debug queue: channel closed" ); } break; case STOP: if ( this.debugConsumerTag == null ) { this.logger.finer( "The DM is not listening to its debug queue." ); return; } if ( this.channel != null && this.channel.isOpen() ) { this.channel.basicCancel( this.debugConsumerTag ); this.debugConsumerTag = null; this.logger.fine( "The DM stops listening to its debug queue" ); } else { this.logger.warning( "Cannot stop listening to debug queue: channel closed" ); } break; } }

Target:
public void listenToDebugMessages( ListenerCommand command ) throws IOException { switch (command) { case START: if ( this.debugConsumerTag != null ) { this.logger.finer( "The DM is already listening to its debug queue." ); return; } if ( this.channel != null && this.channel.isOpen() ) { this.channel.queueDeclare( DEBUG_QUEUE_NAME, true, false, true, null ); QueueingConsumer debugConsumer = new QueueingConsumer( this.channel ); debugConsumerTag = this.channel.basicConsume( DEBUG_QUEUE_NAME, true, DEBUG_QUEUE_NAME, false, false, null, debugConsumer ); this.logger.fine( "The DM starts listening to its debug queue" ); new ListeningThread( "Roboconf - Debug queue listener", this.logger, debugConsumer, this.messageQueue, "The DM (debug)" ).start(); } else { this.logger.warning( "Cannot start listening to debug queue: channel closed" ); } break; case STOP: if ( this.debugConsumerTag == null ) { this.logger.finer( "The DM is not listening to its debug queue." ); return; } if ( this.channel != null && this.channel.isOpen() ) { this.channel.basicCancel( this.debugConsumerTag ); this.debugConsumerTag = null; this.logger.fine( "The DM stops listening to its debug queue" ); } else { this.logger.warning( "Cannot stop listening to debug queue: channel closed" ); } break; } }
Source:
private ResourceGroupInfo getSummaryInfo() { synchronized (root) { return new ResourceGroupInfo( id, getState(), schedulingPolicy, schedulingWeight, DataSize.succinctBytes(softMemoryLimitBytes), softConcurrencyLimit, hardConcurrencyLimit, maxQueuedQueries, DataSize.succinctBytes(cachedMemoryUsageBytes), getQueuedQueries(), getRunningQueries(), eligibleSubGroups.size(), null, null); } }

Target:
private ResourceGroupInfo getSummaryInfo() { synchronized (root) { return new ResourceGroupInfo( id, getState(), schedulingPolicy, schedulingWeight, DataSize.succinctBytes(softMemoryLimitBytes), softConcurrencyLimit, hardConcurrencyLimit, maxQueuedQueries, DataSize.succinctBytes(cachedMemoryUsageBytes), getAllQueuedQueriesCount(), getAllRunningQueriesCount(), eligibleSubGroups.size(), null, null, version); } }
Source:
public void testConstructor() throws Exception { HttpServletRequest req = mock(HttpServletRequest.class); final String path = "/foo/bar/baz/bang"; when(req.getRequestURI()).thenReturn(path); when(req.getMethod()).thenReturn(HttpMethods.POST); FilterChain c = mock(FilterChain.class); doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocationOnMock) throws Throwable { Thread.sleep(100); return null; } }).when(c).doFilter(any(HttpServletRequest.class), any(HttpServletResponse.class)); MetricsFilter constructed = new MetricsFilter( "foobar_baz_filter_duration_seconds", "Help for my filter", 0, null ); HttpServletResponse res = mock(HttpServletResponse.class); constructed.doFilter(req, res, c); final Double sum = CollectorRegistry.defaultRegistry.getSampleValue("foobar_baz_filter_duration_seconds_sum", new String[]{"path", "method"}, new String[]{path, HttpMethods.POST}); assertNotNull(sum); assertEquals(0.1, sum, 0.01); }

Target:
public void testConstructor() throws Exception { HttpServletRequest req = mock(HttpServletRequest.class); final String path = "/foo/bar/baz/bang"; when(req.getRequestURI()).thenReturn(path); when(req.getMethod()).thenReturn(HttpMethods.POST); FilterChain c = mock(FilterChain.class); doAnswer(new Answer<Void>() { @Override public Void answer(InvocationOnMock invocationOnMock) throws Throwable { Thread.sleep(100); return null; } }).when(c).doFilter(any(HttpServletRequest.class), any(HttpServletResponse.class)); MetricsFilter constructed = new MetricsFilter( "foobar_baz_filter_duration_seconds", "Help for my filter", 0, null ); HttpServletResponse res = mock(HttpServletResponse.class); constructed.doFilter(req, res, c); final Double sum = CollectorRegistry.defaultRegistry.getSampleValue("foobar_baz_filter_duration_seconds_sum", new String[]{"path", "method"}, new String[]{path, HttpMethods.POST}); assertNotNull(sum); assertEquals(0.1, sum, 0.001); }
Source:
public void notifyAccountExistsForPhone() throws Exception { study.setEmailSignInEnabled(true); AccountId accountId = AccountId.forPhone(TEST_STUDY_IDENTIFIER, TestConstants.PHONE); when(service.getNextToken()).thenReturn(SPTOKEN, TOKEN); when(mockAccount.getPhone()).thenReturn(TestConstants.PHONE); when(mockAccount.getPhoneVerified()).thenReturn(Boolean.TRUE); when(mockAccountDao.getAccount(accountId)).thenReturn(mockAccount); service.notifyAccountExists(study, accountId); verify(mockCacheProvider).setObject(SPTOKEN+":phone:api", BridgeObjectMapper.get().writeValueAsString(TestConstants.PHONE), AccountWorkflowService.EXPIRE_IN_SECONDS); verify(mockNotificationsService).sendSMSMessage(smsMessageProviderCaptor.capture()); String message = smsMessageProviderCaptor.getValue().getSmsRequest().getMessage(); assertTrue(message.contains("Account for ShortName already exists. Reset password: ")); assertTrue(message.contains("/rp?study=api&sptoken="+SPTOKEN)); assertTrue(message.contains(" or ABC-DEF")); }

Target:
public void notifyAccountExistsForPhone() throws Exception { AccountId accountId = AccountId.forPhone(TEST_STUDY_IDENTIFIER, TestConstants.PHONE); when(service.getNextToken()).thenReturn(SPTOKEN, TOKEN); when(mockAccount.getPhone()).thenReturn(TestConstants.PHONE); when(mockAccount.getPhoneVerified()).thenReturn(Boolean.TRUE); when(mockAccountDao.getAccount(accountId)).thenReturn(mockAccount); service.notifyAccountExists(study, accountId); verify(mockCacheProvider).setObject(SPTOKEN+":phone:api", BridgeObjectMapper.get().writeValueAsString(TestConstants.PHONE), AccountWorkflowService.VERIFY_OR_RESET_EXPIRE_IN_SECONDS); verify(mockNotificationsService).sendSMSMessage(smsMessageProviderCaptor.capture()); String message = smsMessageProviderCaptor.getValue().getSmsRequest().getMessage(); assertTrue(message.contains("Account for ShortName already exists. Reset password: ")); assertTrue(message.contains("/rp?study=api&sptoken="+SPTOKEN)); assertTrue(message.contains(" or "+TOKEN.substring(0,3) + "-" + TOKEN.substring(3,6))); }
Source:
public static void showSignInForResult(Activity activity) { if (shouldShowMagicLinksLogin(activity);) { Intent intent = new Intent(activity, MagicLinkSignInActivity.class); activity.startActivityForResult(intent, RequestCodes.ADD_ACCOUNT); } else { Intent intent = new Intent(activity, SignInActivity.class); activity.startActivityForResult(intent, RequestCodes.ADD_ACCOUNT); } }

Target:
public static void showSignInForResult(Activity activity) { if (shouldShowMagicLinksLogin(activity)) { Intent intent = new Intent(activity, MagicLinkSignInActivity.class); activity.startActivityForResult(intent, RequestCodes.ADD_ACCOUNT); } else { Intent intent = new Intent(activity, SignInActivity.class); activity.startActivityForResult(intent, RequestCodes.ADD_ACCOUNT); } }
Source:
public ClasspathScanDescriptorProvider addAnalyzerClass(Class<? extends Analyzer<?>> clazz) { AnalyzerDescriptor<?> descriptor = _analyzerBeanDescriptors.get(clazz.getName()); if (descriptor == null) { try { descriptor = Descriptors.ofAnalyzer(clazz); _analyzerBeanDescriptors.put(clazz.getName(), descriptor); } catch (Throwable e) { logger.error("Unexpected error occurred while creating descriptor for: " + clazz, e); } } return this; }

Target:
public ClasspathScanDescriptorProvider addAnalyzerClass(Class<? extends Analyzer<?>> clazz) { AnalyzerDescriptor<?> descriptor = _analyzerBeanDescriptors.get(clazz.getName()); if (descriptor == null) { try { descriptor = Descriptors.ofAnalyzer(clazz); _analyzerBeanDescriptors.put(clazz.getName(), descriptor); } catch (Exception | NoClassDefFoundError e) { logger.error("Unexpected error occurred while creating descriptor for: " + clazz, e); } } return this; }