示例#1
0
  /* (non-Javadoc)
   * @see com.jme3.app.SimpleApplication#simpleUpdate(float)
   */
  @Override
  public void simpleUpdate(float tpf) {
    try {
      if (serverState == ServerState.INGAME) {
        syncronizeLevel(tpf);
      }
    } catch (NullPointerException nullPointerException) {

      logger.log(Level.SEVERE, nullPointerException.getMessage(), nullPointerException);
    } catch (IllegalArgumentException illegalArgumentException) {
      logger.log(Level.SEVERE, illegalArgumentException.getMessage(), illegalArgumentException);
    } catch (ArrayIndexOutOfBoundsException aioobe) {
      logger.log(Level.SEVERE, aioobe.getMessage(), aioobe);
    } catch (RuntimeException runtimeException) {
      logger.log(Level.SEVERE, runtimeException.getMessage(), runtimeException);
    } catch (StackOverflowError stackOverflowError) {
      logger.log(Level.SEVERE, stackOverflowError.getMessage(), stackOverflowError);
      serverLogFileHandler.close();
    } catch (Exception exception) {
      logger.log(Level.SEVERE, exception.getMessage(), exception);
      serverLogFileHandler.close();
    } finally {
    }
    //        for (Player p : joinedPlayers) {
    //            respondPlayer(p, true);
    //        }
    //        joinedPlayers.clear();
    //
    //        for (Player p : leavingPlayers) {
    //            respondPlayer(p, false);
    //        }
    //        leavingPlayers.clear();
  }
示例#2
0
  public static void main(String[] args) throws IOException {
    String testInfix = "";
    int num = 0;
    long startTime, endTime;
    final int cnt = 100;
    PrintWriter writer = new PrintWriter("result.txt", "UTF-8");
    // PrintWriter writer2 = new PrintWriter("infix.txt", "UTF-8");
    writer.println("OperNum\tTime(ms)\tRecursion");
    for (int i = 1; i <= 15; i++) {
      num = 1000 * i;
      String strNum = Integer.toString(num);
      testInfix = new CreateInfix().getInfix(num);
      // writer2.println(testInfix);
      // writer2.flush();
      Boolean catchExcep = false;

      // test of parser without recursion
      startTime = System.currentTimeMillis();
      for (int j = 0; j < cnt; j++) {
        System.setIn(new ByteArrayInputStream(testInfix.getBytes()));
        try {
          new ParserNoRec().expr();
        } catch (StackOverflowError e) {
          writer.println(e.toString() + ", from parser without recursion, strNum=" + strNum);
          writer.flush();
          catchExcep = true;
          break;
        }
        System.setIn(null);
      }
      endTime = System.currentTimeMillis();
      if (!catchExcep) {
        writer.println(strNum + "\t" + (endTime - startTime) / (float) cnt + "\tNo");
        writer.flush();
      }

      // test of parser with recursion
      startTime = System.currentTimeMillis();
      for (int j = 0; j < cnt; j++) {
        System.setIn(new ByteArrayInputStream(testInfix.getBytes()));
        try {
          new ParserWithRec().expr();
        } catch (StackOverflowError e) {
          writer.println(e.toString() + ", from parser with recursion, strNum=" + strNum);
          writer.flush();
          catchExcep = true;
          break;
        }
        System.setIn(null);
      }
      endTime = System.currentTimeMillis();
      if (!catchExcep) {
        writer.println(strNum + "\t" + (endTime - startTime) / (float) cnt + "\tYes");
        writer.flush();
      }
    }
    writer.close();
    // writer2.close();
  }
示例#3
0
文件: Repl.java 项目: anba/es6draft
 private void handleException(Realm realm, StackOverflowError e) {
   // Create script exception with stacktrace from stackoverflow-error.
   ScriptException exception =
       newInternalError(realm.defaultContext(), Messages.Key.StackOverflow);
   exception.setStackTrace(e.getStackTrace());
   handleException(realm, exception);
 }
示例#4
0
文件: Main.java 项目: ratnikov/jruby
  /** Print a nicer stack size error since Rubyists aren't used to seeing this. */
  private Status handleStackOverflow(StackOverflowError soe) {
    String memoryMax = getRuntimeFlagValue("-Xss");

    if (memoryMax != null) {
      config
          .getError()
          .println(
              "Error: Your application used more stack memory than the safety cap of "
                  + memoryMax
                  + ".");
    } else {
      config
          .getError()
          .println("Error: Your application used more stack memory than the default safety cap.");
    }
    config.getError().println("Specify -J-Xss####k to increase it (#### = cap size in KB).");

    if (config.isVerbose()) {
      config.getError().println("Exception trace follows:");
      soe.printStackTrace(config.getError());
    } else {
      config.getError().println("Specify -w for full StackOverflowError stack trace");
    }

    return new Status(1);
  }
示例#5
0
文件: Main.java 项目: rebx/jruby
 private Status handleStackOverflow(StackOverflowError soe) {
   // produce a nicer error since Rubyists aren't used to seeing this
   System.gc();
   String stackMax = SafePropertyAccessor.getProperty("jruby.stack.max");
   String message = "";
   if (stackMax != null) {
     message = " of " + stackMax;
   }
   config
       .getError()
       .println(
           "Error: Your application used more stack memory than the safety cap" + message + ".");
   config.getError().println("Specify -J-Xss####k to increase it (#### = cap size in KB).");
   if (config.isVerbose()) {
     config.getError().println("Exception trace follows:");
     soe.printStackTrace();
   } else {
     config.getError().println("Specify -w for full StackOverflowError stack trace");
   }
   return new Status(1);
 }
