This is a shortcut method for ResultBuilder.failed().msg(msg).build()
555334
public static <T> Result<T> failed(String msg) {
        return Result.<T>builder().success(false).msg(msg).build();
    }
793780
public void execute() throws BuildException {
        checkParameters();
        resetFileLists();
        loadRegisteredScriptExtensions();

        if (javac != null) jointCompilation = true;

        // scan source directories and dest directory to build up
        // compile lists
        String[] list = src.list();
        for (String filename : list) {
            File file = getProject().resolveFile(filename);
            if (!file.exists()) {
                throw new BuildException("srcdir \"" + file.getPath() + "\" does not exist!", getLocation());
            }
            DirectoryScanner ds = this.getDirectoryScanner(file);
            String[] files = ds.getIncludedFiles();
            scanDir(file, destDir != null ? destDir : file, files);
        }

        compile();
        if (updatedProperty != null
                && taskSuccess
                && compileList.length != 0) {
            getProject().setNewProperty(updatedProperty, "true");
        }
    }
579371
public static <T> Result<T> successful(T data) {
        return Result.<T>builder().success(true).data(data).build();
    }
487414
private void buildNewInstanceMethodForBuilder( MethodSpec.Builder newInstanceMethodBuilder ) {
        newInstanceMethodBuilder.addStatement( "return new $T(builderDeserializer.deserializeInline(reader, ctx, params, null, null, null, bufferedProperties).build(), bufferedProperties)",
                parameterizedName( Instance.class, beanInfo.getType() ) );
    }
446057
public String build() {
        String fieldsString = this.fields == null ? null : Helpers.quote(this.fields);
        String sortString = this.sort == null ? null : quoteSort(this.sort);
        String limitString = this.limit == null ? null : Helpers.quote(this.limit);
        String skipString = this.skip == null ? null : Helpers.quote(this.skip);
        String bookmarkString = this.bookmark == null ? null : Helpers.quote(this.bookmark);
        String useIndexString = this.useIndex == null ? null : Helpers.quote(this.useIndex);
        StringBuilder builder = new StringBuilder();
        // build up components...
        // selector
        builder.append(Helpers.withKey(Helpers.SELECTOR, this.selector));
        // fields
        if (fieldsString != null) {
            builder.append(String.format(", \"fields\": %s", fieldsString));
        }
        // sort
        if (sortString != null) {
            builder.append(String.format(", \"sort\": %s", sortString));
        }
        // limit
        if (limitString != null) {
            builder.append(String.format(", \"limit\": %s", limitString));
        }
        // skip
        if (skipString != null) {
            builder.append(String.format(", \"skip\": %s", skipString));
        }
        if (bookmarkString != null) {
            builder.append(String.format(", \"bookmark\": %s", bookmarkString));
        }
        if (!this.update) {
            builder.append(", \"update\": false");
        }
        if (this.stable) {
            builder.append(", \"stable\": true");
        }
        // execution_stats
        if (this.executionStats) {
            builder.append(", \"execution_stats\": true");
        }
        if (useIndexString != null) {
            builder.append(String.format(", \"use_index\": %s", useIndexString));
        }
        return String.format("{%s}", builder.toString());
    }
1027908
public static Object buildSingleResult(Result result, int column,
			GeoPackageDataType dataType) {

		Object value = null;
		try {
			if (result.moveToNext()) {
				value = result.getValue(column, dataType);
			}
		} finally {
			result.close();
		}

		return value;
	}
913782
void completedStatus(String buildResult, String message) {
        completedStatus.add(new GhprbBuildResultMessage(
                GHCommitState.valueOf(buildResult),
                message
        ));
    }
218627
public String buildErrorMessages() {

        StringBuffer result = new StringBuffer(8);
        String errorMessages = getErrorMessagesString();
        if (!"".equals(errorMessages)) {
            result.append(dialogBlock(HTML_START, key(Messages.GUI_PERMISSION_ERROR_0), true));
            result.append("<font color='red'>").append(errorMessages).append("</font>");
            result.append(dialogBlockEnd());
        }
        return result.toString();
    }
