auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void init(String username, String password, String email) { User user = new User(); user.setUsername(username); user.setEmail(email); user.setPassword(this.passwordEncoder.encode(password)); user.setEnabled(true); this.userRepository.save(user); if(Arrays.asList(this.environment.getActiveProfiles()).contains("development")) { this.initDevelopmentDatabase(); this.initCoduno(); } }

Target:
public void init(String username, String password, String email) { User user = new User(); user.setUsername(username); user.setEmail(email); user.setPassword(this.passwordEncoder.encode(password)); user.setEnabled(true); this.userRepository.save(user); if(Arrays.asList(this.environment.getActiveProfiles()).contains("development")) { this.initDevelopmentDatabase(); this.initOrganizationsAndUsers(); } }
Source:
public String getUsage(ICommandSender sender) { return new TextComponentTranslation("commands.bloodmagic.network." + getName() + ".usage").getFormattedText() + "\n" + help; }

Target:
public String getUsage(ICommandSender sender) { return "commands.bloodmagic.network." + getName() + ".usage"; }
Source:
private void warnIfProblematicConsistency(NodeContext nodeContext) { FailoverPriority failover = nodeContext.getCluster().getFailoverPriority(); if (failover != null && failover.getType().equals(CONSISTENCY)) { int voters = failover.getVoters(); List<Stripe> evenNodeStripes = nodeContext.getCluster().getStripes() .stream().filter(s -> (s.getNodeCount() + voters) % 2 == 0).collect(Collectors.toList()); if (evenNodeStripes.size() > 0) { StringBuilder warn = new StringBuilder(lineSeparator()); warn.append("===================================================================================================================" + lineSeparator()); warn.append("When a cluster is configured with failover-priority=consistency, stripes with an even number" + lineSeparator()); warn.append("of nodes plus voters are more likely to experience split brain situations." + lineSeparator()); warn.append("The following stripe(s) have an even number of nodes plus voters:" + lineSeparator()); for (Stripe s : evenNodeStripes) { warn.append(" Stripe: '" + s.getName() + "' has " + s.getNodeCount() + " nodes and " + voters + " voters." + lineSeparator()); } warn.append("===================================================================================================================" + lineSeparator()); LOGGER.warn(warn.toString()); } } }

Target:
private void warnIfProblematicConsistency(NodeContext nodeContext) { FailoverPriority failover = nodeContext.getCluster().getFailoverPriority(); if (failover.getType() == CONSISTENCY) { int voters = failover.getVoters(); List<Stripe> evenNodeStripes = nodeContext.getCluster().getStripes() .stream().filter(s -> (s.getNodeCount() + voters) % 2 == 0).collect(Collectors.toList()); if (evenNodeStripes.size() > 0) { StringBuilder warn = new StringBuilder(lineSeparator()); warn.append("===================================================================================================================" + lineSeparator()); warn.append("When a cluster is configured with failover-priority=consistency, stripes with an even number" + lineSeparator()); warn.append("of nodes plus voters are more likely to experience split brain situations." + lineSeparator()); warn.append("The following stripe(s) have an even number of nodes plus voters:" + lineSeparator()); for (Stripe s : evenNodeStripes) { warn.append(" Stripe: '" + s.getName() + "' has " + s.getNodeCount() + " nodes and " + voters + " voters." + lineSeparator()); } warn.append("===================================================================================================================" + lineSeparator()); LOGGER.warn(warn.toString()); } } }
Source:
private Connection getConnection() { if(WildFlySecurityManager.isChecking()) { return RemotingContext.getConnection(); } else { return WildFlySecurityManager.doUnchecked(new PrivilegedAction<Connection>() { @Override public Connection run() { return RemotingContext.getConnection(); } }); } }

Target:
private Connection getConnection() { if(WildFlySecurityManager.isChecking()) { return WildFlySecurityManager.doUnchecked(new PrivilegedAction<Connection>() { @Override public Connection run() { return RemotingContext.getConnection(); } }); } else { return RemotingContext.getConnection(); } }
Source:
public void processResponseEntity(HttpEntity responseEntity, LocalDocument doc) throws ProcessException { try { InputStream inputStream = responseEntity.getContent(); String content; if (responseEntity.getContentEncoding() != null) { Charset encoding = Charset.forName(responseEntity.getContentEncoding().getValue()); content = IOUtils.toString(inputStream, encoding); } else { content = IOUtils.toString(inputStream); } doc.putContentField(outputField, content); } catch (IOException e) { throw new ProcessException("Failed to read HTTP entity body", e); } catch (UnsupportedCharsetException e) { throw new ProcessException("Response used unsupported encoding", e); } }

Target:
public void processResponseEntity(HttpEntity responseEntity, LocalDocument doc) throws ProcessException { try { InputStream inputStream = responseEntity.getContent(); String content; if (responseEntity.getContentEncoding() != null) { Charset encoding = Charset.forName(responseEntity.getContentEncoding().getValue()); content = IOUtils.toString(inputStream, encoding); } else { content = IOUtils.toString(inputStream, fallbackEncoding); } doc.putContentField(outputField, content); } catch (IOException e) { throw new ProcessException("Failed to read HTTP entity body", e); } catch (UnsupportedCharsetException e) { throw new ProcessException("Response used unsupported encoding", e); } }
Source:
public EmailBuilder htmlFooter() { htmlFooter = String.format("<p>" + "If there are any questions about this process, please visit the " + "<a href=\"%s\">" + "ONC-ACB & ONC-ATL Portal</a> to submit a ticket." + "</p>" + "<p>Thank you!</p>" + "ONC CHPL Team", env.getProperty("splitDeveloper.help.url")); return this; }

Target:
public EmailBuilder htmlFooter() { htmlFooter = String.format("<p>" + "If there are any questions about this process, please visit the " + "<a href=\"%s\">" + "ONC-ACB & ONC-ATL Portal</a> to submit a ticket." + "</p>" + "<p>Thank you!</p>" + "ONC CHPL Team", env.getProperty("footer.url")); return this; }
Source:
public HttpResponse doSubmit(StaplerRequest req) throws IOException { StringBuilder whitelist = new StringBuilder(Util.fixNull(req.getParameter("whitelist"))); if (!whitelist.toString().endsWith("\n")) whitelist.append("\n"); Enumeration e = req.getParameterNames(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); if (name.startsWith("class:")) { whitelist.append(name.substring(6)).append("\n"); } } whitelisted.set(whitelist.toString()); String newRules = Util.fixNull(req.getParameter("filePathRules")); filePathRules.parseTest(newRules); filePathRules.set(newRules); return HttpResponses.redirectToDot(); }

Target:
public HttpResponse doSubmit(StaplerRequest req) throws IOException { StringBuilder whitelist = new StringBuilder(Util.fixNull(req.getParameter("whitelist"))); if (whitelist.charAt(whitelist.length() - 1) != '\n') whitelist.append("\n"); Enumeration e = req.getParameterNames(); while (e.hasMoreElements()) { String name = (String) e.nextElement(); if (name.startsWith("class:")) { whitelist.append(name.substring(6)).append("\n"); } } whitelisted.set(whitelist.toString()); String newRules = Util.fixNull(req.getParameter("filePathRules")); filePathRules.parseTest(newRules); filePathRules.set(newRules); return HttpResponses.redirectToDot(); }
Source:
public IStatus run(IProgressMonitor monitor) { if (session != null) { IEditingSession uiSession = SessionUIManager.INSTANCE.getUISession(session); Collection<DialectEditor> editors = uiSession.getEditors(); if (editors.isEmpty()) { session.save(monitor); } else { IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (activeWorkbenchWindow != null) { IEditorPart activeEditor = activeWorkbenchWindow.getActivePage().getActiveEditor(); if (editors.contains(activeEditor)) { activeEditor.doSave(monitor); } else session.save(monitor); } else { editors.iterator().next().doSave(monitor); } } } return Status.OK_STATUS; }

Target:
public IStatus run(IProgressMonitor monitor) { if (session != null) { Optional<IEditingSession> uiSession = Optional.ofNullable(SessionUIManager.INSTANCE.getUISession(session)); Collection<ISiriusEditor> attachedEditors = uiSession.map(IEditingSession::getSiriusEditors).orElse(Collections.emptyList()); IEditorPart activeEditor = EclipseUIUtil.getActiveEditor(); if (attachedEditors.contains(activeEditor)) { activeEditor.doSave(monitor); } else if (!attachedEditors.isEmpty()) { attachedEditors.iterator().next().doSave(monitor); } else { session.save(monitor); } } return Status.OK_STATUS; }
Source:
public void startElement( String namespaceURI, String localName, String rawName, Attributes atts) throws SAXException { if (localName.equals("GetCapabilities")) { LOGGER.finer("found capabilities start."); for (int i = 0, n = atts.getLength(); i < n; i++) { if (atts.getLocalName(i).equals("version")) { String version = atts.getValue(i); request.setVersion(version); } else if (atts.getLocalName(i).equals("updateSequence")) { request.setUpdateSequence(atts.getValue(i)); } else if (atts.getLocalName(i).equals("noRootLayer")) { request.setNoRootLayer(Boolean.valueOf(atts.getValue(i))); } } } }

Target:
public void startElement( String namespaceURI, String localName, String rawName, Attributes atts) throws SAXException { if (localName.equals("GetCapabilities")) { LOGGER.finer("found capabilities start."); for (int i = 0, n = atts.getLength(); i < n; i++) { if (atts.getLocalName(i).equals("version")) { String version = atts.getValue(i); request.setVersion(version); } else if (atts.getLocalName(i).equals("updateSequence")) { request.setUpdateSequence(atts.getValue(i)); } else if (atts.getLocalName(i).equals("rootLayer")) { request.setRootLayerEnabled(Boolean.valueOf(atts.getValue(i))); } } } }
Source:
protected JComponent getParameterPanel() { postContentTabbedPane = new ValidationTabbedPane(); argsPanel = new HTTPArgumentsPanel(); postContentTabbedPane.add(JMeterUtils.getResString("post_as_parameters"), argsPanel); int indx = TAB_PARAMETERS; if(showRawBodyPane) { tabRawBodyIndex = ++indx; postBodyContent = JSyntaxTextArea.getInstance(30, 50); postContentTabbedPane.add(JMeterUtils.getResString("post_body"), JTextScrollPane.getInstance(postBodyContent)); } if(showFileUploadPane) { tabFileUploadIndex = ++indx; filesPanel = new HTTPFileArgsPanel(); postContentTabbedPane.add(JMeterUtils.getResString("post_files_upload"), filesPanel); } JPanel wrapper = new JPanel(new BorderLayout()); wrapper.setBorder(BorderFactory.createTitledBorder("")); wrapper.add(postContentTabbedPane, BorderLayout.CENTER); return wrapper; }

Target:
protected JTabbedPane getParameterPanel() { postContentTabbedPane = new ValidationTabbedPane(); argsPanel = new HTTPArgumentsPanel(); postContentTabbedPane.add(JMeterUtils.getResString("post_as_parameters"), argsPanel); int indx = TAB_PARAMETERS; if(showRawBodyPane) { tabRawBodyIndex = ++indx; postBodyContent = JSyntaxTextArea.getInstance(30, 50); postContentTabbedPane.add(JMeterUtils.getResString("post_body"), JTextScrollPane.getInstance(postBodyContent)); } if(showFileUploadPane) { tabFileUploadIndex = ++indx; filesPanel = new HTTPFileArgsPanel(); postContentTabbedPane.add(JMeterUtils.getResString("post_files_upload"), filesPanel); } return postContentTabbedPane; }
Source:
protected String resolveRegisteredFunctionName(String functionName) { return getIgnoreCase(getRegisteredFunctions(), functionName); }

Target:
protected String resolveRegisteredFunctionName(String functionName) { return getIgnoreCase(STATIC_EMF_INTEGRATOR.getRegisteredFunctions(emf).keySet(), functionName); }
Source:
static boolean isUnresolvedSchema(final Schema schema) { return (schema.getType() == Schema.Type.RECORD && schema.getProp(UR_SCHEMA_ATTR) != null); }

Target:
static boolean isUnresolvedSchema(final Schema schema) { return (schema.getType() == Schema.Type.RECORD && schema.getProp(UR_SCHEMA_ATTR) != null && UR_SCHEMA_NAME.equals(schema.getName()) && UR_SCHEMA_NS.equals(schema.getNamespace())); }
Source:
public void stopping(Connection c) { m_isUp = false; if (!m_closing) { if (isPrimary()) { if (!m_hostMessenger.isShuttingDown()) { VoltDB.dropStackTrace("Received remote hangup from foreign host " + hostnameAndIPAndPort()); hostLog.warn("Received remote hangup from foreign host " + hostnameAndIPAndPort()); } m_hostMessenger.reportForeignHostFailed(m_hostId); } } }

