Run the catalog jar NT procedure to check and write the catalog file.
Check the results map from every host and return error message if needed.
@return  A String describing the error messages. If all hosts return success, NULL is returned.
776223
protected String verifyAndWriteCatalogJar(CatalogChangeResult ccr)
    {
        String procedureName = "@VerifyCatalogAndWriteJar";

        CompletableFuture<Map<Integer,ClientResponse>> cf =
                callNTProcedureOnAllHosts(procedureName, ccr.catalogBytes, ccr.encodedDiffCommands,
                        ccr.catalogHash, ccr.deploymentBytes);

        Map<Integer, ClientResponse> resultMapByHost = null;
        String err;

        long timeoutSeconds = VerifyCatalogAndWriteJar.TIMEOUT;
        hostLog.info("Max timeout setting for VerifyCatalogAndWriteJar is " + timeoutSeconds + " seconds");

        try {
            Stopwatch sw = Stopwatch.createStarted();
            long elapsed = 0;
            while ((elapsed = sw.elapsed(TimeUnit.SECONDS)) < (timeoutSeconds)) {
                resultMapByHost = cf.getNow(null);
                if (resultMapByHost != null) {
                    sw.stop();
                    break;
                }

                if (elapsed < 5) {
                    // do not log under 5 seconds and sleep for 100 milliseconds
                    Thread.sleep(100);
                    continue;
                }
                hostLog.info(elapsed + " seconds has elapsed but " + procedureName + " is still wait for remote response."
                        + "The max timeout value is " + timeoutSeconds + " seconds.");
                Thread.sleep(TimeUnit.SECONDS.toMillis(5));
            }
        } catch (Exception e) {
            err = procedureName + " run everywhere call failed: " + e.getMessage();
            hostLog.info(err + ", " + com.google_voltpatches.common.base.Throwables.getStackTraceAsString(e));
            return err;
        }

        if (resultMapByHost == null) {
            err = "An invocation of procedure " + procedureName + " on all hosts timed out.";
            hostLog.info(err);
            return err;
        }

        for (Entry<Integer, ClientResponse> entry : resultMapByHost.entrySet()) {
            if (entry.getValue().getStatus() != ClientResponseImpl.SUCCESS) {
                err = "The response from host " + entry.getKey().toString() +
                      " for " + procedureName + " returned failures: " + entry.getValue().getStatusString();
                compilerLog.info(err);

                // hide the internal NT-procedure @VerifyCatalogAndWriteJar from the client message
                return err;
            }
        }

        return null;
    }
1344203
@Override
	public HashMap<String, Object> getApplicationMap() {
		return (HashMap<String, Object>) JKThreadLocal.getValue(JKContextConstants.APPLICATION_MAP);
	}
926011
public static String report(Catalog catalog, long minHeap, boolean isPro, int hostCount, int sitesPerHost,
            int kfactor, ArrayList<Feedback> warnings, String autoGenDDL) throws IOException {
        // asynchronously get platform properties
        new Thread() {
            @Override
            public void run() {
                PlatformProperties.getPlatformProperties();
            }
        }.start();


        URL url = Resources.getResource(ReportMaker.class, "template.html");
        String contents = Resources.toString(url, Charsets.UTF_8);

        Cluster cluster = catalog.getClusters().get("cluster");
        assert(cluster != null);
        Database db = cluster.getDatabases().get("database");
        assert(db != null);

        String statsData = getStatsHTML(db, minHeap, warnings);
        contents = contents.replace("##STATS##", statsData);

        // generateProceduresTable needs to happen before generateSchemaTable
        // because some metadata used in the later is generated in the former
        String procData = generateProceduresTable(db.getTables(), db.getProcedures());
        contents = contents.replace("##PROCS##", procData);

        String schemaData = generateSchemaTable(db);
        contents = contents.replace("##SCHEMA##", schemaData);

        DatabaseSizes sizes = CatalogSizing.getCatalogSizes(db, DrRoleType.XDCR.value().equals(cluster.getDrrole()));

        String sizeData = generateSizeTable(sizes);
        contents = contents.replace("##SIZES##", sizeData);

        String clusterConfig = generateClusterConfiguration(isPro, hostCount, sitesPerHost, kfactor);
        contents = contents.replace("##CLUSTERCONFIG##", clusterConfig);

        String sizeSummary = generateSizeSummary(sizes);
        contents = contents.replace("##SIZESUMMARY##", sizeSummary);

        String heapSummary = generateRecommendedServerSettings(sizes);
        contents = contents.replace("##RECOMMENDEDSERVERSETTINGS##", heapSummary);

        String platformData = PlatformProperties.getPlatformProperties().toHTML();
        contents = contents.replace("##PLATFORM##", platformData);

        contents = contents.replace("##VERSION##", VoltDB.instance().getVersionString());

        contents = contents.replace("##DDL##", escapeHtml4(autoGenDDL));

        DateFormat df = new SimpleDateFormat("d MMM yyyy HH:mm:ss z");
        contents = contents.replace("##TIMESTAMP##", df.format(m_timestamp));

        String msg = Encoder.hexEncode(VoltDB.instance().getVersionString() + "," + System.currentTimeMillis());
        contents = contents.replace("get.py?a=KEY&", String.format("get.py?a=%s&", msg));

        return contents;
    }
