javax.net.ssl.SSLKeyException#org.openide.util.Mutex源码实例Demo

下面列出了javax.net.ssl.SSLKeyException#org.openide.util.Mutex 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: netbeans   文件: NbPlatform.java
public static void removePlatform(final NbPlatform plaf) throws IOException {
    try {
        ProjectManager.mutex().writeAccess(new Mutex.ExceptionAction<Void>() {
            @Override public Void run() throws IOException {
                EditableProperties props = PropertyUtils.getGlobalProperties();
                props.remove(PLATFORM_PREFIX + plaf.getID() + PLATFORM_DEST_DIR_SUFFIX);
                props.remove(PLATFORM_PREFIX + plaf.getID() + PLATFORM_HARNESS_DIR_SUFFIX);
                props.remove(PLATFORM_PREFIX + plaf.getID() + PLATFORM_LABEL_SUFFIX);
                props.remove(PLATFORM_PREFIX + plaf.getID() + PLATFORM_SOURCES_SUFFIX);
                props.remove(PLATFORM_PREFIX + plaf.getID() + PLATFORM_JAVADOC_SUFFIX);
                PropertyUtils.putGlobalProperties(props);
                return null;
            }
        });
    } catch (MutexException e) {
        throw (IOException) e.getException();
    }
    getPlatformsInternal().remove(plaf);
    ModuleList.refresh(); // #97262
    LOG.log(Level.FINE, "NbPlatform removed: {0}", plaf);
}
 
源代码2 项目: netbeans   文件: LexerUtils.java
/**
 * Forces to rebuild the document's {@link TokenHierarchy}.
 * 
 * @since 1.62
 * 
 * @param doc a swing document
 */
public  static void rebuildTokenHierarchy(final Document doc) {
    Mutex.EVENT.readAccess(new Runnable() {
        @Override
        public void run() {
            AtomicLockDocument nbdoc = LineDocumentUtils.as(doc, AtomicLockDocument.class);
            Runnable rebuild = new Runnable() {
                @Override
                public void run() {
                    MutableTextInput mti = (MutableTextInput) doc.getProperty(MutableTextInput.class);
                    if (mti != null) {
                        mti.tokenHierarchyControl().rebuild();
                    }
                }
            };
            if (nbdoc != null) {
                nbdoc.runAtomic(rebuild);
            } else {
                rebuild.run();
            }
        }
    });
}
 
源代码3 项目: netbeans   文件: ProjectProblemsProviders.java
@Override
public Collection<? extends ProjectProblem> getProblems() {
    return problemsProviderSupport.getProblems(new ProjectProblemsProviderSupport.ProblemsCollector() {
        @Override
        public Collection<? extends ProjectProblemsProvider.ProjectProblem> collectProblems() {
            Collection<? extends ProjectProblemsProvider.ProjectProblem> currentProblems = ProjectManager.mutex().readAccess((Mutex.Action<Collection<? extends ProjectProblem>>) () -> {
                final Set<ProjectProblem> newProblems = new LinkedHashSet<ProjectProblem>();
                final Set<File> allFiles = new HashSet<>();
                newProblems.addAll(getReferenceProblems(helper,eval,refHelper,refProps,allFiles,false));
                newProblems.addAll(getPlatformProblems(eval, helper, callback, platformProps,false));
                updateFileListeners(allFiles);
                return Collections.unmodifiableSet(newProblems);
            });
            return currentProblems;
        }
    });
}
 
源代码4 项目: netbeans   文件: Evaluator.java
private void reset() {
    if (!project.getProjectDirectoryFile().exists()) {
        return; // recently deleted?
    }
    ProjectManager.mutex().readAccess(new Mutex.Action<Void>() {
        public @Override Void run() {
            final ModuleList moduleList;
            try {
                moduleList = project.getModuleList();
            } catch (IOException e) {
                Util.err.notify(ErrorManager.INFORMATIONAL, e);
                // but leave old evaluator in place for now
                return null;
            }
            synchronized (Evaluator.this) {
                loadedModuleList = true;
                delegate.removePropertyChangeListener(Evaluator.this);
                delegate = createEvaluator(moduleList);
                delegate.addPropertyChangeListener(Evaluator.this);
            }
            // XXX better to compute diff between previous and new values and fire just those
            pcs.firePropertyChange(null, null, null);
            return null;
        }
    });
}
 
源代码5 项目: netbeans   文件: RemoteRepository.java
private void updateCurrentSettingsType () {
    Mutex.EVENT.readAccess(new Runnable() {
        @Override
        public void run() {
            GitURI uri = getURI();
            if (uri == null) {
                return;
            }
            for (ConnectionSettingsType type : settingTypes) {
                if (type.acceptUri(uri)) {
                    activeSettingsType = type;
                    break;
                }
            }
            if (urlFixed) {
                panel.tipLabel.setText(null);
                activeSettingsType.requestFocusInWindow();
            }
        }
    });
}
 
源代码6 项目: netbeans   文件: UpdateProjectImpl.java
/**
 * Returns true if the project is of current version.
 * @return true if the project is of current version, otherwise false.
 */
public boolean isCurrent () {
    return ProjectManager.mutex().readAccess(new Mutex.Action<Boolean>() {
        public Boolean run() {
            synchronized (UpdateProjectImpl.this) {
                if (isCurrent == null) {
                    if ((cfg.getConfigurationFragment("data","http://www.netbeans.org/ns/j2se-project/1",true) != null) ||
                    (cfg.getConfigurationFragment("data","http://www.netbeans.org/ns/j2se-project/2",true) != null)) {
                        isCurrent = Boolean.FALSE;
                    } else {
                        isCurrent = Boolean.TRUE;
                    }
                }
                return isCurrent;
            }
        }
    }).booleanValue();
}
 
源代码7 项目: netbeans   文件: WSUtils.java
public static void storeEditableProperties(final Project prj, final  String propertiesPath, final EditableProperties ep) 
    throws IOException {        
    try {
        ProjectManager.mutex().writeAccess(new Mutex.ExceptionAction<Void>() {
            @Override
            public Void run() throws IOException {                                             
                FileObject propertiesFo = prj.getProjectDirectory().getFileObject(propertiesPath);
                if (propertiesFo!=null) {
                    OutputStream os = null;
                    try {
                        os = propertiesFo.getOutputStream();
                        ep.store(os);
                    } finally {
                        if (os!=null) os.close();
                    }
                }
                return null;
            }
        });
    } catch (MutexException ex) {
    }
}
 
源代码8 项目: netbeans   文件: OpenProjectList.java
private void removeModuleInfo(final Project prj, final ModuleInfo info) {
    // info can be null in case we are closing a project from disabled module
    if (info != null) {
        MUTEX.writeAccess(new Mutex.Action<Void>() {
            public @Override Void run() {
            List<Project> prjlist = openProjectsModuleInfos.get(info);
            if (prjlist != null) {
                prjlist.remove(prj);
                if (prjlist.isEmpty()) {
                    info.removePropertyChangeListener(infoListener);
                    openProjectsModuleInfos.remove(info);
                }
            }
            return null;
        }
        });
    }
}
 
源代码9 项目: netbeans   文件: SuiteProjectGenerator.java
public static void createSuiteProject(final File projectDir, final String platformID, final boolean application) throws IOException {
    try {
        ProjectManager.mutex().writeAccess(new Mutex.ExceptionAction<Void>() {
            public Void run() throws IOException {
                final FileObject dirFO = FileUtil.createFolder(projectDir);
                if (ProjectManager.getDefault().findProject(dirFO) != null) {
                    throw new IllegalArgumentException("Already a project in " + dirFO); // NOI18N
                }
                createSuiteProjectXML(dirFO);
                createPlatformProperties(dirFO, platformID);
                createProjectProperties(dirFO);
                ModuleList.refresh();
                ProjectManager.getDefault().clearNonProjectCache();
                if (application) {
                    initApplication(dirFO, platformID);
                }
                return null;
            }
        });
    } catch (MutexException e) {
        throw (IOException) e.getException();
    }
}
 
源代码10 项目: NBANDROID-V2   文件: AndroidConfigProvider.java
private void load() {
    ProjectManager.mutex().readAccess(new Mutex.Action<Void>() {
        @Override
        public Void run() {
            configs.clear();
            String propNames = auxProps.get(AndroidProjectProperties.PROP_CONFIG_NAMES, false);
            if (propNames != null) {
                for (String key : Splitter.on('|').split(propNames)) {
                    Config cfg = configForKey(key);
                    if (cfg != null) {
                        configs.put(cfg.getDisplayName(), cfg);
                    }
                }
            }
            String active = auxProps.get(AndroidProjectProperties.PROP_ACTIVE_CONFIG, false);
            fixConfigurations(active);
            return null;
        }
    });
}
 
源代码11 项目: netbeans   文件: MiscPrivateUtilities.java
public static void setProjectProperty(final Project project, final AntProjectHelper helper, final String name, final String value, final String propertyPath) {
    if (helper == null) {
        return;
    }
    try {
        ProjectManager.mutex().writeAccess(new Mutex.ExceptionAction() {
            @Override
            public Object run() throws IOException {
                try {
                    EditableProperties ep = helper.getProperties(propertyPath);
                    ep.setProperty(name, value);
                    helper.putProperties(propertyPath, ep);
                    ProjectManager.getDefault().saveProject(project);
                } catch (IOException ioe) {
                    Logger.getLogger(MiscPrivateUtilities.class.getName()).log(Level.INFO, ioe.getLocalizedMessage(), ioe);
                }
                return null;
            }
        });
    } catch (MutexException e) {
        Logger.getLogger(MiscUtilities.class.getName()).log(Level.INFO, null, e);
    }
}
 
源代码12 项目: netbeans   文件: RebaseAction.java
@NbBundle.Messages({
    "LBL_RebaseAction.continueExternalRebase.title=Cannot Continue Rebase",
    "MSG_RebaseAction.continueExternalRebase.text=Rebase was probably started by an external tool "
            + "in non-interactive mode. \nNetBeans IDE cannot continue and finish the action.\n\n"
            + "Please use the external tool or abort and restart rebase inside NetBeans."
})
private boolean checkRebaseFolder (File repository) {
    File folder = getRebaseFolder(repository);
    File messageFile = new File(folder, MESSAGE);
    if (messageFile.exists()) {
        return true;
    } else {
        Mutex.EVENT.readAccess(new Runnable() {
            @Override
            public void run () {
                JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),
                    Bundle.MSG_RebaseAction_continueExternalRebase_text(),
                    Bundle.LBL_RebaseAction_continueExternalRebase_title(),
                    JOptionPane.ERROR_MESSAGE);
            }
        });
        return false;
    }
}
 
源代码13 项目: netbeans   文件: WebModules.java
public WebModule findWebModule (final FileObject file) {
    Project owner = FileOwnerQuery.getOwner (file);
    if (project.equals (owner)) {
        // read modules under project READ access to prevent issues like #119734
        return ProjectManager.mutex().readAccess(new Mutex.Action<WebModule>() {
            public WebModule run() {
                synchronized (WebModules.this) {
                    List<FFWebModule> mods = getModules();
                    for (FFWebModule ffwm : mods) {
                        if (ffwm.contains (file)) {
                            WebModule wm = cache.get (ffwm);
                            if (wm == null) {
                                wm = WebModuleFactory.createWebModule (ffwm);
                                cache.put (ffwm, wm);
                            }
                            return wm;
                        }
                    }
                    return null;
                }
            }});
    }
    return null;
}
 
源代码14 项目: netbeans   文件: SourceRoots.java
@Override
public String[] getRootProperties() {
    synchronized (this) {
        if (sourceRootProperties != null) {
            return sourceRootProperties.toArray(new String[sourceRootProperties.size()]);
        }
    }
    return ProjectManager.mutex().readAccess(new Mutex.Action<String[]>() {
        @Override
        public String[] run() {
            synchronized (SourceRoots.this) {
                if (sourceRootProperties == null) {
                    readProjectMetadata();
                }
                return sourceRootProperties.toArray(new String[sourceRootProperties.size()]);
            }
        }
    });
}
 
源代码15 项目: netbeans   文件: WebModules.java
public ClassPath findClassPath (final FileObject file, final String type) {
    Project owner = FileOwnerQuery.getOwner (file);
    if (owner != null && owner.equals (project)) {
        // read modules under project READ access to prevent issues like #119734
        return ProjectManager.mutex().readAccess(new Mutex.Action<ClassPath>() {
            public ClassPath run() {
                synchronized (WebModules.this) {
                    List<FFWebModule> mods = getModules();
                    for (FFWebModule ffwm : mods) {
                        if (ffwm.contains (file)) {
                            return ffwm.findClassPath (file, type);
                        }
                    }
                }
                return null;
            }
        });
    }
    return null;
}
 
源代码16 项目: netbeans   文件: ProgressSupportTest.java
public void testNoCancelButtonWhenNonCancellableInvocation() {
    List<ProgressSupport.Action> actions = new ArrayList<ProgressSupport.Action>();

    final AtomicBoolean cancelVisible = new AtomicBoolean();

    actions.add(new ProgressSupport.BackgroundAction() {
        public void run(final ProgressSupport.Context actionContext) {
            cancelVisible.set(Mutex.EVENT.readAccess(new Mutex.Action<Boolean>() {
                public Boolean run() {
                    return actionContext.getPanel().isCancelVisible();
                }
            }));
        }
    });

    ProgressSupport.invoke(actions);
    assertFalse(cancelVisible.get());
}
 
源代码17 项目: netbeans   文件: InstanceDataObjectModuleTestHid.java
protected void twiddle(final Module m, final int action) throws Exception {
    try {
        mgr.mutex().writeAccess(new Mutex.ExceptionAction<Void>() {
            public Void run() throws Exception {
                switch (action) {
                case TWIDDLE_ENABLE:
                    mgr.enable(m);
                    break;
                case TWIDDLE_DISABLE:
                    mgr.disable(m);
                    break;
                case TWIDDLE_RELOAD:
                    mgr.disable(m);
                    mgr.enable(m);
                    break;
                default:
                    throw new IllegalArgumentException("bad action: " + action);
                }
                return null;
            }
        });
    } catch (MutexException me) {
        throw me.getException();
    }
}
 
源代码18 项目: netbeans   文件: Children.java
private Mutex getPMMutex() {
    for (;;) {
        Mutex mutex = null;
        WeakReference<Mutex> weakRef = pmMutexRef.get();
        if (weakRef != null) {
            mutex = weakRef.get();
        }
        if (mutex != null) {
            return mutex;
        }
        mutex = callPMMutexMethod();
        if (mutex != null) {
            WeakReference<Mutex> newWeakRef = new WeakReference<Mutex>(mutex);
            if (pmMutexRef.compareAndSet(weakRef, newWeakRef)) {
                return mutex;
            }
        } else {
            return null;
        }
    }
}
 
源代码19 项目: netbeans   文件: GrailsProjectProperties.java
public void save() {
    try {
        // store properties
        ProjectManager.mutex().writeAccess(new Mutex.ExceptionAction<Void>() {
            public Void run() throws IOException {
                saveProperties();
                return null;
            }
        });
        ProjectManager.getDefault().saveProject(project);
    } catch (MutexException e) {
        Exceptions.printStackTrace((IOException) e.getException());
    } catch (IOException ex) {
        Exceptions.printStackTrace(ex);
    }
}
 
源代码20 项目: netbeans   文件: ClassPathProviderImpl.java
private FileObject getDir(final String propname) {
    return ProjectManager.mutex().readAccess(new Mutex.Action<FileObject>() {
        public FileObject run() {
            synchronized (ClassPathProviderImpl.this) {
                FileObject fo = (FileObject) ClassPathProviderImpl.this.dirCache.get (propname);
                if (fo == null ||  !fo.isValid()) {
                    String prop = evaluator.getProperty(propname);
                    if (prop != null) {
                        fo = helper.resolveFileObject(prop);
                        ClassPathProviderImpl.this.dirCache.put (propname, fo);
                    }
                }
                return fo;
            }
        }});
}
 
源代码21 项目: netbeans   文件: RunConfigRemote.java
public static RunConfigRemote forProject(final PhpProject project) {
    return ProjectManager.mutex().readAccess(new Mutex.Action<RunConfigRemote>() {
        @Override
        public RunConfigRemote run() {
            return new RunConfigRemote()
                    .setUrl(ProjectPropertiesSupport.getUrl(project))
                    .setIndexParentDir(FileUtil.toFile(ProjectPropertiesSupport.getWebRootDirectory(project)))
                    .setIndexRelativePath(ProjectPropertiesSupport.getIndexFile(project))
                    .setArguments(ProjectPropertiesSupport.getArguments(project))
                    .setRemoteConfiguration(RemoteConnections.get().remoteConfigurationForName(ProjectPropertiesSupport.getRemoteConnection(project)))
                    .setUploadDirectory(ProjectPropertiesSupport.getRemoteDirectory(project))
                    .setUploadFilesType(ProjectPropertiesSupport.getRemoteUpload(project))
                    .setPermissionsPreserved(ProjectPropertiesSupport.areRemotePermissionsPreserved(project))
                    .setUploadDirectly(ProjectPropertiesSupport.isRemoteUploadDirectly(project));
        }
    });
}
 
源代码22 项目: netbeans   文件: Repository.java
public void selectUrl (final SVNUrl url, final boolean force) {
    Mutex.EVENT.readAccess(new Mutex.Action<Void>() {
        @Override
        public Void run () {
            DefaultComboBoxModel dcbm = (DefaultComboBoxModel) repositoryPanel.urlComboBox.getModel();
            int idx = dcbm.getIndexOf(url.toString());
            if(idx > -1) {
                dcbm.setSelectedItem(url.toString());    
            } else if(force) {
                RepositoryConnection rc = new RepositoryConnection(url.toString());
                dcbm.addElement(rc);
                dcbm.setSelectedItem(rc);
            }
            return null;
        }
    });
}
 
源代码23 项目: netbeans   文件: NbProjectManager.java
/**
 * Save one project (if it was in fact modified).
 * <p>Acquires write access.</p>
 * <p class="nonnormative">
 * Although the project infrastructure permits a modified project to be saved
 * at any time, current UI principles dictate that the "save project" concept
 * should be internal only - i.e. a project customizer should automatically
 * save the project when it is closed e.g. with an "OK" button. Currently there
 * is no UI display of modified projects; this module does not ensure that modified projects
 * are saved at system exit time the way modified files are, though the Project UI
 * implementation module currently does this check.
 * </p>
 * @param p the project to save
 * @throws IOException if it cannot be saved
 * @see ProjectFactory#saveProject
 */
public void saveProject(final Project p) throws IOException {
    try {
        getMutex().writeAccess(new Mutex.ExceptionAction<Void>() {
            @Override
            public Void run() throws IOException {
                //removed projects are the ones that cannot be mapped to an existing project type anymore.
                if (removedProjects.contains(p)) {
                    return null;
                }
                if (modifiedProjects.contains(p)) {
                    ProjectFactory f = proj2Factory.get(p);
                    if (f != null) {
                        f.saveProject(p);
                        LOG.log(Level.FINE, "saveProject({0})", p.getProjectDirectory());
                    } else {
                        LOG.log(Level.WARNING, "Project {0} was already deleted", p);
                    }
                    modifiedProjects.remove(p);
                }
                return null;
            }
        });
    } catch (MutexException e) {
        //##91398 have a more descriptive error message, in case of RO folders.
        // the correct reporting still up to the specific project type.
        if (!p.getProjectDirectory().canWrite()) {
            throw new IOException("Project folder is not writeable.");
        }
        throw (IOException)e.getException();
    }
}
 
源代码24 项目: netbeans   文件: J2SEPlatformCustomizer.java
private synchronized java.util.List<URL> getData () {
    if (this.data == null) {
        switch (this.type) {
            case CLASSPATH:
                RP.execute(new Runnable() {
                    @Override
                    public void run() {
                        final java.util.List<URL> update = getPathList(platform.getBootstrapLibraries());
                        Mutex.EVENT.readAccess(new Runnable() {
                            @Override
                            public void run() {
                                data = update;
                                fireIntervalAdded(PathModel.this, 0, data.size());
                            }
                        });
                    }
                });
                return Collections.<URL>emptyList();
            case SOURCES:
                this.data = getPathList(this.platform.getSourceFolders());
                break;
            case JAVADOC:
                this.data = new ArrayList<URL>(this.platform.getJavadocFolders());
                break;
        }
    }
    return this.data;
}
 
源代码25 项目: netbeans   文件: OpenFilesSearchScopeProvider.java
protected boolean isFromEditorWindow(DataObject dobj,
        final TopComponent tc) {
    final EditorCookie editor = dobj.getLookup().lookup(
            EditorCookie.class);
    if (editor != null) {
        return Mutex.EVENT.readAccess(new Action<Boolean>() {
            @Override
            public Boolean run() {
                return (tc instanceof CloneableTopComponent) // #246597
                        || NbDocument.findRecentEditorPane(editor) != null;
            }
        });
    }
    return false;
}
 
源代码26 项目: netbeans   文件: ValidateNbinstTest.java
public @Override void tearDown() {
    Mutex.EVENT.readAccess(new Mutex.Action<Void>() {
        public @Override Void run() {
            Thread.currentThread().setContextClassLoader(contextClassLoader);
            return null;
        }
    });
}
 
源代码27 项目: NBANDROID-V2   文件: AuxiliaryConfigImpl.java
@Override
public boolean removeConfigurationFragment(final String elementName, final String namespace, final boolean shared) throws IllegalArgumentException {
    return ProjectManager.mutex(false, project).writeAccess(new Mutex.Action<Boolean>() {
        @Override
        public Boolean run() {
            boolean result = false;
            result |= removeFallbackImpl(elementName, namespace, shared);
            return result;
        }
    });
}
 
源代码28 项目: netbeans   文件: MenuBar.java
@Override
public void updateUI() {
    if (EventQueue.isDispatchThread()) {
        super.updateUI();
    } else {
        Mutex.EVENT.readAccess(this);
    }
}
 
源代码29 项目: netbeans   文件: ReferenceHelper.java
/**
 * Attempt to convert this reference to a live artifact object.
 * This involves finding the referenced foreign project on disk
 * (among standard project and private properties) and asking it
 * for the artifact named by the given target.
 * Given that object, you can find important further information
 * such as the location of the actual artifact on disk.
 * <p>
 * Note that non-key attributes of the returned artifact (i.e.
 * type, script location, and clean target name) might not match
 * those in this raw reference.
 * <p>
 * Acquires read access.
 * @param helper an associated reference helper used to resolve the foreign
 *               project location
 * @return the actual Ant artifact object, or null if it could not be located
 */
public AntArtifact toAntArtifact(final ReferenceHelper helper) {
    return ProjectManager.mutex().readAccess(new Mutex.Action<AntArtifact>() {
        public AntArtifact run() {
            AntProjectHelper h = helper.h;
            String path = helper.eval.getProperty("project." + foreignProjectName); // NOI18N
            if (path == null) {
                // Undefined foreign project.
                return null;
            }
            FileObject foreignProjectDir = h.resolveFileObject(path);
            if (foreignProjectDir == null) {
                // Nonexistent foreign project dir.
                return null;
            }
            Project p;
            try {
                p = ProjectManager.getDefault().findProject(foreignProjectDir);
            } catch (IOException e) {
                // Could not load it.
                Logger.getLogger(this.getClass().getName()).log(Level.INFO, null, e);
                return null;
            }
            if (p == null) {
                // Was not a project dir.
                return null;
            }
            return AntArtifactQuery.findArtifactByID(p, artifactID);
        }
    });
}
 
源代码30 项目: netbeans   文件: JPDAThreadImpl.java
/**
 * Sets this thread current.
 *
 * @see JPDADebugger#getCurrentThread
 */
@Override
public void makeCurrent () {
    if (Mutex.EVENT.isReadAccess()) {
        debugger.getRequestProcessor().post(new Runnable() {
            @Override
            public void run() {
                doMakeCurrent();
            }
        });
    } else {
        doMakeCurrent();
    }
}