eppleton commented on code in PR #9820: URL: https://github.com/apache/netbeans/pull/9820#discussion_r4695597927
########## platform/openide.filesystems/src/org/netbeans/modules/openide/filesystems/declmime/NioFileTypeDetector.java: ########## @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.netbeans.modules.openide.filesystems.declmime; + +import java.nio.file.Path; +import java.nio.file.spi.FileTypeDetector; + +import org.openide.filesystems.FileObject; +import org.openide.filesystems.FileUtil; +import org.openide.util.lookup.ServiceProvider; + +@ServiceProvider(service = FileTypeDetector.class, position = 100) Review Comment: Thanks. One concern from reading the launcher code (not tested in a running IDE): `NbFileTypeDetector` is in `core.startup`, which ends up in `platform/core/core.jar`. The launcher (`nbexec` `build_cp`) only puts `lib/*.jar` on the JVM classpath; the `core/*.jar` files are loaded by `MainImpl.BootClassLoader` (`MainImpl.java` around lines 166 and 407). `Files.probeContentType` looks detectors up with `ServiceLoader.load(FileTypeDetector.class, ClassLoader.getSystemClassLoader())`, so in a normally launched IDE it would not find this class. The new `ValidateMimeTypesTest` may still pass, because under `NbModuleSuite` the system class loader is the test JVM's classpath rather than the launcher's. Could you check `Files.probeContentType` on a virtual path in an IDE started via `nbexec`? If it returns `null` there, moving the class to a module with `module.jar.dir=lib` (e.g. `openide.util.lookup` or `openide.util`) should fix it, as discussed above. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
