-
Notifications
You must be signed in to change notification settings - Fork 487
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
Comments
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 |
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) |
Server is now running with this version:
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. |
@RBoelter : Thanks for reporting. @balamurugana will look into the problem and revert back soon.
@RBoelter : Hope this helps. Let us know if you need any help. |
quite strange! I couldn't able to reproduce this problem in my machine. Can you enable tracing by 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 |
hi, no worries - here is the trace:
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:
|
@RBoelter I see below trace back.
I am trying with the string locally whether I am getting |
I have found a solution:
Result:
|
The last (but for me not so important) problem is, that the upload time is uncorrect, because it shows
but my local time is
.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. ;) |
@RBoelter Thanks a lot for debugging :)
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. |
As the time |
Yes, you're right - my fault. I used your test code on my windows machine and on my server: Server:
Result:
Windows Computer:
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
throws an exception. But running with
works fine - Di (Dienstag) is the german word for Tuesday. Now i fixed the problem by changing following:
|
I changed your code in the DateFormat.java to the following and deleted my other solution. Now it looks good.
|
@RBoelter thanks a lot for tracing down the problem.
Taking these changes now. |
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
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
The text was updated successfully, but these errors were encountered: