Page MenuHomePhabricator

Areas, Posts & Comments

Authored by CLOVIS on Aug 3 2018, 11:19 PM.


  • Added method WildFyre#connectToTestDB to decrease code duplication
  • Created the LazyMap class
  • Created the Area class
  • Created the Areas class, a helper class around the cache. More features to come.
  • Removed useless methods from LazyMap.
  • Testing Areas
  • Added the Areas to the Internal class
  • Removed @SuppressWarnings & remapped warnings 'weakeraccess' to WeakWarning, so they don't break the flow.

Fixes T251

Test Plan

Just run the tests :)

Diff Detail

rLIBWFJVA WildFyre Java Libary
Lint Not Applicable
Tests Not Applicable

Event Timeline

I'm just sending this as a prototype to show what's going on, this is not ready yet.

This way you can see what I'm doing. This is mostly the full code for the handling of Areas, but there are still a few errors. In the next few days I will make something similar for both Posts then Comments, so I'm pushing this in the meanwhile so you can tell me if there's any problem to solve.

  • Removed errors in refactorisation

This solves the problem we had about suppressing warnings for methods that were part of the API but were not used inside the lib, so the IDE would complain about them not being useful.

The idea is that this kind of warning (and only this kind) has been lowered to a weaker warning, so it doesn't show up as a problem needed to be fixed -- but it's still there and it still shows up in the IDE.

This way if this is actually an error, I can still see it, but it won't stop me from committing.

Also, this is project-wide, so no need to put @SuppressWarnings in every classes.


Make uppercase?


Why this token? You should get this token from the api


I don't understand what you mean


this is the token for the test DB, I need to initialize the API before every test case (they might be ran in different threads), so it's not much better not to have one more request here

  • The generated Javadoc now links to the native Java javadoc on the official website, and short qualifiers are used: "String" is displayed instead of "java.lang.String".
  • Added NoSuchEntityException
  • Better users & exception handlers
  • Better tests for Users
  • Descriptors can now throw NoSuchEntityException when updating
  • Better everything
  • Better exception handling for updates
  • Made Internal#throwCantConnect public so other parts of the API can use it (eg. Users)
  • Cleaning code of Internal
  • Better exceptions in Areas
  • Created the exception InvalidCredentialsException
  • Hide IssueInTransferException when possible
  • Testing that the correct exception is thrown when wrong credentials are provided.
  • Better exceptions using InvalidCredentialsException
  • Better exceptions using InvalidCredentialsException, and fixed bug with the contents of the JSON request.
  • Better exceptions handling
  • Better exception handling
  • Remove the user from the cache if it does not exist anymore.
  • Descriptors now handles different cache length per object, which means that, for example, Areas can be kept for 2 hours and Users for 30 minutes.
  • IssueInTransferException includes the JSON data in its message.
  • Fixed missing try-catch
  • Fixed bug where Users were not correctly loaded
  • Better exception handling
  • Test that the lib handles the case where an Area is requested but doesn't exist.
  • Areas now support expiration time
  • Areas now support a NoSuchEntityException when none is found, and they implement equals, hashCode & toString
  • Removed references in Javadoc to private attribute
  • Cleaning Areas & cleaning with Internal#clean

This is still a work-in-progress, coming soon are Comments & Posts. I think I'm done with Users & Areas.

  • Created the classes for the Posts
  • New files after IntelliJ update
  • Merge branch 'master'
  • Better file architecture in Area
  • Class to help throw exceptions when a field is missing in some JSON data
  • Created class PostData, that will store the data common to Posts and Drafts
  • Refactored the expiration mechanism to CacheManager
  • Added the Comment class
  • Added getters for Comments
  • Added the requests for posts & the loading of the list of posts.
  • Method toJsonSimple exports a PostData to JSON
  • Implement interface in Draft
  • Retrieve every post created by the logged-in user.
  • Exception-handling helpers to analyse the contents of the 'details'
  • The Post class with update methods.
  • Using new sampledata token & username/password
  • Usage of Optionals for the avatar, since some users do not have it
  • Hotfixing "Not a String" until T235
  • Fixed bug were the cache of Posts was never initialized
  • Method optionalField to get data from a JSON object if needed
  • Hotfix
  • equals, hashCode & toString in Comment
  • Testing comment
  • Initialize the Areas
  • Optimization & fixing bug with null values
  • Author can be nothing!
  • The author of a post can be null!
  • Load my posts
  • Add/remove drafts to the cache
  • Returning an int instead of a long
  • Testing Draft creation, editing, saving & deleting
  • Replacing Post IDs by Long instead of Integer, loading the drafts
  • The Draft class
  • Added IntelliJ settings for inspection

This is FINALLY ready for review!

Do not pay any attention to exception handling. While working on this diff, I noticed a design error in the exception system, which I'll address in T262. This is already long enough, I'm not going to include that much of a design overhaul to it.

This also uses the new sampledata :)


Why this ID?
And shouldnt this be a reputation model? Not area?

CLOVIS added inline comments.

it's the name of the Area as it appears in the URL (eg. "fun" for "Fun").

I need it to build the requests, other than that it's unused

This revision is now accepted and ready to land.Sep 30 2018, 6:33 PM
  • Merge branch 'master'
  • Getting the token from the server instead of hardcoding
  • Fixed wrong ID of post, with new sample-data system
This revision now requires review to proceed.Oct 5 2018, 7:26 PM
This revision is now accepted and ready to land.Oct 5 2018, 7:31 PM
CLOVIS added inline comments.

this is now retrieved from the API

This revision was automatically updated to reflect the committed changes.