_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q168900
SPFRemoteProfile.getProfileOf
validation
public RemoteProfile getProfileOf(SPFPerson p) { if (p == null) { throw new NullPointerException(); } return new RemoteProfile(p, mInterface); }
java
{ "resource": "" }
q168901
TagsPicker.setChangeListener
validation
public void setChangeListener(OnChangeListener listener) { changeListener = listener; if (changeListener != null) { // add a listener to TagViewer for removed tags events tv.setOnRemovedTagListener(new TagsViewer.OnRemovedListener() { @Override pub...
java
{ "resource": "" }
q168902
ValidatorExtensions.getDocumentBuilderFactory
validation
public static DocumentBuilderFactory getDocumentBuilderFactory(final String schema) { System.setProperty(DOCUMENT_BUILDER_FACTORY_KEY, DOCUMENT_BUILDER_FACTORY_VALUE); final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); factory.setValidating(true); fa...
java
{ "resource": "" }
q168903
ValidatorExtensions.getDOMSource
validation
public static DOMSource getDOMSource(final File xml, final ErrorHandler errorHandler) throws SAXException, ParserConfigurationException, IOException { return new DOMSource(parse(xml, errorHandler)); }
java
{ "resource": "" }
q168904
ValidatorExtensions.getSchema
validation
public static Schema getSchema(final File xsd, final ErrorHandler errorHandler) throws SAXException { // Create a new instance for an XSD-aware SchemaFactory final SchemaFactory schemaFactory = SchemaFactory .newInstance(HTTP_WWW_W3_ORG_2001_XML_SCHEMA); // Set the ErrorHandler implementation. schemaFact...
java
{ "resource": "" }
q168905
ValidatorExtensions.parse
validation
public static Document parse(final File xml, final ErrorHandler errorHandler) throws SAXException, ParserConfigurationException, IOException { final DocumentBuilderFactory factory = getDocumentBuilderFactory(xml.getName()); final DocumentBuilder builder = factory.newDocumentBuilder(); builder.setErrorHandler(e...
java
{ "resource": "" }
q168906
ValidatorExtensions.validateSchema
validation
public static void validateSchema(final File xsd, final File xml, final ErrorHandler errorHandler) throws SAXException, ParserConfigurationException, IOException { final Schema schemaXSD = getSchema(xsd, errorHandler); // Create a Validator capable of validating XML files according to my custom schema. fin...
java
{ "resource": "" }
q168907
ValidatorExtensions.validateSchema
validation
public static boolean validateSchema(final String SchemaUrl, final String XmlDocumentUrl) throws SAXException, ParserConfigurationException, IOException { System.setProperty(DOCUMENT_BUILDER_FACTORY_KEY, DOCUMENT_BUILDER_FACTORY_VALUE); final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();...
java
{ "resource": "" }
q168908
SimpleTag.addChild
validation
public boolean addChild(final SimpleTag child) { if (getChildren() == null) { setChildren(ListFactory.newArrayList()); } return getChildren().add(child); }
java
{ "resource": "" }
q168909
SimpleTag.removeAttribute
validation
public String removeAttribute(final String name) { if (getAttributes() != null) { getAttributes().remove(name); } return null; }
java
{ "resource": "" }
q168910
SimpleTag.toVelocityTemplate
validation
public StringBuilder toVelocityTemplate() { final StringBuilder buffer = new StringBuilder(); buffer.append("<"); buffer.append("${").append(getName()).append(".name}\n"); if (getAttributes() != null && !getAttributes().isEmpty()) { buffer.append(" #foreach(" + "$attribute in $").append(getName()) .ap...
java
{ "resource": "" }
q168911
SimpleTag.toXmlString
validation
public String toXmlString() { final StringBuilder buffer = new StringBuilder(); buffer.append("<"); buffer.append(getName()); Optional<String> attr = TagExtensions.attributesToString(getAttributes()); if (attr.isPresent()) { buffer.append(attr.get()); } if (isEndTag()) { buffer.append(">"); ...
java
{ "resource": "" }
q168912
ServiceList.addServiceIfNotPresent
validation
public void addServiceIfNotPresent(WiFiP2pService service) { WfdLog.d(TAG, "addServiceIfNotPresent BEGIN, with size = " + serviceList.size()); if (service == null) { WfdLog.e(TAG, "Service is null, returning..."); return; } boolean add = true; for (WiFiP...
java
{ "resource": "" }
q168913
ServiceList.getServiceByDevice
validation
public WiFiP2pService getServiceByDevice(WifiP2pDevice device) { if (device == null) { return null; } WfdLog.d(TAG, "groupownerdevice passed to getServiceByDevice: " + device.deviceName + ", " + device.deviceAddress); WfdLog.d(TAG, "servicelist size: " + serviceList.size())...
java
{ "resource": "" }
q168914
SPFService.onStartCommand
validation
@Override public int onStartCommand(Intent intent, int flags, int startId) { if (intent == null) { return START_STICKY; } String action = intent.getAction(); if (ACTION_START_FOREGROUND.equals(action)) { if (!SPF.get().isConnected()) { SPF.ge...
java
{ "resource": "" }
q168915
SPFTriggerTable.getAllTriggers
validation
List<SPFTrigger> getAllTriggers(String appIdentifier) { String where = Contract.COLUMN_APP_IDENTIFIER + " = ?"; String[] whereArgs = { appIdentifier }; Cursor c = getReadableDatabase().query(Contract.TABLE_NAME, null, where, whereArgs, null, null, null); List<SPFTrigger> triggers = new ArrayList<SPFTrigger>(); ...
java
{ "resource": "" }
q168916
SPFTriggerTable.deleteAllTriggerOf
validation
boolean deleteAllTriggerOf(String appPackageName) { String where = Contract.COLUMN_APP_IDENTIFIER + " = ?"; String[] whereArgs = { appPackageName }; int c = getReadableDatabase().delete(Contract.TABLE_NAME, where, whereArgs); return c > 0; }
java
{ "resource": "" }
q168917
SPFTriggerTable.deleteTrigger
validation
boolean deleteTrigger(long id, String appPackageName) { String where = Contract.COLUMN_APP_IDENTIFIER + " = ? AND " + Contract._ID + " = ?"; String[] whereArgs = { appPackageName, Long.toString(id) }; int count = getReadableDatabase().delete(Contract.TABLE_NAME, where, whereArgs); return count > 0; }
java
{ "resource": "" }
q168918
SPFTriggerTable.getTrigger
validation
SPFTrigger getTrigger(long triggerId, String appPackageName) { String where = Contract._ID + " = ? AND " + Contract.COLUMN_APP_IDENTIFIER + " = ?"; String[] whereArgs = { Long.toString(triggerId), appPackageName }; Cursor c = getReadableDatabase().query(Contract.TABLE_NAME, null, where, whereArgs, null, null, nul...
java
{ "resource": "" }
q168919
SPFSecurityMonitor.validateAccess
validation
public AppAuth validateAccess(String accessToken, Permission permission) throws TokenNotValidException, PermissionDeniedException { AppAuth appAuth; if (accessToken == null) { throw new TokenNotValidException(); } appAuth = mAppRegistry.getAppAuthorization(accessToken); if ((appAuth.getPermissionCode() &...
java
{ "resource": "" }
q168920
XmlToObjectExtensions.toObjectWithXStream
validation
public static <T> T toObjectWithXStream(final String xmlString, final Map<String, Class<?>> aliases) { return toObjectWithXStream(null, xmlString, aliases); }
java
{ "resource": "" }
q168921
XmlToObjectExtensions.toObjectWithXStream
validation
@SuppressWarnings("unchecked") public static <T> T toObjectWithXStream(XStream xstream, final String xmlString, final Map<String, Class<?>> aliases) { if (xstream == null) { xstream = new XStream(); } if (aliases != null) { for (final Map.Entry<String, Class<?>> alias : aliases.entrySet()) { ...
java
{ "resource": "" }
q168922
XmlToJsonExtensions.toJson
validation
public static String toJson(final String xmlString, final Map<String, Class<?>> aliases) { final Object object = XmlToObjectExtensions.toObjectWithXStream(xmlString); final XStream xstream = new XStream(new JettisonMappedXmlDriver()); if (aliases != null) { for (final Map.Entry<String, Class<?>> alias : ali...
java
{ "resource": "" }
q168923
InvocationStub.invokeMethod
validation
public Object invokeMethod(String methodName, Object[] args, Type retType) throws ServiceInvocationException { checkCurrentThread(methodName); Utils.notNull(methodName); Utils.notNull(args); // Let the target prepare the arguments if needed mInvocationTarget.prepareArguments(args); // Serialize arguments ...
java
{ "resource": "" }
q168924
InvocationStub.checkCurrentThread
validation
private void checkCurrentThread(String methodName) { if (Looper.myLooper() == Looper.getMainLooper()) { Log.w(TAG, String.format(WRONG_THREAD_MSG, mServiceDescriptor.getServiceName(), methodName)); } }
java
{ "resource": "" }
q168925
Utils.logCall
validation
public static void logCall(String tag, String methodName, Object... args) { if (SPFConfig.DEBUG) { Log.d(tag, "method call: " + methodName + "(" + (args != null ? TextUtils.join(",", args) : "") + ")"); } }
java
{ "resource": "" }
q168926
XmlExtensions.loadObject
validation
private static <T> T loadObject(final InputStream is) throws IOException { final String xmlString = ReadFileExtensions.inputStream2String(is); final T object = XmlToObjectExtensions.toObjectWithXStream(xmlString); return object; }
java
{ "resource": "" }
q168927
XmlExtensions.newTag
validation
public static String newTag(final String tagname, final String value, final Map<String, String> attributes) { final StringBuilder xmlTag = new StringBuilder(); xmlTag.append("<").append(tagname); if (attributes != null && !attributes.isEmpty()) { xmlTag.append(" "); int count = 1; for (final Map.Ent...
java
{ "resource": "" }
q168928
SearchResponder.matches
validation
public boolean matches(String queryJSON) { QueryContainer queryContainer; try { queryContainer = QueryContainer.fromJSON(queryJSON); } catch (JSONException e) { return false; } SPFQuery query = queryContainer.getQuery(); String callerApp = queryContainer.getCallerAppId(); String userUID = queryCont...
java
{ "resource": "" }
q168929
SPFServiceRegistry.dispatchInvocation
validation
public InvocationResponse dispatchInvocation(InvocationRequest request) { String appName = request.getAppName(); String serviceName = request.getServiceName(); String componentName = mServiceTable.getComponentForService(appName, serviceName); if (componentName == null) { return InvocationResponse.error("App...
java
{ "resource": "" }
q168930
SPFServiceRegistry.unregisterService
validation
public <T> void unregisterService(Class<? super T> serviceInterface) { Utils.notNull(serviceInterface, "serviceInterface must not be null"); ServiceValidator.validateInterface(serviceInterface, ServiceValidator.TYPE_PUBLISHED); ServiceInterface svcInterface = serviceInterface.getAnnotation(ServiceInterface.class)...
java
{ "resource": "" }
q168931
SearchScheduler.generateQueryId
validation
private String generateQueryId(QueryInfo queryInfo) { String queryId = SPF.get().getUniqueIdentifier() + (++id); queryInfo.setQueryId(queryId); return queryId; }
java
{ "resource": "" }
q168932
SearchScheduler.onInstanceLost
validation
void onInstanceLost(String uniqueIdentifier) { log(TAG, "instance lost " + uniqueIdentifier); List<String> queriesIds = results.get(uniqueIdentifier); if (queriesIds == null) { return; } for (String queryId : queriesIds) { String[] args = new String[2]; args[0] = queryId; args[1] = uniqueIdentifie...
java
{ "resource": "" }
q168933
SearchScheduler.stopSearch
validation
void stopSearch(String queryId) { QueryInfo info = queries.get(queryId); if(info != null){ stopSearch(info); } }
java
{ "resource": "" }
q168934
SearchScheduler.stopAllSearches
validation
void stopAllSearches(String appIdentifier) { List<QueryInfo> qinfos; synchronized (queries) { qinfos = new ArrayList<QueryInfo>(queries.values()); } for (QueryInfo queryInfo : qinfos) { if (queryInfo.getAppName().equals(appIdentifier)) { stopSearch(queryInfo); } } }
java
{ "resource": "" }
q168935
SPF.connect
validation
public static void connect(final Context context, final ConnectionListener listener) { Component.load(context, DESCRIPTOR, asBase(listener)); }
java
{ "resource": "" }
q168936
ProfileFieldViewFactory.createStandardDisplayView
validation
private <E> View createStandardDisplayView(ProfileField<E> field, E currentValue, ViewGroup viewContainer) { View result = mInflater.inflate(R.layout.profileview_field_listelement, viewContainer, false); String friendlyFieldName = mHelper.getFriendlyNameOfField(field); ((TextView) result.findViewById(R.id.profil...
java
{ "resource": "" }
q168937
ProfileFieldViewFactory.createSpinner
validation
private <E> View createSpinner(MultipleChoicheProfileField<E> field, E currentValue, FieldValueListener<E> listener, ViewGroup container) { View result = mInflater.inflate(R.layout.profileedit_field_multiplechoiche, container, false); String friendlyName = mHelper.getFriendlyNameOfField(field); ((TextView) resul...
java
{ "resource": "" }
q168938
ProfileFieldViewFactory.createDateView
validation
@SuppressWarnings("unchecked") private <E> View createDateView(final DateProfileField field, Date currentValue, final FieldValueListener<Date> listener, ViewGroup container) { View result = mInflater.inflate(R.layout.profileedit_field_date, container, false); String friendlyName = mHelper.getFriendlyNameOfField(fi...
java
{ "resource": "" }
q168939
ProfileFieldViewFactory.createTagView
validation
@SuppressWarnings("unchecked") private <E> View createTagView(TagProfileField field, String[] currentValue, FieldValueListener<E> listener, ViewGroup container, boolean editable) { View result = mInflater.inflate(editable ? R.layout.profileedit_field_tag : R.layout.profileview_tag_field, container, false); String...
java
{ "resource": "" }
q168940
ProfileFieldViewFactory.createStandardEditView
validation
private <E> View createStandardEditView(ProfileField<E> field, E currentValue, FieldValueListener<E> listener, ViewGroup container) { View result = mInflater.inflate(R.layout.profileedit_field_standard, container, false); String friendlyName = mHelper.getFriendlyNameOfField(field); ((TextView) result.findViewByI...
java
{ "resource": "" }
q168941
SPFRemoteInstance.sendNotification
validation
public final void sendNotification(String uniqueIdentifier, SPFActionSendNotification action) { if (uniqueIdentifier == null || action == null) { throw new NullPointerException(); } String actionJSON = action.toJSON(); sendNotification(uniqueIdentifier, actionJSON); }
java
{ "resource": "" }
q168942
XmlTransformation.toXml
validation
public String toXml() { final String lqSimpleName = this.getClass().getSimpleName().toLowerCase(); final Map<String, Class<?>> aliases = new HashMap<>(); aliases.put(lqSimpleName, this.getClass()); return ObjectToXmlExtensions.toXmlWithXStream(this, aliases); }
java
{ "resource": "" }
q168943
SPFApp.setContentViewWithMinimalElements
validation
private void setContentViewWithMinimalElements() { // Set data in the RemoteViews programmatically contentView.setImageViewResource(R.id.imageView, R.drawable.ic_launcher); contentView.setTextViewText(R.id.title_text_notification, getResources().getString(R.string.notification_title)); c...
java
{ "resource": "" }
q168944
Helper.getFriendlyNameOfField
validation
public String getFriendlyNameOfField(ProfileField<?> field) { String name = getStringFromResource(PROFILE_FIELD_PREFIX + field.getIdentifier()); if(name == null){ return field.getIdentifier(); } return name; }
java
{ "resource": "" }
q168945
EternalConnect.killScheduler
validation
private void killScheduler() { if (scheduler != null) { WfdLog.d(TAG, "scheduler killed"); scheduler.shutdown(); scheduler = null; } }
java
{ "resource": "" }
q168946
SPFContext.initialize
validation
public static synchronized void initialize(Context context, int goIntent, boolean isAutonomous, ProximityMiddleware.Factory factory) { if (context == null || factory == null) { throw new NullPointerException("Arguments cannot be null"); } ...
java
{ "resource": "" }
q168947
SPFContext.broadcastEvent
validation
public void broadcastEvent(final int code, final Bundle payload) { if (SPFConfig.DEBUG) { Log.d(TAG, "Broadcasting event " + code + " with payload " + payload); } for (final OnEventListener listener : mEventListeners) {//TODO is it thread safe? mHandler.post(new Runnable...
java
{ "resource": "" }
q168948
ProfileFragment.createViewSelfProfileFragment
validation
public static ProfileFragment createViewSelfProfileFragment() { Bundle b = new Bundle(); b.putInt(EXTRA_VIEW_MODE, Mode.SELF.ordinal()); ProfileFragment fragment = new ProfileFragment(); fragment.setArguments(b); return fragment; }
java
{ "resource": "" }
q168949
ProfileFragment.onProfileDataAvailable
validation
private void onProfileDataAvailable() { Log.d(TAG, "onProfileDataAvailable"); mFactory = new ProfileFieldViewFactory(getActivity(), mMode, mCurrentPersona, mContainer); String[] mPageTitles = this.getResources().getStringArray(R.array.profileedit_fragments_titles); tabLayout.removeAllT...
java
{ "resource": "" }
q168950
ProfileFragment.beginCrop
validation
public void beginCrop(Uri source) { Uri destination = Uri.fromFile(new File(this.getActivity().getCacheDir(), "cropped")); Crop.of(source, destination).asSquare().start(this.getActivity()); }
java
{ "resource": "" }
q168951
ProfileFragment.handleCrop
validation
public void handleCrop(int resultCode, Intent result) { if (resultCode == Activity.RESULT_OK) { Uri uri = Crop.getOutput(result); resultView.setImageURI(uri); InputStream inputStream = null; try { inputStream = new FileInputStream(uri.getPath()); ...
java
{ "resource": "" }
q168952
ObjectToJsonExtensions.toJson
validation
public static <T> String toJson(final T object, final boolean newMapper) throws JsonProcessingException { final ObjectMapper mapper = ObjectMapperFactory.getObjectMapper(newMapper); final String json = mapper.writeValueAsString(object); return json; }
java
{ "resource": "" }
q168953
TagsViewer.addTag
validation
public void addTag(String tag) { TagBubble tb = new TagBubble(getContext()); tb.setText(tag); tb.setEditable(editable); tb.setOnRemoveTagListener(bubbleClickListener); tags.add(tag.toString()); addView(tb); }
java
{ "resource": "" }
q168954
TagsViewer.setTags
validation
public void setTags(List<String> tags) { this.tags.clear(); removeAllViews(); for (String tag : tags) { addTag(tag); } }
java
{ "resource": "" }
q168955
SPFNotificationManager.saveTrigger
validation
public long saveTrigger(SPFTrigger trigger, String appPackageName) { trigger = mTriggerTable.saveTrigger(trigger, appPackageName); if (trigger != null) { if (mHandler != null) mHandler.postAddTrigger(trigger); return trigger.getId(); } else { r...
java
{ "resource": "" }
q168956
SPFNotificationManager.deleteTrigger
validation
public boolean deleteTrigger(long id, String appPackageName) { boolean success = mTriggerTable.deleteTrigger(id, appPackageName); if (success) { if (mHandler != null) mHandler.postRemoveTrigger(id); } return success; }
java
{ "resource": "" }
q168957
SPFNotificationManager.start
validation
public void start() { this.mHandlerThread = new HandlerThread("notification-handler-thread"); this.mHandlerThread.start(); this.mHandler = new SPFNotificationHandler(mHandlerThread.getLooper()); mHandler.postSetup(this); isRunning = true; }
java
{ "resource": "" }
q168958
WifiDirectMiddleware.startRegistration
validation
private void startRegistration() { // Create a string map containing information about your service. Map<String, String> mRecordMap = new HashMap<>(); mRecordMap.put(Configuration.PORT, Integer.toString(mPort)); mRecordMap.put(Configuration.IDENTIFIER, myIdentifier); // Service...
java
{ "resource": "" }
q168959
Tag.addAttribute
validation
public String addAttribute(final String name, final String value) { if (getAttributes() == null) { this.attributes = MapFactory.newLinkedHashMap(); } return getAttributes().put(name, value); }
java
{ "resource": "" }
q168960
ServiceWrapper.invokeMethod
validation
public InvocationResponse invokeMethod(InvocationRequest request) { String methodName = request.getMethodName(); if (!mMethodIndex.containsKey(methodName)) { String msg = String.format(ErrorMsg.METHOD_NOT_FOUND, methodName, mServiceDescriptor.getServiceName()); return InvocationResponse.error(msg); } Me...
java
{ "resource": "" }
q168961
CircleSelectSpinner.setSelection
validation
public void setSelection(String[] selection) { for (String sel : selection) { for (int j = 0; j < mItems.length; ++j) { if (mItems[j].equals(sel)) { mSelection[j] = true; } } } refreshDisplayValue(); }
java
{ "resource": "" }
q168962
CircleSelectSpinner.setSelection
validation
public void setSelection(int[] selectedIndicies) { for (int index : selectedIndicies) { if (index >= 0 && index < mSelection.length) { mSelection[index] = true; } else { throw new IllegalArgumentException("Index " + index + " is out of bounds."); } } refreshDisplayValue(); }
java
{ "resource": "" }
q168963
CircleSelectSpinner.getSelectedStrings
validation
public List<String> getSelectedStrings() { List<String> selection = new LinkedList<String>(); for (int i = 0; i < mItems.length; ++i) { if (mSelection[i]) { selection.add(mItems[i]); } } return selection; }
java
{ "resource": "" }
q168964
CircleSelectSpinner.getSelectedIndicies
validation
public List<Integer> getSelectedIndicies() { List<Integer> selection = new LinkedList<Integer>(); for (int i = 0; i < mItems.length; ++i) { if (mSelection[i]) { selection.add(i); } } return selection; }
java
{ "resource": "" }
q168965
ProfileFieldsFragment.onRefresh
validation
public void onRefresh() { mViewContainer.removeAllViews(); for (ProfileField<?> field : mFieldsToShow) { View child = mParent.createViewFor(field, mViewContainer); mViewContainer.addView(child); } }
java
{ "resource": "" }
q168966
AppCommunicationAgent.shutdown
validation
public void shutdown() { synchronized (this) { if (mShutdown) { return; } for (AppServiceProxy p : mProxies.values()) { if (p.isConnected()) { mContext.unbindService(p); mProxies.remove(p); } } mShutdown = true; } }
java
{ "resource": "" }
q168967
WriterHandler.insertNewLine
validation
private void insertNewLine() throws SAXException { try { writer.write(System.getProperty("line.separator")); } catch (final IOException e) { throw new SAXException("I/O error", e); } }
java
{ "resource": "" }
q168968
WriterHandler.writeToBuffer
validation
private void writeToBuffer() throws SAXException { if (stringBuilder == null) { return; } final String string = stringBuilder.toString().trim(); write(string); stringBuilder = null; }
java
{ "resource": "" }
q168969
ObjectToJsonQuietlyExtensions.toJsonQuietly
validation
public static <T> String toJsonQuietly(final T object) { try { return ObjectToJsonExtensions.toJson(object); } catch (final JsonProcessingException e) { log.log(Level.SEVERE, "An error occured when converting object to String.\nGiven object:" + object.toString() + "\n", e); } return nu...
java
{ "resource": "" }
q168970
Component.load
validation
protected static <C extends Component<C, I>, I extends IInterface> void load(final Context context, final Descriptor<C, I> descriptor, final ConnectionCallback<C> callback) { Utils.notNull(context, "context must not be null"); Utils.notNull(descriptor, "context must not be null"); if (AccessTokenManager.get(con...
java
{ "resource": "" }
q168971
Component.bindToService
validation
private static <C extends Component<C, I>, I extends IInterface> void bindToService(final Context context, final Descriptor<C, I> descriptor, final ConnectionCallback<C> callback) { Intent intent = new Intent(); intent.setComponent(SPFInfo.getSPFServiceComponentName()); intent.setAction(descriptor.getActionName(...
java
{ "resource": "" }
q168972
Component.disconnect
validation
public void disconnect() { try { mContext.unbindService(mConnection); } catch (Exception e) { Log.w(getClass().getSimpleName(), "Exception unbinding from service: ", e); } }
java
{ "resource": "" }
q168973
Component.handleError
validation
protected void handleError(SPFError err) { if (err.codeEquals(SPFError.TOKEN_NOT_VALID_ERROR_CODE)) { AccessTokenManager.get(mContext).invalidateToken(); } mCallback.onError(err); }
java
{ "resource": "" }
q168974
SPFTriggerEngine.refreshTriggers
validation
public void refreshTriggers(List<SPFTrigger> triggers2) { triggers.clear(); for (SPFTrigger trg : triggers2) { triggers.put(trg.getId(), trg); } }
java
{ "resource": "" }
q168975
ProfileTable.addPersona
validation
boolean addPersona(SPFPersona persona) { SQLiteDatabase db = getWritableDatabase(); String table = Contract.TABLE_PERSONAS; String nullColumnHack = null; ContentValues values = new ContentValues(); values.put(Contract.COLUMN_PERSONA, persona.getIdentifier()); if (db.insert(table, nullColumnHack, values) > 0...
java
{ "resource": "" }
q168976
ProfileTable.removePersona
validation
boolean removePersona(SPFPersona persona) { SQLiteDatabase db = getWritableDatabase(); if (persona.getIdentifier().equals("default")) { return false; } String table = Contract.TABLE_PERSONAS; String selection = Contract.COLUMN_PERSONA + " = ?"; String[] selectionArgs = { persona.getIdentifier() }; if ...
java
{ "resource": "" }
q168977
ActivityConsumerRouteTable.registerService
validation
public boolean registerService(SPFServiceDescriptor descriptor) { String appId = descriptor.getAppIdentifier(); String serviceName = descriptor.getServiceName(); for (String verb : descriptor.getConsumedVerbs()) { if (!registerServiceInternal(verb, serviceName, appId)) { return false; } Log.v(TA...
java
{ "resource": "" }
q168978
ApplicationRegistry.getAppAuthorizationByAppId
validation
AppAuth getAppAuthorizationByAppId(String appId) { String where = Contract.COLUMN_APP_IDENTIFIER + " = ?"; String args[] = { appId }; Cursor c = mRegistryTable.getReadableDatabase().query(Contract.TABLE_NAME, null, where, args, null, null, null); AppAuth auth = null; if (c.moveToFirst()) { auth = appAuthFr...
java
{ "resource": "" }
q168979
ApplicationRegistry.registerApplication
validation
public String registerApplication(AppDescriptor descriptor, SPFPersona persona) { String token = mTokenGenerator.generateAccessToken(); ContentValues cv = new ContentValues(); cv.put(Contract.COLUMN_APP_NAME, descriptor.getAppName()); cv.put(Contract.COLUMN_ACCESS_TOKEN, token); cv.put(Contract.COLUMN_APP_ID...
java
{ "resource": "" }
q168980
ApplicationRegistry.unregisterApplication
validation
public boolean unregisterApplication(String appIdentifier) { String where = Contract.COLUMN_APP_IDENTIFIER + " = ?"; String[] whereArgs = { appIdentifier }; if (mRegistryTable.getWritableDatabase().delete(Contract.TABLE_NAME, where, whereArgs) == 0) { return false; } if (SPF.get().getServiceRegistry().unr...
java
{ "resource": "" }
q168981
ApplicationRegistry.getPersonaOf
validation
public SPFPersona getPersonaOf(String appIdentifier) { SQLiteDatabase db = mRegistryTable.getReadableDatabase(); String table = Contract.TABLE_NAME; String[] columns = { Contract.COLUMN_PERSONA }; String selection = Contract.COLUMN_APP_IDENTIFIER + " = ? "; String[] selectionArgs = { appIdentifier }; String...
java
{ "resource": "" }
q168982
GroupOwnerActor.onMessageReceived
validation
void onMessageReceived(final WfdMessage msg) { threadPool.execute(new Runnable() { @Override public void run() { if (msg.getReceiverId().equals(myIdentifier)) { handle(msg); } else { route(msg); } ...
java
{ "resource": "" }
q168983
ClientsGuiList.addClientIfNotPresent
validation
public void addClientIfNotPresent(DeviceGuiElement device) { boolean add = true; for (DeviceGuiElement element : clients) { if (element != null && element.getName().equals(device.getName()) && element.getAddress().equals(device.getAddress())) { ...
java
{ "resource": "" }
q168984
SPF.connect
validation
public void connect() { if (!mMiddleware.isConnected()) { mMiddleware.connect(); } if (!mNotificationManager.isRunning()) { mNotificationManager.start(); } if (mAdvertiseManager.isAdvertisingEnabled()) { mMiddleware.registerAdvertisement(mAdv...
java
{ "resource": "" }
q168985
ProfileFieldContainer.getFieldValue
validation
public <E> E getFieldValue(ProfileField<E> field) { if (field == null) { throw new NullPointerException(); } String val = mFields.getString(field.getIdentifier()); return val == null ? null : ProfileFieldConverter.forField(field).fromStorageString(val); }
java
{ "resource": "" }
q168986
ProfileFieldContainer.isModified
validation
public boolean isModified() { for (String key : mStatus.keySet()) { FieldStatus status = getStatus(key); if (status == FieldStatus.DELETED || status == FieldStatus.MODIFIED) { return true; } } return false; }
java
{ "resource": "" }
q168987
SPFSearch.stopSearch
validation
public void stopSearch(int tag) { String queryId = mTagToId.get(tag); mTagToId.delete(tag); if (queryId != null && mCallbacks.remove(queryId) != null) { mSearchInterface.stopSearch(queryId); } }
java
{ "resource": "" }
q168988
SPFSearch.stopAllSearches
validation
public void stopAllSearches() { mTagToId.clear(); String[] queryIds = mCallbacks.keySet().toArray(new String[]{}); mCallbacks.clear(); for (String queryId : queryIds) { mSearchInterface.stopSearch(queryId); } }
java
{ "resource": "" }
q168989
SPFSearch.lookup
validation
public SPFPerson lookup(String identifier) { boolean isReachable = mSearchInterface.lookup(identifier); if (isReachable) { return new SPFPerson(identifier); } else { return null; } }
java
{ "resource": "" }
q168990
SPFProfileManager.getProfileFieldBulk
validation
public ProfileFieldContainer getProfileFieldBulk(PersonAuth auth, SPFPersona persona, String[] fields) { return mProfileTable.getProfileFieldBulk(persona, fields, auth); }
java
{ "resource": "" }
q168991
SPFProfileManager.getBaseInfo
validation
public BaseInfo getBaseInfo(SPFPersona persona) { ProfileFieldContainer pfc = getProfileFieldBulk(persona, ProfileField.IDENTIFIER, ProfileField.DISPLAY_NAME); return new BaseInfo(pfc.getFieldValue(ProfileField.IDENTIFIER), pfc.getFieldValue(ProfileField.DISPLAY_NAME)); }
java
{ "resource": "" }
q168992
XPathExtensions.getNodeList
validation
public static NodeList getNodeList(final String xml, final String xpathExpression) throws XPathExpressionException, ParserConfigurationException, SAXException, IOException { final DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setNamespaceAware(true); final DocumentBuilder...
java
{ "resource": "" }
q168993
LooperUtils.onMainThread
validation
public static <E> E onMainThread(Class<E> callbackInterface, final E callback) { Utils.notNull(callbackInterface, "callbackInterface must not be null"); Utils.notNull(callback, "callback must not be null"); final Handler handler = new Handler(Looper.getMainLooper()); final String tag = callback.getClass().getS...
java
{ "resource": "" }
q168994
PersonPermissionTable.getPersonAuthFrom
validation
public PersonAuth getPersonAuthFrom(String receivedTkn) { if (receivedTkn.equals("")) { return PersonAuth.getPublicAuth(); } String selection = RelationshipEntry.COLUMN_TKN + " = ? AND " + RelationshipEntry.COLUMN_REQUEST_STATUS + " = ?"; String[] selectionArgs = { receivedTkn, Integer.toString(REQUEST_ACCE...
java
{ "resource": "" }
q168995
PersonPermissionTable.createEntryForSentRequest
validation
public String createEntryForSentRequest(String targetUid, String password) throws GeneralSecurityException { // TODO Add it back later // if (entryExistsFor(targetUid) != REQUEST_NOT_EXIST) { // return ; // } String user_uuid = targetUid; String token = new IdentifierGenerator().generateAccessToken(); i...
java
{ "resource": "" }
q168996
PersonPermissionTable.createEntryForReceivedRequest
validation
public boolean createEntryForReceivedRequest(ContactRequest fr) { String user_uuid = fr.getUserIdentifier(); String receive_token = fr.getAccessToken(); int request_status = REQUEST_PENDING; if (insertNewEntry(user_uuid, receive_token, request_status)) { return true; } return false; }
java
{ "resource": "" }
q168997
PersonPermissionTable.entryExistsFor
validation
public int entryExistsFor(String userUID) { String selection = RelationshipEntry.COLUMN_USER_UUID + " = ?"; String[] selectionArgs = { userUID }; String[] columns = { RelationshipEntry.COLUMN_REQUEST_STATUS }; SQLiteDatabase db = getReadableDatabase(); Cursor cursor = db.query(RelationshipEntry.TABLE_PERSON_A...
java
{ "resource": "" }
q168998
PersonPermissionTable.confirmRequest
validation
public boolean confirmRequest(String targetUID, String password) throws GeneralSecurityException, WrongPassphraseException { SQLiteDatabase db = getWritableDatabase(); String table = RelationshipEntry.TABLE_PERSON_AUTH; String[] columns = { RelationshipEntry.COLUMN_TKN, RelationshipEntry.COLUMN_REQUEST_STATUS, Re...
java
{ "resource": "" }
q168999
XMLIndent.addClosingTag
validation
@Override public void addClosingTag(String tagName) { _indent.dec(); _xml.addXML(_indent.toString()); _xml.addClosingTag(tagName); _xml.addXML("\n"); }
java
{ "resource": "" }