From 7456da964add0d6e8530ab731d5e8837dcfb8a54 Mon Sep 17 00:00:00 2001 From: ulrich Date: Sun, 01 Dec 2024 13:19:16 +0000 Subject: [PATCH] Logginglevel angepasst --- src/de/uhilger/neon/JarScanner.java | 46 +++++++++++++++++++++++++++++++--------------- 1 files changed, 31 insertions(+), 15 deletions(-) diff --git a/src/de/uhilger/neon/JarScanner.java b/src/de/uhilger/neon/JarScanner.java index d2c350c..f0cd8ab 100644 --- a/src/de/uhilger/neon/JarScanner.java +++ b/src/de/uhilger/neon/JarScanner.java @@ -1,8 +1,20 @@ /* - * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license - * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template - */ + neon - Embeddable HTTP Server based on jdk.httpserver + Copyright (C) 2024 Ulrich Hilger + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <https://www.gnu.org/licenses/>. + */ package de.uhilger.neon; import java.io.File; @@ -47,32 +59,32 @@ } private void processZipEntry(ClassLoader urlCL, ZipEntry zipentry, String packageName, JarScannerListener l, Handler h, String contextName) { - log(Level.FINEST, zipentry.getName()); + finest(zipentry.getName()); String zName = zipentry.getName(); if (zName.toLowerCase().endsWith(".class")) { int pos = zName.indexOf(".class"); String fullClassName = zName.substring(0, pos); - log(Level.FINEST, "full class name: " + zName); + finest("full class name: " + zName); String fullClassNameDots = fullClassName.replace('/', '.'); - log(Level.FINEST, "full class name dots: " + fullClassNameDots); + finest("full class name dots: " + fullClassNameDots); String pkgName = getPackageName(fullClassNameDots); - log(Level.FINEST, " -- package name: " + pkgName); + finest(" -- package name: " + pkgName); if (null != urlCL && pkgName.toLowerCase().startsWith(packageName)) { Class c = null; try { c = urlCL.loadClass(fullClassNameDots); if (c != null) { if (c.isAnnotationPresent(Actor.class)) { - log(Level.FINER, " ---- ACTOR ---- " + fullClassNameDots); + finest(" ---- ACTOR ---- " + fullClassNameDots); l.actorFound(c, h, contextName); } else { - log(Level.FINER, "kein Actor " + fullClassNameDots); + finest("kein Actor " + fullClassNameDots); } } else { - log(Level.FINER, "class NOT loaded: " + zName); + finest("class NOT loaded: " + zName); } } catch (ClassNotFoundException ex) { - log(Level.FINER, " +++++ Class not found: " + ex.getMessage()); + finest(" +++++ Class not found: " + ex.getMessage()); } } } @@ -94,7 +106,7 @@ ClassLoader urlCL = null; try { url = getPath(c).toURL(); - log(Level.FINER, "url: " + url.getPath()); + finer("url: " + url.getPath()); urlCL = new URLClassLoader(new URL[]{url}); } catch (URISyntaxException ex) { log(Level.SEVERE, ex.getMessage()); @@ -108,14 +120,14 @@ public URI getPath(Class c) throws URISyntaxException { //Class c = this.getClass(); String className = c.getName(); - finer("this name: " + className); + finest("this name: " + className); int pos = className.indexOf(".class"); if(pos > -1) { String classNameWoExt = className.substring(0, pos); } String classNameWoPkg = className.substring(className.lastIndexOf(".") + 1); - finer("Class name: " + classNameWoPkg); + finest("Class name: " + classNameWoPkg); String classPath = c.getResource(classNameWoPkg + ".class").getPath(); pos = classPath.indexOf("!"); String jarPath; @@ -124,10 +136,14 @@ } else { jarPath = classPath; } - finer("path: " + jarPath); + finest("path: " + jarPath); return new URI(jarPath); } + private void finest(String msg) { + log(Level.FINEST, msg); + } + private void finer(String msg) { log(Level.FINER, msg); } -- Gitblit v1.9.3