872886
public static alluxio.proto.journal.Job.TaskInfo.Builder setResult(
          alluxio.proto.journal.Job.TaskInfo.Builder builder, byte[] bytes) {
    return builder.setResult(com.google.protobuf.ByteString.copyFrom(bytes));
  }
742969
function buildParams(msg, method, config, params) {
    var p = buildWorkspaceParams(msg, method, config, params)
      .then(function(){
        return buildIntentParams(msg, method, config, params);
      })
      .then(function(){
        return buildExampleParams(msg, method, config, params);
      })
      .then(function(){
        return buildEntityParams(msg, method, config, params);
      })
      .then(function(){
        return buildEntityValueParams(msg, method, config, params);
      })
      .then(function(){
        return buildDialogParams(msg, method, config, params);
      })
      .then(function(){
        return buildExportParams(method, config, params);
      });

    return p;
  }
750858
private void buildStructure() throws DevFailed {
        DbServer    server;
        if (tgHost ==null || tgPort ==null)
            server = new DbServer(serverName);
        else {
            server = new DbServer(serverName, tgHost, tgPort);
        }

        //  Check if server defined in database.
        String  adminName = (tgHost ==null)? "" : "tango://"+ tgHost +":"+ tgPort +"/";
        adminName += "dserver/"+serverName.toLowerCase();
        new DeviceProxy(adminName);

        //  Build Server classes
        String[]    classNames = server.get_class_list();
        classes.add(new TangoClass("DServer"));
        for (String className : classNames) {
             classes.add(new TangoClass(className));
        }
	}
483291
@Override
	public Future<ModuleBuildReader> getBuild(HttpServletRequest request) {
		String errorMessage = MessageFormat.format(
				Messages.NotFoundModule_0,
				new Object[]{StringUtil.escapeForJavaScript(uri.toString())}
		);
		return
			new CompletedFuture<ModuleBuildReader>(
				new ModuleBuildReader(
					new ErrorModuleReader(
						ErrorModuleReader.ConsoleMethod.error,
						errorMessage,
						getModuleName(),
						request
					), true,
					null,
					errorMessage
				)
			);
	}
