Skip to content

Instantly share code, notes, and snippets.

@cvrebert
Created April 14, 2015 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cvrebert/fbf0f030515bd272b54e to your computer and use it in GitHub Desktop.
Save cvrebert/fbf0f030515bd272b54e to your computer and use it in GitHub Desktop.
Trying to get createdAt of an MkComment throws IllegalStateException
import java.io.IOException;
import java.util.Date;
import com.jcabi.github.*;
import com.jcabi.github.mock.*;
public class Main {
public static void main(String[] args) throws IOException {
Github gh = new MkGithub("mock_gh");
Comment cmt = gh
.repos().create(javax.json.Json.createObjectBuilder().add("name", "foobar").build())
.issues().create("Title", "Description")
.comments().post("Comment");
Date created = new Comment.Smart(cmt).createdAt();
}
}
2015-04-14 06:52:43,928 [ERROR] com.jcabi.aspects.aj.MethodValidator - JSR-303 validator failed to initialize: Unable to create a Configuration, because no Bean Validation provider could be found. Add a provider like Hibernate Validator (RI) to your classpath. (see http://aspects.jcabi.com/jsr-303.html)
2015-04-14 06:52:43,965 [INFO ] com.jcabi.aspects.aj.NamedThreads - jcabi-aspects 0.20.1/f0aff93 started new daemon thread jcabi-loggable for watching of @Loggable annotated methods
2015-04-14 06:52:44,092 [INFO ] com.jcabi.github.mock.MkRepos - repository mock_gh/foobar created by mock_gh
2015-04-14 06:52:44,116 [INFO ] com.jcabi.github.mock.MkIssues - issue #1 created in mock_gh/foobar by mock_gh: Title
2015-04-14 06:52:44,142 [INFO ] com.jcabi.github.mock.MkComments - comment #1 posted to issue #1 by mock_gh: Comment
2015-04-14 06:52:44,188 [ERROR] com.jcabi.github.SmartJson - #value('created_at', 'interface javax.json.JsonString'): thrown java.lang.IllegalStateException('created_at' is absent in JSON: {"number":"1","body":"Comment","user":{"login":"mock_gh","created_at":"2015-04-14T06:52:44Z","updated_at":"2015-04-14T06:52:44Z"}}) out of com.jcabi.github.SmartJson#value_aroundBody6[122] in 32ms
Exception in thread "main" java.lang.IllegalStateException: 'created_at' is absent in JSON: {"number":"1","body":"Comment","user":{"login":"mock_gh","created_at":"2015-04-14T06:52:44Z","updated_at":"2015-04-14T06:52:44Z"}}
2015-04-14 06:52:44,188 [ERROR] com.jcabi.github.SmartJson - #text('created_at'): thrown java.lang.IllegalStateException('created_at' is absent in JSON: {"number":"1","body":"Comment","user":{"login":"mock_gh","created_at":"2015-04-14T06:52:44Z","updated_at":"2015-04-14T06:52:44Z"}}) out of com.jcabi.github.SmartJson#value_aroundBody6[122] in 33ms
at com.jcabi.github.SmartJson.value_aroundBody6(SmartJson.java:122)
at com.jcabi.github.SmartJson$AjcClosure7.run(SmartJson.java:1)
2015-04-14 06:52:44,188 [ERROR] com.jcabi.github.Comment$Smart - #createdAt(): thrown java.lang.IllegalStateException('created_at' is absent in JSON: {"number":"1","body":"Comment","user":{"login":"mock_gh","created_at":"2015-04-14T06:52:44Z","updated_at":"2015-04-14T06:52:44Z"}}) out of com.jcabi.github.SmartJson#value_aroundBody6[122] in 34ms
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
at com.jcabi.aspects.aj.MethodLogger.wrap(MethodLogger.java:212)
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:136)
at com.jcabi.github.SmartJson.value(SmartJson.java:120)
at com.jcabi.github.SmartJson.text_aroundBody0(SmartJson.java:81)
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:212)
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:136)
at com.jcabi.github.SmartJson.text(SmartJson.java:81)
at com.jcabi.github.Comment$Smart.createdAt_aroundBody8(Comment.java:168)
at com.jcabi.github.Comment$Smart$AjcClosure9.run(Comment.java:1)
at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
at com.jcabi.aspects.aj.MethodLogger.wrap(MethodLogger.java:212)
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:136)
at com.jcabi.github.Comment$Smart.createdAt(Comment.java:168)
at Main.main(Main.java:13)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment