premek commented on a change in pull request #2906:
URL: https://github.com/apache/netbeans/pull/2906#discussion_r617031157



##########
File path: 
platform/keyring.impl/src/org/netbeans/modules/keyring/gnome/libsecret/GnomeLibSecretProvider.java
##########
@@ -0,0 +1,146 @@
+/*
+ * 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.keyring.gnome.libsecret;
+
+import com.sun.jna.Pointer;
+import com.sun.jna.Structure;
+import com.sun.jna.ptr.PointerByReference;
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.netbeans.modules.keyring.gnome.libsecret.Glib.GError;
+import org.netbeans.modules.keyring.gnome.libsecret.LibSecret.SecretSchema;
+import 
org.netbeans.modules.keyring.gnome.libsecret.LibSecret.SecretSchemaAttribute;
+import org.netbeans.spi.keyring.KeyringProvider;
+import org.openide.util.NbBundle;
+import org.openide.util.lookup.ServiceProvider;
+
+@ServiceProvider(service = KeyringProvider.class, position = 150)
+public class GnomeLibSecretProvider implements KeyringProvider {
+
+    private static final Logger LOG = 
Logger.getLogger(GnomeLibSecretProvider.class.getName());
+    private static final String KEY = "key"; // NOI18N
+
+    private final String appName;
+
+    public GnomeLibSecretProvider() {
+        appName = getAppName();
+    }
+
+    private SecretSchema getSchema() {

Review comment:
       That is what I did initially but the way the KeyringProvider interface 
is being used is that an instance is created and then `enabled` is called on it 
and if the native library is not present, the `UnsatisfiedLinkError` is catched 
inside the `enabled` method and it returns false (not enabled).
   
   If the constructor throws the exception (on systems where libsecret is not 
present) at least the current unit tests failed.
   
   Should we make the field for the `schema` but not initialize it in the 
constructor but on the first use?
   




-- 
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.

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

Reply via email to