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

Support for typesafe java.time.Duration #403

Open
costimuraru opened this issue Apr 6, 2016 · 2 comments
Open

Support for typesafe java.time.Duration #403

costimuraru opened this issue Apr 6, 2016 · 2 comments

Comments

@costimuraru
Copy link

Sample of reference.conf file:
foo = 300ms

We should be able to map this to a Duration attribute.

Exception thrown:

WARN com.netflix.governator.configuration.ArchaiusConfigurationProvider - Could not deserialize configuration with key foo to type class java.time.Duration
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('m' (code 109)): Expected space separating root-level values
 at [Source: 300ms; line: 1, column: 5]
    at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1419)
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:508)
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:437)
    at com.fasterxml.jackson.core.base.ParserMinimalBase._reportMissingRootWS(ParserMinimalBase.java:453)
    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._verifyRootSpace(ReaderBasedJsonParser.java:1236)
    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._parsePosNumber(ReaderBasedJsonParser.java:886)
    at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:680)
    at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3090)
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3036)
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2146)
    at com.netflix.governator.configuration.AbstractObjectConfigurationProvider$1.get(AbstractObjectConfigurationProvider.java:45)
    at com.netflix.governator.configuration.Property$3.get(Property.java:28)
    at com.netflix.governator.lifecycle.ConfigurationProcessor.assignConfiguration(ConfigurationProcessor.java:115)
    at com.netflix.governator.lifecycle.DefaultConfigurationMapper.mapConfiguration(DefaultConfigurationMapper.java:45)
    at com.netflix.governator.lifecycle.LifecycleManager.startInstance(LifecycleManager.java:333)
    at com.netflix.governator.lifecycle.LifecycleManager.add(LifecycleManager.java:155)
    at com.netflix.governator.guice.InternalLifecycleModule.processInjectedObject(InternalLifecycleModule.java:101)
    at com.netflix.governator.guice.InternalLifecycleModule.access$000(InternalLifecycleModule.java:44)
    at com.netflix.governator.guice.InternalLifecycleModule$2$1.afterInjection(InternalLifecycleModule.java:76)
    at com.google.inject.internal.MembersInjectorImpl.notifyListeners(MembersInjectorImpl.java:119)
    at com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:115)
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:267)
    at com.google.inject.internal.InjectorImpl$2$1.call(InjectorImpl.java:1016)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1092)
    at com.google.inject.internal.InjectorImpl$2.get(InjectorImpl.java:1012)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1051)
    at com.adobe.test.Main.main(Main.java:37)
    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:497)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
@howardyuan
Copy link
Contributor

You want to give it a try and submit a PR?

@costimuraru
Copy link
Author

@howardyuan, yup. I'm going to do it in the 2.x branch if that's ok with you guys.

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

3 participants