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

Date Parsing - IllegalArgumentException: Invalid format #411

Closed
RBoelter opened this issue Jun 21, 2016 · 15 comments · Fixed by #414
Closed

Date Parsing - IllegalArgumentException: Invalid format #411

RBoelter opened this issue Jun 21, 2016 · 15 comments · Fixed by #414

Comments

@RBoelter
Copy link

Hi,
minio-java throws the following exception for every MinioClient funktion (putObject, getObject, bucketExists, ...). Putting and getting objects works fine, but this exception is a bit irritating.

Thanks for help.

Cheers,
Ronny

Jun 21, 2016 4:26:29 PM io.minio.http.HeaderParser set
INFORMATION: setter: setDate
Jun 21, 2016 4:26:29 PM io.minio.http.HeaderParser set
INFORMATION: annotation: Date
Jun 21, 2016 4:26:29 PM io.minio.http.HeaderParser set
INFORMATION: value: Tue, 21 Jun 2016 14:26:29 GMT
Jun 21, 2016 4:26:30 PM io.minio.http.HeaderParser set
SCHWERWIEGEND: exception occured:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.minio.http.HeaderParser.set(HeaderParser.java:71)
at io.minio.MinioClient.execute(MinioClient.java:714)
at io.minio.MinioClient.executePost(MinioClient.java:927)
at io.minio.MinioClient.completeMultipart(MinioClient.java:2314)
at io.minio.MinioClient.putObject(MinioClient.java:2007)
at io.minio.MinioClient.putObject(MinioClient.java:1907)
at de.zpid.datawiz.util.MinioTest.storeFileIntoMino(MinioTest.java:26)
at de.zpid.datawiz.controller.ProjectController.uploadFile(ProjectController.java:230)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:832)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:743)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:961)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:895)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:869)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:158)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:206)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:121)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:124)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:106)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Invalid format: "Tue, 21 Jun 2016 14:26:30 GMT"
at org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:899)
at io.minio.ResponseHeader.setDate(ResponseHeader.java:89)
... 87 more

@balamurugana
Copy link
Member

It looks like HTTP header does not have time in right format. Can you add more information about the server you use?

Currently the library expects Date: header in the response. I see this value is mostly used for debugging purpose.

@RBoelter
Copy link
Author

RBoelter commented Jun 21, 2016

I'm using a Apache Tomcat/8.0.30 (JVM 1.8.0_91-b14)(for my application) on Ubuntu (3.19.0-61-generic) and the latest Minio Server. My time format is usally GMT. I think the parsing error occurs on the lastModified time, because if i use minioClient.statObject i get a java.lang.NullPointerException at io.minio.ResponseHeader.lastModified(ResponseHeader.java:129)

@balamurugana
Copy link
Member

balamurugana commented Jun 22, 2016

@RBoelter I couldn't able to reproduce the error. Can you please try with version

$ minio version
Version: 2016-06-22T03:12:52Z
Release-Tag: DEVELOPMENT.2016-06-22T03-12-52Z
Commit-ID: 78ae69674961af1abd198e66dbf59b48dae9386f

with minio-java fix #412

@RBoelter
Copy link
Author

RBoelter commented Jun 23, 2016

@balamurugana

Server is now running with this version:

Version: 2016-06-23T09:08:40Z
Release-Tag: DEVELOPMENT.2016-06-23T09-08-40Z
Commit-ID: 41c089a7e048456ccdb2db5f23eaefa759aa5f24

