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

Firebase User auth create user
Modeling nested structures and filtering them
Using Firebase with React Native [on hold]
Firebase snapshot getValue could not pars int suddenly
Redux, Firebase, and react-native: fetch data async
Firebase realtime databse offline persistence in Unity
Firebase Cloud Messaging (FCM) notifications doesn't work on devices behind proxy. Is there any alternative way to solve it?
Two accounts made with same email bug - Firebase Auth
Gmail auth has higher authority over Facebook auth - Firebase authentication [duplicate]
Cloud Functions for Firebase: How to get event.data.ref.parent.child(“xxx”).val?
Actually when update button is clicked i want to update address and description. update()is not working what are the parameters to put?
Can I create a user on Firebase Authentication in Cloud Functions Http Trigger?
clang: error: linker command failed with exit code 1(Firebase)
Confusion about concurrent connections [duplicate]
Firebase CLI is not authenticating because Google account is not retaining authorization
Firebase Database Rules Using an unspecified index

Categories

HOME
adfs3.0
seedstack
qc
writefile
portable-class-library
nsis
dependencies
capistrano
amazon-emr
orc
fullcalendar-scheduler
freertos
texas-instruments
google-tasks-api
reselect
significance
sqlplus
stackexchange.redis
pymongo
mod-wsgi
dragula
web-config-transform
password-generator
onchange
amazon-cloudtrail
ibm-connections
openbr
progid
argv
python-2.x
opnet
fotorama
apptentive
stackpanel
forms-authentication
eclipse-gmf
unification
xll
fluid-mac-app-engine
jqgrid-asp.net
transparency
liteide
nothing
non-linear-regression
hibernate-ogm
node-apn
punctuation
android-sharing
clrs
swiperefreshlayout
ltrace
mifos
elastic4s
okio
always-on-top
nsdata
jtag
wicked-pdf
node-glob
django-redis
preferenceactivity
ioexception
msgpack
arbre
lowercase
blockquote
gql
wlanapi
replicaset
bootstrap-wysiwyg
console.log
deque
android-audiomanager
incron
google-hangouts
cakephp-2.2
ildasm
berkeley-db-xml
jini
commenting
miglayout
principalcontext
smips
facebook-game-groups
apache-shindig
ntlmv2
xcode4.5
gamesalad
trialware
exponent
dropshadow
netstream
n-queens
fbml
servercontrol
startupscript
photo-management
asp.net-mvc-views
principles
iphone-sdk-4.3
getimagesize
bucket
processors
fuzzy-comparison

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