Target:
public void stopping(Connection c) { m_isUp = false; if (!m_closing && isPrimary()) { if (!m_hostMessenger.isShuttingDown()) { VoltDB.dropStackTrace("Received remote hangup from foreign host " + hostnameAndIPAndPort()); hostLog.warn("Received remote hangup from foreign host " + hostnameAndIPAndPort()); } m_hostMessenger.reportForeignHostFailed(m_hostId); } }
Source:
void startTestCase(final TestCase testCase) { if (!testCase.getUri().equals(currentUri)) { currentUri = testCase.getUri(); currentFeatureName = testSources.getFeatureName(currentUri); } ensureUniqueTestName(testCase); currentTestCaseName = getUniqueTestName(testCase); resetSeverestResult(); final Bundle testStart = createBundle(currentFeatureName, currentTestCaseName); instrumentation.sendStatus(StatusCodes.START, testStart); }

Target:
void startTestCase(final TestCase testCase) { if (!testCase.getUri().equals(currentUri)) { currentUri = testCase.getUri(); currentFeatureName = testSources.getFeatureName(currentUri); } currentTestCaseName = calculateUniqueTestName(testCase); resetSeverestResult(); final Bundle testStart = createBundle(currentFeatureName, currentTestCaseName); instrumentation.sendStatus(StatusCodes.START, testStart); }
Source:
public void afterSLAViolated(SLAViolatedEvent event) { CaseFileInstance caseFile = getCaseFile((KieSession) event.getKieRuntime()); if (caseFile != null) { String caseId = ((WorkflowProcessInstanceImpl) event.getProcessInstance()).getCorrelationKey(); if (caseFile.getCaseId().equals(caseId)) { logger.debug("Case instance has SLA violation, escalating starting new process instance for {}", caseId, processId); CaseService caseService = (CaseService) ServiceRegistry.get().service(ServiceRegistry.CASE_SERVICE); Long slaViolationProcessInstanceId = caseService.addDynamicSubprocess(caseId, processId, null); logger.debug("Process instance with id was created to handler SLA violation for case {}", slaViolationProcessInstanceId, caseId); } } }

Target:
public void afterSLAViolated(SLAViolatedEvent event) { CaseFileInstance caseFile = getCaseFile((KieSession) event.getKieRuntime()); if (caseFile != null) { String caseId = ((WorkflowProcessInstanceImpl) event.getProcessInstance()).getCorrelationKey(); if (caseFile.getCaseId().equals(caseId)) { logger.debug("Case instance has SLA violation, escalating starting new process instance for {}", caseId, processId); CaseService caseService = (CaseService) ServiceRegistry.get().service(ServiceRegistry.CASE_SERVICE); Long slaViolationProcessInstanceId = caseService.addDynamicSubprocess(caseId, processId, null); logger.debug("Process instance with id was created to handle SLA violation for case {}", slaViolationProcessInstanceId, caseId); } } }
Source:
public static Cipher getInstance(CipherTransformation transformation) throws GeneralSecurityException { return getInstance(null, transformation); }

Target:
public static Cipher getInstance(CipherTransformation transformation) throws GeneralSecurityException { return getInstance(transformation, null); }
Source:
public void visitNode(Tree tree) { ListTree<TypeTree> thrownList = ((MethodTree) tree).throwsClauses(); Set<String> reported = new HashSet<>(); for (TypeTree typeTree : thrownList) { Type symbolType = typeTree.symbolType(); String fullyQualifiedName = symbolType.fullyQualifiedName(); if (!reported.contains(fullyQualifiedName)) { String isSubtypeOfAny = isSubclassOfAny(symbolType, thrownList); if (isSubtypeOfAny != null) { addIssue(typeTree, "Remove the declaration of thrown exception '" + fullyQualifiedName + "' which is a subclass of '" + isSubtypeOfAny + "'."); } else if (symbolType.isSubtypeOf("java.lang.RuntimeException")) { addIssue(typeTree, "Remove the declaration of thrown exception '" + fullyQualifiedName + "' which is a runtime exception."); } else if (declaredMoreThanOnce(fullyQualifiedName, thrownList)) { addIssue(typeTree, "Remove the redundant '" + fullyQualifiedName + "' thrown exception declaration(s)."); } reported.add(fullyQualifiedName); } } }

Target:
public void visitNode(Tree tree) { ListTree<TypeTree> thrownList = ((MethodTree) tree).throwsClauses(); Set<String> reported = new HashSet<>(); for (TypeTree typeTree : thrownList) { Type symbolType = typeTree.symbolType(); String fullyQualifiedName = symbolType.fullyQualifiedName(); if (!reported.contains(fullyQualifiedName)) { String superTypeName = isSubclassOfAny(symbolType, thrownList); if (superTypeName != null) { addIssue(typeTree, "Remove the declaration of thrown exception '" + fullyQualifiedName + "' which is a subclass of '" + superTypeName + "'."); } else if (symbolType.isSubtypeOf("java.lang.RuntimeException")) { addIssue(typeTree, "Remove the declaration of thrown exception '" + fullyQualifiedName + "' which is a runtime exception."); } else if (declaredMoreThanOnce(fullyQualifiedName, thrownList)) { addIssue(typeTree, "Remove the redundant '" + fullyQualifiedName + "' thrown exception declaration(s)."); } reported.add(fullyQualifiedName); } } }
Source:
public void read_events_by_time_and_type() { final Duration delta = Durations2.seconds(111); final Timestamp present = getCurrentTime(); final Timestamp past = subtract(present, delta); final Timestamp future = add(present, delta); final Event eventInPast = taskAdded(past); final Event eventInPresent = projectCreated(present); final Event eventInFuture = taskAdded(future); eventStore.append(eventInPast); eventStore.append(eventInPresent); eventStore.append(eventInFuture); final EventFilter taskAddedType = EventFilter.newBuilder() .setEventType(of(TaskAdded.class).value()) .build(); final EventStreamQuery query = EventStreamQuery.newBuilder() .setAfter(past) .addFilter(taskAddedType) .build(); final AtomicBoolean done = new AtomicBoolean(false); final Collection<Event> resultEvents = Collections.synchronizedSet(new HashSet<Event>()); eventStore.read(query, new ResponseObserver(resultEvents, done)); if (!done.get()) { fail("Please use the MoreExecutors.directExecutor in EventStore for tests."); } assertSize(1, resultEvents); final Event event = resultEvents.iterator() .next(); assertEquals(eventInFuture, event); }

