auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static Object getFor(int status, Request request, Response response) { Object customRenderer = CustomErrorPages.getInstance().customPages.get(status); Object customPage; if (customRenderer instanceof String) { customPage = customRenderer; } else { try { customPage = ((Route) customRenderer).handle(request, response); } catch (Exception e) { customPage = status == 400 ? NOT_FOUND : INTERNAL_ERROR; } } return customPage; }

Target:
public static Object getFor(int status, Request request, Response response) { Object customRenderer = CustomErrorPages.getInstance().customPages.get(status); Object customPage; customPage = status == 400 ? NOT_FOUND : INTERNAL_ERROR; if (customRenderer instanceof String) { customPage = customRenderer; } else if (customRenderer instanceof Route) { try { customPage = ((Route) customRenderer).handle(request, response); } catch (Exception e) { } } return customPage; }
Source:
public void onTaskComplete(int taskTag, int resultCode) { if (resultCode == TaskFragment.STATUS_OK) { if (taskTag == DATABASE_RESYNC_TASK) { mDbResyncing = false; refreshChapterCards(); } else if (taskTag == COMPILE_CHAPTER_TASK) { ProjectDatabaseHelper db = new ProjectDatabaseHelper(ActivityChapterList.this); for (int i : mChaptersCompiled) { mAdapter.notifyItemChanged(i); db.setCheckingLevel(mProject, i + 1, 0); } } } }

Target:
public void onTaskComplete(int taskTag, int resultCode) { if (resultCode == TaskFragment.STATUS_OK) { if (taskTag == DATABASE_RESYNC_TASK) { mDbResyncing = false; refreshChapterCards(); } else if (taskTag == COMPILE_CHAPTER_TASK) { ProjectDatabaseHelper db = new ProjectDatabaseHelper(ActivityChapterList.this); for (int i : mChaptersCompiled) { db.setCheckingLevel(mProject, i + 1, 0); mAdapter.notifyItemChanged(i); } } } }
Source:
public void init(final SamlDeployment deployment, final ResourceLoader loader, final Properties config) { String path = DEFAULT_LOCATION; if (config.getProperty(PROPERTIES_LOCATION) != null) { path = config.getProperty(PROPERTIES_LOCATION); } InputStream is = loader.getResourceAsStream(path); this.roleMappings = new Properties(); boolean loaded = false; try { this.roleMappings.load(is); loaded = true; if (logger.isDebugEnabled()) { logger.debugf("Resource loader successfully loaded role mappings from %s", path); } } catch(Exception e) { if (logger.isDebugEnabled()) { logger.debugv(e, "Resource loader unable to load role mappings from %s", path); } } if (!loaded && !DEFAULT_LOCATION.equals(path)) { File file = new File(path); if (file.exists()) { try { this.roleMappings.load(new FileInputStream(file)); if (logger.isDebugEnabled()) { logger.debugf("Successfully loaded role mappings from %s", path); } } catch(Exception e) { if (logger.isDebugEnabled()) { logger.debugv(e, "Unable to load role mappings from %s", path); } } } else { if (logger.isDebugEnabled()) { logger.debugf("Unable to load role mappings from %s: file does not exist in filesystem", path); } } } }

Target:
public void init(final SamlDeployment deployment, final ResourceLoader loader, final Properties config) { this.roleMappings = new Properties(); String path = config.getProperty(PROPERTIES_FILE_LOCATION); if (path != null) { File file = new File(path); if (file.exists()) { try { this.roleMappings.load(new FileInputStream(file)); logger.debugf("Successfully loaded role mappings from %s", path); } catch (Exception e) { logger.debugv(e, "Unable to load role mappings from %s", path); } } else { throw new RuntimeException("Unable to load role mappings from " + path + ": file does not exist in filesystem"); } } else { path = config.getProperty(PROPERTIES_RESOURCE_LOCATION, DEFAULT_RESOURCE_LOCATION); InputStream is = loader.getResourceAsStream(path); if (is != null) { try { this.roleMappings.load(is); logger.debugf("Resource loader successfully loaded role mappings from %s", path); } catch (Exception e) { logger.debugv(e, "Resource loader unable to load role mappings from %s", path); } } else { throw new RuntimeException("Unable to load role mappings from " + path + ": file does not exist in the resource"); } } }
Source:
public void evaluate_shouldReturnAllPatientsTakingAnyDrugWithinADateRange() throws Exception { cohortDefinition.setActivatedOnOrAfter(DateUtil.getDateTime(2008, 8, 1)); cohortDefinition.setActivatedOnOrBefore(DateUtil.getDateTime(2008, 8, 8)); Cohort cohort = Context.getService(CohortDefinitionService.class).evaluate(cohortDefinition, null); System.out.println("Taking Drugs in date range " + cohort.getMemberIds() + " " + cohortDefinition); Assert.assertTrue(cohort.contains(2)); Assert.assertTrue(cohort.contains(7)); Assert.assertTrue(cohort.contains(8)); Assert.assertTrue(cohort.contains(21)); Assert.assertTrue(cohort.contains(22)); Assert.assertEquals(3, cohort.size()); }

Target:
public void evaluate_shouldReturnAllPatientsTakingAnyDrugWithinADateRange() throws Exception { cohortDefinition.setActivatedOnOrAfter(DateUtil.getDateTime(2008, 8, 1)); cohortDefinition.setActivatedOnOrBefore(DateUtil.getDateTime(2008, 8, 8)); Cohort cohort = Context.getService(CohortDefinitionService.class).evaluate(cohortDefinition, null); Assert.assertTrue(cohort.contains(2)); Assert.assertTrue(cohort.contains(7)); Assert.assertTrue(cohort.contains(8)); Assert.assertTrue(cohort.contains(21)); Assert.assertTrue(cohort.contains(22)); Assert.assertEquals(5, cohort.size()); }
Source:
protected int run(List<String> nonFlagArgs) throws Exception { final Random random = new Random(System.currentTimeMillis()); final List<String> nameDictionary = loadNameDictionary(mNameDictionaryFilename); final WordSynthesizer nameSynth = new WordSynthesizer(random, nameDictionary); final NGramSynthesizer fullNameSynth = new NGramSynthesizer(nameSynth, 2); final EmailSynthesizer emailSynth = new EmailSynthesizer(random, nameDictionary); getPrintStream().printf("Generating %d users on kiji table '%s'...%n", mNumUsers, mTableURI); final KijiTableWriter tableWriter = mTable.openTableWriter(); try { for (int iuser = 0; iuser < mNumUsers; iuser++) { final String fullName = fullNameSynth.synthesize(); final String email = EmailSynthesizer.formatEmail(fullName.replace(" ", "."), emailSynth.synthesizeDomain()); final EntityId entityId = mTable.getEntityId(email); tableWriter.put(entityId, "info", "name", fullName); tableWriter.put(entityId, "info", "email", email); if (iuser % 1000 == 0) { getPrintStream().printf("%d rows synthesized...%n", iuser); } } } finally { tableWriter.close(); } getPrintStream().printf("%d rows synthesized...%n", mNumUsers); getPrintStream().println("Done."); return 0; }

