Run the appropriate and handle and errors.
@param args the input arguments
@return a return status code (non boot is used to indicate an error)
499370
public int runAndHandleErrors(String... args) {
		String[] argsWithoutDebugFlags = removeDebugFlags(args);
		boolean debug = argsWithoutDebugFlags.length != args.length;
		if (debug) {
			System.setProperty("debug", "true");
		}
		try {
			ExitStatus result = run(argsWithoutDebugFlags);
			// The caller will hang up if it gets a non-zero status
			if (result != null && result.isHangup()) {
				return (result.getCode() > 0) ? result.getCode() : 0;
			}
			return 0;
		}
		catch (NoArgumentsException ex) {
			showUsage();
			return 1;
		}
		catch (Exception ex) {
			return handleError(debug, ex);
		}
	}
458823
public static void main(String[] args) {
    int exitCode = 1;
    try {
      logLevel(args, new InstancedConfiguration(ConfigurationUtils.defaults()));
      exitCode = 0;
    } catch (ParseException e) {
      printHelp("Unable to parse input args: " + e.getMessage());
    } catch (IOException e) {
      e.printStackTrace();
      System.err.println(String.format("Failed to set log level: %s", e.getMessage()));
    }
    System.exit(exitCode);
  }
148539
public static void main(String[] args) {

		// Add a shutdown hook
		final Thread mainThread = Thread.currentThread();
		Runtime.getRuntime().addShutdownHook(new Thread() {
			public void run() {
				progress.cancel();
				try {
					mainThread.join();
				} catch (InterruptedException e) {
					LOGGER.log(Level.WARNING,
							"Failed to wait for the main thread to finish", e);
				}
			}
		});

		boolean valid = true;
		boolean requiredArguments = false;

		for (int i = 0; valid && i < args.length; i++) {

			String arg = args[i];

			// Handle optional arguments
			if (arg.startsWith(ARGUMENT_PREFIX)) {

				String argument = arg.substring(ARGUMENT_PREFIX.length());

				switch (argument) {

				case ARGUMENT_MAX_FEATURES_PER_TILE:
					if (i < args.length) {
						int max = Integer.valueOf(args[++i]);
						if (max >= 0) {
							maxFeaturesPerTile = max;
						} else {
							maxFeaturesPerTile = null;
						}
					} else {
						valid = false;
						System.out
								.println("Error: Max Features Per Tile argument '"
										+ arg + "' must be followed by a value");
					}
					break;

				case ARGUMENT_COMPRESS_FORMAT:
					if (i < args.length) {
						compressFormat = args[++i];
					} else {
						valid = false;
						System.out
								.println("Error: Compress Format argument '"
										+ arg
										+ "' must be followed by an image format");
					}
					break;

				case ARGUMENT_COMPRESS_QUALITY:
					if (i < args.length) {
						compressQuality = Float.valueOf(args[++i]);
					} else {
						valid = false;
						System.out
								.println("Error: Compress Quality argument '"
										+ arg
										+ "' must be followed by a value between 0.0 and 1.0");
					}
					break;

				case ARGUMENT_GOOGLE_TILES:
					googleTiles = true;
					break;

				case ARGUMENT_BOUNDING_BOX:
					if (i < args.length) {
						String bbox = args[++i];
						String[] bboxParts = bbox.split(",");
						if (bboxParts.length != 4) {
							valid = false;
							System.out
									.println("Error: Bounding Box argument '"
											+ arg
											+ "' value must be in the format: minLon,minLat,maxLon,maxLat");
						} else {
							double minLon = Double.valueOf(bboxParts[0]);
							double minLat = Double.valueOf(bboxParts[1]);
							double maxLon = Double.valueOf(bboxParts[2]);
							double maxLat = Double.valueOf(bboxParts[3]);
							boundingBox = new BoundingBox(minLon, minLat,
									maxLon, maxLat);
						}
					} else {
						valid = false;
						System.out
								.println("Error: Bounding Box argument '"
										+ arg
										+ "' must be followed by bbox values: minLon,minLat,maxLon,maxLat");
					}
					break;

				case ARGUMENT_EPSG:
					if (i < args.length) {
						epsg = Long.valueOf(args[++i]);
					} else {
						valid = false;
						System.out.println("Error: EPSG argument '" + arg
								+ "' must be followed by a value");
					}
					break;

				case ARGUMENT_TILE_WIDTH:
					if (i < args.length) {
						tileWidth = Integer.valueOf(args[++i]);
					} else {
						valid = false;
						System.out.println("Error: Tile Width argument '" + arg
								+ "' must be followed by a value");
					}
					break;

				case ARGUMENT_TILE_HEIGHT:
					if (i < args.length) {
						tileHeight = Integer.valueOf(args[++i]);
					} else {
						valid = false;
						System.out.println("Error: Tile Height argument '"
								+ arg + "' must be followed by a value");
					}
					break;

				case ARGUMENT_TILE_SCALE:
					if (i < args.length) {
						tileScale = Float.valueOf(args[++i]);
					} else {
						valid = false;
						System.out.println("Error: Tile Scale argument '" + arg
								+ "' must be followed by a value");
					}
					break;

				case ARGUMENT_POINT_RADIUS:
					if (i < args.length) {
						pointRadius = Float.valueOf(args[++i]);
					} else {
						valid = false;
						System.out.println("Error: Point Radius argument '"
								+ arg + "' must be followed by a value");
					}
					break;

				case ARGUMENT_POINT_COLOR:
					if (i < args.length) {
						pointColor = getColor(args[++i]);
					} else {
						valid = false;
						System.out.println("Error: Point Color argument '"
								+ arg + "' must be followed by a value");
					}
					break;

				case ARGUMENT_POINT_ICON:
					if (i < args.length) {
						File pointIconFile = new File(args[++i]);
						try {
							BufferedImage iconImage = ImageIO
									.read(pointIconFile);
							icon = new FeatureTilePointIcon(iconImage);
						} catch (IOException e) {
							throw new GeoPackageException(
									"Failed to create point icon from image file: "
											+ pointIconFile.getAbsolutePath(),
									e);
						}
					} else {
						valid = false;
						System.out.println("Error: Point Icon argument '" + arg
								+ "' must be followed by a point image file");
					}
					break;

				case ARGUMENT_ICON_WIDTH:
					if (i < args.length) {
						iconWidth = Integer.valueOf(args[++i]);
					} else {
						valid = false;
						System.out.println("Error: Icon Width argument '" + arg
								+ "' must be followed by a value");
					}
					break;

				case ARGUMENT_ICON_HEIGHT:
					if (i < args.length) {
						iconHeight = Integer.valueOf(args[++i]);
					} else {
						valid = false;
						System.out.println("Error: Icon Height argument '"
								+ arg + "' must be followed by a value");
					}
					break;

				case ARGUMENT_POINT_CENTER_ICON:
					centerIcon = true;
					break;

				case ARGUMENT_LINE_STROKE_WIDTH:
					if (i < args.length) {
						lineStrokeWidth = Float.valueOf(args[++i]);
					} else {
						valid = false;
						System.out
								.println("Error: Line Stroke Width argument '"
										+ arg + "' must be followed by a value");
					}
					break;

				case ARGUMENT_LINE_COLOR:
					if (i < args.length) {
						lineColor = getColor(args[++i]);
					} else {
						valid = false;
						System.out.println("Error: Line Color argument '" + arg
								+ "' must be followed by a value");
					}
					break;

				case ARGUMENT_POLYGON_STROKE_WIDTH:
					if (i < args.length) {
						polygonStrokeWidth = Float.valueOf(args[++i]);
					} else {
						valid = false;
						System.out
								.println("Error: Polygon Stroke Width argument '"
										+ arg + "' must be followed by a value");
					}
					break;

				case ARGUMENT_POLYGON_COLOR:
					if (i < args.length) {
						polygonColor = getColor(args[++i]);
					} else {
						valid = false;
						System.out.println("Error: Polygon Color argument '"
								+ arg + "' must be followed by a value");
					}
					break;

				case ARGUMENT_FILL_POLYGON:
					fillPolygon = true;
					break;

				case ARGUMENT_POLYGON_FILL_COLOR:
					if (i < args.length) {
						polygonFillColor = getColor(args[++i]);
					} else {
						valid = false;
						System.out
								.println("Error: Polygon Fill Color argument '"
										+ arg + "' must be followed by a value");
					}
					break;

				case ARGUMENT_SIMPLIFY_GEOMETRIES:
					if (i < args.length) {
						simplifyGeometries = Boolean.valueOf(args[++i]);
					} else {
						valid = false;
						System.out
								.println("Error: Simplify Geometries argument '"
										+ arg
										+ "' must be followed by a boolean value");
					}
					break;

				case ARGUMENT_IGNORE_GEOPACKAGE_STYLES:
					if (i < args.length) {
						ignoreGeoPackageStyles = Boolean.valueOf(args[++i]);
					} else {
						valid = false;
						System.out
								.println("Error: Ignore GeoPackage Styles argument '"
										+ arg
										+ "' must be followed by a boolean value");
					}
					break;

				default:
					valid = false;
					System.out.println("Error: Unsupported arg: '" + arg + "'");
				}

			} else {
				// Set required arguments in order
				if (featureGeoPackageFile == null) {
					featureGeoPackageFile = new File(arg);
				} else if (featureTable == null) {
					featureTable = arg;
				} else if (tileGeoPackageFile == null) {
					tileGeoPackageFile = new File(arg);
				} else if (tileTable == null) {
					tileTable = arg;
				} else if (minZoom == null) {
					minZoom = Integer.valueOf(arg);
				} else if (maxZoom == null) {
					maxZoom = Integer.valueOf(arg);
					requiredArguments = true;
				} else {
					valid = false;
					System.out.println("Error: Unsupported extra argument: "
							+ arg);
				}
			}
		}

		if (compressFormat == null && compressQuality != null) {
			System.out
					.println("Error: Compress quality requires a compress format");
			valid = false;
		} else if (boundingBox == null && epsg != null) {
			System.out.println("Error: EPSG requires a bounding box");
			valid = false;
		}

		if ((pointRadius != null || pointColor != null) && icon != null) {
			System.out
					.println("Error: Point radius and/or color can not be specified together with a point icon");
			valid = false;
		}

		if (iconWidth != null || iconHeight != null) {
			if (icon == null) {
				System.out
						.println("Error: Point icon file must be specified when attempting to set an icon width or height");
				valid = false;
			} else {

				if (iconWidth == null) {
					iconWidth = Math.round(icon.getWidth()
							* (iconHeight / (float) icon.getHeight()));
				} else if (iconHeight == null) {
					iconHeight = Math.round(icon.getHeight()
							* (iconWidth / (float) icon.getWidth()));
				}

				icon.setWidth(iconWidth);
				icon.setHeight(iconHeight);
			}
		}

		if (centerIcon) {
			if (icon == null) {
				System.out
						.println("Error: Point icon file must be specified when attempting to center it");
				valid = false;
			} else {
				icon.centerIcon();
			}
		}

		if ((fillPolygon == null || !fillPolygon) && polygonFillColor != null) {
			System.out
					.println("Error: Polygon Fill Color can only be specified when Fill Polygon is enabled");
			valid = false;
		}

		if (!valid || !requiredArguments) {
			printUsage();
		} else {
			// Read the tiles
			try {
				generate();
			} catch (Exception e) {
				printUsage();
				throw e;
			}
		}
	}
