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

Can not address the Array in the configuration #480

Open
qizha opened this issue Mar 28, 2017 · 1 comment
Open

Can not address the Array in the configuration #480

qizha opened this issue Mar 28, 2017 · 1 comment

Comments

@qizha
Copy link

qizha commented Mar 28, 2017

Hi there,
Using archaius-core version 0.7.3, I created a YAMLConfigurationSource myself to load the configuration from YAML file. In YAML, the List is support like this:

    required:
    - appId
    - serviceName
    - version
    - status

It is OK to load these values into an List and get them in the fist time. However, I got error after a while:

[2017-03-28 15:11:22,691/GMT+08:00][pollingConfigurationSource][ERROR]Error occured applying properties com.netflix.config.AbstractPollingScheduler$1.run(AbstractPollingScheduler.java:174)
java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.String
    at com.netflix.config.DynamicPropertyUpdater.addOrChangeProperty(DynamicPropertyUpdater.java:134)
    at com.netflix.config.AbstractPollingScheduler.populateProperties(AbstractPollingScheduler.java:111)
    at com.netflix.config.AbstractPollingScheduler$1.run(AbstractPollingScheduler.java:172)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

The reason is in the "DynamicPropertyUpdater.java", it is assumed the List is described in a String and trying to assemble the List by split that String:

                    if(e instanceof CopyOnWriteArrayList && AbstractConfiguration.getDefaultListDelimiter() != 0) {
                        newValueArray = new CopyOnWriteArrayList();
                        Iterable stringiterator = Splitter.on(AbstractConfiguration.getDefaultListDelimiter()).omitEmptyStrings().trimResults().split((String)newValue);
                        Iterator i$ = stringiterator.iterator();

So basically, the real List is not considered currently. Any idea how to make it supported?

@brharrington
Copy link
Contributor

I think it is always assumes a simple delimited string. There is some related discussion in #266 and #360.

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

No branches or pull requests

2 participants