Clean up error opening Events table and reading new database credentials.
git-svn-id: file:///home/svn/framework3/trunk@14123 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
f64893d305
commit
11c5801895
Binary file not shown.
|
@ -229,6 +229,14 @@ public class DbConnectDialog extends OptionsDialog {
|
|||
props.put("db"+key, val);
|
||||
}
|
||||
|
||||
/** Remove quotes */
|
||||
private String stripQuotes(String quoted){
|
||||
if(quoted.startsWith("\"") && quoted.endsWith("\"")
|
||||
|| quoted.startsWith("\'") && quoted.endsWith("\'"))
|
||||
return quoted.substring(1, quoted.length() - 1);
|
||||
return quoted;
|
||||
}
|
||||
|
||||
/** Loads database information from the database.yml file in the default install. */
|
||||
private void reloadDefaults(){
|
||||
try{
|
||||
|
@ -243,17 +251,17 @@ public class DbConnectDialog extends OptionsDialog {
|
|||
token = s.next();
|
||||
while(s.hasNext()){
|
||||
if(token.equals("adapter:"))
|
||||
props.put("dbdriver", s.next());
|
||||
props.put("dbdriver", stripQuotes(s.next()));
|
||||
else if(token.equals("database:"))
|
||||
props.put("dbdatabase", s.next());
|
||||
props.put("dbdatabase", stripQuotes(s.next()));
|
||||
else if(token.equals("username:"))
|
||||
props.put("dbusername", s.next());
|
||||
props.put("dbusername", stripQuotes(s.next()));
|
||||
else if(token.equals("password:"))
|
||||
props.put("dbpassword", s.next().replace("'", ""));
|
||||
props.put("dbpassword", stripQuotes(s.next()));
|
||||
else if(token.equals("host:"))
|
||||
props.put("dbhost", s.next());
|
||||
props.put("dbhost", stripQuotes(s.next()));
|
||||
else if(token.equals("port:"))
|
||||
props.put("dbport", s.next());
|
||||
props.put("dbport", stripQuotes(s.next()));
|
||||
token = s.next();
|
||||
}
|
||||
} catch (FileNotFoundException fnfox){
|
||||
|
|
|
@ -874,9 +874,6 @@
|
|||
<Property name="action" type="javax.swing.Action" editor="org.netbeans.modules.swingapp.ActionEditor">
|
||||
<action class="msfgui.MainFrame" id="showAboutBox" methodName="showAboutBox"/>
|
||||
</Property>
|
||||
<Property name="accelerator" type="javax.swing.KeyStroke" editor="org.netbeans.modules.form.editors.KeyStrokeEditor">
|
||||
<KeyStroke key="F1"/>
|
||||
</Property>
|
||||
<Property name="name" type="java.lang.String" value="aboutMenuItem" noResource="true"/>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
|
|
|
@ -55,6 +55,7 @@ public class MainFrame extends FrameView {
|
|||
});
|
||||
eventsTable.setName("eventsTable"); // NOI18N
|
||||
eventsPane.setViewportView(eventsTable);
|
||||
tabbedPane.addTab("Events", eventsPane); // NOI18N
|
||||
sessionsTableModel = null;
|
||||
sessionWindowMap = new HashMap();
|
||||
|
||||
|
@ -1558,11 +1559,6 @@ nameloop: for (int i = 0; i < names.length; i++) {
|
|||
}//GEN-LAST:event_vulnsViewItemActionPerformed
|
||||
|
||||
private void eventsViewItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_eventsViewItemActionPerformed
|
||||
if(eventsPane.getParent() == null)
|
||||
tabbedPane.addTab("Events", eventsPane);
|
||||
if(eventsTable.getRowCount() == 0)
|
||||
reAdd(eventsTable,(List) ((Map)rpcConn.execute("db.events",MsfguiApp.workspace)).get("events"),
|
||||
new String[]{"host","created_at","updated_at","name","critical","username","info"});
|
||||
DraggableTabbedPane.show(eventsPane);
|
||||
}//GEN-LAST:event_eventsViewItemActionPerformed
|
||||
|
||||
|
|
Loading…
Reference in New Issue