|
38 | 38 |
|
39 | 39 | /**
|
40 | 40 | * Defines various global configuration for the running {@code GlassFish} instance.
|
41 |
| - * |
42 | 41 | * <p>
|
43 | 42 | * This primarily replaces all the system variables in V2.
|
44 | 43 | *
|
@@ -111,60 +110,45 @@ public ServerEnvironmentImpl(File root) {
|
111 | 110 | @PostConstruct
|
112 | 111 | public void postConstruct() {
|
113 | 112 |
|
114 |
| - // todo : dochez : this will need to be reworked... |
115 | 113 | String installRoot = startupContext.getArguments().getProperty(INSTALL_ROOT.getPropertyName());
|
116 | 114 | if (installRoot == null) {
|
117 | 115 | // During unit testing, we find an empty StartupContext.
|
118 | 116 | // Let's first see if the installRoot system property is set in the client VM. If not
|
119 | 117 | // to be consistent with earlier code (i.e., code that relied on StartupContext.getRootDirectory()),
|
120 | 118 | // I am setting user.dir as installRoot.
|
121 |
| - if (System.getProperty(INSTALL_ROOT.getSystemPropertyName()) != null) { |
122 |
| - installRoot = System.getProperty(INSTALL_ROOT.getSystemPropertyName()); |
123 |
| - } else { |
| 119 | + if (System.getProperty(INSTALL_ROOT.getSystemPropertyName()) == null) { |
| 120 | + // current directory |
124 | 121 | installRoot = System.getProperty("user.dir");
|
| 122 | + } else { |
| 123 | + installRoot = System.getProperty(INSTALL_ROOT.getSystemPropertyName()); |
125 | 124 | }
|
126 | 125 | }
|
127 | 126 | asenv = new ASenvPropertyReader(new File(installRoot));
|
128 | 127 |
|
129 | 128 | // Default
|
130 | 129 | if (this.root == null) {
|
131 | 130 | String envVar = System.getProperty(INSTANCE_ROOT.getSystemPropertyName());
|
132 |
| - if (envVar!=null) { |
| 131 | + if (envVar != null) { |
133 | 132 | root = new File(envVar);
|
134 | 133 | } else {
|
135 | 134 | String instanceRoot = startupContext.getArguments().getProperty(INSTANCE_ROOT.getPropertyName());
|
136 | 135 | if (instanceRoot == null) {
|
137 |
| - // In client container, instanceRoot is not set. It is a different question altogether as to why |
138 |
| - // an object called ServerEnvironmentImpl is at all active in client runtime. To be consistent |
139 |
| - // with earlier code, we use installRoot as instanceRoot. |
| 136 | + // In client container, instanceRoot is not set. |
| 137 | + // It is a different question altogether as to why |
| 138 | + // an object called ServerEnvironmentImpl is at all active in client runtime. |
| 139 | + // To be consistent with earlier code, we use installRoot as instanceRoot. |
140 | 140 | instanceRoot = installRoot;
|
141 | 141 | }
|
142 | 142 | root = new File(instanceRoot);
|
143 | 143 | }
|
144 | 144 | }
|
145 | 145 |
|
146 |
| - /* |
147 |
| - * bnevins 12/12/11 |
148 |
| - * The following chunk of code sets things like hostname to be a file under instance root |
149 |
| - * I.e. it's crazy. It's 1 hour until SCF so I'll just fix the current problem which is a NPE |
150 |
| - * if the value is null. |
151 |
| - * At any rate the weird values that get set into System Properties get un-done at |
152 |
| - * the line of code in bootstrap (see end of this comment). It's easy to trace just step out of this method |
153 |
| - * in a debugger |
154 |
| - * createGlassFish(gfKernel, habitat, gfProps.getProperties()) |
155 |
| - */ |
156 | 146 | asenv.getProps().put(INSTANCE_ROOT.getPropertyName(), root.getAbsolutePath());
|
157 | 147 | for (Map.Entry<String, String> entry : asenv.getProps().entrySet()) {
|
158 |
| - |
159 |
| - if (entry.getValue() == null) { // don't NPE File ctor |
| 148 | + if (entry.getValue() == null) { |
160 | 149 | continue;
|
161 | 150 | }
|
162 |
| - |
163 |
| - File location = new File(entry.getValue()); |
164 |
| - if (!location.isAbsolute()) { |
165 |
| - location = new File(asenv.getProps().get(INSTANCE_ROOT.getPropertyName()), entry.getValue()); |
166 |
| - } |
167 |
| - System.setProperty(entry.getKey(), location.getAbsolutePath()); |
| 151 | + System.setProperty(entry.getKey(), entry.getValue()); |
168 | 152 | }
|
169 | 153 |
|
170 | 154 | Properties args = startupContext.getArguments();
|
|
0 commit comments