GithubHelp home page GithubHelp logo

thegaminggrunts / thunderbolt-2 Goto Github PK

View Code? Open in Web Editor NEW
9.0 9.0 4.0 106 KB

A Java file library designed from the ground-up to be as efficient as possible, in addition to using a JSON (JavaScript Object Notation) backend for file storage.

License: GNU General Public License v3.0

Java 100.00%

thunderbolt-2's People

Contributors

thegaminggrunts avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

thunderbolt-2's Issues

Tutorial Code cause "JSONException"

Error Message :
[Thunderbolt 2] Created new file test.json at C:\Users\Midas 2.5 derp Exception in thread "main" me.projectx.thunderbolt2.org.json.JSONException: JSONObject["C:\\Users\\Midas"] not found. at me.projectx.thunderbolt2.org.json.JSONObject.get(JSONObject.java:476) at me.projectx.thunderbolt2.models.ThunderFile.getList(ThunderFile.java:109) at me.projectx.thunderbolt2.models.ThunderFile.getList(ThunderFile.java:126) at me.projectx.thunderbolt2.models.ThunderFile.getByteList(ThunderFile.java:141) at com.YouEras.BossArea.Java.main(Java.java:26)

My Code :

`package com.YouEras.BossArea;

import java.util.ArrayList;
import java.util.List;

import me.projectx.thunderbolt2.Thunderbolt;
import me.projectx.thunderbolt2.managers.ThunderboltManager;
import me.projectx.thunderbolt2.models.ThunderFile;

public class Java {

public static void main(String[] args) throws Exception {
    Thunderbolt t = new ThunderboltManager(); //Or extend ThunderboltManager

    ThunderFile tf = t.load("test", "C:\\Users\\Midas");
    List<String> l = new ArrayList<String>();
    l.add("String 1");
    l.add("String 2");
    l.add("String 3");
    tf.set("List", l);
    tf.set("Double", 2.5);
    tf.set("herp", "derp");
    tf.save();
    System.out.println(tf.getDouble("Double"));
    System.out.println(tf.getString("herp"));
    System.out.println(tf.getByteList("List"));
}

}`

Print :

[Thunderbolt 2] Created new file test.json at C:/Users/Midas/Desktop
2.5
derp
Exception in thread "main" me.projectx.thunderbolt2.org.json.JSONException: JSONObject["C:/Users/Midas/Desktop"] not found.
at me.projectx.thunderbolt2.org.json.JSONObject.get(JSONObject.java:476)
at me.projectx.thunderbolt2.models.ThunderFile.getList(ThunderFile.java:109)
at me.projectx.thunderbolt2.models.ThunderFile.getList(ThunderFile.java:126)
at me.projectx.thunderbolt2.models.ThunderFile.getStringList(ThunderFile.java:130)
at com.YouEras.BossArea.Java.main(Java.java:30)

This ERROR causes when use "getList" Methods.

JSONObject["config"] - not found while reading the config folder - write okay

I have my executable jar in build directory
I tried to created test.json under build/config
cat config/test.json
{
"List": [
"String 1",
"String 2",
"String 3"
],
"herp": "derp",
"Double": 2.5
}
--------------until this is fine----
problem starts when it tries to read it JSONObject["config"] - not found - why ? when it can write, why it can't read ?
save works
Double works
herp works
but the next lines throws exception and program terminated - if this is not a bug and a programmer error, please advise, how to fix this ? I just tried your example and you got proper result. So, confused.

try {
tf.save();
System.out.println(tf.getDouble("Double"));
System.out.println(tf.getString("herp"));
System.out.println(tf.getStringList("List"));
}

Exception in thread "AWT-EventQueue-0" me.projectx.thunderbolt2.org.json.JSONException: JSONObject["config"] not found.
at me.projectx.thunderbolt2.org.json.JSONObject.get(JSONObject.java:476)
at me.projectx.thunderbolt2.models.ThunderFile.getList(ThunderFile.java:112)
at me.projectx.thunderbolt2.models.ThunderFile.getList(ThunderFile.java:129)
at me.projectx.thunderbolt2.models.ThunderFile.getStringList(ThunderFile.java:133)

Validator#checkName(String) error

Your code:
return (name.contains(".")) ? name.split(".")[0] : name;
Here «name.split(".")» works incorrectly, I mean regexp "." is only one any simbol. If you wanted to split with dot symbol - should use "\\." statement.

I got error with it:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at io.bluecube.thunderbolt.utils.Validator.checkName(Validator.java:12) at io.bluecube.thunderbolt.Thunderbolt.load(Thunderbolt.java:75)
When my file name was "config.json"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.