631463
public void execute() throws BuildException {
    log.debug("projectname=" + getProjectName());
    log.debug("src/srcdir=" + getSrcdir());
    log.debug("destdir=" + getDestdir());
    log.debug("failOnError=" + getFailOnError());
    log.debug("checkedArithmetic=" + isCheckedArithmetic());
    log.debug("scriptExtensions=" + getScriptExtensions());
    log.debug("_compileClasspath=" + _compileClasspath);

    if(isCheckedArithmetic()) {
      System.setProperty("checkedArithmetic", "true");
    }
    
    ICompilerDriver driver = new SoutCompilerDriver();
    IGosuCompiler gosuc = new gw.lang.gosuc.simple.GosuCompiler();

    List<String> classpath = new ArrayList<>();
    classpath.addAll(Arrays.asList(_compileClasspath.list()));
    classpath.addAll( GosucUtil.getJreJars());

    String startupMsg = "Initializing Gosu compiler";
    if(!getProjectName().isEmpty()) {
      startupMsg += " for " + getProjectName();
    }
    log.info(startupMsg);
    log.debug("\tsourceFolders:" + Arrays.asList(getSrcdir().list()));
    log.debug("\tclasspath:" + classpath);
    log.debug("\toutputPath:" + getDestdir().getAbsolutePath());

    List<String> sourceRoots = Arrays.asList(getSrcdir().list());
    for (String sourceRootName : sourceRoots) {
      File sourceRoot = getProject().resolveFile(sourceRootName);
      if (!sourceRoot.exists()) {
        throw new BuildException("srcdir \"" + sourceRoot.getPath() + "\" does not exist!", getLocation());
      }
      DirectoryScanner ds = this.getDirectoryScanner(sourceRoot);
      String[] files = ds.getIncludedFiles();
      if( hasSelectors() ) { 
        // we have explicit includes/excludes criteria nested in a <src> element; no need to call scanDir
        // this is the typical use case when ant is invoked dynamically by gradle
        for( String relativeFilename : files ) {
          compileList.add( new File( sourceRoot, relativeFilename ) );
        }
      } else {
        // <src> element was not used - instead we have an explicit list of srcDir elements 
        // and optionally additionalscriptextensions specified in addition to the defaults
        scanDir(sourceRoot, _destDir != null ? _destDir : sourceRoot, files);
      }
    }
    
    gosuc.initializeGosu( sourceRoots, classpath, getDestdir().getAbsolutePath() );

    log.debug("About to compile these files:");
    for(File file : compileList) {
      log.debug("\t" + file.getAbsolutePath());
    }
    
    for(File file : compileList) {
      try {
        gosuc.compile(file, driver);
      } catch (Exception e) {
        log.error(e.getMessage());
        throw new BuildException(e);
      }
    }

    gosuc.uninitializeGosu();

    List<String> warnings = ((SoutCompilerDriver) driver).getWarnings();
    boolean errorsInCompilation = ((SoutCompilerDriver) driver).hasErrors();
    List<String> errors = ((SoutCompilerDriver) driver).getErrors();
    
    List<String> warningMessages = new ArrayList<>();
    List<String> errorMessages = new ArrayList<>();
   
    warnings.forEach(warning -> warningMessages.add("[WARNING] " + warning));
    int numWarnings = warningMessages.size();

    int numErrors = 0;
    if(errorsInCompilation) {
      errors.forEach(error -> errorMessages.add("[ERROR] " + error));
      numErrors = errorMessages.size();
    }

    boolean hasWarningsOrErrors = numWarnings > 0 || errorsInCompilation;
    StringBuilder sb;
    sb = new StringBuilder();
    sb.append(getProjectName().isEmpty() ? "Gosu compilation" : getProjectName());
    sb.append(" completed");
    if(hasWarningsOrErrors) {
      sb.append(" with ");
      if(numWarnings > 0) {
        sb.append(numWarnings).append(" warning").append(numWarnings == 1 ? "" : 's');
      }
      if(errorsInCompilation) {
        sb.append(numWarnings > 0 ? " and " : "");
        sb.append(numErrors).append(" error").append(numErrors == 1 ? "" : 's');
      }
    } else {
      sb.append(" successfully.");
    }

    if(hasWarningsOrErrors) {
      log.warn(sb.toString());
    } else {
      log.info(sb.toString());
    }

    //log at most 100 warnings or errors
    warningMessages.subList(0, Math.min(warningMessages.size(), 100)).forEach(log::info);
    errorMessages.subList(0, Math.min(errorMessages.size(), 100)).forEach(log::error);

    if(errorsInCompilation) {
      if(getFailOnError()) {
        buildError("Gosu compilation failed with errors; see compiler output for details.");
      } else {
        log.warn("Gosu Compiler: Ignoring compilation failure(s) as 'failOnError' was set to false");
      }
    }
    
  }
433279
public static void error(Logger log, String methodName, Object... params) {
        log.error(buildMethodLogString(methodName, params));
    }
562493
protected String buildErrorSetMsg(Object obj, Object value, Field aField)
    {
        String eol = SystemUtils.LINE_SEPARATOR;
        StringBuffer buf = new StringBuffer();
        buf
                .append(eol + "[try to set 'object value' in 'target object'")
                .append(eol + "target obj class: " + (obj != null ? obj.getClass().getName() : null))
                .append(eol + "target field name: " + (aField != null ? aField.getName() : null))
                .append(eol + "target field type: " + (aField != null ? aField.getType() : null))
                .append(eol + "target field declared in: " + (aField != null ? aField.getDeclaringClass().getName() : null))
                .append(eol + "object value class: " + (value != null ? value.getClass().getName() : null))
                .append(eol + "object value: " + (value != null ? value : null))
                .append(eol + "]");
        return buf.toString();
    }
653215
@Override
	public Future<?> buildAsync(final Callable<?> builder, final HttpServletRequest req) {
		return getExecutors().getBuildExecutor().submit(new Callable<Object>() {
			public Object call() throws Exception {
				AbstractAggregatorImpl.this.currentRequest.set(req);
				Object result;
				try {
					result = builder.call();
				} finally {
					AbstractAggregatorImpl.this.currentRequest.set(null);
				}
				return result;
			}
		});
	}
425695
public static Result failure(String message, String description) {
        return new Result(message, description, null);
    }