Target:
protected int run(List<String> nonFlagArgs) throws Exception { final Random random = new Random(System.currentTimeMillis()); final List<String> nameDictionary = loadNameDictionary(mNameDictionaryFilename); final WordSynthesizer nameSynth = new WordSynthesizer(random, nameDictionary); final NGramSynthesizer fullNameSynth = new NGramSynthesizer(nameSynth, 2); final EmailSynthesizer emailSynth = new EmailSynthesizer(random, nameDictionary); getPrintStream().printf("Generating %d users on kiji table '%s'...%n", mNumUsers, mTableURI); final KijiTableWriter tableWriter = mTable.openTableWriter(); try { for (int iuser = 0; iuser < mNumUsers; iuser++) { final String fullName = fullNameSynth.synthesize(); final String email = EmailSynthesizer.formatEmail(fullName.replace(" ", "."), emailSynth.synthesizeDomain()); final EntityId entityId = mTable.getEntityId(email); tableWriter.put(entityId, "info", "name", fullName); tableWriter.put(entityId, "info", "email", email); if (iuser % 1000 == 0) { getPrintStream().printf("%d rows synthesized...%n", iuser); } } } finally { tableWriter.close(); } getPrintStream().printf("%d rows synthesized...%n", mNumUsers); getPrintStream().println("Done."); return SUCCESS; }
Source:
public void testMulticast(Bootstrap sb, Bootstrap cb) throws Throwable { sb.option(EpollChannelOption.IP_RECVORIGDSTADDR, true); super.testMulticast(sb, cb); sb.option(EpollChannelOption.IP_RECVORIGDSTADDR, false); }

Target:
public void testMulticast(Bootstrap sb, Bootstrap cb) throws Throwable { super.testMulticast(sb, cb); }
Source:
public static FlattrService getService(AccessToken token) { if (flattrService == null) { flattrService = FlattrFactory.getInstance().createFlattrService(token); } return flattrService; }

Target:
public synchronized static FlattrService getService(AccessToken token) { if (flattrService == null) { flattrService = FlattrFactory.getInstance().createFlattrService(token); } return flattrService; }
Source:
public StudyParticipant getSelfParticipant(Study study, CriteriaContext context, boolean includeHistory) { AccountId accountId = AccountId.forId(study.getIdentifier(), context.getUserId()); Account account = getAccountThrowingException(accountId); StudyParticipant.Builder builder = new StudyParticipant.Builder(); SubstudyAssociations assoc = BridgeUtils.substudyAssociationsVisibleToCaller(account.getAccountSubstudies()); addAccount(builder, assoc, account); addConsentStatus(builder, account, context); if (includeHistory) { addHistory(builder, account, context); } return builder.build(); }

Target:
public StudyParticipant getSelfParticipant(Study study, CriteriaContext context, boolean includeHistory) { AccountId accountId = AccountId.forId(study.getIdentifier(), context.getUserId()); Account account = getAccountThrowingException(accountId); StudyParticipant.Builder builder = new StudyParticipant.Builder(); SubstudyAssociations assoc = BridgeUtils.substudyAssociationsVisibleToCaller(account.getAccountSubstudies()); addAccount(builder, assoc, account); addConsentStatus(builder, account, context); if (includeHistory) { addHistory(builder, account, context.getStudyIdentifier()); } return builder.build(); }
Source:
public void check(File file) throws AppException { File[] files = file.listFiles(); Arrays.sort(files); if (files == null) { throw new AppException("Contest archive file is invalid."); } boolean hasContestInfo = false; Character nextProblemAlias = 'A'; for (File current : files) { if ("contestInfo.xml".equals(current.getName())) { hasContestInfo = true; } else if (current.isDirectory()) { if (!nextProblemAlias.toString().equals(current.getName())) { throw new AppException("Wrong problem alias."); } File[] filesInSubDirectory = current.listFiles(); checkProblemSubDirectory(filesInSubDirectory); nextProblemAlias ++; } else { throw new AppException("Contest information directory contains unknown type files."); } } if (!hasContestInfo) { throw new AppException("Contest archive has not contest information!"); } }

Target:
public void check(File file) throws AppException { AppExceptionUtil.assertNotNull(file); File[] files = file.listFiles(); Arrays.sort(files); boolean hasContestInfo = false; for (File current : files) { if ("contestInfo.xml".equals(current.getName())) { hasContestInfo = true; } else if (current.isDirectory()) { checkProblemSubDirectory(current); } else { throw new AppException("Contest information directory contains unknown type files."); } } if (!hasContestInfo) { throw new AppException("Contest archive has not contest information!"); } }
Source:
public void swaptionNegativeStrike() { double prIrs2Neg = IRS_R_2.accept(PRDC, MULTICURVE_NEG); MultipleCurrencyAmount pvIrs2Neg = IRS_R_2.accept(PVDC, MULTICURVE_NEG); MultipleCurrencyAmount pvSwpt2NegNorm = SWPT_R_L_2.accept(PVNSC, MULTICURVE_NEG_NORMAL); MultipleCurrencyParameterSensitivity pvcsIrs2Neg = MQSBDC.fromInstrument(IRS_R_2, MULTICURVE_NEG, BLOCK_STD).multipliedBy(BP1); MultipleCurrencyParameterSensitivity pvcsSwpt2NegNorm = MQSBNSC.fromInstrument(SWPT_R_L_2, MULTICURVE_NEG_NORMAL, BLOCK_STD).multipliedBy(BP1); PresentValueSwaptionSurfaceSensitivity pvvs2NegNorm = METHOD_SWPT_NORMAL.presentValueVolatilitySensitivity(SWPT_R_L_2, MULTICURVE_NEG_NORMAL); PresentValueSwaptionSurfaceSensitivity pvnns = SSSNC.calculateNodeSensitivities(pvvs2NegNorm, MULTICURVE_NEG_NORMAL); int t = 0; }

Target:
public void swaptionNegativeStrike() { double prIrs2Neg = IRS_R_2.accept(PRDC, MULTICURVE_NEG); MultipleCurrencyAmount pvIrs2Neg = IRS_R_2.accept(PVDC, MULTICURVE_NEG); MultipleCurrencyAmount pvSwpt2NegNorm = SWPT_R_L_2.accept(PVNSC, MULTICURVE_NEG_NORMAL); MultipleCurrencyParameterSensitivity pvcsIrs2Neg = MQSBDC.fromInstrument(IRS_R_2, MULTICURVE_NEG, BLOCK_STD).multipliedBy(BP1); MultipleCurrencyParameterSensitivity pvcsSwpt2NegNorm = MQSBNSC.fromInstrument(SWPT_R_L_2, MULTICURVE_NEG_NORMAL, BLOCK_STD).multipliedBy(BP1); PresentValueSwaptionSurfaceSensitivity pvvs2NegNorm = METHOD_SWPT_NORMAL.presentValueVolatilitySensitivity(SWPT_R_L_2, MULTICURVE_NEG_NORMAL); PresentValueSwaptionSurfaceSensitivity pvnns = SSSNC.calculateNodeSensitivities(pvvs2NegNorm, MULTICURVE_NEG_NORMAL); }
Source:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (id == null ? 0 : id.hashCode()); return result; }

Target:
public int hashCode() { return id.hashCode(); }
Source:
private void optionDecl() throws QueryException { skipWS(); final QNm name = eQName(QNAMEINV, URICHECK); final byte[] val = stringLiteral(); if(ctx.sc.xquery3() && eq(name.prefix(), OUTPUT)) { final String key = string(name.local()); if(module != null) error(MODOUT); if(ctx.serProp == null) ctx.serProp = new SerializerProp(); if(ctx.serProp.get(key) == null) error(OUTWHICH, key); if(serial.contains(key)) error(OUTDUPL, key); ctx.serProp.set(key, string(val)); serial.add(key); } else if(eq(name.prefix(), DB)) { final String key = string(uc(name.local())); final Object obj = ctx.context.prop.get(key); if(obj == null) error(BASX_OPTIONS, key); ctx.globalOpt.put(key, obj); ctx.dbOptions.add(key); ctx.dbOptions.add(string(val)); } else if(eq(name.prefix(), QUERY)) { if(eq(name.local(), READ_LOCK)) for (String lock : string(val).split("\\s*,\\s*")) ctx.userReadLocks.add(DBLocking.USER_PREFIX + lock); else if(eq(name.local(), WRITE_LOCK)) { for (String lock : string(val).split("\\s*,\\s*")) ctx.userWriteLocks.add(DBLocking.USER_PREFIX + lock); } else error(BASX_OPTIONS, string(name.local())); } }

Target:
private void optionDecl() throws QueryException { skipWS(); final QNm name = eQName(QNAMEINV, URICHECK); final byte[] val = stringLiteral(); if(ctx.sc.xquery3() && eq(name.uri(), OUTPUTURI)) { final String key = string(name.local()); if(module != null) error(MODOUT); if(ctx.serProp == null) ctx.serProp = new SerializerProp(); if(ctx.serProp.get(key) == null) error(OUTWHICH, key); if(serial.contains(key)) error(OUTDUPL, key); ctx.serProp.set(key, string(val)); serial.add(key); } else if(eq(name.uri(), DBURI)) { final String key = string(uc(name.local())); final Object obj = ctx.context.prop.get(key); if(obj == null) error(BASX_OPTIONS, key); ctx.globalOpt.put(key, obj); ctx.dbOptions.add(key); ctx.dbOptions.add(string(val)); } else if(eq(name.uri(), QUERYURI)) { if(eq(name.local(), READ_LOCK)) for (String lock : string(val).split("\\s*,\\s*")) ctx.userReadLocks.add(DBLocking.USER_PREFIX + lock); else if(eq(name.local(), WRITE_LOCK)) { for (String lock : string(val).split("\\s*,\\s*")) ctx.userWriteLocks.add(DBLocking.USER_PREFIX + lock); } else error(BASX_OPTIONS, string(name.local())); } }
Source:
HttpResponse doGetContent(String spaceId, String contentId, Long startByte, Long endByte) throws ContentStoreException { String task = "get content"; String url = buildContentURL(spaceId, contentId); try { final boolean hasRange = !(startByte == 0l && endByte == null); final HttpResponse response; if (!hasRange) { response = restHelper.get(url); } else { Map<String, String> headers = new HashMap<>(); headers.put("Range", "bytes=" + startByte + "-" + (endByte != null ? endByte : "")); response = restHelper.get(url, headers); } checkResponse(response, hasRange ? HttpStatus.SC_PARTIAL_CONTENT : HttpStatus.SC_OK); return response; } catch (NotFoundException e) { throw new NotFoundException(task, spaceId, contentId, e); } catch (UnauthorizedException e) { throw new UnauthorizedException(task, spaceId, contentId, e); } catch (Exception e) { throw new ContentStoreException(task, spaceId, contentId, e); } }

Target:
protected HttpResponse doGetContent(String spaceId, String contentId, Long startByte, Long endByte) throws ContentStoreException { String task = "get content"; String url = buildContentURL(spaceId, contentId); try { final boolean hasRange = !(startByte == 0l && endByte == null); final HttpResponse response; if (!hasRange) { response = restHelper.get(url); } else { Map<String, String> headers = new HashMap<>(); headers.put("Range", "bytes=" + startByte + "-" + (endByte != null ? endByte : "")); response = restHelper.get(url, headers); } checkResponse(response, hasRange ? HttpStatus.SC_PARTIAL_CONTENT : HttpStatus.SC_OK); return response; } catch (NotFoundException e) { throw new NotFoundException(task, spaceId, contentId, e); } catch (UnauthorizedException e) { throw new UnauthorizedException(task, spaceId, contentId, e); } catch (Exception e) { throw new ContentStoreException(task, spaceId, contentId, e); } }
Source:
public void setRetryAnalyzerClass(Class<? extends IRetryAnalyzer> clazz) { m_retryAnalyzerClass = clazz; if (isRetryAnalyzerNotTestNGInjected(clazz)) { m_retryAnalyzer = ClassHelper.newInstance(clazz); } }

Target:
public void setRetryAnalyzerClass(Class<? extends IRetryAnalyzer> clazz) { m_retryAnalyzerClass = clazz == null ? DisabledRetryAnalyzer.class : clazz; m_retryAnalyzer = ClassHelper.newInstance(m_retryAnalyzerClass); }
Source:
protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { if (root != null) { return root; } root = new DiffNode(Differencer.NO_CHANGE); for (IReviewItem item : items.getItems()) { if (!(item instanceof IFileItem)) { continue; } else if (item instanceof IFileItem && ((IFileItem) item).getBase().getContent() != null) { FileItemNode node = new FileItemNode(behavior, (IFileItem) item, monitor); DiffNode parent = findNode(root, node.getPath()); parent.add(node); } } for (IDiffElement child : root.getChildren()) { if (child instanceof FileItemNode) { flattenTree((FileItemNode) child); } } return root; }

