Java 类java.util.prefs.BackingStoreException 实例源码
项目:jdk8u-jdk
文件:SoftSynthesizer.java
private Properties getStoredProperties() {
return AccessController
.doPrivileged((PrivilegedAction<Properties>) () -> {
Properties p = new Properties();
String notePath = "/com/sun/media/sound/softsynthesizer";
try {
Preferences prefroot = Preferences.userRoot();
if (prefroot.nodeExists(notePath)) {
Preferences prefs = prefroot.node(notePath);
String[] prefs_keys = prefs.keys();
for (String prefs_key : prefs_keys) {
String val = prefs.get(prefs_key, null);
if (val != null) {
p.setProperty(prefs_key, val);
}
}
}
} catch (final BackingStoreException ignored) {
}
return p;
});
}
项目:incubator-netbeans
文件:RepositoryRegistry.java
private String[] getRepoIds(Preferences preferences, String repoId) {
String[] keys = null;
try {
keys = preferences.keys();
} catch (BackingStoreException ex) {
BugtrackingManager.LOG.log(Level.SEVERE, null, ex);
}
if (keys == null || keys.length == 0) {
return new String[0];
}
List<String> ret = new ArrayList<String>();
for (String key : keys) {
if (key.startsWith(repoId)) {
ret.add(key.substring(repoId.length()));
}
}
return ret.toArray(new String[ret.size()]);
}
项目:incubator-netbeans
文件:CodeCompletionOptionsPanelController.java
public Preferences getPreferences(String mimeType) {
ProxyPreferences pp = mimeTypePreferences.get(mimeType);
try {
// clean up the cached ProxyPreferences instance that has been removed in the meantime
if (pp != null && !pp.nodeExists("")) { //NOI18N
pp = null;
}
} catch (BackingStoreException bse) {
// ignore
}
if (pp == null) {
Preferences p = MimeLookup.getLookup(mimeType).lookup(Preferences.class);
pp = ProxyPreferences.getProxyPreferences(this, p);
pp.addPreferenceChangeListener(weakPrefL);
pp.addNodeChangeListener(weakNodeL);
mimeTypePreferences.put(mimeType, pp);
LOG.fine("getPreferences('" + mimeType + "')"); //NOI18N
}
return pp;
}
项目:incubator-netbeans
文件:ProxyPreferencesImplTest.java
public void testRemoveKey() throws BackingStoreException {
Preferences orig = Preferences.userRoot().node(getName());
orig.put("key-2", "value-2");
assertNull("Original contains value", orig.get("key-1", null));
assertEquals("Original doesn't contain value", "value-2", orig.get("key-2", null));
Preferences test = ProxyPreferencesImpl.getProxyPreferences(this, orig);
test.put("key-1", "xyz");
assertEquals("Wrong value", "xyz", test.get("key-1", null));
test.remove("key-1");
assertNull("Test contains removed key-1", test.get("key-1", null));
test.remove("key-2");
assertNull("Test contains removed key-2", test.get("key-2", null));
test.flush();
assertNull("Test flushed removed key-1", orig.get("key-1", null));
assertNull("Test.flush did not remove removed key-2", orig.get("key-2", null));
}
项目:incubator-netbeans
文件:ProxyPreferencesTest.java
public void testRemoveKey() throws BackingStoreException {
Preferences orig = Preferences.userRoot().node(getName());
orig.put("key-2", "value-2");
assertNull("Original contains value", orig.get("key-1", null));
assertEquals("Original doesn't contain value", "value-2", orig.get("key-2", null));
Preferences test = ProxyPreferences.getProxyPreferences(this, orig);
test.put("key-1", "xyz");
assertEquals("Wrong value", "xyz", test.get("key-1", null));
test.remove("key-1");
assertNull("Test contains removed key-1", test.get("key-1", null));
test.remove("key-2");
assertNull("Test contains removed key-2", test.get("key-2", null));
test.flush();
assertNull("Test flushed removed key-1", orig.get("key-1", null));
assertNull("Test.flush did not remove removed key-2", orig.get("key-2", null));
}
项目:incubator-netbeans
文件:ProxyPreferencesImplTest.java
private void checkEquals(String msg, Preferences expected, Preferences test) throws BackingStoreException {
assertEquals("Won't compare two Preferences with different absolutePath", expected.absolutePath(), test.absolutePath());
// check the keys and their values
for(String key : expected.keys()) {
String expectedValue = expected.get(key, null);
assertNotNull(msg + "; Expected:" + expected.absolutePath() + " has no '" + key + "'", expectedValue);
String value = test.get(key, null);
assertNotNull(msg + "; Test:" + test.absolutePath() + " has no '" + key + "'", value);
assertEquals(msg + "; Test:" + test.absolutePath() + "/" + key + " has wrong value", expectedValue, value);
}
// check the children
for(String child : expected.childrenNames()) {
assertTrue(msg + "; Expected:" + expected.absolutePath() + " has no '" + child + "' subnode", expected.nodeExists(child));
Preferences expectedChild = expected.node(child);
assertTrue(msg + "; Test:" + test.absolutePath() + " has no '" + child + "' subnode", test.nodeExists(child));
Preferences testChild = test.node(child);
checkEquals(msg, expectedChild, testChild);
}
}
项目:incubator-netbeans
文件:InstancePropertiesManager.java
/**
* Returns all existing properties created in the given namespace.
*
* @param namespace string identifying the namespace
* @return list of all existing properties created in the given namespace
*/
public List<InstanceProperties> getProperties(String namespace) {
Preferences prefs = NbPreferences.forModule(InstancePropertiesManager.class);
try {
prefs = prefs.node(namespace);
prefs.flush();
List<InstanceProperties> allProperties = new ArrayList<InstanceProperties>();
synchronized (this) {
for (String id : prefs.childrenNames()) {
Preferences child = prefs.node(id);
InstanceProperties props = cache.get(child);
if (props == null) {
props = new DefaultInstanceProperties(id, this, child);
cache.put(child, props);
}
allProperties.add(props);
}
}
return allProperties;
} catch (BackingStoreException ex) {
LOGGER.log(Level.INFO, null, ex);
throw new IllegalStateException(ex);
}
}
项目:incubator-netbeans
文件:Group.java
protected static String sanitizeNameAndUniquifyForId(String name) {
String sanitizedId = name.replaceAll("[^a-zA-Z0-9_.-]+", "_");
Set<String> existing;
try {
existing = new HashSet<String>(Arrays.asList(NODE.childrenNames()));
} catch (BackingStoreException x) {
Exceptions.printStackTrace(x);
return sanitizedId;
}
if (existing.contains(sanitizedId)) {
for (int i = 2; ; i++) {
String candidate = sanitizedId + "_" + i;
if (!existing.contains(candidate)) {
return candidate;
}
}
} else {
return sanitizedId;
}
}
项目:incubator-netbeans
文件:TaskSchedulingManager.java
private void loadTasks() {
Preferences pref = NbPreferences.forModule(TaskSchedulingManager.class);
try {
for (String key : pref.keys()) {
if (key.startsWith(PREF_SCHEDULED)) {
String repositoryId = key.substring(PREF_SCHEDULED.length());
String tasks = pref.get(key, "");
for (String taskId : tasks.split(SEP)) {
if (!taskId.isEmpty()) {
getRepositoryTasks(repositoryId).add(taskId);
}
}
}
}
} catch (BackingStoreException ex) {
Logger.getLogger(TaskSchedulingManager.class.getName()).log(Level.INFO, null, ex);
}
}
项目:OpenJSharp
文件:ExecutableInputMethodManager.java
private String findPreferredInputMethodNode(Locale locale) {
if (userRoot == null) {
return null;
}
// create locale node relative path
String nodePath = preferredIMNode + "/" + createLocalePath(locale);
// look for the descriptor
while (!nodePath.equals(preferredIMNode)) {
try {
if (userRoot.nodeExists(nodePath)) {
if (readPreferredInputMethod(nodePath) != null) {
return nodePath;
}
}
} catch (BackingStoreException bse) {
}
// search at parent's node
nodePath = nodePath.substring(0, nodePath.lastIndexOf('/'));
}
return null;
}
项目:incubator-netbeans
文件:TaskFilter.java
void load( Preferences prefs, String prefix ) throws BackingStoreException {
name = prefs.get( prefix+"_name", "Filter" ); //NOI18N //NOI18N
if( prefs.getBoolean( prefix+"_types", false ) ) { //NOI18N
types = new TypesFilter();
types.load( prefs, prefix+"_types" ); //NOI18N
} else {
types = null;
}
if( prefs.getBoolean( prefix+"_keywords", false ) ) { //NOI18N
keywords = new KeywordsFilter();
keywords.load( prefs, prefix+"_keywords" ); //NOI18N
} else {
keywords = null;
}
}
项目:neoscada
文件:FactoryImpl.java
public FactoryImpl ()
{
this.prefs = Preferences.userNodeForPackage ( FactoryImpl.class ).node ( "files" );
try
{
for ( final String child : this.prefs.childrenNames () )
{
final Preferences childNode = this.prefs.node ( child );
final String fileName = childNode.get ( "file", null );
if ( fileName != null )
{
this.files.add ( fileName );
}
}
}
catch ( final BackingStoreException e )
{
StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, e ) );
}
}
项目:incubator-netbeans
文件:ProxyPreferencesImplTest.java
private void checkNotContains(Preferences prefs, String[] tree, String prefsId) throws BackingStoreException {
for(String s : tree) {
int equalIdx = s.lastIndexOf('=');
assertTrue(equalIdx != -1);
String value = s.substring(equalIdx + 1);
String key;
String nodePath;
int slashIdx = s.lastIndexOf('/', equalIdx);
if (slashIdx != -1) {
key = s.substring(slashIdx + 1, equalIdx);
nodePath = s.substring(0, slashIdx);
} else {
key = s.substring(0, equalIdx);
nodePath = "";
}
if (prefs.nodeExists(nodePath)) {
Preferences node = prefs.node(nodePath);
String realValue = node.get(key, null);
if (realValue != null && realValue.equals(value)) {
fail(prefsId + ", '" + nodePath + "' node contains key '" + key + "' = '" + realValue + "'");
}
}
}
}
项目:incubator-netbeans
文件:ProxyPreferencesImplTest.java
private void checkContains(Preferences prefs, String[] tree, String prefsId) throws BackingStoreException {
for(String s : tree) {
int equalIdx = s.lastIndexOf('=');
assertTrue(equalIdx != -1);
String value = s.substring(equalIdx + 1);
String key;
String nodePath;
int slashIdx = s.lastIndexOf('/', equalIdx);
if (slashIdx != -1) {
key = s.substring(slashIdx + 1, equalIdx);
nodePath = s.substring(0, slashIdx);
} else {
key = s.substring(0, equalIdx);
nodePath = "";
}
assertTrue(prefsId + " doesn't contain node '" + nodePath + "'", prefs.nodeExists(nodePath));
Preferences node = prefs.node(nodePath);
String realValue = node.get(key, null);
assertNotNull(prefsId + ", '" + nodePath + "' node doesn't contain key '" + key + "'", realValue);
assertEquals(prefsId + ", '" + nodePath + "' node, '" + key + "' contains wrong value", value, realValue);
}
}
项目:incubator-netbeans
文件:GroupsManager.java
void addGroup(String displayName) {
Preferences prefs = getPreferences();
int groupIndex = getGroups().size();
String groupName = DEFAULT_GROUP_NAME + groupIndex;
try {
do {
groupIndex++;
groupName = DEFAULT_GROUP_NAME + groupIndex;
} while( prefs.nodeExists(groupName) );
} catch( BackingStoreException ex ) {
LOG.log(Level.INFO, null, ex);
}
prefs.put(SEL_GROUP, groupName);
prefs.node(groupName).put(DISPLAY_NAME, displayName);
}
项目:incubator-netbeans
文件:FilterRepository.java
public void save() throws IOException {
try {
Preferences prefs = NbPreferences.forModule( FilterRepository.class );
prefs = prefs.node( "Filters" ); //NOI18N
prefs.clear();
prefs.putBoolean( "firstTimeStart", false ); //NOI18N
prefs.putBoolean( "firstTimeStartWithIssue", false ); //NOI18N
prefs.putInt( "count", filters.size() ); //NOI18N
prefs.putInt( "active", active ); //NOI18N
for( int i=0; i<filters.size(); i++ ) {
TaskFilter filter = filters.get( i );
filter.save( prefs, "Filter_" + i ); //NOI18N
}
} catch( BackingStoreException bsE ) {
IOException ioE = new IOException( "Cannot save filter repository" ); //NOI18N
ioE.initCause( bsE );
throw ioE;
}
}
项目:incubator-netbeans
文件:HistorySettings.java
private static void migrate() {
// migrate pre 7.2 settings
String prevPath = "org/netbeans/modules/localhistory"; // NOI18N
try {
if(!NbPreferences.root().nodeExists(prevPath)) {
return;
}
Preferences prev = NbPreferences.root().node(prevPath);
Preferences cur = NbPreferences.forModule(HistorySettings.class);
String[] keys = prev.keys();
for (String key : keys) {
String value = prev.get(key, null);
if(value != null && cur.get(key, null) == null) {
cur.put(key, value);
}
}
prev.removeNode();
} catch (BackingStoreException ex) {
Exceptions.printStackTrace(ex);
}
}
项目:incubator-netbeans
文件:ProxyPreferencesImplTest.java
public void testFlushTree1() throws BackingStoreException {
String [] origTree = new String [] {
"CodeStyle/profile=GLOBAL",
};
String [] newTree = new String [] {
"CodeStyle/text/x-java/tab-size=2",
"CodeStyle/text/x-java/override-global-settings=true",
"CodeStyle/text/x-java/expand-tabs=true",
"CodeStyle/profile=PROJECT",
};
Preferences orig = Preferences.userRoot().node(getName());
write(orig, origTree);
checkContains(orig, origTree, "Orig");
checkNotContains(orig, newTree, "Orig");
Preferences test = ProxyPreferencesImpl.getProxyPreferences(this, orig);
checkEquals("Test should be the same as Orig", orig, test);
write(test, newTree);
checkContains(test, newTree, "Test");
test.flush();
checkEquals("Test didn't flush to Orig", test, orig);
}
项目:JavaGraph
文件:QuitAction.java
@Override
public void execute() {
boolean quit = getDisplaysPanel().saveAllEditors(true);
if (quit) {
// Saves the current user settings.
groove.gui.UserSettings.syncSettings(getSimulator());
getDisplaysPanel().dispose();
getFrame().dispose();
// try to persist the user preferences
try {
Preferences.userRoot().flush();
} catch (BackingStoreException e) {
// do nothing if the backing store is inaccessible
}
}
}
项目:incubator-netbeans
文件:TopComponentTracker.java
/**
* Load window list from previous session.
*/
void load() {
Preferences prefs = getPreferences();
try {
for( String key : prefs.keys() ) {
boolean view = prefs.getBoolean( key, false );
if( view )
viewIds.add( key );
else
editorIds.add( key );
}
} catch( BackingStoreException ex ) {
Logger.getLogger( TopComponentTracker.class.getName() ).log( Level.INFO, null, ex );
}
}
项目:incubator-netbeans
文件:InspectAndRefactorPanel.java
private void storeScope(org.netbeans.modules.refactoring.api.Scope customScope) {
try {
storeFileList(customScope.getSourceRoots(), "sourceRoot" ); //NOI18N
storeFileList(customScope.getFolders(), "folder" ); //NOI18N
storeFileList(customScope.getFiles(), "file" ); //NOI18N
} catch (BackingStoreException ex) {
Exceptions.printStackTrace(ex);
}
}
项目:incubator-netbeans
文件:DockerInstance.java
final void save() {
synchronized (this) {
if (prefs != null) {
throw new IllegalStateException();
}
Preferences global = NbPreferences.forModule(DockerInstance.class).node(INSTANCES_KEY);
Preferences p = null;
int suffix = 0;
do {
p = global.node(escapeUrl(url) + suffix);
suffix++;
} while (p.get(URL_KEY, null) != null && suffix < Integer.MAX_VALUE);
p.put(DISPLAY_NAME_KEY, displayName);
p.put(URL_KEY, url);
if (caCertificate != null) {
p.put(CA_CERTIFICATE_PATH_KEY, FileUtil.normalizeFile(caCertificate).getAbsolutePath());
}
if (certificate != null) {
p.put(CERTIFICATE_PATH_KEY, FileUtil.normalizeFile(certificate).getAbsolutePath());
}
if (key != null) {
p.put(KEY_PATH_KEY, FileUtil.normalizeFile(key).getAbsolutePath());
}
try {
p.flush();
} catch (BackingStoreException ex) {
// XXX better solution?
throw new IllegalStateException(ex);
}
this.prefs = p;
this.prefs.addPreferenceChangeListener(listener);
}
}
项目:incubator-netbeans
文件:AuxiliaryConfigBasedPreferencesProviderTest.java
private void doTestSubnodes() throws IOException, BackingStoreException {
AuxiliaryConfiguration ac = p.getLookup().lookup(AuxiliaryConfiguration.class);
AuxiliaryProperties ap = p.getLookup().lookup(AuxiliaryProperties.class);
assertTrue(ac != null || ap != null);
AuxiliaryConfigBasedPreferencesProvider provider = new AuxiliaryConfigBasedPreferencesProvider(p, ac, ap, true);
Preferences pref = provider.findModule("test");
pref.put("test", "test");
pref.node("subnode1/subnode2").put("somekey", "somevalue1");
pref.node("subnode1").put("somekey", "somevalue2");
pref.flush();
provider = new AuxiliaryConfigBasedPreferencesProvider(p, ac, ap, true);
pref = provider.findModule("test");
assertTrue(pref.node("subnode1").nodeExists("subnode2"));
assertEquals("somevalue1", pref.node("subnode1/subnode2").get("somekey", null));
assertEquals("somevalue2", pref.node("subnode1").get("somekey", null));
pref.node("subnode1").removeNode();
assertEquals(null, pref.node("subnode1/subnode2").get("somekey", null));
assertEquals(null, pref.node("subnode1").get("somekey", null));
pref.flush();
provider = new AuxiliaryConfigBasedPreferencesProvider(p, ac, ap, true);
pref = provider.findModule("test");
assertEquals(null, pref.node("subnode1/subnode2").get("somekey", null));
assertEquals(null, pref.node("subnode1").get("somekey", null));
}
项目:incubator-netbeans
文件:CategoryFilter.java
void load(Preferences prefs, String prefix) throws BackingStoreException {
enabledCategories.clear();
String enabled = prefs.get(prefix + "_enabled", ""); //NOI18N //NOI18N
if (enabled.trim().length() > 0) {
StringTokenizer tokenizer = new StringTokenizer(enabled, "\n"); //NOI18N
while (tokenizer.hasMoreTokens()) {
enabledCategories.add(tokenizer.nextToken());
}
} else {
addDefaultTypes();
}
}
项目:incubator-netbeans
文件:NotificationFilter.java
void load(Preferences prefs, String prefix) throws BackingStoreException {
name = prefs.get(prefix + "_name", "Filter"); //NOI18N //NOI18N
if (prefs.getBoolean(prefix + "_types", false)) { //NOI18N
categoryFilter = new CategoryFilter();
categoryFilter.load(prefs, prefix + "_types"); //NOI18N
} else {
categoryFilter = null;
}
}
项目:incubator-netbeans
文件:InheritedPreferences.java
@Override
protected String[] keysSpi() throws BackingStoreException {
Collection<String> names = new HashSet<String>();
names.addAll(Arrays.asList(stored.keys()));
names.addAll(Arrays.asList(inherited.keys()));
return names.toArray(new String[names.size()]);
}
项目:incubator-netbeans
文件:AuxiliaryConfigBasedPreferencesProvider.java
@Override
protected AbstractPreferences getChild(final String nodeName) throws BackingStoreException {
try {
return ProjectManager.mutex(false, project).readAccess(new ExceptionAction<AbstractPreferences>() {
public AbstractPreferences run() throws BackingStoreException {
return AuxiliaryConfigBasedPreferences.super.getChild(nodeName);
}
});
} catch (MutexException ex) {
throw (BackingStoreException) ex.getException();
}
}
项目:incubator-netbeans
文件:AppliedFilterCondition.java
void load( Preferences prefs, String prefix ) throws BackingStoreException {
prop = TaskProperties.getProperty( prefs.get( prefix+"_propertyId", "" ) ); //NOI18N
if( null == prop )
throw new BackingStoreException( "Missing propertyId attribute" ); //NOI18N
cond = KeywordsFilter.createCondition( prop );
cond.load( prefs, prefix );
}
项目:incubator-netbeans
文件:FormattingSettingsFromNbPreferences.java
@Override
public void afterLoad(Map<String, TypedValue> map, MimePath mimePath, String profile, boolean defaults) throws IOException {
if (defaults || mimePath.size() != 1 || !affectedMimeTypes.containsKey(mimePath.getPath())) {
return;
}
try {
Preferences nbprefs = getNbPreferences(mimePath.getPath());
if (nbprefs != null && nbprefs.nodeExists("CodeStyle/default")) { //NOI18N
Preferences codestyle = nbprefs.node("CodeStyle/default"); //NOI18N
for(String key : codestyle.keys()) {
if (!map.containsKey(key)) {
TypedValue typedValue = guessTypedValue(codestyle.get(key, null));
if (typedValue != null) {
map.put(key, typedValue);
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Injecting '" + key + "' = '" + typedValue.getValue() //NOI18N
+ "' (" + typedValue.getJavaType() + ") for '" + mimePath.getPath() + "'"); //NOI18N
}
}
}
}
}
} catch (BackingStoreException bse) {
// ignore
LOG.log(Level.FINE, null, bse);
}
}
项目:marathonv5
文件:LogViewLogger.java
@Override public void setLogLevel(int level) {
Preferences p = Preferences.userNodeForPackage(LogViewLogger.class);
p.putInt("loglevel", level);
try {
p.flush();
} catch (BackingStoreException e) {
}
this.level = level;
}
项目:intellij-deps-ini4j
文件:IniPreferences.java
/**
* Implements the <CODE>childrenNamesSpi</CODE> method as per the specification in
* {@link java.util.prefs.AbstractPreferences#childrenNamesSpi()}.
* @return an array containing the names of the children of this preference node.
* @throws BackingStoreException if this operation cannot be completed due to a failure in the backing store, or inability to communicate with it.
*/
@Override protected String[] childrenNamesSpi() throws BackingStoreException
{
List<String> names = new ArrayList<String>();
for (String name : _ini.keySet())
{
if (name.indexOf(_ini.getPathSeparator()) < 0)
{
names.add(name);
}
}
return names.toArray(EMPTY);
}
项目:waterrower-workout
文件:SharedPreferences.java
/**
* Stores the preferences.
*/
public void store() {
try {
preferences.flush();
} catch (BackingStoreException e) {
Log.error("Couldn't store preferences of the application!", e);
}
}
项目:incubator-netbeans
文件:HudsonInstanceProperties.java
/**
* Load preferences in background thread.
*/
private void loadPreferences() {
RP.post(new Runnable() {
@Override
public void run() {
if (hasPreferences()) {
Preferences prefs = getPreferences();
if (prefs != null) {
try {
String[] keys = prefs.keys();
for (String key : keys) {
if (INSTANCE_NAME.equals(key)
|| INSTANCE_URL.equals(key)) {
continue;
}
String val = prefs.get(key, null);
if (val != null) {
put(key, val);
}
}
} catch (BackingStoreException ex) {
Exceptions.printStackTrace(ex);
}
}
}
}
});
}
项目:routerapp
文件:XMLPreferences.java
/**
* Removes this node from the backing store. Please note that, though the
* AbstractPreferences method signature defines that this method should
* throw a BackingStoreException, this implementation doesn't.
*/
protected void removeNodeSpi() throws BackingStoreException {
org.w3c.dom.Node root = PreferencesController.getInstance().getXMLDocument().getDocumentElement();
Element myNode = myXMLNode();
Element parentNode = (Element)myNode.getParentNode();
if(root.getNodeType() == org.w3c.dom.Node.ELEMENT_NODE) {
Element docRoot = (Element) root;
parentNode.removeChild(myNode);
}
}
项目:incubator-netbeans
文件:HudsonManagerImpl.java
private void init() {
RP.post(new Runnable() {
@Override
public void run() {
try {
try {
for (String kid : instancePrefs().childrenNames()) {
Preferences node = instancePrefs().node(kid);
Map<String, String> m = new HashMap<String, String>();
for (String k : node.keys()) {
m.put(k, node.get(k, null));
}
if (!m.containsKey(INSTANCE_NAME) || !m.containsKey(INSTANCE_URL) || !m.containsKey(INSTANCE_SYNC)) {
continue;
}
if (FALSE.equals(m.get(INSTANCE_PERSISTED))) {
continue;
}
HudsonInstanceImpl.createHudsonInstance(new HudsonInstanceProperties(m), false);
}
} catch (BackingStoreException ex) {
Exceptions.printStackTrace(ex);
}
} finally {
// Fire changes
fireChangeListeners();
}
}
});
for (HudsonManagerAgent agent: agents) {
agent.start();
}
}
项目:incubator-netbeans
文件:Installer.java
/** #159810: avoid loading anything further unless this module is known to be in use */
public static boolean active() {
try {
return NbPreferences.forModule(Installer.class).nodeExists("instances"); // NOI18N
} catch (BackingStoreException ex) {
Exceptions.printStackTrace(ex);
return false;
}
}
项目:incubator-netbeans
文件:AdjustConfigurationPanel.java
public void store( Preferences target ) {
try {
for (String key : keys()) {
target.put(key, get(key, null));
}
for (String child : childrenNames()) {
((ModifiedPreferences) node(child)).store(target.node(child));
}
}
catch (BackingStoreException ex) {
Exceptions.printStackTrace(ex);
}
}
项目:vars-annotation
文件:WebPreferences.java
@Override
protected String[] keysSpi() throws BackingStoreException {
log.debug("keysSpi()");
try {
CompletableFuture<Stream<String>> f = service.findByNameLike(absolutePath())
.thenApply(nodes -> nodes.stream().map(PreferenceNode::getKey));
return f.get(timeout.toMillis(), TimeUnit.MILLISECONDS)
.toArray(String[]::new);
}
catch (Exception e) {
log.warn("Failed to lookup keys for node '" + absolutePath() + "'", e);
return new String[0];
}
}
项目:Logisim
文件:AppPreferences.java
public static void clear() {
Preferences p = getPrefs(true);
try {
p.clear();
} catch (BackingStoreException e) {
}
}
项目:incubator-netbeans
文件:MavenFileOwnerQueryImpl.java
public void registerCoordinates(String groupId, String artifactId, String version, URL owner, boolean fire) {
String oldkey = groupId + ':' + artifactId;
//remove old key if pointing to the same project
if (owner.toString().equals(prefs().get(oldkey, null))) {
prefs().remove(oldkey);
}
String key = cacheKey(groupId, artifactId, version);
String ownerString = owner.toString();
try {
for (String k : prefs().keys()) {
if (ownerString.equals(prefs().get(k, null))) {
prefs().remove(k);
break;
}
}
} catch (BackingStoreException ex) {
LOG.log(Level.FINE, "Error iterating preference to find old mapping", ex);
}
prefs().put(key, ownerString);
LOG.log(Level.FINE, "Registering {0} under {1}", new Object[] {owner, key});
if (fire) {
fireChange(new GAVCHangeEvent(this, groupId, artifactId, version));
}
}