Lines 43-48
Link Here
|
43 |
import java.io.IOException; |
43 |
import java.io.IOException; |
44 |
import java.io.InputStreamReader; |
44 |
import java.io.InputStreamReader; |
45 |
import java.text.MessageFormat; |
45 |
import java.text.MessageFormat; |
|
|
46 |
import java.util.Arrays; |
46 |
import java.util.MissingResourceException; |
47 |
import java.util.MissingResourceException; |
47 |
import java.util.logging.Level; |
48 |
import java.util.logging.Level; |
48 |
import java.util.logging.Logger; |
49 |
import java.util.logging.Logger; |
Lines 129-135
Link Here
|
129 |
} |
130 |
} |
130 |
|
131 |
|
131 |
private char[] runCommand(String command,char[]... commandArgs){ |
132 |
private char[] runCommand(String command,char[]... commandArgs){ |
132 |
String commandString = "qdbus org.kde.kwalletd /modules/kwalletd org.kde.KWallet."+command; |
|
|
133 |
String[] argv = new String[commandArgs.length+4]; |
133 |
String[] argv = new String[commandArgs.length+4]; |
134 |
argv[0] = "qdbus"; |
134 |
argv[0] = "qdbus"; |
135 |
argv[1] = "org.kde.kwalletd"; |
135 |
argv[1] = "org.kde.kwalletd"; |
Lines 139-147
Link Here
|
139 |
//unfortunatelly I cannot pass char[] to the exec in any way - so this poses a security issue with passwords in String() ! |
139 |
//unfortunatelly I cannot pass char[] to the exec in any way - so this poses a security issue with passwords in String() ! |
140 |
//TODO: find a way to avoid changing char[] into String |
140 |
//TODO: find a way to avoid changing char[] into String |
141 |
argv[i+4] = new String(commandArgs[i]); |
141 |
argv[i+4] = new String(commandArgs[i]); |
142 |
char[] arg = commandArgs[i]; |
|
|
143 |
String string = new String(arg); |
144 |
commandString = commandString+" "+string; |
145 |
} |
142 |
} |
146 |
|
143 |
|
147 |
Runtime rt = Runtime.getRuntime(); |
144 |
Runtime rt = Runtime.getRuntime(); |
Lines 173-188
Link Here
|
173 |
|
170 |
|
174 |
int exitVal = pr.waitFor(); |
171 |
int exitVal = pr.waitFor(); |
175 |
if(exitVal!=0){ |
172 |
if(exitVal!=0){ |
176 |
logger.log(Level.SEVERE,"application exit with code "+exitVal+" for commandString: "+commandString); |
173 |
logger.log(Level.SEVERE,"application exit with code "+exitVal+" for commandString: "+Arrays.toString(argv)); |
177 |
} |
174 |
} |
178 |
|
175 |
|
179 |
} catch (InterruptedException ex) { |
176 |
} catch (InterruptedException ex) { |
180 |
logger.log(Level.SEVERE, |
177 |
logger.log(Level.SEVERE, |
181 |
"exception thrown while invoking the command \""+commandString+"\"", |
178 |
"exception thrown while invoking the command \""+Arrays.toString(argv)+"\"", |
182 |
ex); |
179 |
ex); |
183 |
} catch (IOException ex) { |
180 |
} catch (IOException ex) { |
184 |
logger.log(Level.SEVERE, |
181 |
logger.log(Level.SEVERE, |
185 |
"exception thrown while invoking the command \""+commandString+"\"", |
182 |
"exception thrown while invoking the command \""+Arrays.toString(argv)+"\"", |
186 |
ex); |
183 |
ex); |
187 |
} |
184 |
} |
188 |
return (!retVal.equals("")) ? retVal.trim().toCharArray() : null; |
185 |
return (!retVal.equals("")) ? retVal.trim().toCharArray() : null; |
Lines 193-199
Link Here
|
193 |
try { |
190 |
try { |
194 |
appName = MessageFormat.format(NbBundle.getBundle("org.netbeans.core.windows.view.ui.Bundle").getString("CTL_MainWindow_Title_No_Project"),"…"); |
191 |
appName = MessageFormat.format(NbBundle.getBundle("org.netbeans.core.windows.view.ui.Bundle").getString("CTL_MainWindow_Title_No_Project"),"…"); |
195 |
} catch (MissingResourceException x) { |
192 |
} catch (MissingResourceException x) { |
196 |
appName = "NetBeans"; |
193 |
appName = "NetBeans"; |
197 |
} |
194 |
} |
198 |
return appName.toCharArray(); |
195 |
return appName.toCharArray(); |
199 |
} |
196 |
} |