Target:
protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { if (root != null) { return root; } root = new DiffNode(Differencer.NO_CHANGE); for (IReviewItem item : items.getItems()) { if (!(item instanceof IFileItem)) { continue; } IFileItem fileItem = (IFileItem) item; if (fileItem.getBase().getContent() != null) { FileItemNode node = new FileItemNode(behavior, fileItem, monitor); DiffNode parent = findNode(root, node.getPath()); parent.add(node); } } for (IDiffElement child : root.getChildren()) { if (child instanceof FileItemNode) { flattenTree((FileItemNode) child); } } return root; }
Source:
public void shouldReturnEmptyListWhenWrongLookupNameForProgramEnrollment() { String className = ProgramEnrollment.class.getSimpleName(); Map<String, String> lookupFields = new HashMap<>(); lookupFields.put(PATIENT_UUID, DEFAULT_UUID); lookupFields.put(PROGRAM_NAME, PROGRAM_DEFAULT_NAME); Object object = taskDataProvider.lookup(className + '-' + CONFIG_NAME, "wrongLookupName", lookupFields); assertTrue(object instanceof ProgramEnrollmentListResult); ProgramEnrollmentListResult actual = (ProgramEnrollmentListResult) object; assertEquals(0, actual.getResults().size()); verifyZeroInteractions(programEnrollmentService); }

Target:
public void shouldReturnEmptyListWhenWrongLookupNameForProgramEnrollment() { String className = ProgramEnrollment.class.getSimpleName(); Map<String, String> lookupFields = new HashMap<>(); lookupFields.put(PATIENT_UUID, DEFAULT_UUID); lookupFields.put(PROGRAM_NAME, PROGRAM_DEFAULT_NAME); Object object = taskDataProvider.lookup(className + '-' + CONFIG_NAME, "wrongLookupName", lookupFields); assertTrue(object instanceof ProgramEnrollmentListResult); ProgramEnrollmentListResult actual = (ProgramEnrollmentListResult) object; assertTrue(actual.getResults().isEmpty()); assertEquals(0, actual.getNumberOfPrograms()); verifyZeroInteractions(programEnrollmentService); }
Source:
public void handleMemoryChange(BigInteger address) { int addressesLength = fLength/fWordSize; BigInteger fEndAddress = fBlockAddress.add(BigInteger.valueOf(addressesLength)); if (address.equals(BigInteger.ZERO) || ((fBlockAddress.compareTo(address) != 1) && (fEndAddress.compareTo(address) == 1))) { DebugEvent debugEvent = new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.CONTENT); DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { debugEvent }); } }

Target:
public void handleMemoryChange(BigInteger address) { int addressableSize; try { addressableSize = getAddressableSize(); } catch (DebugException e) { addressableSize = 1; } int addressesLength = fLength/addressableSize; BigInteger fEndAddress = fBlockAddress.add(BigInteger.valueOf(addressesLength)); if (address.equals(BigInteger.ZERO) || ((fBlockAddress.compareTo(address) != 1) && (fEndAddress.compareTo(address) == 1))) { DebugEvent debugEvent = new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.CONTENT); DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { debugEvent }); } }
Source:
public void testUnits() { QuantityType<Length> dt2 = (QuantityType<Length>) QuantityType.valueOf("2m"); assertEquals(dt2.getDimension(), QuantityDimension.LENGTH); assertEquals(dt2.getUnit(), Units.METRE); assertEquals("2 m", dt2.toString()); QuantityType<Length> dt1 = new QuantityType<>("2.1cm"); assertEquals(dt1.getDimension(), QuantityDimension.LENGTH); assertEquals(dt1.getUnit(), tec.uom.se.unit.MetricPrefix.CENTI(Units.METRE)); assertEquals("2.1 cm", dt1.toString()); assertEquals(dt1.intValue(), dt2.intValue()); QuantityType<Length> dt3 = new QuantityType<Length>("200cm"); assertEquals(dt3.compareTo(dt2), 0); assertTrue(dt3.equals(dt2)); QuantityType dt4 = new QuantityType<>("2kg"); assertEquals("2 kg", dt4.toString()); assertFalse(dt2.equals(dt4)); try { dt2.compareTo(dt4); fail(); } catch (Exception e) { } }

Target:
public void testUnits() { QuantityType<Length> dt2 = new QuantityType<>("2 m"); assertEquals(dt2.getDimension(), QuantityDimension.LENGTH); assertEquals(dt2.getUnit(), SIUnits.METRE); assertEquals("2 m", dt2.toString()); QuantityType<Length> dt1 = new QuantityType<>("2.1cm"); assertEquals(dt1.getDimension(), QuantityDimension.LENGTH); assertEquals(dt1.getUnit(), CENTI(SIUnits.METRE)); assertEquals("2.1 cm", dt1.toString()); assertEquals(dt1.intValue(), dt2.intValue()); QuantityType<Length> dt3 = new QuantityType<Length>("200cm"); assertEquals(dt3.compareTo(dt2), 0); assertTrue(dt3.equals(dt2)); QuantityType dt4 = new QuantityType<>("2kg"); assertEquals("2 kg", dt4.toString()); assertFalse(dt2.equals(dt4)); try { dt2.compareTo(dt4); fail(); } catch (Exception e) { } }
Source:
private List<Product> getProductsByProductType(ProductType type, boolean getRefs) throws CatalogException { IndexSearcher searcher = null; List<Product> products = new Vector<Product>(); try { try { reader = DirectoryReader.open(indexDir); } catch (IOException e) { e.printStackTrace(); } searcher = new IndexSearcher(reader); Term productIdTerm = new Term("product_type_id", type .getProductTypeId()); org.apache.lucene.search.Query query = new TermQuery(productIdTerm); Sort sort = new Sort(new SortField("CAS.ProductReceivedTime", SortField.Type.STRING, true)); TopDocs check = searcher.search(query, 1, sort); if(check.totalHits>0) { TopDocs topDocs = searcher.search(query, check.totalHits, sort); ScoreDoc[] hits = topDocs.scoreDocs; if (hits.length > 0) { for (ScoreDoc hit : hits) { Document productDoc = searcher.doc(hit.doc); CompleteProduct prod = toCompleteProduct(productDoc, getRefs, false); products.add(prod.getProduct()); } } else { LOG.log(Level.FINEST, "Request for products by type: [" + type.getProductTypeId() + "] returned no results"); return products; } } } catch (IOException e) { LOG.log(Level.WARNING, "IOException when opening index directory: [" + indexFilePath + "] for search: Message: " + e.getMessage()); throw new CatalogException(e.getMessage(), e); } finally { if (searcher != null) { try { } catch (Exception ignore) { } } } return products; }

Target:
private List<Product> getProductsByProductType(ProductType type, boolean getRefs) throws CatalogException { IndexSearcher searcher = null; List<Product> products = new Vector<Product>(); try { try { reader = DirectoryReader.open(indexDir); } catch (IOException e) { e.printStackTrace(); } searcher = new IndexSearcher(reader); Term productIdTerm = new Term("product_type_id", type .getProductTypeId()); org.apache.lucene.search.Query query = new TermQuery(productIdTerm); Sort sort = new Sort(new SortField("CAS.ProductReceivedTime", SortField.Type.STRING, true)); TopDocs check = searcher.search(query, 1, sort); if(check.totalHits>0) { TopDocs topDocs = searcher.search(query, check.totalHits, sort); ScoreDoc[] hits = topDocs.scoreDocs; if (hits.length > 0) { for (ScoreDoc hit : hits) { Document productDoc = searcher.doc(hit.doc); CompleteProduct prod = toCompleteProduct(productDoc, getRefs, false); products.add(prod.getProduct()); } } else { LOG.log(Level.FINEST, "Request for products by type: [" + type.getProductTypeId() + "] returned no results"); } } } catch (IOException e) { LOG.log(Level.WARNING, "IOException when opening index directory: [" + indexFilePath + "] for search: Message: " + e.getMessage()); throw new CatalogException(e.getMessage(), e); } finally { if (searcher != null) { try { } catch (Exception ignore) { } } } return products; }
Source:
private void findReferences(CompositeChange compositeChange, IProgressMonitor monitor) { String pointId = getId(); IPluginModelBase[] bases = PDECore.getDefault().getExtensionsRegistry().findExtensionPlugins(pointId, true); SubMonitor subMonitor = SubMonitor.convert(monitor, "", bases.length); for (int i = 0; i < bases.length; i++) { IFile file = getModificationFile(bases[i]); if (file != null) compositeChange.addAll(PDEModelUtility.changesForModelModication(getExtensionModification(file), subMonitor.newChild(1))); } }

Target:
private void findReferences(CompositeChange compositeChange, IProgressMonitor monitor) { String pointId = getId(); IPluginModelBase[] bases = PDECore.getDefault().getExtensionsRegistry().findExtensionPlugins(pointId, true); SubMonitor subMonitor = SubMonitor.convert(monitor, bases.length); for (int i = 0; i < bases.length; i++) { IFile file = getModificationFile(bases[i]); if (file != null) { compositeChange.addAll(PDEModelUtility.changesForModelModication(getExtensionModification(file), subMonitor.newChild(1))); } subMonitor.setWorkRemaining(bases.length - i); } }
Source:
private void setupDefaultSecurityLabels(KeyExtent extent) { if (extent.isMeta()) { defaultSecurityLabel = new byte[0]; } else { try { ColumnVisibility cv = new ColumnVisibility( tableConfiguration.get(Property.TABLE_DEFAULT_SCANTIME_VISIBILITY)); this.defaultSecurityLabel = cv.getExpression(); } catch (Exception e) { log.error("Error setting up default security label " + e.getMessage(), e); this.defaultSecurityLabel = new byte[0]; } } }

Target:
private void setupDefaultSecurityLabels(KeyExtent extent) { if (extent.isMeta()) { defaultSecurityLabel = new byte[0]; } else { try { ColumnVisibility cv = new ColumnVisibility( tableConfiguration.get(Property.TABLE_DEFAULT_SCANTIME_VISIBILITY)); this.defaultSecurityLabel = cv.getExpression(); } catch (Exception e) { log.error("Error setting up default security label {}", e.getMessage(), e); this.defaultSecurityLabel = new byte[0]; } } }
Source:
private DocumentMetadata.Builder handleDatasourceIds(OafEntity oafEntity, DocumentMetadata.Builder metaBuilder) { if (CollectionUtils.isNotEmpty(oafEntity.getCollectedfrom())) { List<CharSequence> datasourceIds = new ArrayList<CharSequence>( oafEntity.getCollectedfrom().size()); for (KeyValue currentCollectedFrom : oafEntity.getCollectedfrom()) { datasourceIds.add(currentCollectedFrom.getKey()); } metaBuilder.setDatasourceIds(datasourceIds); } return metaBuilder; }

Target:
private static void handleDatasourceIds(OafEntity oafEntity, DocumentMetadata.Builder metaBuilder) { if (CollectionUtils.isNotEmpty(oafEntity.getCollectedfrom())) { List<CharSequence> datasourceIds = oafEntity.getCollectedfrom().stream().map(KeyValue::getKey) .collect(Collectors.toList()); if (!datasourceIds.isEmpty()) { metaBuilder.setDatasourceIds(datasourceIds); } } }
Source:
protected void runOneIteration() { final Instant staleBy = Instant.now().minus(BROKER_OFFSETS_FETCH_INTERVAL); final Set<TopicPartition> partitionsNeedingUpdate = new HashSet<>(); _kafkaPositionTracker._ownedKeys.forEach(((topicPartition, key) -> { @Nullable final KafkaPositionValue value = _kafkaPositionTracker._positions.get(key); if (value != null && (value.getLastBrokerQueriedTime() == null || value.getLastBrokerQueriedTime().isBefore(staleBy))) { partitionsNeedingUpdate.add(topicPartition); } })); try { updatePartitionLeadershipMap(); } catch (Exception e) { LOG.warn("Failed to update the partition leadership map. Using stale leadership data. Reason: {}", e.getMessage()); LOG.debug("Failed to update the partition leadership map. Using stale leadership data.", e); } batchPartitionsByLeader(partitionsNeedingUpdate).forEach(partitionLeaderBatch -> { try { _kafkaPositionTracker.queryBrokerForLatestOffsets(_consumer, partitionLeaderBatch, CONSUMER_REQUEST_TIMEOUT); } catch (Exception e) { LOG.warn("Failed to query latest broker offsets for this leader batch via endOffsets() RPC. Reason: {}", e.getMessage()); LOG.debug("Failed to query latest broker offsets for this leader batch via endOffsets() RPC", e); } }); }

