2 Replies Latest reply on Oct 20, 2014 8:47 AM by timeu

    Compile error when current working directory contains a directory with wrong permissions (possible bug?)

    timeu

      When compiling a GWT app that uses Errai-Bus I get following exception:

       

             Invoking generator org.jboss.errai.marshalling.rebind.MarshallersGenerator           

                 Generating Marshallers Bootstrapper...

                    java.util.concurrent.ExecutionException: java.lang.NullPointerException

       

       

                     Caused by: java.lang.NullPointerException       

                         at org.jboss.errai.codegen.util.ClassChangeUtil._findAllMatching(ClassChangeUtil.java:453)       

                         at  org.jboss.errai.codegen.util.ClassChangeUtil._findAllMatching(ClassChangeUtil.java:454)       

                         at org.jboss.errai.codegen.util.ClassChangeUtil.findAllMatching(ClassChangeUtil.java:446)

       

       

      The Problem occurs when I run the  com.google.gwt.dev.Compiler in a working directory that contains a folder with wrong permissions (i.e. to which the user doesn't have access to).

       

      The root cause is that in ClassChangeUtil._findAllMatching:


      public static void _findAllMatching(final HashSet<File> matching, final String fileName, final File from) {

          if (from.isDirectory()) {

            for (final File file : from.listFiles()) {

              _findAllMatching(matching, fileName, file);

            }

          }

          else {

            if (fileName.equals(from.getName())) {

              matching.add(from);

            }

          }

        }

       

      from.listFiles() returns null if the from folder throws a SecurityException.

      I think there should be a check if listFiles != null to avoid this error.