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

List not stored as expected in Lightning storage file #29

Closed
Magnum97 opened this issue May 6, 2020 · 2 comments
Closed

List not stored as expected in Lightning storage file #29

Magnum97 opened this issue May 6, 2020 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@Magnum97
Copy link
Contributor

Magnum97 commented May 6, 2020

Describe the bug
LightningStorage file type does not store list correctly

To Reproduce
Steps to reproduce the behavior:

  1. Create String array
  2. Create Lightning file and store array as list
  3. See result:
Method used to create files
private void setupConfig () {
        String string1 = "string";
        String nest1 = "Nested Value";
        String nest2 = "Another nested value";
        String[] list = new String[]{"List item one", "Another item", "The last one, I promise"};
        int ultimateAnswer = 42;
        boolean boo = true;
        Json json = new Json("lightning.json", getDataFolder().toString());
        Yaml yaml = new Yaml("lightning.yaml", getDataFolder().toString());
        Toml toml = new Toml("lightning.toml", getDataFolder().toString());
        LightningFile lightningFile = new LightningFile("lightning.ltn", getDataFolder().toString());
        List <String> header = new ArrayList <String>();

        header.add("This is a header");
        header.add("It supports array list");
        header.add("for multiple line comments.");
        header.add("Only available in YAML");

        json.setDefault("key1", string1);
        json.setDefault("nested.key1", nest1);
        json.setDefault("nested.key2", nest2);
        json.setDefault("next_key", "next_value");
        json.setDefault("the_answer_to_everything", ultimateAnswer);
        json.setDefault("listExample", list);

        yaml.setHeader(header);
        yaml.write();
        yaml.setDefault("key1", string1);
        yaml.setDefault("nested.key1", nest1);
        yaml.setDefault("nested.key2", nest2);
        yaml.setDefault("next_key", "next_value");
        yaml.setDefault("the_answer_to_everything", ultimateAnswer);
        yaml.setDefault("listExample", list);

        toml.setDefault("key1", string1);
        toml.setDefault("nested.key1", nest1);
        toml.setDefault("nested.key2", nest2);
        toml.setDefault("next_key", "next_value");
        toml.setDefault("the_answer_to_everything", ultimateAnswer);
        toml.setDefault("listExample", list);

        lightningFile.setDefault("key1", string1);
        lightningFile.setDefault("nested.key1", nest1);
        lightningFile.setDefault("nested.key2", nest2);
        lightningFile.setDefault("next_key", "next_value");
        lightningFile.setDefault("the_answer_to_everything", ultimateAnswer);
        lightningFile.setDefault("listExample", list);
}
Resulting storage file
key1 = string
nested {
  key1 = Nested Value
  key2 = Another nested value
}
next_key = next_value
the_answer_to_everything = 42
listExample = [Ljava.lang.String;@25288e12

Expected behavior
Strings would be stored, not just a reference to java object.
Also tested with Json, Yaml and Toml with perfect results. I realize this is an array, not a list and is similar to #20 but not quite the same as I am using v3.1.0

Expected results achived with Json, Yaml, & Toml:
{
   "key1": "string",
   "listExample": [
      "List item one",
      "Another item",
      "The last one, I promise"
   ],
   "next_key": "next_value",
   "nested": {
      "key1": "Nested Value",
      "key2": "Another nested value"
   },
   "the_answer_to_everything": 42
}

key1: string
nested: 
   key1: Nested Value
   key2: Another nested value
next_key: next_value
the_answer_to_everything: 42
listExample: 
- List item one
- Another item
- The last one, I promise

key1 = "string"
next_key = "next_value"
the_answer_to_everything = 42
listExample = ["List item one", "Another item", "The last one, I promise", ]

[nested]
key1 = "Nested Value"
key2 = "Another nested value"

Desktop (please complete the following information):

  • OS: Linux 5.3.0-46-generic x86_64 GNU/Linux
  • Browser Chrome
  • Version: 81.0.4044.138-1

Smartphone (please complete the following information):

  • OS: Android
  • Browser: Chrome

Additional context
Add any other context about the problem here.

@KotlinFactory KotlinFactory added bug Something isn't working good first issue Good for newcomers labels May 6, 2020
@KotlinFactory
Copy link
Member

Hey Magnum97,

thank you so much for your detailed issue report & your dedication to help us.

We will have a look soon.

Regards,

  • Leonhard

@KotlinFactory
Copy link
Member

Hey we have decided not to support LightningFile anymore, as it was developed by a developer that is not active on this project anymore.

It was deleted in the latest version of LightningStorage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants