MCPcopy Index your code
hub / github.com/cloudfoundry/java-buildpack / Finalize

Method Finalize

src/java/frameworks/debug.go:61–88  ·  view source on GitHub ↗

Finalize adds debug options to JAVA_OPTS

()

Source from the content-addressed store, hash-verified

59
60// Finalize adds debug options to JAVA_OPTS
61func (d *DebugFramework) Finalize() error {
62 config, err := d.loadConfig()
63 if err != nil {
64 d.context.Log.Warning("Failed to load debug config: %s", err.Error())
65 return nil // Don't fail the build
66 }
67 if !config.isEnabled() {
68 return nil
69 }
70
71 port := config.getPort()
72 suspend := config.getSuspend()
73
74 // Build JDWP agent string
75 suspendValue := "n"
76 if suspend {
77 suspendValue = "y"
78 }
79
80 debugOpts := fmt.Sprintf("-agentlib:jdwp=transport=dt_socket,server=y,address=%d,suspend=%s", port, suspendValue)
81
82 // Write JAVA_OPTS to .opts file with priority 20 (Ruby buildpack line 54)
83 if err := writeJavaOptsFile(d.context, 20, "debug", debugOpts); err != nil {
84 return fmt.Errorf("failed to write java_opts file: %w", err)
85 }
86
87 return nil
88}
89
90// isEnabled checks if debugging is enabled
91func (d *debugConfig) isEnabled() bool {

Callers

nothing calls this directly

Calls 5

loadConfigMethod · 0.95
writeJavaOptsFileFunction · 0.85
getSuspendMethod · 0.80
isEnabledMethod · 0.45
getPortMethod · 0.45

Tested by

no test coverage detected