Target:
protected void runOneIteration() { final Instant staleBy = Instant.now().minus(_brokerOffsetsFetchInterval); final Set<TopicPartition> partitionsNeedingUpdate = new HashSet<>(); _kafkaPositionTracker._ownedKeys.forEach(((topicPartition, key) -> { @Nullable final KafkaPositionValue value = _kafkaPositionTracker._positions.get(key); if (value != null && (value.getLastBrokerQueriedTime() == null || value.getLastBrokerQueriedTime().isBefore(staleBy))) { partitionsNeedingUpdate.add(topicPartition); } })); try { if (_enablePartitionLeadershipCalculation) { Instant calculationStaleBy = Optional.ofNullable(_lastPartitionLeadershipCalculation) .map(lastCalculation -> lastCalculation.plus(_partitionLeadershipCalculationFrequency)) .orElse(Instant.MIN); if (Instant.now().isAfter(calculationStaleBy)) { updatePartitionLeadershipMap(); _lastPartitionLeadershipCalculation = Instant.now(); } } } catch (Exception e) { LOG.warn("Failed to update the partition leadership map. Using stale leadership data. Reason: {}", e.getMessage()); LOG.debug("Failed to update the partition leadership map. Using stale leadership data.", e); } batchPartitionsByLeader(partitionsNeedingUpdate).forEach(partitionLeaderBatch -> { try { _kafkaPositionTracker.queryBrokerForLatestOffsets(_consumer, partitionLeaderBatch, _consumerRequestTimeout); } catch (Exception e) { LOG.warn("Failed to query latest broker offsets for this leader batch via endOffsets() RPC. Reason: {}", e.getMessage()); LOG.debug("Failed to query latest broker offsets for this leader batch via endOffsets() RPC", e); } }); }
Source:
private static boolean isValidFieldName(FieldSpec fieldSpec) { String columnName = fieldSpec.getName(); if (SQL_PARSER_METADATA.isReservedWord(columnName.toUpperCase(Locale.ROOT))) { LOGGER.error("Cannot use SQL reserved word as field name in the schema", columnName); return false; } return true; }

Target:
private static boolean isValidFieldName(FieldSpec fieldSpec) { String columnName = fieldSpec.getName(); if (SQL_PARSER_METADATA.isReservedWord(columnName.toUpperCase())) { LOGGER.error("Cannot use SQL reserved word as field name in the schema", columnName); return false; } return true; }
Source:
public boolean attemptReceive() throws IOException { boolean received = false; try { InputStream is = buffer.getInputStream(); if (this.fileReceiver != null) { received = this.fileReceiver.receive(is); } else { MessageFormat format = new MessageFormat(); format.deserialize(is); this.receivedMessage = format.getMessage(); if (!isFileMessage(this.receivedMessage)) { received = true; } else { this.fileReceiver = new FileReceiver((IFileMessage) this.receivedMessage, this.tempFolder); if (is.available() > 0) { received = this.fileReceiver.receive(is); } } } buffer.consume(); if (LogUtil.isLogAvailable()) { if (buffer.size() > 0) { Log.v(TAG, "Residual buffer data: " + buffer.size() + " bytes left in buffer"); } } } catch (MessageNotCompleteException e) { } return received; }

Target:
public boolean attemptReceive() throws IOException { boolean received = false; try { InputStream input = buffer.getInputStream(); if (this.fileReceiver != null) { received = this.fileReceiver.receive(input); } else { MessageFormat format = new MessageFormat(); format.deserialize(input); this.receivedMessage = format.getMessage(); if (!isFileMessage(this.receivedMessage)) { received = true; } else { this.fileReceiver = new FileReceiver((IFileMessage) this.receivedMessage, this.tempFolder); if (input.available() > 0) { received = this.fileReceiver.receive(input); } } } buffer.consume(); if (LogUtil.isLogAvailable()) { if (buffer.size() > 0) { Log.v(TAG, "Residual buffer data: " + buffer.size() + " bytes left in buffer"); } } } catch (MessageNotCompleteException e) { } return received; }
Source:
public void replaceUserCredentialsDataInPollRequest( HttpMessage msg, User user, UnaryOperator<String> bodyEncoder) { if (user != null) { AuthenticationCredentials creds = user.getAuthenticationCredentials(); if (creds instanceof UsernamePasswordAuthenticationCredentials) { Map<String, String> kvMap = new HashMap<>(); kvMap.put( PostBasedAuthenticationMethod.MSG_USER_PATTERN, ((UsernamePasswordAuthenticationCredentials) creds).getUsername()); AuthenticationHelper.replaceUserDataInRequest(msg, kvMap, bodyEncoder); } } }

Target:
public static void replaceUserCredentialsDataInPollRequest( HttpMessage msg, User user, UnaryOperator<String> bodyEncoder) { if (user != null) { AuthenticationCredentials creds = user.getAuthenticationCredentials(); if (creds instanceof UsernamePasswordAuthenticationCredentials) { Map<String, String> kvMap = new HashMap<>(); kvMap.put( PostBasedAuthenticationMethod.MSG_USER_PATTERN, ((UsernamePasswordAuthenticationCredentials) creds).getUsername()); AuthenticationHelper.replaceUserDataInRequest(msg, kvMap, bodyEncoder); } } }
Source:
public List<ScheduledActivity> getScheduledActivities(Study study, ScheduleContext context) { checkNotNull(study); checkNotNull(context); Validate.nonEntityThrowingException(VALIDATOR, context); Map<String, DateTime> events = createEventsMap(context); ScheduleContext updatedContext = new ScheduleContext.Builder().withContext(context).withEvents(events).build(); List<ScheduledActivity> scheduledActivities = scheduleActivitiesForPlans(updatedContext); List<ScheduledActivity> dbActivities = activityDao.getActivities(context.getEndsOn().getZone(), scheduledActivities); Map<String, ScheduledActivity> dbMap = Maps.newHashMap(); for (ScheduledActivity dbActivity : dbActivities) { dbMap.put(dbActivity.getGuid(), dbActivity); } List<ScheduledActivity> saves = performMerge(scheduledActivities, dbMap); activityDao.saveActivities(saves); List<ScheduledActivity> orderedActivities = orderActivities(scheduledActivities, V3_FILTER); String healthCode = context.getCriteriaContext().getHealthCode(); activityEventService.publishActivitiesRetrieved(study, healthCode, DateUtils.getCurrentDateTime()); return orderedActivities; }

Target:
public List<ScheduledActivity> getScheduledActivities(Study study, ScheduleContext context) { checkNotNull(study); checkNotNull(context); Validate.nonEntityThrowingException(VALIDATOR, context); String healthCode = context.getCriteriaContext().getHealthCode(); activityEventService.publishActivitiesRetrieved(study, healthCode, DateUtils.getCurrentDateTime()); Map<String, DateTime> events = createEventsMap(context); ScheduleContext updatedContext = new ScheduleContext.Builder().withContext(context).withEvents(events).build(); List<ScheduledActivity> scheduledActivities = scheduleActivitiesForPlans(updatedContext); List<ScheduledActivity> dbActivities = activityDao.getActivities(context.getEndsOn().getZone(), scheduledActivities); Map<String, ScheduledActivity> dbMap = Maps.newHashMap(); for (ScheduledActivity dbActivity : dbActivities) { dbMap.put(dbActivity.getGuid(), dbActivity); } List<ScheduledActivity> saves = performMerge(scheduledActivities, dbMap); activityDao.saveActivities(saves); return orderActivities(scheduledActivities, V3_FILTER); }
Source:
public void rollback(Xid xid) throws XAException { assertIfRecoveryScanWasStarted(); delegate.rollback(xid); }

Target:
public void rollback(Xid xid) throws XAException { delegate.rollback(xid); }
Source:
private void writeGrants(JsonWriter writer) throws IOException { for (ApprovedSite site : approvedSiteRepository.getAll()) { writer.beginObject(); writer.name("id").value(site.getId()); writer.name("accessDate").value(DateUtil.toUTCString(site.getAccessDate())); writer.name("clientId").value(site.getClientId()); writer.name("creationDate").value(DateUtil.toUTCString(site.getCreationDate())); writer.name("timeoutDate").value(DateUtil.toUTCString(site.getTimeoutDate())); writer.name("userId").value(site.getUserId()); writer.name("allowedScopes"); writeNullSafeArray(writer, site.getAllowedScopes()); writer.name("whitelistedSiteId").value(site.getIsWhitelisted() ? site.getWhitelistedSite().getId() : null); writer.endObject(); logger.debug("Wrote grant {}", site.getId()); } logger.info("Done writing grants"); }

Target:
private void writeGrants(JsonWriter writer) throws IOException { for (ApprovedSite site : approvedSiteRepository.getAll()) { writer.beginObject(); writer.name("id").value(site.getId()); writer.name("accessDate").value(DateUtil.toUTCString(site.getAccessDate())); writer.name("clientId").value(site.getClientId()); writer.name("creationDate").value(DateUtil.toUTCString(site.getCreationDate())); writer.name("timeoutDate").value(DateUtil.toUTCString(site.getTimeoutDate())); writer.name("userId").value(site.getUserId()); writer.name("allowedScopes"); writeNullSafeArray(writer, site.getAllowedScopes()); writer.name("whitelistedSiteId").value(site.getIsWhitelisted() ? site.getWhitelistedSite().getId() : null); List<OAuth2AccessTokenEntity> tokens = tokenRepository.getAccessTokensForApprovedSite(site); writer.name("approvedAccessTokens"); writer.beginArray(); for (OAuth2AccessTokenEntity token : tokens) { writer.value(token.getId()); } writer.endArray(); writer.endObject(); logger.debug("Wrote grant {}", site.getId()); } logger.info("Done writing grants"); }
Source:
void kotlinTestWithMethodNameContainingSpecialCharacters() { ExecutionsResult executionsResult = executeTestsForClass( ArbitraryNamingKotlinTestCase.class).getExecutionsResult(); assertThat(executionsResult.getTestsStartedCount()).isEqualTo(2); TestDescriptor testDescriptor1 = executionsResult.getEventsFinished(TestExecutionResult.Status.SUCCESSFUL).get( 0).getTestDescriptor(); assertAll( () -> assertEquals(METHOD_NAME + "()", testDescriptor1.getDisplayName()), () -> assertEquals(METHOD_NAME + "()", testDescriptor1.getLegacyReportingName())); TestDescriptor testDescriptor2 = executionsResult.getEventsFinished(TestExecutionResult.Status.SUCCESSFUL).get( 1).getTestDescriptor(); assertAll( () -> assertEquals("test name ends with parentheses()()", testDescriptor2.getDisplayName()), () -> assertEquals("test name ends with parentheses()()", testDescriptor2.getLegacyReportingName())); }

Target:
void kotlinTestWithMethodNameContainingSpecialCharacters() { ExecutionsResult executionsResult = executeTestsForClass( ArbitraryNamingKotlinTestCase.class).getExecutionsResult(); assertThat(executionsResult.getTestStartedCount()).isEqualTo(2); TestDescriptor testDescriptor1 = executionsResult.getSuccessfulTestFinishedEvents().get(0).getTestDescriptor(); assertAll( () -> assertEquals(METHOD_NAME + "()", testDescriptor1.getDisplayName()), () -> assertEquals(METHOD_NAME + "()", testDescriptor1.getLegacyReportingName())); TestDescriptor testDescriptor2 = executionsResult.getSuccessfulTestFinishedEvents().get(1).getTestDescriptor(); assertAll( () -> assertEquals("test name ends with parentheses()()", testDescriptor2.getDisplayName()), () -> assertEquals("test name ends with parentheses()()", testDescriptor2.getLegacyReportingName())); }
Source:
private void setDefaults() { this.putClientProperty("html.disable", Boolean.TRUE); this.setEditable(false); this.setCursor(null); this.setBorder(null); this.setBackground(new Color(UIManager.getLookAndFeel().getDefaults().getColor("Label.background").getRGB())); this.setForeground(new Color(UIManager.getLookAndFeel().getDefaults().getColor("Label.foreground").getRGB())); }

Target:
private void setDefaults() { this.setEditable(false); this.setCursor(null); this.setBorder(null); this.setBackground(new Color(UIManager.getLookAndFeel().getDefaults().getColor("Label.background").getRGB())); this.setForeground(new Color(UIManager.getLookAndFeel().getDefaults().getColor("Label.foreground").getRGB())); }
Source:
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { MqttMessage mqttMessage = (MqttMessage) msg; System.out.println("Received MQTT message: " + mqttMessage); switch (mqttMessage.fixedHeader().messageType()) { case CONNECT: MqttFixedHeader connackFixedHeader = new MqttFixedHeader(MqttMessageType.CONNACK, false, MqttQoS.AT_MOST_ONCE, false, 0); MqttConnAckVariableHeader mqttConnAckVariableHeader = new MqttConnAckVariableHeader(MqttConnectReturnCode.CONNECTION_ACCEPTED, false); MqttConnAckMessage connack = new MqttConnAckMessage(connackFixedHeader, mqttConnAckVariableHeader); ctx.channel().writeAndFlush(connack); break; case PINGREQ: MqttFixedHeader pingreqFixedHeader = new MqttFixedHeader(MqttMessageType.PINGRESP, false, MqttQoS.AT_MOST_ONCE, false, 0); MqttMessage pingResp = new MqttMessage(pingreqFixedHeader); ctx.channel().writeAndFlush(pingResp); break; case DISCONNECT: ctx.channel().close(); break; default: System.out.println("Unexpected message type: " + mqttMessage.fixedHeader().messageType()); ctx.channel().close(); } }