Target:
public void read_events_by_time_and_type() { final Duration delta = Durations2.seconds(111); final Timestamp present = getCurrentTime(); final Timestamp past = subtract(present, delta); final Timestamp future = add(present, delta); final Event eventInPast = taskAdded(past); final Event eventInPresent = projectCreated(present); final Event eventInFuture = taskAdded(future); eventStore.append(eventInPast); eventStore.append(eventInPresent); eventStore.append(eventInFuture); final EventFilter taskAddedType = EventFilter.newBuilder() .setEventType(of(TaskAdded.class).value()) .build(); final EventStreamQuery query = EventStreamQuery.newBuilder() .setAfter(past) .addFilter(taskAddedType) .build(); final AtomicBoolean done = new AtomicBoolean(false); final Collection<Event> resultEvents = newConcurrentHashSet(); eventStore.read(query, new ResponseObserver(resultEvents, done)); if (!done.get()) { fail("Please use the MoreExecutors.directExecutor in EventStore for tests."); } assertSize(1, resultEvents); final Event event = resultEvents.iterator() .next(); assertEquals(eventInFuture, event); }
Source:
private void updateBranch() throws MergeException { if (mergeTip != null && (branchTip == null || branchTip != mergeTip)) { branchUpdate.setForceUpdate(false); branchUpdate.setNewObjectId(mergeTip); branchUpdate.setRefLogMessage("merged", true); try { switch (branchUpdate.update(rw)) { case NEW: case FAST_FORWARD: final Project.NameKey projectName = projectCache.get(destBranch.getParentKey()).getProject().getNameKey(); replication.scheduleUpdate(projectName, branchUpdate .getName()); break; default: throw new IOException(branchUpdate.getResult().name()); } } catch (IOException e) { throw new MergeException("Cannot update " + branchUpdate.getName(), e); } } }

Target:
private void updateBranch() throws MergeException { if (mergeTip != null && (branchTip == null || branchTip != mergeTip)) { branchUpdate.setForceUpdate(false); branchUpdate.setNewObjectId(mergeTip); branchUpdate.setRefLogMessage("merged", true); try { switch (branchUpdate.update(rw)) { case NEW: case FAST_FORWARD: final ProjectState ps = projectCache.get(destBranch.getParentKey()); final Project.NameKey projectName = ps.getProject().getNameKey(); replication.scheduleUpdate(projectName, branchUpdate .getName()); break; default: throw new IOException(branchUpdate.getResult().name()); } } catch (IOException e) { throw new MergeException("Cannot update " + branchUpdate.getName(), e); } } }
Source:
public void addExporter() { CreateModifyExporterDialogView dialog = new CreateModifyExporterDialogView(null, dialogService, preferences ); Optional<ExporterViewModel> exporter = dialogService.showCustomDialogAndWait(dialog); if ((exporter != null) && exporter.isPresent()) { exporters.add(exporter.get()); } }

Target:
public void addExporter() { CreateModifyExporterDialogView dialog = new CreateModifyExporterDialogView(null); Optional<ExporterViewModel> exporter = dialogService.showCustomDialogAndWait(dialog); if ((exporter != null) && exporter.isPresent()) { exporters.add(exporter.get()); } }
Source:
private void partitionIndexSegments(Map<Offset, IndexSegment> toRemove, Set<Offset> toRetain) { int i = 0; for (Map.Entry<Offset, IndexSegment> indexSegmentEntry : state.index.getIndexSegments().entrySet()) { if (indexSegmentEntry.equals(state.index.getIndexSegments().lastEntry()) || i % 3 != 0) { toRetain.add(indexSegmentEntry.getKey()); } else { toRemove.put(indexSegmentEntry.getKey(), indexSegmentEntry.getValue()); } i++; } }

Target:
private void partitionIndexSegments(Map<Offset, IndexSegment> toRemove, Set<Offset> toRetain) { int i = 0; for (Map.Entry<Offset, IndexSegment> indexSegmentEntry : state.index.getIndexSegments().entrySet()) { if (indexSegmentEntry.getValue().getEndOffset().compareTo(state.index.journal.getFirstOffset()) >= 0 || i % 3 != 0) { toRetain.add(indexSegmentEntry.getKey()); } else { toRemove.put(indexSegmentEntry.getKey(), indexSegmentEntry.getValue()); } i++; } }
Source:
public void testBlockingOnStoreAvailabilityChange() { Cache<Object, Object> cache = createManagerAndGetCache(false, 1); PollingPersistenceManager pm = new PollingPersistenceManager(); TestingUtil.replaceComponent(cache, PersistenceManager.class, pm, true); AdvancedAsyncCacheWriter asyncWriter = TestingUtil.getFirstWriter(cache); DummyInMemoryStore store = (DummyInMemoryStore) TestingUtil.extractField(AdvancedAsyncCacheWriter.class, asyncWriter, "actual"); store.setAvailable(true); cache.put(1, 1); eventually(() -> store.load(1) != null); assertEquals(1, store.size()); store.setAvailable(false); assertFalse(store.isAvailable()); int pollCount = pm.pollCount.get(); assertTrue(asyncWriter.isAvailable()); assertFalse(TestingUtil.extractField(asyncWriter, "delegateAvailable")); eventually(() -> pm.pollCount.get() > pollCount); assertTrue(pm.isAvailable()); cache.putAll(intMap(0, 10)); assertEquals(1, store.size()); assertFalse(asyncWriter.isAvailable()); eventually(() -> !pm.isAvailable()); Exceptions.expectException(StoreUnavailableException.class, () -> cache.putAll(intMap(10, 20))); assertEquals(1, store.size()); store.setAvailable(true); assertTrue(store.isAvailable()); assertTrue(asyncWriter.isAvailable()); eventually(pm::isAvailable); eventually(() -> 10 == store.size()); assertFalse(store.contains(10)); }

