MCPcopy Create free account
hub / github.com/cloudfoundry/java-buildpack / Detect

Method Detect

src/java/frameworks/java_opts.go:28–43  ·  view source on GitHub ↗

Detect returns a positive result if loadConfig() finds settings (universal framework for JAVA_OPTS configuration)

()

Source from the content-addressed store, hash-verified

26
27// Detect returns a positive result if loadConfig() finds settings (universal framework for JAVA_OPTS configuration)
28func (j *JavaOptsFramework) Detect() (string, error) {
29 // Check if there's any configuration to apply
30 config, err := j.loadConfig()
31 if err != nil {
32 // if detect "fails" Finalize() is not called so log parse failures as warning
33 j.context.Log.Warning("Failed to load java_opts config: %s", err.Error())
34 return "", nil
35 }
36
37 // Detect if there are any custom java_opts or if from_environment is enabled
38 if len(config.JavaOpts) > 0 || config.FromEnvironment {
39 return "Java Opts", nil
40 }
41
42 return "", nil
43}
44
45// Supply does nothing (no dependencies to install)
46func (j *JavaOptsFramework) Supply() error {

Callers

nothing calls this directly

Calls 1

loadConfigMethod · 0.95

Tested by

no test coverage detected