Target:
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { MqttMessage mqttMessage = (MqttMessage) msg; System.out.println("Received MQTT message: " + mqttMessage); switch (mqttMessage.fixedHeader().messageType()) { case CONNECT: MqttFixedHeader connackFixedHeader = new MqttFixedHeader(MqttMessageType.CONNACK, false, MqttQoS.AT_MOST_ONCE, false, 0); MqttConnAckVariableHeader mqttConnAckVariableHeader = new MqttConnAckVariableHeader(MqttConnectReturnCode.CONNECTION_ACCEPTED, false); MqttConnAckMessage connack = new MqttConnAckMessage(connackFixedHeader, mqttConnAckVariableHeader); ctx.writeAndFlush(connack); break; case PINGREQ: MqttFixedHeader pingreqFixedHeader = new MqttFixedHeader(MqttMessageType.PINGRESP, false, MqttQoS.AT_MOST_ONCE, false, 0); MqttMessage pingResp = new MqttMessage(pingreqFixedHeader); ctx.writeAndFlush(pingResp); break; case DISCONNECT: ctx.close(); break; default: System.out.println("Unexpected message type: " + mqttMessage.fixedHeader().messageType()); ReferenceCountUtil.release(msg); ctx.close(); } }
Source:
void initialize(BaseDAO baseDAO, List<? extends BaseBean> list) { if (Objects.nonNull(this.id) && !Hibernate.isInitialized(list)) { try { Hibernate.initialize(list); } catch (HibernateException e) { baseDAO.initialize(this, list); } } }

Target:
void initialize(BaseDAO baseDAO, List<? extends BaseBean> list) { if (Objects.nonNull(this.id) && !Hibernate.isInitialized(list)) { baseDAO.initialize(this, list); } }
Source:
public AuditEvent buildEvent(ProcessStartedEvent pse) { ProcessInstanceImpl pi = (ProcessInstanceImpl) pse.getProcessInstance(); ProcessInstanceLog log = new ProcessInstanceLog(pi.getId(), pi.getProcessId()); log.setExternalId(""+((KieSession) pse.getKieRuntime()).getIdentifier()); log.setProcessName(pi.getProcess().getName()); log.setProcessVersion(pi.getProcess().getVersion()); log.setStatus(ProcessInstance.STATE_ACTIVE); log.setProcessInstanceDescription( pi.getDescription() ); log.setProcessType(((WorkflowProcess)pi.getProcess()).getProcessType()); CorrelationKey correlationKey = (CorrelationKey) pi.getMetaData().get("CorrelationKey"); if (correlationKey != null) { log.setCorrelationKey(correlationKey.toExternalForm()); } try { Object value = pi.getMetaData().get("ParentProcessInstanceId"); if( value != null ){ long parentProcessInstanceId = (Long) value; log.setParentProcessInstanceId( parentProcessInstanceId ); }else{ log.setParentProcessInstanceId(-1L); } } catch (Exception e) { log.setParentProcessInstanceId(-1L); } return log; }

Target:
public AuditEvent buildEvent(ProcessStartedEvent pse) { ProcessInstanceImpl pi = (ProcessInstanceImpl) pse.getProcessInstance(); ProcessInstanceLog log = new ProcessInstanceLog(pi.getId(), pi.getProcessId()); log.setExternalId(""+((KieSession) pse.getKieRuntime()).getIdentifier()); log.setProcessName(pi.getProcess().getName()); log.setProcessVersion(pi.getProcess().getVersion()); log.setStatus(ProcessInstance.STATE_ACTIVE); log.setProcessInstanceDescription( pi.getDescription() ); log.setProcessType(((WorkflowProcess)pi.getProcess()).getProcessType()); CorrelationKey correlationKey = (CorrelationKey) pi.getMetaData().get("CorrelationKey"); if (correlationKey != null) { log.setCorrelationKey(correlationKey.toExternalForm()); } long parentProcessInstanceId = (Long) pi.getMetaData().getOrDefault("ParentProcessInstanceId", -1L); log.setParentProcessInstanceId( parentProcessInstanceId ); return log; }
Source:
public void handleEvent(Event event) { if (event.widget instanceof Control) { Control c = (Control) event.widget; Shell shell = c.getShell(); switch (event.type) { case SWT.MouseDown: if (isHideOnMouseDown()) { toolTipHide(shell, event); } break; case SWT.MouseExit: Rectangle rect = shell.getBounds(); rect.width -= 10; rect.height -= 10; if (!rect.contains(c.getDisplay().getCursorLocation())) { toolTipHide(shell, event); } break; } } }

Target:
public void handleEvent(Event event) { if (event.widget instanceof Control) { Control c = (Control) event.widget; Shell shell = c.getShell(); switch (event.type) { case SWT.MouseDown: if (isHideOnMouseDown()) { toolTipHide(shell, event); } break; case SWT.MouseExit: Rectangle rect = shell.getBounds(); if (!rect.contains(c.getDisplay().getCursorLocation())) { toolTipHide(shell, event); } break; } } }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mHandler = ViewModelProviders.of(this).get(SmartLockHandler.class); mHandler.init(getFlowParams()); Credential credential = getIntent().getParcelableExtra(ExtraConstants.EXTRA_CREDENTIAL); mIdpResponse = getIntent().getParcelableExtra(ExtraConstants.EXTRA_IDP_RESPONSE); mHandler.saveCredentials(credential); mHandler.getSaveOperation().observe(this, new Observer<Resource<Void>>() { @Override public void onChanged(@Nullable Resource<Void> resource) { if (resource == null) { Log.w(TAG, "getSaveOperation:onChanged:null"); return; } onSaveOperation(resource); } }); mHandler.getPendingResolution().observe(this, new Observer<PendingResolution>() { @Override public void onChanged(@Nullable PendingResolution resolution) { if (resolution == null) { Log.w(TAG, "getPendingResolution:onChanged: null"); return; } onPendingResolution(resolution); } }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mHandler = ViewModelProviders.of(this).get(SmartLockHandler.class); mHandler.init(getFlowParams()); Credential credential = getIntent().getParcelableExtra(ExtraConstants.EXTRA_CREDENTIAL); mIdpResponse = getIntent().getParcelableExtra(ExtraConstants.EXTRA_IDP_RESPONSE); mHandler.getSaveOperation().observe(this, new Observer<Resource<Void>>() { @Override public void onChanged(@Nullable Resource<Void> resource) { if (resource == null) { Log.w(TAG, "getSaveOperation:onChanged:null"); return; } onSaveOperation(resource); } }); mHandler.getPendingResolution().observe(this, new Observer<PendingResolution>() { @Override public void onChanged(@Nullable PendingResolution resolution) { if (resolution == null) { Log.w(TAG, "getPendingResolution:onChanged: null"); return; } onPendingResolution(resolution); } }); Resource<Void> currentOp = mHandler.getSaveOperation().getValue(); if (currentOp == null) { mHandler.saveCredentials(credential); } }