Coder Social home page Coder Social logo

debukkit / simplefilestorage Goto Github PK

View Code? Open in Web Editor NEW
22.0 7.0 13.0 53 KB

A very, very, very light-weight utility for Java applications allowing you to store all kind of serializable object in one or more files under a certain key.

License: GNU General Public License v3.0

Java 100.00%
storage datastorage database save filestorage file

simplefilestorage's People

Contributors

debukkit avatar leoganz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

simplefilestorage's Issues

Three quick improvement suggestions

  1. Send some kind of warning message when a password is longer than 16 chars, because if it is longer than 16 characters, only the first 16 characters will be used for the encryption.

  2. If the password in DB.get("ID", "PASSWORD"); is wrong, it throws an exception:

javax.crypto.BadPaddingException: Given final block not properly padded
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:989)
at com.sun.crypto.provider.CipherCore.doFinal(CipherCore.java:845)
at com.sun.crypto.provider.AESCipher.engineDoFinal(AESCipher.java:446)
at javax.crypto.Cipher.doFinal(Cipher.java:2165)
at com.blogspot.debukkitsblog.Crypt.Crypter.decrypt(Crypter.java:54)
at com.blogspot.debukkitsblog.Crypt.Crypter.decrypt(Crypter.java:33)
at com.blogspot.debukkitsblog.Util.FileStorage.get(FileStorage.java:117)
at dbtest.main(Main.java:37)
Exception in thread "main" java.lang.NullPointerException
at dbtest.main(Main.java:37)

instead, it should either print a message with "Wrong password" or something like this, or it should print out the "garbage" of the decryption result, but not an error. :D

Edit:

3: Please add the ability to specify the password key too in getAll() and printAll() :D

Unendlichschleife in Crypter.java

In der Datei Crypter.java zeile 121 wird in der while schleife anstatt resultKey key verwendet.
Dadurch ensteht eine unendlichschleife die am ende in einem Java Heap Space error endet.

Separate encoding

What do you think about making separate encoding. It would be good because it will make it platform(and java ) independent.

Method for getting direct HashMap

A Method for getting the HashMap would be useful.
Example:

HashMap<String, Object> List = fs.getAll();
List.forEach(
   (k, v) -> {
      System.out.println(k + ", " + v);
   }
);

You could split it up like this:

/**
* All stored objects in an ArrayList of Objects
* @return all stored objects in an ArrayList of Objects
*/
public ArrayList<Object> getAllObjects(){
   ArrayList<Object> result = new ArrayList<Object>();
   for(Object c: storageMap.values()){
      result.add(c);
   }
   return result;
}

/**
* All stored objects and keys in an HashMap of String and Objects
* @return all stored objects and keys in an HashMap of String and Objects
*/
public HashMap<String, Object> getAll(){
   return storageMap;
}

(This is to short for a Fork + Pull request)

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.