Guest User

Untitled

a guest
Oct 22nd, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. Caused by java.lang.NullPointerException: Null lastPlatform
  2. x.x.x.x.AutoValue_Session. (SourceFile:27)
  3. x.x.x.x.Session.from (SourceFile:28)
  4. x.x.x.x.Session. (SourceFile:22)
  5. x.x.x.x.Session.from (SourceFile:32)
  6. [...]
  7.  
  8. sealed class Platform {
  9.  
  10. abstract val name : String
  11.  
  12. sealed class Local : Platform() {
  13.  
  14. object Default : Local() {
  15. override val name: String = "android"
  16. }
  17.  
  18. object Amazon : Local() {
  19. override val name: String = "android-amazon"
  20. }
  21. }
  22.  
  23. object Missing : ResumePlatform() {
  24. override val name: String = "missing"
  25. }
  26.  
  27. data class Remote(override val name: String) : ResumePlatform()
  28.  
  29. companion object {
  30. @JvmName("from")
  31. @JvmStatic
  32. operator fun invoke(name: String?): ResumePlatform = when (name) {
  33. Local.Default.name -> Local.Default
  34. Local.Amazon.name -> Local.Amazon
  35. Missing.name -> Missing
  36. null -> Missing
  37. else -> Remote(name)
  38. }
  39.  
  40. @JvmField
  41. val LOCAL : Platform = if (BuildConfig.amazon) Local.Amazon else Local.Generic
  42.  
  43. @JvmField
  44. val MISSING : Platform = Missing
  45. }
  46. }
  47.  
  48. @AutoValue
  49. public abstract class Session implements Serializable {
  50.  
  51. public static final Session NONE_FOUND = from(0, new DateTime(0), Platform.MISSING);
  52.  
  53. public static Session from(String id, @Nullable Platform lastPlatform) {
  54. Platform platform = lastPlatform == null ? Platform.MISSING : lastPlatform;
  55. return new AutoValue_Session(id, platform);
  56. }
  57.  
  58. public static Session from(RemoreSession remote) {
  59. return from(
  60. remote.id(),
  61. remote.lastPlatform()
  62. );
  63. }
  64.  
  65. public abstract String id();
  66.  
  67. public abstract Platform lastPlatform();
  68.  
  69. }
Add Comment
Please, Sign In to add comment