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

文字列型のセルをjava.util.Date型にマッピングする際に、@XlsDateConverterを指定しないとエラーとなる。 #25

Closed
mygreen opened this issue May 5, 2015 · 1 comment

Comments

@mygreen
Copy link
Owner

mygreen commented May 5, 2015

@XlsDateConverterで書式を指定しない場合、文字列型のセルをjava.util.Date型にマッピングすると例外が発生する。

com.gh.mygreen.xlsmapper.AnnotationInvalidException: Anotation '@null' attribute 'pattern' should be not empty.
    at com.gh.mygreen.xlsmapper.cellconvert.converter.AbstractDateCellConverter.createDateFormat(AbstractDateCellConverter.java:95)
    at com.gh.mygreen.xlsmapper.cellconvert.converter.AbstractDateCellConverter.toObject(AbstractDateCellConverter.java:70)
    at com.gh.mygreen.xlsmapper.cellconvert.converter.AbstractDateCellConverter.toObject(AbstractDateCellConverter.java:1)
    at com.gh.mygreen.xlsmapper.fieldprocessor.processor.HorizontalRecordsProcessor.loadRecords(HorizontalRecordsProcessor.java:260)
    at com.gh.mygreen.xlsmapper.fieldprocessor.processor.HorizontalRecordsProcessor.loadProcess(HorizontalRecordsProcessor.java:91)
    at com.gh.mygreen.xlsmapper.fieldprocessor.processor.HorizontalRecordsProcessor.loadProcess(HorizontalRecordsProcessor.java:1)
    at com.gh.mygreen.xlsmapper.FieldAdaptorProxy.loadProcess(FieldAdaptorProxy.java:61)
    at com.gh.mygreen.xlsmapper.XlsLoader.loadSheet(XlsLoader.java:440)
    at com.gh.mygreen.xlsmapper.XlsLoader.load(XlsLoader.java:157)
    at com.gh.mygreen.xlsmapper.XlsLoader.load(XlsLoader.java:105)
    at com.gh.mygreen.xlsmapper.XlsMapper.load(XlsMapper.java:90)
    at com.gh.mygreen.xlsmapper.cellconvert.DateTimeCellConverterTest.test_load_date_time(DateTimeCellConverterTest.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
@mygreen mygreen added the bug label May 5, 2015
@mygreen
Copy link
Owner Author

mygreen commented May 5, 2015

fix v0.5

各タイプごとに標準の書式を設定するよう修正。

  • java.util.Date の場合、デフォルトで yyyy-MM-dd HH:mm:ss の書式が適用されます。
  • java.sql.Date の場合、デフォルトで yyyy-MM-dd の書式が適用されます。
  • java.sql.Time の場合、デフォルトで yyyy-MM-dd HH:mm:ss の書式が適用されます。
  • java.sql.Timestamp の場合、デフォルトで yyyy-MM-dd HH:mm:ss.SSS の書式が適用されます。

@mygreen mygreen changed the title 文字列型のセルをjava.util.Date型にマッピングする際に、@XlsConverterを指定しないとエラーとなる。 文字列型のセルをjava.util.Date型にマッピングする際に、@XlsDateConverterを指定しないとエラーとなる。 Jun 28, 2015
@mygreen mygreen closed this as completed Jun 28, 2015
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

1 participant