Unsolved
This post is more than 5 years old
3 Posts
0
4109
May 25th, 2009 05:00
Atmos + timezone problem?
Hello,
In the course of evaluating Atmos, I've tried to write a small java uploader, "translating" from the .NET version of the quick start guide. This is what I've come up with:
public class HelloAtmosWorld {
public static void main(String[] args) {
Logger logger = Logger.getLogger(HelloAtmosWorld.class);
BasicConfigurator.configure();
logger.setLevel(Level.ALL);
logger.info("Initializing connection...");
EsuApi esu= new EsuRestApi( "accesspoint.emccis.com", 80, "my token", "my shared" );UploadHelper helper = new UploadHelper( esu, null );
logger.info("Done!");
logger.info("Initializing upload...");
ObjectId id = helper.createObject( new File( "/home/readme.txt" ), null, null );
logger.info("Done!");
logger.info("Object contents:");
System.out.println( esu.readObject(id, null, null));
logger.info("Done!");
}}
where "my token" = subtenantid/tokenid (tried all combinations - only subtenant/only token) and "my secret"=shared secret as per the confirmation e-mail.
Unfortunately, I end up with something like this:
0 [main] INFO gr.ntua.cslab.atmos.test.HelloAtmosWorld - Initializing connection...
51 [main] DEBUG com.emc.esu.api.rest.EsuRestApi - TZ: sun.util.calendar.ZoneInfo[id="GMT",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
57 [main] DEBUG com.emc.esu.api.rest.EsuRestApi - Date: Τρι, 26 Μαϊ 2009 12:31:09 GMT
59 [main] DEBUG com.emc.esu.api.rest.EsuRestApi - Hashing:
GET
Τρι, 26 Μαϊ 2009 12:31:09 GMT
/rest/namespacenull?metadata/system
x-emc-uid:c936ea05fce94111914de4d593f2fcc5/NTUA0F21D9CF00B06914
338 [main] DEBUG com.emc.esu.api.rest.EsuRestApi - Hash: hOlmZW2PlhCpaw3UFL+j0sLGW5Q=
813 [main] DEBUG com.emc.esu.api.rest.EsuRestApi - Error response:
1031
The request timestamp was outside the valid time window. 867 [main] DEBUG com.emc.esu.api.rest.EsuRestApi - Error: 1031 message: The request timestamp was outside the valid time window.
So the question is am I doing something wrong during the initialization fase? Should I try to mess with the calendar info, the metadata, or is it simply an access denied error?
Thanks in advance!


eangelou
3 Posts
0
May 26th, 2009 03:00
OK, sorry, there is an exception thrown when evaluating time and using a different locale - it seems it was all Greek to the java bindings.
JasonCwik
281 Posts
0
June 1st, 2009 21:00
Hi eangelou,
Can you change line 91 of EsuRestApi to this and see if it runs in your Locale?
private static final DateFormat HEADER_FORMAT = new SimpleDateFormat( "EEE, d MMM yyyy HH:mm:ss z", Locale.ENGLISH );
eangelou
3 Posts
0
June 2nd, 2009 10:00
Hi Jason,
Yes, this solution does work, as well as changing the default locale which is how I've figured it out in the first place.
I am just thinking aloud here, but since we are only interested in determining time and date, why not use something more concise like ISO 8601's format - date_T_time (e.g. 20090602T172022)? Not as pretty, but should work everywhere. Changing locales is an elegant solution to a problem that should not exist, I think.
Thanks again!
Vangelis
JasonCwik
281 Posts
0
June 2nd, 2009 11:00
Hi Vangelis,
I agree, ISO8601 is much nicer, but after some research it appers that the HTTP spec states that the Date header should be in RFC-822 format (http://tools.ietf.org/html/rfc822#section-5) and not very locale friendly
I'll update the Java wrapper code with this fix. Thanks for pointing it out.
--Jason