示例#6
0
  public int run(String[] args) {
    try {
      config.processArguments(args);
      return run();
    } catch (MainExitException mee) {
      if (!mee.isAborted()) {
        config.getOutput().println(mee.getMessage());
        if (mee.isUsageError()) {
          printUsage();
        }
      }
      return mee.getStatus();
    } catch (OutOfMemoryError oome) {
      // produce a nicer error since Rubyists aren't used to seeing this
      System.gc();

      String memoryMax = SafePropertyAccessor.getProperty("jruby.memory.max");
      String message = "";
      if (memoryMax != null) {
        message = " of " + memoryMax;
      }
      config
          .getError()
          .println("Error: Your application used more memory than the safety cap" + message + ".");
      config.getError().println("Specify -J-Xmx####m to increase it (#### = cap size in MB).");

      if (config.getVerbose()) {
        config.getError().println("Exception trace follows:");
        oome.printStackTrace();
      } else {
        config.getError().println("Specify -w for full OutOfMemoryError stack trace");
      }
      return 1;
    } catch (StackOverflowError soe) {
      // produce a nicer error since Rubyists aren't used to seeing this
      System.gc();

      String stackMax = SafePropertyAccessor.getProperty("jruby.stack.max");
      String message = "";
      if (stackMax != null) {
        message = " of " + stackMax;
      }
      config
          .getError()
          .println(
              "Error: Your application used more stack memory than the safety cap" + message + ".");
      config.getError().println("Specify -J-Xss####k to increase it (#### = cap size in KB).");

      if (config.getVerbose()) {
        config.getError().println("Exception trace follows:");
        soe.printStackTrace();
      } else {
        config.getError().println("Specify -w for full StackOverflowError stack trace");
      }
      return 1;
    } catch (UnsupportedClassVersionError ucve) {
      config
          .getError()
          .println("Error: Some library (perhaps JRuby) was built with a later JVM version.");
      config
          .getError()
          .println(
              "Please use libraries built with the version you intend to use or an earlier one.");

      if (config.getVerbose()) {
        config.getError().println("Exception trace follows:");
        ucve.printStackTrace();
      } else {
        config.getError().println("Specify -w for full UnsupportedClassVersionError stack trace");
      }
      return 1;
    } catch (ThreadKill kill) {
      return 0;
    }
  }
  // http://dev.eclipse.org/bugs/show_bug.cgi?id=27658
  public void testObjectWithSuperInterfaces() throws JavaModelException {
    try {
      IPath projectPath = env.addProject("Project"); // $NON-NLS-1$
      env.addExternalJars(projectPath, Util.getJavaClassLibs());

      // remove old package fragment root so that names don't collide
      env.removePackageFragmentRoot(projectPath, ""); // $NON-NLS-1$

      IPath root = env.addPackageFragmentRoot(projectPath, "src"); // $NON-NLS-1$
      env.setOutputFolder(projectPath, "bin"); // $NON-NLS-1$

      env.addClass(
          root,
          "java.lang",
          "Object", //$NON-NLS-1$ //$NON-NLS-2$
          "package java.lang; \n"
              + //$NON-NLS-1$
              "public class Object implements I {} \n"
              + //$NON-NLS-1$
              "interface I {}	\n"); //$NON-NLS-1$

      fullBuild(projectPath);

      expectingOnlySpecificProblemsFor(
          root,
          new Problem[] {
            new Problem(
                "",
                "The type java.lang.Object cannot have a superclass or superinterfaces",
                new Path("/Project/src/java/lang/Object.java"),
                33,
                39,
                CategorizedProblem.CAT_INTERNAL,
                IMarker.SEVERITY_ERROR), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$		
          });

      env.addClass(
          root,
          "p",
          "X", //$NON-NLS-1$ //$NON-NLS-2$
          "package p; \n"
              + //$NON-NLS-1$
              "public class X {}\n"); //$NON-NLS-1$

      incrementalBuild(projectPath);

      expectingOnlySpecificProblemsFor(
          root,
          new Problem[] {
            new Problem(
                "",
                "The type java.lang.Object cannot have a superclass or superinterfaces",
                new Path("/Project/src/java/lang/Object.java"),
                33,
                39,
                CategorizedProblem.CAT_INTERNAL,
                IMarker.SEVERITY_ERROR), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$		
          });

      env.addClass(
          root,
          "p",
          "Y", //$NON-NLS-1$ //$NON-NLS-2$
          "package p; \n"
              + //$NON-NLS-1$
              "public class Y extends X {}\n"); //$NON-NLS-1$

      incrementalBuild(projectPath);

      expectingOnlySpecificProblemsFor(
          root,
          new Problem[] {
            new Problem(
                "",
                "The type java.lang.Object cannot have a superclass or superinterfaces",
                new Path("/Project/src/java/lang/Object.java"),
                33,
                39,
                CategorizedProblem.CAT_INTERNAL,
                IMarker.SEVERITY_ERROR), // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$		
          });

    } catch (StackOverflowError e) {
      assertTrue("Infinite loop in cycle detection", false); // $NON-NLS-1$
      e.printStackTrace();
    }
  }