Target:
public void testBlockingOnStoreAvailabilityChange() { Cache<Object, Object> cache = createManagerAndGetCache(false, 1); PollingPersistenceManager pm = new PollingPersistenceManager(); TestingUtil.replaceComponent(cache, PersistenceManager.class, pm, true); AdvancedAsyncCacheWriter asyncWriter = TestingUtil.getFirstWriter(cache); DummyInMemoryStore store = (DummyInMemoryStore) TestingUtil.extractField(AdvancedAsyncCacheWriter.class, asyncWriter, "actual"); store.setAvailable(true); cache.put(1, 1); eventually(() -> store.load(1) != null); assertEquals(1, store.size()); store.setAvailable(false); assertFalse(store.isAvailable()); int pollCount = pm.pollCount.get(); eventually(() -> pm.pollCount.get() > pollCount); assertTrue(asyncWriter.isAvailable()); assertFalse(TestingUtil.extractField(asyncWriter, "delegateAvailable")); assertTrue(pm.isAvailable()); cache.putAll(intMap(0, 10)); assertEquals(1, store.size()); eventually(() -> !pm.isAvailable()); assertFalse(asyncWriter.isAvailable()); Exceptions.expectException(StoreUnavailableException.class, () -> cache.putAll(intMap(10, 20))); assertEquals(1, store.size()); store.setAvailable(true); assertTrue(store.isAvailable()); assertTrue(asyncWriter.isAvailable()); eventually(pm::isAvailable); eventually(() -> 10 == store.size()); assertFalse(store.contains(10)); }
Source:
protected RaftPartitionServer createServer(PartitionManagementService managementService) { final RaftPartitionServer raftPartitionServer = new RaftPartitionServer( this, config, managementService.getMembershipService().getLocalMember().id(), managementService.getMembershipService(), managementService.getMessagingService(), managementService.getPrimitiveTypes(), threadContextFactory); if (!deferredRoleChangeListeners.isEmpty()) { deferredRoleChangeListeners.forEach(raftPartitionServer::addRoleChangeListener); deferredRoleChangeListeners.clear(); } return raftPartitionServer; }

Target:
protected RaftPartitionServer createServer(PartitionManagementService managementService) { return new RaftPartitionServer( this, config, managementService.getMembershipService().getLocalMember().id(), managementService.getMembershipService(), managementService.getMessagingService(), managementService.getPrimitiveTypes(), threadContextFactory); }
Source:
void check() throws Exception { root = task.getContext().getNextPush(); task.execute(); IInterpreter interpreter = iRegistry.getInterpreter(root); assertNotNull("The $" + variableName + " should be available to reference the created instance", interpreter.evaluateEObject(root, "aql:" + variableName)); }

Target:
void check() throws Exception { root = task.getContext().getNextPush(); task.execute(); IInterpreter interpreter = iRegistry.getInterpreter(root); assertNotNull("The " + variableName + " variable should be available to reference the created instance", interpreter.evaluateEObject(root, "aql:" + variableName)); }
Source:
private Account getAccount(String id) { try { return restTemplate.getForObject(Account.URI, Account.class, id); } catch (GoodDataRestException e) { if (HttpStatus.NOT_FOUND.value() == e.getStatusCode()) { throw new AccountNotFoundException(Account.TEMPLATE.expand(id).toString(), e); } else { throw e; } } catch (RestClientException e) { throw new GoodDataException("Unable to get account", e); } }

Target:
public Account getAccount(String id) { try { return restTemplate.getForObject(Account.URI, Account.class, id); } catch (GoodDataRestException e) { if (HttpStatus.NOT_FOUND.value() == e.getStatusCode()) { throw new AccountNotFoundException(Account.TEMPLATE.expand(id).toString(), e); } else { throw e; } } catch (RestClientException e) { throw new GoodDataException("Unable to get account", e); } }
Source:
public void proxyConfiguration() throws Exception { server.await(); String mockProxyUser = "alpha"; String mockProxyPass = "alphaPass"; CloudantClient client = new CloudantClient("<LINK_0>", new ConnectOptions() .setProxyURL(new URL(server.getUrl())) .setProxyUser(mockProxyUser) .setProxyPassword(mockProxyPass)); client.executeRequest(Http.GET(client.getBaseUri())); boolean foundProxyAuthHeader = false; for (String line : server.getLastInputRequestLines()) { if (line.contains("Proxy-Authorization")) { foundProxyAuthHeader = true; Matcher m = Pattern.compile("Proxy-Authorization: Basic (.*)", Pattern .CASE_INSENSITIVE).matcher(line); assertTrue("The Proxy-Authorization header should match the pattern", m.matches()); assertEquals("There should be 1 group for the value", 1, m.groupCount()); final String encodedCreds = new ProxyAuthInterceptor(mockProxyUser, mockProxyPass) { String getEncodedCreds() { return encodedAuth; } }.getEncodedCreds(); assertEquals("The encoded credentials should match the expected value", encodedCreds, m.group(1)); } } assertTrue(foundProxyAuthHeader); }

Target:
public void proxyConfiguration() throws Exception { server.await(); String mockProxyUser = "alpha"; String mockProxyPass = "alphaPass"; CloudantClient client = new CloudantClient("<LINK_1>", new ConnectOptions() .setProxyURL(new URL(server.getUrl())) .setProxyUser(mockProxyUser) .setProxyPassword(mockProxyPass)); client.executeRequest(Http.GET(client.getBaseUri())); boolean foundProxyAuthHeader = false; for (String line : server.getLastInputRequestLines()) { if (line.contains("Proxy-Authorization")) { foundProxyAuthHeader = true; Matcher m = Pattern.compile("Proxy-Authorization: Basic (.*)", Pattern .CASE_INSENSITIVE).matcher(line); assertTrue("The Proxy-Authorization header should match the pattern", m.matches()); assertEquals("There should be 1 group for the value", 1, m.groupCount()); final String encodedCreds = new ProxyAuthInterceptor(mockProxyUser, mockProxyPass) { String getEncodedCreds() { return encodedAuth; } }.getEncodedCreds(); assertEquals("The encoded credentials should match the expected value", encodedCreds, m.group(1)); } } assertTrue(foundProxyAuthHeader); }
Source:
public void generatePage_WithSpecifiedQualifier_generatesStatsTableBody() { String testQualifier = "testQualifier"; configuration.setQualifier(FilenameUtils.removeExtension(SAMPLE_JSON), testQualifier); setUpWithJson(SAMPLE_JSON); configuration.addPresentationModes(PresentationMode.PARALLEL_TESTING); page = new FeaturesOverviewPage(reportResult, configuration); page.generatePage(); DocumentAssertion document = documentFrom(page.getWebPage()); TableRowAssertion[] bodyRows = document.getReport().getTableStats().getBodyRows(); assertThat(bodyRows).hasSize(2); TableRowAssertion firstRow = bodyRows[0]; firstRow.hasExactValues("1st feature", testQualifier, "10", "0", "0", "0", "0", "10", "1", "0", "1", "1:39.263", "Passed"); firstRow.hasExactCSSClasses("tagname", "", "passed", "", "", "", "", "total", "passed", "", "total", "duration", "passed"); firstRow.hasExactDataValues("", "", "", "", "", "", "", "", "", "", "", "99263122889", ""); firstRow.getReportLink().hasLabelAndAddress("1st feature", "report-feature_1920820787.html"); TableRowAssertion secondRow = bodyRows[1]; secondRow.hasExactValues("Second feature", testQualifier, "5", "1", "2", "1", "3", "12", "1", "2", "3", "0.092", "Failed"); secondRow.hasExactCSSClasses("tagname", "", "passed", "failed", "skipped", "pending", "undefined", "total", "passed", "failed", "total", "duration", "failed"); secondRow.hasExactDataValues("", "", "", "", "", "", "", "", "", "", "", "92610000", ""); secondRow.getReportLink().hasLabelAndAddress("Second feature", "report-feature_1_1515379431.html"); }

Target:
public void generatePage_WithSpecifiedQualifier_generatesStatsTableBody() { String testQualifier = "testQualifier"; configuration.setQualifier(FilenameUtils.removeExtension(SAMPLE_JSON), testQualifier); setUpWithJson(SAMPLE_JSON); configuration.addPresentationModes(PresentationMode.PARALLEL_TESTING); page = new FeaturesOverviewPage(reportResult, configuration); page.generatePage(); DocumentAssertion document = documentFrom(page.getWebPage()); TableRowAssertion[] bodyRows = document.getReport().getTableStats().getBodyRows(); assertThat(bodyRows).hasSize(2); TableRowAssertion firstRow = bodyRows[0]; firstRow.hasExactValues("1st feature", testQualifier, "10", "0", "0", "0", "0", "10", "1", "0", "1", "1:39.263", "Passed"); }
Source:
public ClientResponseImpl shouldAccept(AuthUser user, StoredProcedureInvocation invocation, Procedure sysProc) { if (!invocation.getProcName().equals("@UpdateClasses")) { return null; } ParameterSet params = invocation.getParams(); Object paramsArray = params.toArray(); if (paramsArray.length != 2) { return new ClientResponseImpl(ClientResponseImpl.UNEXPECTED_FAILURE, new VoltTable[0], "UpdateClasses system procedure requires exactly " + "two parameters, the bytes of the jarfile containing new class files " + "and the string containing class names to be deleted " + "(either of which may be null).", invocation.clientHandle); } if (paramsArray[0] != null) { boolean isHex = false; if (paramsArray[0] instanceof String) { isHex = Encoder.isHexEncodedString((String) paramsArray[0]); } if (!isHex && !(paramsArray[0] instanceof byte[])) { return new ClientResponseImpl(ClientResponseImpl.UNEXPECTED_FAILURE, new VoltTable[0], "UpdateClasses system procedure takes the " + "jarfile bytes as a byte array. The received parameter " + "is of type " + paramsArray[0].getClass() + ".", invocation.clientHandle); } } if (paramsArray[1] != null && !(paramsArray[1] instanceof String)) { return new ClientResponseImpl(ClientResponseImpl.UNEXPECTED_FAILURE, new VoltTable[0], "UpdateClasses system procedure takes the list of classes to be " + "deleted as a string. The received parameter " + "is of type " + paramsArray[0].getClass() + ".", invocation.clientHandle); } return null; }

Target:
public ClientResponseImpl shouldAccept(AuthUser user, StoredProcedureInvocation invocation, Procedure sysProc) { if (!invocation.getProcName().equals("@UpdateClasses")) { return null; } ParameterSet params = invocation.getParams(); final Object paramsArray = params.toArray(); if (paramsArray.length != 2) { return new ClientResponseImpl(ClientResponseImpl.UNEXPECTED_FAILURE, new VoltTable[0], "UpdateClasses system procedure requires exactly " + "two parameters, the bytes of the jarfile containing new class files " + "and the string containing class names to be deleted " + "(either of which may be null).", invocation.clientHandle); } if (paramsArray[0] != null) { boolean isHex = false; if (paramsArray[0] instanceof String) { isHex = Encoder.isHexEncodedString((String) paramsArray[0]); } if (!isHex && !(paramsArray[0] instanceof byte[])) { return new ClientResponseImpl(ClientResponseImpl.UNEXPECTED_FAILURE, new VoltTable[0], "UpdateClasses system procedure takes the " + "jarfile bytes as a byte array. The received parameter " + "is of type " + paramsArray[0].getClass() + ".", invocation.clientHandle); } } if (paramsArray[1] != null && !(paramsArray[1] instanceof String)) { return new ClientResponseImpl(ClientResponseImpl.UNEXPECTED_FAILURE, new VoltTable[0], "UpdateClasses system procedure takes the list of classes to be " + "deleted as a string. The received parameter " + "is of type " + paramsArray[0].getClass() + ".", invocation.clientHandle); } return null; }
Source:
public void testEncodeByMD5() { String encodeStr = "This is the content to be encoded"; try { String encodedByMD5 = DigestUtil.encodeByMD5(encodeStr.getBytes("utf-8")); assertNotNull(encodedByMD5); assertEquals(32, encodedByMD5.length()); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } }

Target:
public void testEncodeByMD5() { String encodeStr = "This is the content to be encoded"; try { String encodedByMD5 = DigestUtil.encodeByMD5(encodeStr.getBytes("utf-8")); assertNotNull(encodedByMD5); assertEquals(32, encodedByMD5.length()); } catch (UnsupportedEncodingException e) { log.error(e.getMessage(), e); } }
Source:
public void setGroupMembers_shouldSetGroupMembers () throws Exception { executeDataSet("obsWithGroupMembers.xml"); ObsResource1_8 resource = getResource(); Obs groupMemberParent = resource.getByUniqueId("47f18998-96cc-11e0-8d6b-9b9415a91423"); ArrayList<String> membersAfterUuidlist = new ArrayList<String>(); Set<Obs> groupMembersBefore = groupMemberParent.getGroupMembers(); Set<Obs> groupMembersAfter = (Set<Obs>) ObsResource1_8.getGroupMembers(resource.getByUniqueId("5117f5d4-96cc-11e0-8d6b-9b9415a91433")); for (Obs memberAfter : groupMembersAfter) { membersAfterUuidlist.add(memberAfter.getUuid()); } ObsResource1_8.setGroupMembers(groupMemberParent, membersAfterUuidlist); assertNotEquals(groupMembersBefore, groupMemberParent.getGroupMembers()); assertEquals(groupMembersAfter, groupMemberParent.getGroupMembers()); }

