redouane59 / twittered

Twitter API client for Java developers
Apache License 2.0
238 stars 66 forks source link

v2.5 #242

Closed redouane59 closed 3 years ago

redouane59 commented 3 years ago
calves07 commented 3 years ago

ETA on this release?

redouane59 commented 3 years ago

ETA on this release?

I will try to release it next week-end as a maximum, stay tuned :)

calves07 commented 3 years ago

ETA on this release?

I will try to release it next week-end as a maximum, stay tuned :)

Anyway I can easily use this version before the official release?

redouane59 commented 3 years ago

Anyway I can easily use this version before the official release?

Yes I guess that you can just fork and build it locally

calves07 commented 3 years ago

I forked the project as suggested but I wasn't able to serialize the objects. I had to add implements Serializable in classes UserV2, UserData and UserPublicMetrics. Now yes, I can serialize objects.

redouane59 commented 3 years ago

I had to add implements Serializable in classes UserV2, UserData and UserPublicMetrics. Now yes, I can serialize objects.

That's not normal. Can you just launch the unit test testSerialization() in UserDeserializerV2Test.java and tell me if it passes ? Because on my side it is.

sonarcloud[bot] commented 3 years ago

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 174 Code Smells

46.0% 46.0% Coverage
0.0% 0.0% Duplication

calves07 commented 3 years ago

The test did pass, yes, but in my own project it still failed to serialize with

FileOutputStream fileOut = new FileOutputStream(file);
ObjectOutputStream out = new ObjectOutputStream(fileOut);
out.writeObject(object);
out.close();
fileOut.close();

After implementing Serializable, there are no longer exceptions and it works fine.

redouane59 commented 3 years ago

After implementing Serializable, there are no longer exceptions and it works fine.

Are you sure your project is using this new version ?

I just created the same test in class TweetDeserializerV2Test and it is working, with a UserData object inside the main object.

calves07 commented 3 years ago

Yes.

De: Redouane @.> Enviado: 5 de julho de 2021 14:19 Para: @.> Cc: @.>; @.> Assunto: Re: [redouane59/twittered] v2.5 (#242)

After implementing Serializable, there are no longer exceptions and it works fine.

Are you sure your project is using this new version ?

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/redouane59/twittered/pull/242#issuecomment-874107831, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AD34HLRQZICJ32WAK3ALQZLTWGWMLANCNFSM47YF64YA.

redouane59 commented 3 years ago

Can you please write to me here your full test please ?

calves07 commented 3 years ago

Just get a random UserV2 or User or UserData object.

Then call this function:

public static boolean serialize(Object object, String file) {
        try {
            FileOutputStream fileOut = new FileOutputStream(new File(file));
            ObjectOutputStream out = new ObjectOutputStream(fileOut);
            out.writeObject(object);
            out.close();
            fileOut.close();
        } catch (Exception ex) {
            return false;
        }
        return true;
    }

In my tests with a similar function, NotSerializableException was thrown.

redouane59 commented 3 years ago

Thank you very much, I'm currently debugging that :)

redouane59 commented 3 years ago

I just merge the PR https://github.com/redouane59/twittered/pull/249 . Could you just try this :

  @Test
  public void getAndSerializeUser() throws IOException {
    String userName = "RedouaneBali";
    User   result   = twitterClient.getUserFromUserName(userName);
    assertNotNull(TwitterClient.OBJECT_MAPPER.writeValueAsString(result));
    TwitterClient.OBJECT_MAPPER.writeValue(new File("../test_serialization.json"), result);
  }

On my side, after having added some @JsonIgnore annotations on methods which gave NPE on DTO classes, it's now working :)

sonarcloud[bot] commented 3 years ago

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 186 Code Smells

43.3% 43.3% Coverage
0.0% 0.0% Duplication