and i have build a minio-java.jar (#412) but the exception is still thrown.

I have a further question: Have you any plans to build a feature for synchronisation/replication between different minio server, or is it already included and i didn't found it? I have to ask, because I want to use minio as file server for research data and it's always a good idea to replicate this critical files.

@hackintoshrao
Copy link

hackintoshrao commented Jun 23, 2016

@RBoelter : Thanks for reporting. @balamurugana will look into the problem and revert back soon.

I have a further question: Have you any plans to build a feature for synchronisation/replication between different minio server, or is it already included and i didn't found it? I have to ask, because I want to use minio as file server for research data and it's always a good idea to replicate this critical files.

  • Minio provides a easy to use tool called minio client(mc) to administer the Minio instance. Here is the link to the quick start guide for mc https://docs.minio.io/docs/minio-client-quick-start-guide.
  • Using this command called mc mirror you can easily replicate the data between Minio instances. Here is the reference to the docs on using mc mirror https://docs.minio.io/docs/minio-client-complete-guide#mirror .
  • ex: mc mirror instance1/mybucket instance2/mybucket , this syncs the data of instance1/mybucket with instance2/mybucket. You can have automated scheduled backups using the same.
  • Minio will be soon rolling out a multi drive version ( precursor to the multi node version), wherein Minio server can be configured to run using Multiple drives on a single machine. It comes with mechanisms for data protection/ fault tolerance on occurrence of disk failures. All the operations will unaffected and data will be safe even if half the number of drives stop working.

@RBoelter : Hope this helps. Let us know if you need any help.

@balamurugana
Copy link
Member

balamurugana commented Jun 23, 2016

@RBoelter

and i have build a minio-java.jar (#412) but the exception is still thrown.

quite strange! I couldn't able to reproduce this problem in my machine. Can you enable tracing by minioClient.traceOn(System.out) and paste the output?

If possible, please share your machine information of minio server and minio-java client. I think there could be a machine configuration issue.

If an exception occurs, please paste the trace back too.

If you are able to use mc tool, you could do the same operation (Get/Put) by enabling mc --debug and paste the output here.

@RBoelter
Copy link
Author

hi, no worries - here is the trace:

---------START-HTTP---------
HEAD /project.1 HTTP/1.1
Host: 136.199.85.160:9000
User-Agent: Minio (amd64; amd64) minio-java/dev
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date: 20160623T141824Z
Authorization: AWS4-HMAC-SHA256 Credential=JNAPQZQU0CRBDQUM4OG9/20160623/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=*REDACTED*

HTTP/1.1 200
Accept-Ranges: bytes
Server: Minio/DEVELOPMENT.2016-06-23T09-08-40Z (linux; amd64)
Vary: Origin
X-Amz-Request-Id: S7PMMPG0YR82314T
Date: Thu, 23 Jun 2016 14:18:23 GMT
Content-Type: text/plain; charset=utf-8
OkHttp-Sent-Millis: 1466691504752
OkHttp-Received-Millis: 1466691504775

Jun 23, 2016 4:18:24 PM io.minio.http.HeaderParser set
SCHWERWIEGEND: exception occured: 
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at io.minio.http.HeaderParser.set(HeaderParser.java:73)
    at io.minio.MinioClient.execute(MinioClient.java:762)
    at io.minio.MinioClient.executeHead(MinioClient.java:935)
    at io.minio.MinioClient.bucketExists(MinioClient.java:1748)
    at de.zpid.datawiz.util.MinioTest.storeFileIntoMino(MinioTest.java:24)
    at de.zpid.datawiz.controller.ProjectController.uploadFile(ProjectController.java:228)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:832)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:743)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:961)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:895)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:869)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:115)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:112)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:158)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:169)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:206)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:121)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:124)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:66)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:106)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.IllegalArgumentException: Invalid format: "Thu, 23 Jun 2016 14:18:23 GMT"
    at org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:899)
    at io.minio.ResponseHeader.setDate(ResponseHeader.java:89)
    ... 85 more

Jun 23, 2016 4:18:24 PM io.minio.http.HeaderParser set
INFORMATION: setter: setDate
Jun 23, 2016 4:18:24 PM io.minio.http.HeaderParser set
INFORMATION: annotation: Date
Jun 23, 2016 4:18:24 PM io.minio.http.HeaderParser set
INFORMATION: value: Thu, 23 Jun 2016 14:18:23 GMT
----------END-HTTP----------

I will try the (GET/PUT) Operation with mc as soon as possible and send you the debug information. What kind of machine information do you need? Minio server and my java application which includes the minio-java is running on a virtual machine (VMWare) with an Ubuntu 14.04., but in addition i tested both on my Windows 10 machine with a local Minio Server and a local tomcat - the exception occured on both systems. When i start the server the log shows "Region: us-east-1", but my server locale is:

LANG=de_DE.UTF-8
LANGUAGE=
LC_CTYPE="de_DE.UTF-8"
LC_NUMERIC="de_DE.UTF-8"
LC_TIME="de_DE.UTF-8"
LC_COLLATE="de_DE.UTF-8"
LC_MONETARY="de_DE.UTF-8"
LC_MESSAGES="de_DE.UTF-8"
LC_PAPER="de_DE.UTF-8"
LC_NAME="de_DE.UTF-8"
LC_ADDRESS="de_DE.UTF-8"
LC_TELEPHONE="de_DE.UTF-8"
LC_MEASUREMENT="de_DE.UTF-8"
LC_IDENTIFICATION="de_DE.UTF-8"
LC_ALL=

@balamurugana
Copy link
Member

@RBoelter I see below trace back.

Caused by: java.lang.IllegalArgumentException: Invalid format: "Thu, 23 Jun 2016 14:18:23 GMT"
    at org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:899)
    at io.minio.ResponseHeader.setDate(ResponseHeader.java:89)
    ... 85 more

I am trying with the string locally whether I am getting IllegalArgumentException

@RBoelter
Copy link
Author

RBoelter commented Jun 24, 2016

I have found a solution:
It is a bit weird, because on the first view everything looks fine with the date, and in the HTTP logtrace the used date is "Date: Fri, 24 Jun 2016 13:03:26 GMT" for example, but during parsing the date, it seems, that the parser has a problem with the 3 letter of the day of the week at the beginning of the time string. It accepts 'EE', but it crashes at 'EEE' formatted strings. So i have built a "quick and dirty" workaround to solve this problem: I have changed the try block in your HeaderParser.set function to:

try {
        Method setterMethod = cls.getMethod(setter, new Class[] { String.class });
        String valueString = headers.get(value);
        if (setterMethod.getName().equals("setDate")
            || setterMethod.getName().equals("setLastModified") && (valueString != null && !valueString.isEmpty()
                && (valueString.contains("Mon") || valueString.contains("Tue") || valueString.contains("Wed")
                    || valueString.contains("Thu") || valueString.contains("Fri") || valueString.contains("Sat")
                    || valueString.contains("Sun")))) {
          valueString = valueString.substring(0, 2) + valueString.substring(3, valueString.length());
        }
        if (valueString != null) {
          setterMethod.invoke(destination, valueString);
        }
      }

Result:

---------START-HTTP---------
HEAD /project.2 HTTP/1.1
Host: 136.199.85.160:9000
User-Agent: Minio (amd64; amd64) minio-java/dev
x-amz-content-sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
x-amz-date: 20160624T132301Z
Authorization: AWS4-HMAC-SHA256 Credential=JNAPQZQU0CRBDQUM4OG9/20160624/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=*REDACTED*

HTTP/1.1 200
Accept-Ranges: bytes
Server: Minio/DEVELOPMENT.2016-06-23T09-08-40Z (linux; amd64)
Vary: Origin
X-Amz-Request-Id: 8HC17FXF19NP8NVH
Date: Fri, 24 Jun 2016 13:23:02 GMT
Content-Type: text/plain; charset=utf-8
OkHttp-Sent-Millis: 1466774582567
OkHttp-Received-Millis: 1466774582585

----------END-HTTP----------

@RBoelter
Copy link
Author

RBoelter commented Jun 24, 2016

The last (but for me not so important) problem is, that the upload time is uncorrect, because it shows

Date: Fri, 24 Jun 2016 13:23:02 GMT

but my local time is

15:23:02

.I think, it occurs because of the missing time difference information after GMT. Usually it looks like "GMT+02:00".

Edit: In Minio Browser the correct time is shown, so forget it. ;)

@balamurugana
Copy link
Member

balamurugana commented Jun 24, 2016

@RBoelter Thanks a lot for debugging :)

it seems, that the parser has a problem with the 3 letter of the day of the week at the beginning of the time string. It accepts 'EE', but it crashes at 'EEE' formatted strings.

This is quite weird. However a test program works fine though.

import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;

public class DateCheck {
  public static final DateTimeFormatter HTTP_HEADER_DATE_FORMAT =
      DateTimeFormat.forPattern("EEE',' dd MMM yyyy HH':'mm':'ss zzz").withZoneUTC();

  public static void main(String args[]) {
    String dateString = "Fri, 24 Jun 2016 13:23:02 GMT";
    DateTime date;

    date = HTTP_HEADER_DATE_FORMAT.parseDateTime(dateString);

    System.out.println(date);
  }
}
$ javac -cp ~/java/jar/joda-time-2.7.jar DateCheck.java && java -cp ~/java/jar/joda-time-2.7.jar:. DateCheck
2016-06-24T13:23:02.000Z

I use oracle java8.

$ javac -version
javac 1.8.0_91

$ java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

Please check the test program your side.

As a note, joda-time people recommends to use built-in date/time class in java 8 and onwards. Currently we support java 7 in addition to java 8, we would need to keep this dependency.

@balamurugana
Copy link
Member

@RBoelter

I think, it occurs because of the missing time difference information after GMT. Usually it looks like "GMT+02:00".

As the time Fri, 24 Jun 2016 13:23:02 GMT is in GMT, this is correct as per your local time.

@RBoelter
Copy link
Author

RBoelter commented Jun 27, 2016

As the time Fri, 24 Jun 2016 13:23:02 GMT is in GMT, this is correct as per your local time.

Yes, you're right - my fault.

I used your test code on my windows machine and on my server:

Server:

java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b14, mixed mode)

Result:

Exception in thread "main" java.lang.IllegalArgumentException: Invalid format: "Fri, 24 Jun 2016 13:23:02 GMT" is malformed at "i, 24 Jun 2016 13:23:02 GMT"
        at org.joda.time.format.DateTimeFormatter.parseDateTime(DateTimeFormatter.java:899)
        at DateCheck.main(DateCheck.java:15)

Windows Computer:

java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b60)
Java HotSpot(TM) 64-Bit Server VM (build 25.91-b60, mixed mode)

Result:

The same exception.

I found out, that my solutuion i posted before is not working on all weekdays, because the shortcut for friday is "fri" in english, and it is "fr" for freitag in german.

Running your test program with

"Tue, 28 Jun 2016 13:23:02 GMT"

throws an exception. But running with

"Di, 28 Jun 2016 13:23:02 GMT"

works fine - Di (Dienstag) is the german word for Tuesday.

Now i fixed the problem by changing following:

date = HTTP_HEADER_DATE_FORMAT.withLocale(Locale.US).parseDateTime(dateString);

@RBoelter
Copy link
Author

RBoelter commented Jun 27, 2016

I changed your code in the DateFormat.java to the following and deleted my other solution. Now it looks good.

public class DateFormat {
  public static final DateTimeFormatter AMZ_DATE_FORMAT = DateTimeFormat.forPattern("yyyyMMdd'T'HHmmss'Z'")
      .withZoneUTC().withLocale(Locale.US);

  public static final DateTimeFormatter EXPIRATION_DATE_FORMAT = DateTimeFormat
      .forPattern("yyyy-MM-dd'T'HH':'mm':'ss'.'SSS'Z'").withZoneUTC().withLocale(Locale.US);

  public static final DateTimeFormatter RESPONSE_DATE_FORMAT = EXPIRATION_DATE_FORMAT;

  public static final DateTimeFormatter SIGNER_DATE_FORMAT = DateTimeFormat.forPattern("yyyyMMdd").withZoneUTC()
      .withLocale(Locale.US);

  public static final DateTimeFormatter HTTP_HEADER_DATE_FORMAT = DateTimeFormat
      .forPattern("EEE',' dd MMM yyyy HH':'mm':'ss zzz").withZoneUTC().withLocale(Locale.US);

  private DateFormat() {
  }
}

@balamurugana
Copy link
Member

@RBoelter thanks a lot for tracing down the problem.

public class DateFormat { public static final DateTimeFormatter AMZ_DATE_FORMAT = DateTimeFormat.forPattern("yyyyMMdd'T'HHmmss'Z'") .withZoneUTC().withLocale(Locale.US); public static final DateTimeFormatter EXPIRATION_DATE_FORMAT = DateTimeFormat .forPattern("yyyy-MM-dd'T'HH':'mm':'ss'.'SSS'Z'").withZoneUTC().withLocale(Locale.US); public static final DateTimeFormatter RESPONSE_DATE_FORMAT = EXPIRATION_DATE_FORMAT; public static final DateTimeFormatter SIGNER_DATE_FORMAT = DateTimeFormat.forPattern("yyyyMMdd").withZoneUTC() .withLocale(Locale.US); public static final DateTimeFormatter HTTP_HEADER_DATE_FORMAT = DateTimeFormat .forPattern("EEE',' dd MMM yyyy HH':'mm':'ss zzz").withZoneUTC().withLocale(Locale.US); private DateFormat() { }

Taking these changes now.

balamurugana added a commit to balamurugana/minio-java that referenced this issue Jun 27, 2016
When minio-java is used in system running with different locale than
English, date parsing fails with IllegalArgumentException.  This patch
fixes the issue by setting the locale to English for all date formats.

Fixes minio#411
balamurugana added a commit to balamurugana/minio-java that referenced this issue Jun 27, 2016
When minio-java is used in system running with different locale than
"US", date parsing fails with IllegalArgumentException.  This patch
fixes the issue by setting the locale to "US" for all date formats.

Thanks to @RBoelter for reporting/debugging/providing the solution.

Fixes minio#411
balamurugana added a commit to balamurugana/minio-java that referenced this issue Jun 27, 2016
When minio-java is used in system running with different locale than
"US", date parsing fails with IllegalArgumentException.  This patch
fixes the issue by setting the locale to "US" for all date formats.

Thanks to @RBoelter for reporting/debugging/providing the solution.

Fixes minio#411
balamurugana added a commit to balamurugana/minio-java that referenced this issue Jun 28, 2016
When minio-java is used in system running with different locale than
"US", date parsing fails with IllegalArgumentException.  This patch
fixes the issue by setting the locale to "US" for all date formats.

Thanks to @RBoelter for reporting/debugging/providing the solution.

Fixes minio#411
harshavardhana pushed a commit that referenced this issue Jun 28, 2016
When minio-java is used in system running with different locale than
"US", date parsing fails with IllegalArgumentException.  This patch
fixes the issue by setting the locale to "US" for all date formats.

Thanks to @RBoelter for reporting/debugging/providing the solution.

Fixes #411
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants