applyPreferences error ? [message #256689] |
Tue, 29 June 2004 10:53  |
Eclipse User |
|
|
|
This is a multi-part message in MIME format.
------=_NextPart_000_0016_01C45E2B.F66CD9F0
Content-Type: text/plain;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable
dear all, i have a code fragment like below,.
code fragment:
//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= 3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
IPreferencesService service =3D Platform.getPreferencesService();
IEclipsePreferences rootPreferences =3D service.getRootNode();
Preferences pref =3D rootPreferences.node("/favorite");
Preferences child =3D pref.node("my");
child.put("file","my.txt");
try {
child.flush();
pref.flush();
rootPreferences.flush();
} catch (BackingStoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
service.exportPreferences(rootPreferences,new FileOutputStream(new =
File("c:\\tmp.dat")), null);
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (CoreException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
IExportedPreferences epref =3D service.readPreferences(new =
FileInputStream(new File("c:\\tmp.dat"))) ;
service.applyPreferences(epref);
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (CoreException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
....
//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= 3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
message is:
Tue Jun 29 22:45:47 CST 2004 - [main] Setting preference: =
/favorite/my/file=3Dmy.txt
Tue Jun 29 22:45:47 CST 2004 - [main] Legacy plug-in preference file not =
found: =
G:\my\dev\eclipse-SDK-3.0M9\eclipse\runtime-workspace\.metad ata\.plugins\=
org.eclipse.ui.ide\pref_store.ini
Tue Jun 29 22:45:47 CST 2004 - [main] Loading preferences from file: =
G:/my/dev/eclipse-SDK-3.0M9/eclipse/runtime-workspace/.metad ata/.plugins/=
org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs
Tue Jun 29 22:45:47 CST 2004 - [main] Setting preference: =
/instance/org.eclipse.ui.ide/EXIT_PROMPT_ON_CLOSE_LAST_WINDO W=3Dfalse
Tue Jun 29 22:45:47 CST 2004 - [main] Setting preference: =
/instance/org.eclipse.ui.ide/EXIT_PROMPT_ON_CLOSE_LAST_WINDO W=3Dfalse
Tue Jun 29 22:45:47 CST 2004 - [main] Getting preference value: =
/favorite/my/file->my.txt
Tue Jun 29 22:45:47 CST 2004 - [main] Reading preferences from stream...
Tue Jun 29 22:45:47 CST 2004 - [main] Read preferences file.
Tue Jun 29 22:45:47 CST 2004 - [main] Setting preference: =
/favorite/my/file=3Dmy.txt
Tue Jun 29 22:45:47 CST 2004 - [main] Getting preference value: =
/favorite/my/file->my.txt
Tue Jun 29 22:45:47 CST 2004 - [main] Converted preferences file to =
IExportedPreferences tree: * /
/favorite
/favorite/my
/favorite/my/file=3Dmy.txt
Tue Jun 29 22:45:47 CST 2004 - [main] Getting preference value: =
/favorite/my/file->my.txt
Tue Jun 29 22:45:47 CST 2004 - [main] Applying exported preferences: * /
/favorite
/favorite/my
/favorite/my/file=3Dmy.txt
Tue Jun 29 22:45:47 CST 2004 - [main] Found export root: /
java.lang.NullPointerException
at =
org.eclipse.core.internal.preferences.EclipsePreferences.rem oveNode(Eclip=
sePreferences.java:959)
at =
org.eclipse.core.internal.preferences.PreferencesService$1.v isit(Preferen=
cesService.java:152)
at =
org.eclipse.core.internal.preferences.EclipsePreferences.acc ept(EclipsePr=
eferences.java:90)
at =
org.eclipse.core.internal.preferences.PreferencesService.app lyPreferences=
(PreferencesService.java:184)
........
what's wrong?
regards
...jay
------=_NextPart_000_0016_01C45E2B.F66CD9F0
Content-Type: text/html;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dgb2312">
<META content=3D"MSHTML 6.00.2800.1400" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><STRONG>dear all, i have a code fragment like =
below,.</STRONG></DIV>
<DIV><STRONG></STRONG> </DIV>
<DIV><STRONG>code fragment:</STRONG></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT =
size=3D2> //=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= 3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</FONT></DIV >
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>IPreferencesService service =3D=20
Platform.getPreferencesService();</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>IEclipsePreferences rootPreferences =3D=20
service.getRootNode();<BR>Preferences pref =3D=20
rootPreferences.node("/favorite");</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Preferences child =3D=20
pref.node("my");<BR>child.put("file","my.txt");<BR>try=20
{<BR> child.flush();<BR> pref.flush(); <BR> rootPreferences=
..flush();<BR>}=20
catch (BackingStoreException e) {<BR> // TODO Auto-generated catch=20
block<BR> e.printStackTrace();<BR>}<BR>try=20
{<BR> service.exportPreferences(rootPreferences,new =
FileOutputStream(new=20
File("c:\\tmp.dat")), null);<BR>} catch (FileNotFoundException e1) =
{<BR> //=20
TODO Auto-generated catch block<BR> e1.printStackTrace();<BR>} =
catch=20
(CoreException e1) {<BR> // TODO Auto-generated catch=20
block<BR> e1.printStackTrace();<BR>}<BR>try =
{<BR> IExportedPreferences=20
epref =3D service.readPreferences(new FileInputStream(new =
File("c:\\tmp.dat")))=20
;<BR> service.applyPreferences(epref);<BR>} catch =
(FileNotFoundException=20
e1) {<BR> // TODO Auto-generated catch=20
block<BR> e1.printStackTrace();<BR>} catch (CoreException e1) =
{<BR> //=20
TODO Auto-generated catch block<BR> e1.printStackTrace();<BR>} =
catch=20
(Exception e) {<BR> e.printStackTrace();<BR>}</FONT></DIV>
<DIV><FONT size=3D2>...</FONT></DIV>
<DIV><FONT=20
size=3D2> //=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= 3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><STRONG>message is:</STRONG></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Tue Jun 29 22:45:47 CST 2004 - [main] Setting =
preference:=20
/favorite/my/file=3Dmy.txt<BR>Tue Jun 29 22:45:47 CST 2004 - [main] =
Legacy plug-in=20
preference file not found:=20
G:\my\dev\eclipse-SDK-3.0M9\eclipse\runtime-workspace\.metad ata\.plugins\=
org.eclipse.ui.ide\pref_store.ini<BR>Tue=20
Jun 29 22:45:47 CST 2004 - [main] Loading preferences from file:=20
G:/my/dev/eclipse-SDK-3.0M9/eclipse/runtime-workspace/.metad ata/.plugins/=
org.eclipse.core.runtime/.settings/org.eclipse.ui.ide.prefs<BR >Tue=20
Jun 29 22:45:47 CST 2004 - [main] Setting preference:=20
/instance/org.eclipse.ui.ide/EXIT_PROMPT_ON_CLOSE_LAST_WINDO W=3Dfalse <BR>=
Tue Jun=20
29 22:45:47 CST 2004 - [main] Setting preference:=20
/instance/org.eclipse.ui.ide/EXIT_PROMPT_ON_CLOSE_LAST_WINDO W=3Dfalse <BR>=
Tue Jun=20
29 22:45:47 CST 2004 - [main] Getting preference value:=20
/favorite/my/file->my.txt<BR>Tue Jun 29 22:45:47 CST 2004 - [main] =
Reading=20
preferences from stream...<BR>Tue Jun 29 22:45:47 CST 2004 - [main] Read =
preferences file.<BR>Tue Jun 29 22:45:47 CST 2004 - [main] Setting =
preference:=20
/favorite/my/file=3Dmy.txt<BR>Tue Jun 29 22:45:47 CST 2004 - [main] =
Getting=20
preference value: /favorite/my/file->my.txt<BR>Tue Jun 29 22:45:47 =
CST 2004 -=20
[main] Converted preferences file to IExportedPreferences tree: *=20
/<BR>/favorite<BR>/favorite/my<BR>/favorite/my/file=3Dmy.txt </FONT></DIV>=
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Tue Jun 29 22:45:47 CST 2004 - [main] Getting =
preference=20
value: /favorite/my/file->my.txt<BR>Tue Jun 29 22:45:47 CST 2004 - =
[main]=20
Applying exported preferences: *=20
/<BR>/favorite<BR>/favorite/my<BR>/favorite/my/file=3Dmy.txt </FONT></DIV>=
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>Tue Jun 29 22:45:47 CST 2004 - [main] Found export =
root:=20
/<BR>java.lang.NullPointerException<BR> at=20
org.eclipse.core.internal.preferences.EclipsePreferences.rem oveNode(Eclip=
sePreferences.java:959)<BR> at=20
org.eclipse.core.internal.preferences.PreferencesService$1.v isit(Preferen=
cesService.java:152)<BR> at=20
org.eclipse.core.internal.preferences.EclipsePreferences.acc ept(EclipsePr=
eferences.java:90)<BR> at=20
org.eclipse.core.internal.preferences.PreferencesService.app lyPreferences=
(PreferencesService.java:184)</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><FONT size=3D2>.......</FONT></DIV>
<DIV><FONT size=3D2></FONT> </DIV>
<DIV><STRONG>what's wrong?</STRONG></DIV>
<DIV><STRONG></STRONG> </DIV>
<DIV><STRONG>regards</STRONG></DIV>
<DIV><STRONG>..jay</STRONG></DIV>
<DIV><STRONG></STRONG> </DIV></BODY></HTML>
------=_NextPart_000_0016_01C45E2B.F66CD9F0--
|
|
|
Re: applyPreferences error ? [message #256768 is a reply to message #256689] |
Tue, 29 June 2004 13:37  |
Eclipse User |
|
|
|
Originally posted by: dj_houghton.nospam.ca.ibm.com
I have entered https://bugs.eclipse.org/bugs/show_bug.cgi?id=68897 to
track your problem.
jay wrote:
> *dear all, i have a code fragment like below,.*
> **
> *code fragment:*
>
> //======================================
>
> IPreferencesService service = Platform.getPreferencesService();
>
> IEclipsePreferences rootPreferences = service.getRootNode();
> Preferences pref = rootPreferences.node("/favorite");
>
> Preferences child = pref.node("my");
> child.put("file","my.txt");
> try {
> child.flush();
> pref.flush();
> rootPreferences.flush();
> } catch (BackingStoreException e) {
> // TODO Auto-generated catch block
> e.printStackTrace();
> }
> try {
> service.exportPreferences(rootPreferences,new FileOutputStream(new
> File("c:\\tmp.dat")), null);
> } catch (FileNotFoundException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> } catch (CoreException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> }
> try {
> IExportedPreferences epref = service.readPreferences(new
> FileInputStream(new File("c:\\tmp.dat"))) ;
> service.applyPreferences(epref);
> } catch (FileNotFoundException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> } catch (CoreException e1) {
> // TODO Auto-generated catch block
> e1.printStackTrace();
> } catch (Exception e) {
> e.printStackTrace();
> }
> ...
> //========================================================== ==
>
> *message is:*
>
> Tue Jun 29 22:45:47 CST 2004 - [main] Setting preference:
> /favorite/my/file=my.txt
> Tue Jun 29 22:45:47 CST 2004 - [main] Legacy plug-in preference file not
> found:
> G:\my\dev\eclipse-SDK-3.0M9\eclipse\runtime-workspace\.metad ata\.plugins\org.eclipse.ui.ide\pref_store.ini
> Tue Jun 29 22:45:47 CST 2004 - [main] Loading preferences from file:
> G:/my/dev/eclipse-SDK-3.0M9/eclipse/runtime-workspace/.metad ata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse. ui.ide.prefs
> Tue Jun 29 22:45:47 CST 2004 - [main] Setting preference:
> /instance/org.eclipse.ui.ide/EXIT_PROMPT_ON_CLOSE_LAST_WINDO W=false
> Tue Jun 29 22:45:47 CST 2004 - [main] Setting preference:
> /instance/org.eclipse.ui.ide/EXIT_PROMPT_ON_CLOSE_LAST_WINDO W=false
> Tue Jun 29 22:45:47 CST 2004 - [main] Getting preference value:
> /favorite/my/file->my.txt
> Tue Jun 29 22:45:47 CST 2004 - [main] Reading preferences from stream...
> Tue Jun 29 22:45:47 CST 2004 - [main] Read preferences file.
> Tue Jun 29 22:45:47 CST 2004 - [main] Setting preference:
> /favorite/my/file=my.txt
> Tue Jun 29 22:45:47 CST 2004 - [main] Getting preference value:
> /favorite/my/file->my.txt
> Tue Jun 29 22:45:47 CST 2004 - [main] Converted preferences file to
> IExportedPreferences tree: * /
> /favorite
> /favorite/my
> /favorite/my/file=my.txt
>
> Tue Jun 29 22:45:47 CST 2004 - [main] Getting preference value:
> /favorite/my/file->my.txt
> Tue Jun 29 22:45:47 CST 2004 - [main] Applying exported preferences: * /
> /favorite
> /favorite/my
> /favorite/my/file=my.txt
>
> Tue Jun 29 22:45:47 CST 2004 - [main] Found export root: /
> java.lang.NullPointerException
> at
> org.eclipse.core.internal.preferences.EclipsePreferences.rem oveNode(EclipsePreferences.java:959)
> at
> org.eclipse.core.internal.preferences.PreferencesService$1.v isit(PreferencesService.java:152)
> at
> org.eclipse.core.internal.preferences.EclipsePreferences.acc ept(EclipsePreferences.java:90)
> at
> org.eclipse.core.internal.preferences.PreferencesService.app lyPreferences(PreferencesService..java:184)
>
> .......
>
> *what's wrong?*
> **
> *regards*
> *..jay*
> **
|
|
|
Powered by
FUDForum. Page generated in 0.03107 seconds