What can it be the reason to get NullPointerException sometimes with below code piece.
Exception in thread "main" java.lang.NullPointerException
     [java]  at java.io.Reader.<init>(Reader.java:78)
     [java]  at java.io.InputStreamReader.<init>(InputStreamReader.java:72)
     [java]  at helloworld.HelloWorld.fixture(Unknown Source)
     [java]  at helloworld.HelloWorld.replaceScheduler(Unknown Source)
     [java]  at helloworld.HelloWorld.test(Unknown Source)
     [java]  at helloworld.HelloWorld.main(Unknown Source)My code i trying to read that file extension .fscript ; the problem is getResourceAsStream(name) is returning null
Here is all code:
public class HelloWorld {
    FScriptInterpreter fscript;
    Node rootNode; 
    
    private Reader fixture(String name) {
        InputStream stream = HelloWorld.class.getClassLoader().getResourceAsStream(name);
        return new InputStreamReader(stream);
    } 
    
 private Component getChildByName(Component parent, String name)
            throws NoSuchInterfaceException {
        ContentController cc = Fractal.getContentController(parent);
        for (Component child : cc.getFcSubComponents()) {
            if (name.equals(Fractal.getNameController(child).getFcName())) {
                return child;
            }
        }
        return null;
    }
 
 public void replaceScheduler(Component root) throws Exception {
        Component client = getChildByName(root, "client");
        fscript.loadDefinitions(fixture("replace-scheduler.fscript"));
        fscript.apply("replace-scheduler", new Object[] { rootNode });
        Component newScheduler = getChildByName(client, "client1");
        assertNotNull("New scheduler not found.", newScheduler);
    }
 
  public void test() throws Exception {
      Factory factory = FactoryFactory.getFactory(FactoryFactory.FRACTAL_BACKEND);
         Component root = (Component) factory.newComponent("helloworld.ClientServerImpl",new HashMap());
         Fractal.getLifeCycleController(root).startFc();
         ((java.lang.Runnable)root.getFcInterface("r")).run();
         replaceScheduler(root);
     }
     
    public static void main(String[] args) throws Exception {      
     HelloWorld h=new HelloWorld();
     h.test();
    }
}