Lines 77-83
Link Here
|
77 |
public char[] read(String key){ |
77 |
public char[] read(String key){ |
78 |
runCommand("close", runCommand("localWallet"), "true".toCharArray() ); |
78 |
runCommand("close", runCommand("localWallet"), "true".toCharArray() ); |
79 |
if (updateHandler()){ |
79 |
if (updateHandler()){ |
80 |
char[] runCommand = runCommand("readPassword", handler, getApplicationName(), key.toCharArray(), getApplicationNameWithVersion()); |
80 |
char[] runCommand = runCommand("readPassword", handler, getApplicationName(), key.toCharArray(), getApplicationName(true)); |
81 |
runCommand("close", runCommand("localWallet"), "true".toCharArray() ); |
81 |
runCommand("close", runCommand("localWallet"), "true".toCharArray() ); |
82 |
return runCommand; |
82 |
return runCommand; |
83 |
} |
83 |
} |
Lines 91-97
Link Here
|
91 |
runCommand("close", runCommand("localWallet"), "true".toCharArray() ); |
91 |
runCommand("close", runCommand("localWallet"), "true".toCharArray() ); |
92 |
if (updateHandler()){ |
92 |
if (updateHandler()){ |
93 |
if (new String(runCommand("writePassword", handler , getApplicationName() |
93 |
if (new String(runCommand("writePassword", handler , getApplicationName() |
94 |
, key.toCharArray(), password , getApplicationNameWithVersion()) |
94 |
, key.toCharArray(), password , getApplicationName(true)) |
95 |
).equals("-1")){ |
95 |
).equals("-1")){ |
96 |
throw new KwalletException("save"); |
96 |
throw new KwalletException("save"); |
97 |
} |
97 |
} |
Lines 106-112
Link Here
|
106 |
runCommand("close", runCommand("localWallet"), "true".toCharArray() ); |
106 |
runCommand("close", runCommand("localWallet"), "true".toCharArray() ); |
107 |
if (updateHandler()){ |
107 |
if (updateHandler()){ |
108 |
if (new String(runCommand("removeEntry" ,handler, |
108 |
if (new String(runCommand("removeEntry" ,handler, |
109 |
getApplicationName() , key.toCharArray() , getApplicationNameWithVersion() |
109 |
getApplicationName() , key.toCharArray() , getApplicationName(true) |
110 |
)).equals("-1")){ |
110 |
)).equals("-1")){ |
111 |
throw new KwalletException("delete"); |
111 |
throw new KwalletException("delete"); |
112 |
} |
112 |
} |
Lines 122-128
Link Here
|
122 |
return true; |
122 |
return true; |
123 |
} |
123 |
} |
124 |
char[] localWallet = runCommand("localWallet"); |
124 |
char[] localWallet = runCommand("localWallet"); |
125 |
handler = runCommand("open", localWallet , "0".toCharArray() , getApplicationNameWithVersion()); |
125 |
handler = runCommand("open", localWallet , "0".toCharArray() , getApplicationName(true)); |
126 |
if(!(new String(handler)).equals("-1")){ |
126 |
if(!(new String(handler)).equals("-1")){ |
127 |
return true; |
127 |
return true; |
128 |
} |
128 |
} |
Lines 186-204
Link Here
|
186 |
} |
186 |
} |
187 |
|
187 |
|
188 |
private char[] getApplicationName(){ |
188 |
private char[] getApplicationName(){ |
|
|
189 |
return getApplicationName(false); |
190 |
} |
191 |
|
192 |
private char[] getApplicationName(boolean version){ |
189 |
String appName; |
193 |
String appName; |
190 |
try { |
194 |
try { |
191 |
appName = MessageFormat.format(NbBundle.getBundle("org.netbeans.core.windows.view.ui.Bundle").getString("CTL_MainWindow_Title_No_Project"),"…"); |
195 |
appName = MessageFormat.format(NbBundle.getBundle("org.netbeans.core.windows.view.ui.Bundle").getString("CTL_MainWindow_Title_No_Project"),version ? System.getProperty("netbeans.buildnumber"):""); |
192 |
} catch (MissingResourceException x) { |
196 |
} catch (MissingResourceException x) { |
193 |
appName = "NetBeans"; |
197 |
appName = "NetBeans"+(version? " "+System.getProperty("netbeans.buildnumber"):""); |
194 |
} |
198 |
} |
195 |
return appName.toCharArray(); |
199 |
return appName.toCharArray(); |
196 |
} |
200 |
} |
197 |
|
201 |
|
198 |
private char[] getApplicationNameWithVersion(){ |
|
|
199 |
return (new String(getApplicationName())+" "+System.getProperty("netbeans.buildnumber")).toCharArray(); |
200 |
} |
201 |
|
202 |
public class KwalletException extends RuntimeException{ |
202 |
public class KwalletException extends RuntimeException{ |
203 |
|
203 |
|
204 |
public KwalletException(String desc) { |
204 |
public KwalletException(String desc) { |