Target:
public void setGroupMembers_shouldSetGroupMembers () throws Exception { executeDataSet("obsWithGroupMembers.xml"); ObsResource1_8 resource = getResource(); Obs groupMemberParent = resource.getByUniqueId("47f18998-96cc-11e0-8d6b-9b9415a91423"); Set<Obs> groupMembersBefore = groupMemberParent.getGroupMembers(); Set<Obs> groupMembersAfter = (Set<Obs>) ObsResource1_8.getGroupMembers(resource.getByUniqueId("5117f5d4-96cc-11e0-8d6b-9b9415a91433")); ObsResource1_8.setGroupMembers(groupMemberParent, groupMembersAfter); assertNotEquals(groupMembersBefore, groupMemberParent.getGroupMembers()); assertEquals(groupMembersAfter, groupMemberParent.getGroupMembers()); }
Source:
private boolean plugNic() { PlugUnplugVmNicParameters plugParameters = createPlugUnPlugParameters(); plugParameters.setVmId(getParameters().getVmId()); VdcReturnValueBase plugVmNicReturnValue = Backend.getInstance().runInternalAction(VdcActionType.PlugUnplugVmNic, plugParameters, ExecutionHandler.createDefaultContexForTasks(getExecutionContext())); if (!plugVmNicReturnValue.getSucceeded()) { getReturnValue().getExecuteFailedMessages().add("Failed hot-plugging nic to VM"); getReturnValue().getCanDoActionMessages().addAll(plugVmNicReturnValue.getCanDoActionMessages()); getReturnValue().getCanDoActionMessages().remove(VdcBllMessages.VAR__ACTION__ADD); getReturnValue().setCanDoAction(false); } return plugVmNicReturnValue.getSucceeded(); }

Target:
private boolean plugNic() { PlugUnplugVmNicParameters plugParameters = createPlugUnPlugParameters(); VdcReturnValueBase plugVmNicReturnValue = Backend.getInstance().runInternalAction(VdcActionType.PlugUnplugVmNic, plugParameters, ExecutionHandler.createDefaultContexForTasks(getExecutionContext())); if (!plugVmNicReturnValue.getSucceeded()) { getReturnValue().getExecuteFailedMessages().add("Failed hot-plugging nic to VM"); getReturnValue().getCanDoActionMessages().addAll(plugVmNicReturnValue.getCanDoActionMessages()); getReturnValue().getCanDoActionMessages().remove(VdcBllMessages.VAR__ACTION__ADD.toString()); getReturnValue().setCanDoAction(false); } return plugVmNicReturnValue.getSucceeded(); }
Source:
private String getDataNeededByAllEntries(Vector<Entry> entries) { String needDatum = null; String neededDatumId = null; for (Entry e : entries) { SessionDatum datumNeededForThisEntry = getFirstMissingDatum(collectedDatums, e.getSessionDataReqs()); if (datumNeededForThisEntry != null) { if (neededDatumId == null) { neededDatumId = datumNeededForThisEntry.getDataId(); if (datumNeededForThisEntry.getNodeset() != null) { needDatum = SessionFrame.STATE_DATUM_VAL; } else { needDatum = SessionFrame.STATE_DATUM_COMPUTED; } } else if (!neededDatumId.equals(datumNeededForThisEntry.getDataId())) { return null; } } else { return null; } } return needDatum; }

Target:
private String getDataNeededByAllEntries(Vector<Entry> entries) { String datumNeededByAllEntriesSoFar = null; String neededDatumId = null; for (Entry e : entries) { SessionDatum datumNeededForThisEntry = getFirstMissingDatum(collectedDatums, e.getSessionDataReqs()); if (datumNeededForThisEntry != null) { if (neededDatumId == null) { neededDatumId = datumNeededForThisEntry.getDataId(); if (datumNeededForThisEntry.getNodeset() != null) { datumNeededByAllEntriesSoFar = SessionFrame.STATE_DATUM_VAL; } else { datumNeededByAllEntriesSoFar = SessionFrame.STATE_DATUM_COMPUTED; } } else if (!neededDatumId.equals(datumNeededForThisEntry.getDataId())) { return null; } } else { return null; } } return datumNeededByAllEntriesSoFar; }
Source:
void closeSockSync() { try { if (sock != null) { long startTime = Time.currentElapsedTime(); sock.close(); ServerMetrics.getMetrics().SOCKET_CLOSING_TIME.add(Time.currentElapsedTime() - startTime); } } catch (IOException e) { LOG.warn("Ignoring error closing connection to learner", e); } }

Target:
void closeSockSync() { try { if (sock != null) { long startTime = Time.currentElapsedTime(); sock.close(); ServerMetrics.getMetrics().SOCKET_CLOSING_TIME.add(Time.currentElapsedTime() - startTime); } } catch (IOException e) { LOG.warn("Ignoring error closing connection to learner {}", getSid(), e); } }
Source:
private void generateHelper(Service service) { initVariables(service); serviceMethods.forEach(x -> generateHelperCode(x)); try { javaBuffer.write(outDir); } catch (IOException exception) { exception.printStackTrace(); } }

Target:
private void generateHelper(Service service) { initVariables(service); serviceMethods.forEach(x -> generateHelperCode(x)); javaBuffer.addLine("}"); try { javaBuffer.write(outDir); } catch (IOException exception) { exception.printStackTrace(); } }
Source:
public void testForExisting() { String url = "/v2/identifiers/rs199692280?species=mmusculus&assembly=grcm38"; ResponseEntity<List<Variant>> response = restTemplate.exchange(url, HttpMethod.GET, null, new ParameterizedTypeReference<List<Variant>>() { }); assertEquals(HttpStatus.OK, response.getStatusCode()); assertTrue(response.getBody().size() > 0); }

Target:
public void testForExisting() { String url = "/v2/identifiers/rs199692280?species=mmusculus&assembly=grcm38"; ResponseEntity<List<Variant>> response = restTemplate.exchange(url, HttpMethod.GET, null, new ParameterizedTypeReference<List<Variant>>() { }); assertEquals(HttpStatus.OK, response.getStatusCode()); List<Variant> variantList = response.getBody(); assertTrue(variantList.size() > 0); assertEquals("20", variantList.get(0).getChromosome()); assertEquals("T", variantList.get(0).getAlternate()); assertEquals("A", variantList.get(0).getReference()); assertEquals(60100L, variantList.get(0).getStart()); assertEquals(60100L, variantList.get(0).getEnd()); }
Source:
public static QualifiedFunctionName of(String dottedName) { String[] parts = dottedName.split("\\."); if (parts.length != 3) { throw new PrestoException( INVALID_FUNCTION_ARGUMENT, format("Non-builtin functions must be reference by three parts: catalog.schema.function_name, found: %s", dottedName)); } return of(new CatalogSchemaName(parts[0], parts[1]), parts[2]); }