1362568
public String getErrorMessage() {
        final Object result = getStateHelper().eval(PropertyKeys.errorMessage);
        if (result == null) {
            return null;
        }
        return result.toString();
    }
361084
public com.google.rpc.StatusOrBuilder getErrorOrBuilder() {
    if (resultCase_ == 4) {
       return (com.google.rpc.Status) result_;
    }
    return com.google.rpc.Status.getDefaultInstance();
  }
721706
public String getErrorReport() {
		Map<String, List<PropertyMigration>> content = getContent(
				LegacyProperties::getUnsupported);
		if (content.isEmpty()) {
			return null;
		}
		StringBuilder report = new StringBuilder();
		report.append(String.format("%nThe use of configuration keys that are no longer "
				+ "supported was found in the environment:%n%n"));
		append(report, content);
		report.append(String.format("%n"));
		report.append("Please refer to the migration guide or reference guide for "
				+ "potential alternatives.");
		report.append(String.format("%n"));
		return report.toString();
	}
634402
public static String getFailureDescriptionAsString(final ModelNode result) {
        if (isSuccessfulOutcome(result)) {
            return "";
        }
        final String msg;
        if (result.hasDefined(ClientConstants.FAILURE_DESCRIPTION)) {
            if (result.hasDefined(ClientConstants.OP)) {
                msg = String.format("Operation '%s' at address '%s' failed: %s", result.get(ClientConstants.OP), result.get(ClientConstants.OP_ADDR), result
                        .get(ClientConstants.FAILURE_DESCRIPTION));
            } else {
                msg = String.format("Operation failed: %s", result.get(ClientConstants.FAILURE_DESCRIPTION));
            }
        } else {
            msg = String.format("An unexpected response was found checking the deployment. Result: %s", result);
        }
        return msg;
    }
701871
public static Map<String, Object> getRunningAndCompleteStats() {
    Map<String, Object> root = new TreeMap<String, Object>();
    
    if (running_queries.isEmpty()) {
      root.put("running", Collections.emptyList());
    } else {
      final List<Object> running = new ArrayList<Object>(running_queries.size());
      root.put("running", running);
      
      // don't need to lock the map beyond what the iterator will do implicitly
      for (final QueryStats stats : running_queries.values()) {
        final Map<String, Object> obj = new HashMap<String, Object>(10);
        obj.put("query", stats.query);
        obj.put("remote", stats.remote_address);
        obj.put("user", stats.user);
        obj.put("headers", stats.headers);;
        obj.put("queryStart", stats.query_start_ms);
        obj.put("elapsed", DateTime.msFromNanoDiff(DateTime.nanoTime(), 
            stats.query_start_ns));
        running.add(obj);
      }
    }
    
    final Map<Integer, QueryStats> completed = completed_queries.asMap();
    if (completed.isEmpty()) {
      root.put("completed", Collections.emptyList());
    } else {
      root.put("completed", completed.values());
    }
    
    return root;
  }
1113767
public BeetlException validate(){
		if(!(program instanceof ErrorGrammarProgram)){
			return null;
		}
		ErrorGrammarProgram error = (ErrorGrammarProgram)program;
		BeetlException exception = error.getException();
		return exception;
	}
128952
public RunT getNearestOldBuild(int n) {
        SortedMap<Integer, ? extends RunT> m = _getRuns().tailMap(n);
        if (m.isEmpty())
            return null;
        return m.get(m.firstKey());
    }
861309
protected static String getString(List<Error> errorList) {
		String exceptionDetails = "";
		if (errorList != null) {
			Iterator<Error> iter = errorList.iterator();
			while (iter.hasNext()) {
				Error error = iter.next();
				StringBuilder sb = new StringBuilder();
				sb.append("ERROR CODE:").append(error.getCode()).append(", ERROR MESSAGE:").append(error.getMessage()).append(", ERROR DETAIL:")
						.append(error.getDetail());
				/**
				 * this was done as a result of adding Payment APIs; this wasn't
				 * done before. so keep it consistent with V3 SDK (to preserve
				 * the behaviour for V3) the null check is being done before adding it.
				 */
				if (error.getElement() != null) {
					sb.append(", MORE ERROR DETAIL:").append(error.getElement());
				}
				sb.append("\r\n");
				exceptionDetails = exceptionDetails + sb.toString();
			}
		}
		return exceptionDetails;
	}
