Skip to content

Commit aa51f44

Browse files
authored
Merge pull request #978 from AdoptOpenJDK/OptimiseLogging
Optimise logging
2 parents b328e1e + a29b78b commit aa51f44

7 files changed

Lines changed: 4 additions & 16 deletions

File tree

common/src/main/java/net/adoptopenjdk/icedteaweb/lockingfile/LockableFile.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,9 @@ public void lock() throws IOException {
317317
return;
318318
}
319319

320-
logger.debug("Trying to create lock file {}", lockFile.getPath());
321320
while (file.exists() && !tryLock()) {
322321
try {
323322
Thread.sleep(500);
324-
logger.debug("Trying to create lock file {}", lockFile.getPath());
325323
} catch (InterruptedException e) {
326324
e.printStackTrace();
327325
}
@@ -344,7 +342,6 @@ public boolean tryLock() throws IOException {
344342
logger.debug("Could not create lock file {}", lockFile.getPath());
345343
return false;
346344
}
347-
logger.debug("Created lock file {}", lockFile.getPath());
348345
lockFile.deleteOnExit();
349346
return true;
350347
}

core/src/main/java/net/sourceforge/jnlp/JNLPFileFactory.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ private InputStream openURL(final URL location, final VersionString version, fin
125125
final ResourceTracker tracker = new ResourceTracker(false, DownloadOptions.NONE, policy); // no prefetch
126126
tracker.addResource(location, version);
127127
final File f = tracker.getCacheFile(location);
128+
if (f == null) {
129+
throw new IOException("Error fetching file from " + location);
130+
}
128131
return new FileInputStream(f);
129132
} catch (IOException ex) {
130133
throw ex;

core/src/main/java/net/sourceforge/jnlp/runtime/JNLPPolicy.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ private Policy getPolicyFromConfig(String key) {
230230
* @return a policy based on the configuration set by the user
231231
*/
232232
private Policy getPolicyFromUrl(String policyLocation) {
233-
LOG.debug("Begin getPolicyFromUrl({})", policyLocation);
233+
LOG.debug("getPolicyFromUrl({})", policyLocation);
234234
Policy policy = null;
235235
if (policyLocation != null) {
236236
try {
@@ -241,14 +241,11 @@ private Policy getPolicyFromUrl(String policyLocation) {
241241
} else {
242242
policyUri = new URI(policyLocation.replace("\\", "/"));
243243
}
244-
LOG.debug("Start Policy.getInstance({})", policyUri.toString());
245244
policy = getInstance("JavaPolicy", new URIParameter(policyUri));
246-
LOG.debug("End Policy.getInstance({})", policyUri.toString());
247245
} catch (Exception e) {
248246
LOG.error("Error while loading the policy from URL " + policyLocation, e);
249247
}
250248
}
251-
LOG.debug("End getPolicyFromUrl()");
252249
return policy;
253250
}
254251

core/src/main/java/net/sourceforge/jnlp/runtime/JNLPRuntime.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,7 @@ public static void initialize() throws IllegalStateException {
257257

258258
ServiceManager.setServiceManagerStub(new XServiceManagerStub()); // ignored if we're running under Web Start
259259

260-
LOG.debug("Start get JavaPolicy");
261260
policy = new JNLPPolicy();
262-
LOG.debug("Finished get JavaPolicy");
263261

264262
security = new JNLPSecurityManager(); // side effect: create JWindow
265263

@@ -296,10 +294,8 @@ public static void initialize() throws IllegalStateException {
296294

297295
// plug in a custom authenticator and proxy selector
298296
Authenticator.setDefault(new JNLPAuthenticator());
299-
LOG.debug("Start Proxy Selector");
300297
ProxySelector proxySelector = getExtensionPoint().createProxySelector(getConfiguration());
301298
ProxySelector.setDefault(proxySelector);
302-
LOG.debug("Finished Proxy Selector");
303299

304300
// Restrict access to netx classes
305301
Security.setProperty("package.access",

core/src/main/java/net/sourceforge/jnlp/security/KeystorePasswordAttempter.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,13 @@ Key unlockKeystore(KeystoreOperation operation) throws KeyStoreException, NoSuch
137137
for (int i = 0; i < localPasses.size(); i++) {
138138
final SavedPassword pass = localPasses.get(i);
139139
try {
140-
LOG.debug("unlockKeyStore: Operating Keystore {}", keyStorePath);
141140
//we expect, that any keystore is loaded before read.
142141
//so we are writing by correct password
143142
//if no successful password was provided during reading, then finish(firstEx); will save us from overwrite
144143
final Key result = operation.operateKeystore(pass.pass);
145144
//ok we were successful
146145
//save the loading password for storing purposes (and another reading too)
147146
if (operation.f != null) {
148-
LOG.debug("unlockKeyStore: Store successful pass for file {}", keyStorePath);
149147
successfulPerKeystore.put(keyStorePath, pass);
150148
}
151149
return result;

core/src/main/java/net/sourceforge/jnlp/security/SecurityUtil.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@ Key operateKeystore(char[] pass) throws KeyStoreException, NoSuchAlgorithmExcept
354354

355355
public static void loadKeyStore(KeyStore ks, File f) throws IOException, NoSuchAlgorithmException, CertificateException {
356356
try {
357-
LOG.debug("Loading Keystore {}", f != null ? f.toString() : "Unknown");
358357
KeystorePasswordAttempter.INSTANCE.unlockKeystore(
359358
new KeystorePasswordAttempter.KeystoreOperation(ks, f) {
360359

core/src/main/java/net/sourceforge/jnlp/util/RestrictedFileUtils.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ private static void createRestrictedFile(File file, boolean isDir) throws IOExce
128128
List<AclEntry> list = new ArrayList<>();
129129
for (AclEntry ae : view.getAcl()) {
130130
if (principalInWinSIDS(ae.principal())) {
131-
LOG.debug("Allowing permissions on restricted file {} for principal {} : {} ", tempFile.getAbsolutePath(), ae.principal().getName(), getSIDForPrincipal(ae.principal()));
132131
list.add(AclEntry.newBuilder()
133132
.setType(AclEntryType.ALLOW)
134133
.setPrincipal(ae.principal())
@@ -138,7 +137,6 @@ private static void createRestrictedFile(File file, boolean isDir) throws IOExce
138137
}
139138
}
140139
// Add permissions for the owner
141-
LOG.debug("Allowing permissions on restricted file {} for principal {} : {} ", tempFile.getAbsolutePath(), view.getOwner().getName(), getSIDForPrincipal(view.getOwner()));
142140
list.add(AclEntry.newBuilder()
143141
.setType(AclEntryType.ALLOW)
144142
.setPrincipal(view.getOwner())

0 commit comments

Comments
 (0)