Target:
public static QualifiedFunctionName of(String dottedName) { String[] parts = dottedName.split("\\."); if (parts.length != 3) { throw new IllegalArgumentException("QualifiedFunctionName should have exactly 3 parts"); } return of(new CatalogSchemaName(parts[0], parts[1]), parts[2]); }
Source:
List<E> getValues(@NotNull GrStatementOwner closure) { List<E> result = Lists.newArrayList(); for (PsiElement element : closure.getChildren()) { List<E> values = getValues(element); if (values != null && !values.isEmpty()) { result.addAll(values); } } return result; }

Target:
public List<E> getValues(@NotNull GrStatementOwner closure) { List<E> result = Lists.newArrayList(); for (PsiElement element : closure.getChildren()) { List<E> values = getValues(element); if (values != null && !values.isEmpty()) { result.addAll(values); } } return result; }
Source:
public static List<BrooklinMetricInfo> getMetricInfos() { List<BrooklinMetricInfo> metrics = new ArrayList<>(); String className = EventProducer.class.getSimpleName(); metrics.add(new BrooklinCounterInfo(METRICS_PREFIX + EVENTS_PRODUCED_WITHIN_SLA)); metrics.add(new BrooklinCounterInfo(METRICS_PREFIX + EVENTS_PRODUCED_WITHIN_ALTERNATE_SLA)); metrics.add(new BrooklinCounterInfo(METRICS_PREFIX + TOTAL_EVENTS_PRODUCED)); metrics.add(new BrooklinMeterInfo(METRICS_PREFIX + EVENT_PRODUCE_RATE)); metrics.add(new BrooklinCounterInfo(METRICS_PREFIX + SKIPPED_BAD_MESSAGES_RATE)); metrics.add(new BrooklinCounterInfo(METRICS_PREFIX + EVENTS_PRODUCED_OUTSIDE_SLA)); metrics.add(new BrooklinCounterInfo(METRICS_PREFIX + EVENTS_PRODUCED_OUTSIDE_ALTERNATE_SLA)); metrics.add(new BrooklinHistogramInfo(METRICS_PREFIX + EVENTS_LATENCY_MS_STRING, Optional.of( Arrays.asList(BrooklinHistogramInfo.MEAN, BrooklinHistogramInfo.MAX, BrooklinHistogramInfo.PERCENTILE_50, BrooklinHistogramInfo.PERCENTILE_99, BrooklinHistogramInfo.PERCENTILE_999)))); metrics.add(new BrooklinHistogramInfo(METRICS_PREFIX + EVENTS_SEND_LATENCY_MS_STRING)); metrics.add(new BrooklinHistogramInfo(METRICS_PREFIX + FLUSH_LATENCY_MS_STRING)); return Collections.unmodifiableList(metrics); }

Target:
public static List<BrooklinMetricInfo> getMetricInfos() { List<BrooklinMetricInfo> metrics = new ArrayList<>(); String className = EventProducer.class.getSimpleName(); metrics.add(new BrooklinCounterInfo(METRICS_PREFIX + EVENTS_PRODUCED_WITHIN_SLA)); metrics.add(new BrooklinCounterInfo(METRICS_PREFIX + EVENTS_PRODUCED_WITHIN_ALTERNATE_SLA)); metrics.add(new BrooklinCounterInfo(METRICS_PREFIX + TOTAL_EVENTS_PRODUCED)); metrics.add(new BrooklinMeterInfo(METRICS_PREFIX + EVENT_PRODUCE_RATE)); metrics.add(new BrooklinCounterInfo(METRICS_PREFIX + SKIPPED_BAD_MESSAGES_COUNTER)); metrics.add(new BrooklinCounterInfo(METRICS_PREFIX + EVENTS_PRODUCED_OUTSIDE_SLA)); metrics.add(new BrooklinCounterInfo(METRICS_PREFIX + EVENTS_PRODUCED_OUTSIDE_ALTERNATE_SLA)); metrics.add(new BrooklinHistogramInfo(METRICS_PREFIX + EVENTS_LATENCY_MS_STRING, Optional.of( Arrays.asList(BrooklinHistogramInfo.MEAN, BrooklinHistogramInfo.MAX, BrooklinHistogramInfo.PERCENTILE_50, BrooklinHistogramInfo.PERCENTILE_99, BrooklinHistogramInfo.PERCENTILE_999)))); metrics.add(new BrooklinHistogramInfo(METRICS_PREFIX + EVENTS_SEND_LATENCY_MS_STRING)); metrics.add(new BrooklinHistogramInfo(METRICS_PREFIX + FLUSH_LATENCY_MS_STRING)); return Collections.unmodifiableList(metrics); }
Source:
public void onOpen(SQLiteDatabase db) { SQLiteDatabaseAdapter adapter = new SQLiteDatabaseAdapter(db); delegate.onOpen(adapter); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { delegate.onConfigure(adapter); } }

Target:
public void onOpen(SQLiteDatabase db) { SQLiteDatabaseAdapter adapter = new SQLiteDatabaseAdapter(db); if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) { delegate.onConfigure(adapter); } delegate.onOpen(adapter); }
Source:
public static void serialize( ObjectDataOutput out, Email object ) throws IOException { serializeMailAddresses( out, object.getFrom() ); serializeMailAddresses( out, object.getTo() ); serializeMailAddresses( out, object.getCc() ); serializeMailAddresses( out, object.getBcc() ); serializeMailAddresses( out, object.getReplyTo() ); out.writeUTF( object.getSubject() ); out.writeUTF( object.getSubjectEncoding() ); out.writeInt( object.getPriority() ); out.writeLong( object.getSentDate().getTime() ); serializeEmailMessages( out, object.getAllMessages() ); }

Target:
public static void serialize( ObjectDataOutput out, Email object ) throws IOException { serializeMailAddresses( out, object.getFrom() ); serializeMailAddresses( out, object.getTo() ); serializeMailAddresses( out, object.getCc() ); serializeMailAddresses( out, object.getBcc() ); serializeMailAddresses( out, object.getReplyTo() ); out.writeUTF( object.getSubject() ); out.writeUTF( object.getSubjectEncoding() ); out.writeInt( object.getPriority() ); Date sentDate = object.getSentDate(); boolean hasSentDate = ( sentDate != null ); out.writeBoolean( hasSentDate ); if ( hasSentDate ) { out.writeLong( object.getSentDate().getTime() ); } serializeEmailMessages( out, object.getAllMessages() ); }