98813
@SuppressWarnings("unchecked")
    private final int checkNodeDirectory() throws ClusterInfoException {
        try {

            // get all of the nodes in the nodeDir and set one for this node if it's not already set.
            final Collection<String> nodeDirs;
            if (nodeDirectory == null) {
                nodeDirectory = utils.session.recursiveMkdir(utils.nodesDir + "/node_", thisNode, DirMode.PERSISTENT,
                        DirMode.EPHEMERAL_SEQUENTIAL);
                nodeDirs = session.getSubdirs(utils.nodesDir, this);
            } else
                nodeDirs = utils.persistentGetSubdir(utils.nodesDir, null);

            // what node am I?
            int nodeRank = -1;
            int index = 0;
            final String nodeSubdir = new File(nodeDirectory).getName();
            for (final String cur : nodeDirs) {
                if (nodeSubdir.equals(cur)) {
                    nodeRank = index;
                    break;
                }
                index++;
            }

            // If I couldn't find me, there's a problem.
            if (nodeRank == -1) {
                // drop the node directory since it clearly doesn't exist anymore
                nodeDirectory = null;
                throw new ClusterInfoException(
                        "Node " + thisNode + " was registered at " + nodeSubdir + " but it wasn't found as a subdirectory.");
            }

            // verify the container address is correct.
            C curDest = (C) session.getData(nodeDirectory, null);
            if (curDest == null) // this really can't be null
                session.setData(nodeDirectory, thisNode);
            else if (!thisNode.equals(curDest)) { // wth?
                final String tmp = nodeDirectory;
                nodeDirectory = null;
                throw new ClusterInfoException("Impossible! The Node directory " + tmp + " contains the destination for " + curDest
                        + " but should have " + thisNode);
            }

            // Check to make sure that THIS node is only in one place. If we find it in a node directory
            // that's not THIS node directory then this is something we should clean up.
            for (final String subdir : nodeDirs) {
                final String fullPathToSubdir = utils.nodesDir + "/" + subdir;
                curDest = (C) session.getData(fullPathToSubdir, null);
                if (thisNode.equals(curDest) && !fullPathToSubdir.equals(nodeDirectory)) // this is bad .. clean up
                    session.rmdir(fullPathToSubdir);
            }

            return nodeRank;
        } catch (final ClusterInfoException cie) {
            cleanupAfterExceptionDuringNodeDirCheck();
            throw cie;
        } catch (final RuntimeException re) {
            cleanupAfterExceptionDuringNodeDirCheck();
            throw re;
        } catch (final Throwable th) {
            cleanupAfterExceptionDuringNodeDirCheck();
            throw new RuntimeException("Unknown exception!", th);
        }
    }
141941
@Override
  public String getMessage() {

    if (getValidationExceptions().size() == 0) {
      return super.getMessage();
    }

    StringBuffer sb = new StringBuffer();

    boolean first = true;

    for (Iterator iter = getValidationExceptions().iterator(); iter.hasNext(); ) {
      Exception e = (Exception) iter.next();

      if (!first) {
        sb.append('\n');
        first = false;
      }

      sb.append(e.getMessage());
    }

    return sb.toString();
  }
1288986
public String run() {
        if (def != null) {
            return System.getProperty(property, def);
        }
        return System.getProperty(property);
    }
1177677
public String getErrorMessage() {

        StringBuffer result = new StringBuffer(512);

        String reason = m_messages.key(Messages.GUI_REASON_0, new Object[] {});

        if (CmsStringUtil.isNotEmpty(m_errorMessage)) {
            result.append(m_errorMessage);
            result.append("\n").append(reason).append(": ");
        }

        // if a localized message is already set as a parameter, append it.
        result.append(getMessage(m_throwable));
        // recursively append all error reasons to the message
        for (Throwable cause = m_throwable.getCause(); cause != null; cause = cause.getCause()) {
            result.append("\n").append(reason).append(": ");
            result.append(getMessage(cause));
        }
        return result.toString();
    }
297490
public Map<String, ClassInfo> getAllClassesAsMap() {
        if (closed.get()) {
            throw new IllegalArgumentException("Cannot use a ScanResult after it has been closed");
        }
        if (!scanSpec.enableClassInfo) {
            throw new IllegalArgumentException("Please call ClassGraph#enableClassInfo() before #scan()");
        }
        return classNameToClassInfo;
    }
1045192
public static <K /*>>> extends @NonNull Object*/, V /*>>> extends @NonNull Object*/>
      void checkMapElementNotNull(Map<K, V> map, @javax.annotation.Nullable Object errorMessage) {
    for (Map.Entry<K, V> entry : map.entrySet()) {
      if (entry.getKey() == null || entry.getValue() == null) {
        throw new NullPointerException(String.valueOf(errorMessage));
      }
    }
  }