Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with certain user profiles. #226

Closed
zack6849 opened this issue Sep 30, 2013 · 5 comments
Closed

Issue with certain user profiles. #226

zack6849 opened this issue Sep 30, 2013 · 5 comments

Comments

@zack6849
Copy link

I'm using the newest build for java, and i keep getting an error on this one profile, i know the profile is valid and stuff, i guess maybe valve had something they did the parser didn't expect?

Stack trace below

com.github.koraktor.steamcondenser.exceptions.SteamCondenserException: XML data could not be parsed.
at com.github.koraktor.steamcondenser.steam.community.SteamId.fetchData(SteamId.java:388)
at com.github.koraktor.steamcondenser.steam.community.SteamId.<init>(SteamId.java:297)
at com.github.koraktor.steamcondenser.steam.community.SteamId.create(SteamId.java:235)
at com.github.koraktor.steamcondenser.steam.community.SteamId.create(SteamId.java:127)
at test.Logging.main(Logging.java:25)
Caused by: java.text.ParseException: Unparseable date: "August 17"
at java.text.DateFormat.parse(DateFormat.java:357)
at com.github.koraktor.steamcondenser.steam.community.SteamId.fetchData(SteamId.java:362)
... 4 more

Related code i was using

public static void main(String[] args)
{
    try
    {
        SteamId id = SteamId.create(Long.valueOf("76561198103364730"));
        String avatar_url = id.getAvatarMediumUrl();
        String avatar_name = id.getNickname();
        System.out.println(avatar_name);
        System.out.println(avatar_url);
    } catch (SteamCondenserException ex)
    {
        Logger.getLogger(Logging.class.getName()).log(Level.SEVERE, null, ex);
    }
}
@koraktor
Copy link
Owner

koraktor commented Oct 1, 2013

Thanks for the report.

Usually, the memberSince field in the profile data has a format like "September 25, 2003". The data in the profile you're parsing is only "August 17". It seems like Valve now omits the year if the user joined in the current year.

@ghost ghost assigned koraktor Oct 1, 2013
@koraktor
Copy link
Owner

koraktor commented Oct 1, 2013

The big question here is, what happens if the current date is 10/20/2013, but the user joined on 10/21/2012? If we need to double check all dates if they are "valid" at the current time, there's quite a bit of code to write just for parsing that date.

I'll check if this is necessary and if it is, I'll think twice if we really need this.

@zack6849
Copy link
Author

zack6849 commented Oct 1, 2013

If it only omits it if it's the current year, why not just check if it contains a year, and if not assume the current year?
(probably isnt that easy, but perhaps that'd work as a temporary fix?)

@koraktor
Copy link
Owner

koraktor commented Oct 2, 2013

Well, that will be the first step. But depending on Valves output (which is bad because it's not an absolute value) there might be some fine tuning required.

  • Java: Fails hard when parsing such a relative date
  • Ruby: Time.parse already adds the current year
  • PHP: Currently doesn't format the date at all. DateFormat is only available in 5.2+, so this might be a good addition to the next major release.

koraktor added a commit to koraktor/steam-condenser-java that referenced this issue Oct 3, 2013
@koraktor
Copy link
Owner

koraktor commented Jan 1, 2014

Happy new year.

So it seems like the year is only omitted if it is the current year, so the workaround introduced for Java seems sufficient.

@koraktor koraktor closed this as completed Jan 1, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants