Bug: Registering asset loader for multiple file types


Just wanted to see if I was doing something wrong (I found a simple work around though, so no issue). I was registering a loader like this:

assetLoader.registerLoader(IniLoader.class, "ini", "cfg");

and got null returned when trying to load cfg-files (but it worked for ini-files). When I then changed the above to

assetLoader.registerLoader(IniLoader.class, "ini");
assetLoader.registerLoader(IniLoader.class, "cfg");

it works fine for loading both file types. Was I doing something wrong in the first example?

Looking at the code, it seems like the only difference between one way and the other is that the IniLoader is a shared instance.

…so maybe there is something weird in IniLoader?

Edit: for reference:

Your “working” way, addHandler() is called twice. Else addHandler() is called once. The only difference then would be that ImplThreadLocal is shared in one case and not the other.

This is the IniLoader:

import com.jme3.asset.AssetInfo;
import com.jme3.asset.AssetLoader;
import java.io.IOException;
import org.ini4j.Ini;
public class IniLoader implements AssetLoader {

    public Ini load(AssetInfo assetInfo) throws IOException {

        Ini result = new Ini(assetInfo.openStream());

        return result;