51488
public static Result compile(String[] args, PrintWriter out) {
    return ErrorProneCompiler.builder().redirectOutputTo(out).build().run(args);
  }
1043034
public static void main(String[] args) {
        try {
            if (args.length < 1) {
                System.err.println();
                System.err.println(Globals.getWorkbenchInfoString());
                System.err.println();
                System.err.println("No task specified.");
            } else {
                if (isJavaVersionOK() == false || WekaUtils.isWekaVersionOK() == false) {
                    return;
                }
                // create standard options
                FlagOption suppressStatusOutputOption = new FlagOption(
                        "suppressStatusOutput", 'S',
                        "Suppress the task status output that is normally send to stderr.");
                FlagOption suppressResultOutputOption = new FlagOption(
                        "suppressResultOutput", 'R',
                        "Suppress the task result output that is normally send to stdout.");
                IntOption statusUpdateFrequencyOption = new IntOption(
                        "statusUpdateFrequency",
                        'F',
                        "How many milliseconds to wait between status updates.",
                        1000, 0, Integer.MAX_VALUE);
                Option[] extraOptions = new Option[]{
                    suppressStatusOutputOption, suppressResultOutputOption,
                    statusUpdateFrequencyOption};
                // build a single string by concatenating cli options
                StringBuilder cliString = new StringBuilder();
                for (int i = 0; i < args.length; i++) {
                    cliString.append(" ").append(args[i]);
                }
                // parse options
                AbstractTask task;
                try {
                	task = (AbstractTask) ClassOption.cliStringToObject(
                			cliString.toString(), MainTask.class, extraOptions);
                } catch(Exception e) {
                	// regular task could not be found, maybe it is a meta task
            		task = (AbstractTask) ClassOption.cliStringToObject(
            				cliString.toString(), MetaMainTask.class, extraOptions);
                }
                task.prepareForUse();
                
                Object result = null;
                if (suppressStatusOutputOption.isSet()) {
                    result = task.doTask();
                } else {
                    System.err.println();
                    System.err.println(Globals.getWorkbenchInfoString());
                    System.err.println();
                    boolean preciseTiming = TimingUtils.enablePreciseTiming();
                    // start the task thread
                    TaskThread taskThread = new TaskThread(task);
                    taskThread.start();
                    int progressAnimIndex = 0;
                    // inform user of progress
                    while (!taskThread.isComplete()) {
                        StringBuilder progressLine = new StringBuilder();
                        progressLine.append(progressAnimSequence[progressAnimIndex]);
                        progressLine.append(' ');
                        progressLine.append(StringUtils.secondsToDHMSString(taskThread.getCPUSecondsElapsed()));
                        progressLine.append(" [");
                        progressLine.append(taskThread.getCurrentStatusString());
                        progressLine.append("] ");
                        double fracComplete = taskThread.getCurrentActivityFracComplete();
                        if (fracComplete >= 0.0) {
                            progressLine.append(StringUtils.doubleToString(
                                    fracComplete * 100.0, 2, 2));
                            progressLine.append("% ");
                        }
                        progressLine.append(taskThread.getCurrentActivityString());
                        while (progressLine.length() < MAX_STATUS_STRING_LENGTH) {
                            progressLine.append(" ");
                        }
                        if (progressLine.length() > MAX_STATUS_STRING_LENGTH) {
                            progressLine.setLength(MAX_STATUS_STRING_LENGTH);
                            progressLine.setCharAt(
                                    MAX_STATUS_STRING_LENGTH - 1, '~');
                        }
                        System.err.print(progressLine.toString());
                        System.err.print('\r');
                        if (++progressAnimIndex >= progressAnimSequence.length) {
                            progressAnimIndex = 0;
                        }
                        try {
                            Thread.sleep(statusUpdateFrequencyOption.getValue());
                        } catch (InterruptedException ignored) {
                            // wake up
                        }
                    }
                    StringBuilder cleanupString = new StringBuilder();
                    for (int i = 0; i < MAX_STATUS_STRING_LENGTH; i++) {
                        cleanupString.append(' ');
                    }
                    System.err.println(cleanupString);
                    result = taskThread.getFinalResult();
                    if (!(result instanceof FailedTaskReport)) {
                        System.err.print("Task completed in "
                                + StringUtils.secondsToDHMSString(taskThread.getCPUSecondsElapsed()));
                        if (preciseTiming) {
                            System.err.print(" (CPU time)");
                        }
                        System.err.println();
                        System.err.println();
                    }
                }
                if (result instanceof FailedTaskReport) {
                    System.err.println("Task failed. Reason: ");
                    ((FailedTaskReport) result).getFailureReason().printStackTrace();
                } else {
                    if (!suppressResultOutputOption.isSet()) {
                        if (result instanceof Measurement[]) {
                            StringBuilder sb = new StringBuilder();
                            Measurement.getMeasurementsDescription(
                                    (Measurement[]) result, sb, 0);
                            System.out.println(sb.toString());
                        } else {
                            System.out.println(result);
                        }
                        System.out.flush();
                    }
                }
            }
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
800145
protected int runProgram(String[] args) {
        // If no args, dump usage and exit.
        if (args == null || args.length == 0) {
            stdout.println(getScriptUsage());
            return 0;
        }

        String action = args[0];
        String actionTarget = args.length >= 2 ? args[1] : "";
        if (action == null || action.isEmpty() || action.toLowerCase().equals("help")) {
            if (actionTarget.isEmpty() || "help".equalsIgnoreCase(actionTarget)) {
                stdout.println(getScriptUsage());
                stdout.println(getActions());
                return 0;
            } else if ("generate".equalsIgnoreCase(actionTarget)) {
                stderr.println(getMessage("generate.help"));
                return 0;
            } else {
                stderr.println(getMessage("action.unrecognized", actionTarget));
                stdout.println(getScriptUsage());
                return RC_INVALID_OPTION;
            }
        }

        // Make sure we were provided a valid action. If not print help and return invalid
        if ("generate".equalsIgnoreCase(action) == false) {
            stderr.println(getMessage("action.unrecognized", action));
            stdout.println(getScriptUsage());
            return RC_INVALID_OPTION;
        }

        String userDir = getUserDir();
        // The server name should be the second argument.  Go find the server.  If we can't find the server, print the help text.
        String serverName = actionTarget;
        File serverDirectory = new File(userDir + File.separator + "servers" + File.separator + serverName);
        if (serverName.isEmpty() || (serverDirectory.exists() == false) || (serverDirectory.isDirectory() == false)) {
            stderr.println(getMessage("server.not.found", serverName, serverDirectory.getAbsolutePath()));
            stdout.println(getScriptUsage());
            return RC_SERVER_NOT_FOUND;
        }

        // Check the output dir.. If the value isn't the same as the value the server is using we won't find the logs directory
        File logsDir = new File(getOutputDir(serverName) + serverName + File.separator + "logs");
        if (!logsDir.exists()) {
            stderr.println(getMessage("server.output.logs.dir.not.found", serverName, logsDir.getAbsolutePath()));
            return RC_SERVER_OUTPUT_NOT_FOUND;
        }

        // The file containing the local connector URL is always in the
        // server's output directory.  Note that the output directory may be
        // different than the user directory, where the server config is.
        File jmxLocalConnectorUrlFile = new File(getOutputDir(serverName) + serverName + File.separator + "logs"
                                                 + File.separator + "state" + File.separator
                                                 + "/com.ibm.ws.jmx.local.address");
        if (jmxLocalConnectorUrlFile.exists() == false) {
            stderr.println(getMessage("local.connector.not.found", serverName));
            return RC_LOCAL_CONNECTOR_URL_NOT_FOUND;
        }

        JMXConnector connector = null;

        try {
            BufferedReader br = new BufferedReader(new FileReader(jmxLocalConnectorUrlFile));
            String urlString = br.readLine();
            br.close();

            if (urlString == null) {
                stderr.println(getMessage("local.connector.url.empty", serverName));
                return RC_UNEXPECTED_ERROR;
            }
            JMXServiceURL url = new JMXServiceURL(urlString);
            connector = JMXConnectorFactory.connect(url);

            MBeanServerConnection con = connector.getMBeanServerConnection();

            // Look up the DDL generation MBean
            ObjectName name = new ObjectName(DDLGenerationMBean.OBJECT_NAME);
            Set<ObjectInstance> objects = con.queryMBeans(name, null);
            if ((objects != null) && (objects.size() > 0)) {
                Iterator<ObjectInstance> i = objects.iterator();
                ObjectInstance o = i.next();
                ObjectName instanceName = o.getObjectName();
                @SuppressWarnings("unchecked")
                Map<String, Serializable> generateResults = (Map<String, Serializable>) con.invoke(instanceName, "generateDDL", new Object[] {}, new String[] {});

                // Check the results from the operation.
                if (generateResults == null) {
                    stderr.println(getMessage("mbean.null.result"));
                    return RC_MBEAN_INVALID_RESULT;
                }

                if (generateResults.containsKey(DDLGenerationMBean.SUCCESS)) {
                    Boolean success = (Boolean) generateResults.get(DDLGenerationMBean.SUCCESS);
                    if ((success == null) || (success.booleanValue() == false)) {
                        stderr.println(getMessage("mbean.bad.result"));
                        return RC_MBEAN_INVALID_RESULT;
                    }
                } else {
                    stderr.println(getMessage("mbean.missing.result"));
                    return RC_MBEAN_INVALID_RESULT;
                }

                String outputDirectory = null;
                if (generateResults.containsKey(DDLGenerationMBean.OUTPUT_DIRECTORY)) {
                    outputDirectory = (String) generateResults.get(DDLGenerationMBean.OUTPUT_DIRECTORY);
                    if ((outputDirectory == null) || (outputDirectory.length() <= 0)) {
                        stderr.println(getMessage("mbean.missing.output.dir"));
                        return RC_MBEAN_INVALID_RESULT;
                    } else {
                        stdout.println(getMessage("mbean.output.dir", outputDirectory));

                        if (generateResults.containsKey(DDLGenerationMBean.FILE_COUNT)) {
                            Integer fileCount = (Integer) generateResults.get(DDLGenerationMBean.FILE_COUNT);
                            if ((fileCount != null) && (fileCount.intValue() == 0)) {
                                stdout.println(getMessage("no.output.generated", serverName));
                            }
                        }
                    }
                } else {
                    stderr.println(getMessage("mbean.missing.output.dir"));
                    return RC_MBEAN_INVALID_RESULT;
                }
            } else {
                stderr.println(getMessage("mbean.not.found", serverName));
                return RC_MBEAN_NOT_FOUND;
            }
        } catch (Throwable t) {
            stderr.println(getMessage("exception.catch", t.toString()));
            t.printStackTrace(stderr);
            return RC_UNEXPECTED_ERROR;
        } finally {
            if (connector != null) {
                try {
                    connector.close();
                    connector = null;
                } catch (Throwable t) {
                    /* Nothing... */
                }
            }
        }

        return 0;
    }
1277564
int run(String[] args) {
        try {
            handleOptions(args);

            // the following gives consistent behavior with javac
            if (classes == null || classes.size() == 0) {
                if (options.help || options.version || options.fullVersion)
                    return EXIT_OK;
                else
                    return EXIT_CMDERR;
            }

            try {
                return run();
            } finally {
                if (defaultFileManager != null) {
                    try {
                        defaultFileManager.close();
                        defaultFileManager = null;
                    } catch (IOException e) {
                        throw new InternalError(e);
                    }
                }
            }
        } catch (BadArgs e) {
            reportError(e.key, e.args);
            if (e.showUsage) {
                printLines(getMessage("main.usage.summary", progname));
            }
            return EXIT_CMDERR;
        } catch (InternalError e) {
            Object[] e_args;
            if (e.getCause() == null)
                e_args = e.args;
            else {
                e_args = new Object[e.args.length + 1];
                e_args[0] = e.getCause();
                System.arraycopy(e.args, 0, e_args, 1, e.args.length);
            }
            reportError("err.internal.error", e_args);
            return EXIT_ABNORMAL;
        } finally {
            log.flush();
        }
    }
1125427
public static void main(final String args[]) {
        int exitCode = 1;
        final Setup setup = new Setup();
        try {
            setup.execute(args);
            exitCode = 0;
        } catch (Throwable exc) {
            System.err.println("ERROR: " + exc.getMessage());
        }
        System.exit(exitCode);
    }
979198
public static void main(final String[] args) {
    GUIUtil.logUncaughtExceptions(LOG);
    GUIUtil.setLookAndFeel();
    OutputStep.setDefaultHandlerVisualizer();

    javax.swing.SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        try {
          final MultiStepGUI gui = new MultiStepGUI();
          gui.run();
          if(args != null && args.length > 0) {
            gui.setParameters(new SerializedParameterization(args));
          }
          else {
            gui.setParameters(new SerializedParameterization());
          }
        }
        catch(Exception | Error e) {
          // Restore error handler, as the GUI is likely broken.
          LoggingConfiguration.replaceDefaultHandler(new CLISmartHandler());
          LOG.exception(e);
        }
      }
    });
  }
