firebase


Firebase snapshot getValue could not pars int suddenly


I hade a strange happening today with my Firebase project.
Suddenly the
AddressChatMessage chatMessage = snapshot.getValue(AddressChatMessage.class);
parsed everything ok for the AddressChatMessage except for one int.
Took me 2 hour until i tried this, setting the field to public
public int type;
Note I use this code for weeks without problem and today Android studio made some core updated to 2.3.2 and maybe that trigger this strange event.
Here´s the AddressChatMessage.java nothing strange except that the public int type cannot be private, if it is, it will be zero, that too is strange, usually Firebase give out a logcat warning when pojo parsing fails. I have 10 other modell classes like this with plenty of int´s
#IgnoreExtraProperties
public class AddressChatMessage {
// [START Firebase keys inside AddressChatMessage ]
#Exclude
public static final String TYPE = "type";
#Exclude
public static final String SENDER_ID = "senderId";
#Exclude
public static final String MESSAGE = "message";
#Exclude
public static final String FILENAME = "fileName";
#Exclude
public static final String DOWNLOAD_URI = "downloadUri";
#Exclude
public static final String TIME = "time";
// [STOP Firebase keys inside AddressChatMessage ]
public int type;
private String senderId;
private String message;
private String fileName;
private String downloadUri;
#Exclude
private long time;
#Exclude
private String messageId;
public AddressChatMessage() {
}
public AddressChatMessage(int type, String senderUid) {
this.senderId = senderUid;
this.type = type;
}
public AddressChatMessage(int type, String senderUid, String message) {
this.type = type;
this.senderId = senderUid;
this.message = message;
}
private int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getSenderId() {
return senderId;
}
public void setSenderId(String senderId) {
this.senderId = senderId;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getDownloadUri() {
return downloadUri;
}
public void setDownloadUri(String downloadUri) {
this.downloadUri = downloadUri;
}
public long getTime() {
return time;
}
public String getMessageId() {
return messageId;
}
public void setMessageId(String messageId) {
this.messageId = messageId;
}
#Exclude
public Map<String, Object> toMap() {
HashMap<String, Object> result = new HashMap<>();
result.put(TYPE, type);
result.put(SENDER_ID, senderId);
result.put(MESSAGE, message);
result.put(FILENAME, fileName);
result.put(DOWNLOAD_URI, downloadUri);
result.put(TIME, time);
return result;
}
#Exclude
public boolean isTypeNormal() {
return getType() == ChatAdapter.MessageType.NORMAL.ordinal();
}
#Exclude
public boolean isTypeImage() {
return getType() == ChatAdapter.MessageType.IMAGE.ordinal();
}
}
When cleaning the code using Lint. Lint suggested changes like "This can be private instead of public" - I accidentally set the getType() to private access.

Related Links

Root authorization for providers in firebase
Firebase RemoteConfig FetchTime does not work on Unity
Run Firebase cloud functions locally? [duplicate]
Firebase security rules newData.val() compared to data.val()
Please fix your application to end transactions in progress properly and to close the database when it is no longer needed
How to use 'orderByChild' in the nested children on firebase?
Does Firebase Allow Address Book Access?
Firebase database rule to read all the child nodes of a particular parent but apply read rules for each child nodes
Project missing from firebase console
React Native and Firebase authentication
How to know whether the Register Email is verified or not in Firebase?
Firebase dashboard upgrade
Why does this “.indexOn” not work?
Firebase database rule $id doesnt work
NodeMCU, Lua http.get() “Disconnected with error 8” - what is error 8?
Ionic 2 Firebase Cloud Messaging Notifications - Xcode says Connected to FCM, but message never comes through

Categories

HOME
orientdb
mousemove
tcsh
initialization
nsis
header
ipv6
google-search-console
graphql-js
scheduler
bellman-ford
swarm
spring-security-oauth2
alljoyn
business-intelligence
bootstrap-switch
multi-step
google-awareness
bnf
pywinauto
mixpanel
gmp
http-authentication
psql
el
altium-designer
batch-rename
quartz.net
mod-wsgi
router
ipa
uri
hdmi
network-analysis
jackrabbit-oak
microprocessors
audit
windows2012
wampsharp
universal
kendo-listview
gnu-classpath
pdfnet
spinner
eclipse-gmf
tidal-scheduler
classnotfoundexception
hdiv
haar-classifier
httphandler
git-tfs
docker-ucp
android-5.0-lollipop
lightning-workbench
winston
android-sharing
zend-server
wildfly-9
d3v4
petsc
pjax
clp
ftp-client
maven-release-plugin
meld
ajaxmin
node-glob
processor
verisign
preferenceactivity
webgrind
odesk
miniconda
arbre
dsa
incron
cakephp-2.2
berkeley-db-xml
rails-api
flipboard
django-sites
principalcontext
spring-security-acl
ctp
grails-2.3
mute
yii-booster
revmob
sql-view
ldif
jquery-lazyload
aero
itunes-sdk
jquery-dialog
nsmutablestring
uitextfielddelegate
kaazing
navigationcontroller
fbml
differentiation
glassfish-esb
motodev-studio
data-dump
space-partitioning
kohana-auth
simile
servlet-container
aggregator
dm
bucket
gtktextview
database-cloning

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App