jcabi-github icon indicating copy to clipboard operation
jcabi-github copied to clipboard

User.Smart Null values for string return errors

Open chbrown13 opened this issue 6 years ago • 3 comments

I am trying to get information for GitHub users, namely email addresses. When using a User.Smart object, calling the email() and bio() functions fail with a ClassCastException shown below:

User.Smart user = new User.Smart(github.users().get(username));
System.out.println(user.email());
java.lang.ClassCastException: Cannot cast javax.json.JsonValue$1 to javax.json.JsonString
	at java.lang.Class.cast(Class.java:3369)
	at com.jcabi.github.SmartJson.value_aroundBody6(SmartJson.java:139)
	at com.jcabi.github.SmartJson$AjcClosure7.run(SmartJson.java:1)
	at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
	at com.jcabi.aspects.aj.MethodLogger.wrap(MethodLogger.java:213)
	at com.jcabi.aspects.aj.MethodLogger.ajc$inlineAccessMethod$com_jcabi_aspects_aj_MethodLogger$com_jcabi_aspects_aj_MethodLogger$wrap(MethodLogger.java:1)
	at com.jcabi.aspects.aj.MethodLogger.wrapClass(MethodLogger.java:140)
	at com.jcabi.github.SmartJson.value(SmartJson.java:116)
	at com.jcabi.github.SmartJson.text_aroundBody0(SmartJson.java:79)
	at com.jcabi.github.SmartJson$AjcClosure1.run(SmartJson.java:1)
	at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
	at com.jcabi.aspects.aj.MethodLogger.wrap(MethodLogger.java:213)
	at com.jcabi.aspects.aj.MethodLogger.ajc$inlineAccessMethod$com_jcabi_aspects_aj_MethodLogger$com_jcabi_aspects_aj_MethodLogger$wrap(MethodLogger.java:1)
	at com.jcabi.aspects.aj.MethodLogger.wrapClass(MethodLogger.java:140)
	at com.jcabi.github.SmartJson.text(SmartJson.java:79)
	at com.jcabi.github.User$Smart.email_aroundBody16(User.java:232)
	at com.jcabi.github.User$Smart$AjcClosure17.run(User.java:1)
	at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
	at com.jcabi.aspects.aj.MethodLogger.wrap(MethodLogger.java:213)
	at com.jcabi.aspects.aj.MethodLogger.ajc$inlineAccessMethod$com_jcabi_aspects_aj_MethodLogger$com_jcabi_aspects_aj_MethodLogger$wrap(MethodLogger.java:1)
	at com.jcabi.aspects.aj.MethodLogger.wrapClass(MethodLogger.java:140)
	at com.jcabi.github.User$Smart.email(User.java:232)
	at com.chbrown13.tool_rec.Recommender.main(Recommender.java:196)

chbrown13 avatar Feb 12 '19 18:02 chbrown13

@amihaiemil/z please, pay attention to this issue

0crat avatar Feb 12 '19 18:02 0crat

@chbrown13/z this project will fix the problem faster if you donate a few dollars to it; just click here and pay via Stripe, it's very fast, convenient and appreciated; thanks a lot!

0crat avatar Feb 12 '19 18:02 0crat

Never mind, only appears for users without email addresses. Was expecting a null value instead of an error.

chbrown13 avatar Feb 12 '19 19:02 chbrown13