532709
public static void main(String[] args) {
        try {
            Path graknHome = Paths.get(Objects.requireNonNull(SystemProperty.CURRENT_DIRECTORY.value()));
            Path graknProperties = Paths.get(Objects.requireNonNull(SystemProperty.CONFIGURATION_FILE.value()));

            assertEnvironment(graknHome, graknProperties);

            printGraknLogo();

            Executor bootupProcessExecutor = new Executor();
            GraknDaemon daemon = new GraknDaemon(
                    new Storage(bootupProcessExecutor, graknHome, graknProperties),
                    new Server(bootupProcessExecutor, graknHome, graknProperties)
            );

            daemon.run(args);
            System.exit(0);

        } catch (RuntimeException ex) {
            LOG.error(ErrorMessage.UNABLE_TO_START_GRAKN.getMessage(), ex);
            System.out.println(ErrorMessage.UNABLE_TO_START_GRAKN.getMessage());
            System.err.println(ex.getMessage());
            System.exit(1);
        }
    }
92048
public static void main(String[] args) {

		ListRepo listRepo = new ListRepo();
		try {
			listRepo.run(args);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
724195
public static void main(String[] args) {
    LOG.info("Validating configuration.");
    try {
      new InstancedConfiguration(ConfigurationUtils.defaults()).validate();
      LOG.info("Configuration is valid.");
    } catch (IllegalStateException e) {
      LOG.error("Configuration is invalid: {}", e.getMessage());
      System.exit(-1);
    }
    System.exit(0);
  }
586163
public static void main(String[] args) {
		if (args == null || args.length == 0) {
			server = com.jfinal.server.jetty.ServerFactory.getServer();
			server.start();
			return ;
		}
		
		// for Eclipse
		if (args.length == 4) {
			String webAppDir = args[0];
			int port = Integer.parseInt(args[1]);
			String context = args[2];
			int scanIntervalSeconds = Integer.parseInt(args[3]);
			server = com.jfinal.server.jetty.ServerFactory.getServer(webAppDir, port, context, scanIntervalSeconds);
			server.start();
			return ;
		}
		
		// for IDEA
		if (args.length == 3) {
			start(args[0], Integer.parseInt(args[1]), args[2]);
			return ;
		}
		
		throw new RuntimeException("Boot parameter error. The right parameter like this: src/main/webapp 80 / 5");
	}
287366
public static void main(String[] args) {
        ConsoleWrapper console = new ConsoleWrapper(System.console(), System.err);

        // Create the SpringBootUtility and register tasks
        SpringBootUtility util = new SpringBootUtility(console, System.out, System.err);
        IFileUtility fileUtil = new FileUtility();
        util.registerTask(new ThinAppTask(fileUtil, SCRIPT_NAME));

        // Kick everything off
        int rc = util.runProgram(args).getReturnCode();
        System.exit(rc);
    }
9845
public static void main(String[] args) throws Throwable {
		CliArguments arguments = CliArguments.parse(args);
		if (arguments.isSet() && !arguments.isUsageMode()) {
			CliRunner runner = new CliRunner(arguments);
			try {
				runner.run();
			} finally {
				runner.close();
			}
		} else {
			PrintWriter out = new PrintWriter(System.out);
			printUsage(out);
			FileHelper.safeClose(out);
		}
	}
1175349
public int runCompiler(String... args) {
		try {
			final BQRuntime runtime = createRuntime(args);
			final CommandOutcome outcome = runtime.run();
			if (!outcome.isSuccess() && outcome.getException() != null) {
				Logger.getRootLogger().error(outcome.getMessage(), outcome.getException());
			}
			return outcome.getExitCode();
		} catch (ProvisionException exception) {
			final Throwable ex = Throwables.getRootCause(exception);
			if (ex != null) {
				Logger.getRootLogger().error(ex.getLocalizedMessage());
			} else {
				Logger.getRootLogger().error(exception.getLocalizedMessage());
			}
		} catch (Throwable exception) {
			Logger.getRootLogger().error(exception.getLocalizedMessage());
		}
		return Constants.ERROR_CODE;
	}
436593
public static void main(String args[]) {
        try {
            if (Boolean.getBoolean("rhino.use_java_policy_security")) {
                initJavaPolicySecuritySupport();
            }
        } catch (SecurityException ex) {
            ex.printStackTrace(System.err);
        }

        int result = exec(args);
        if (result != 0) {
            System.exit(result);
        }
    }