зеркало из https://github.com/mozilla/gecko-dev.git
Bug 300464 - If no servers are register, a NullPointerException prevents normal operation.
This commit is contained in:
Родитель
6f91479228
Коммит
2769f32da7
|
@ -202,9 +202,14 @@ public class MasterPanel extends GeneralPanel {
|
|||
fModel = new FolderModel();
|
||||
ViewedStore stores[] = StoreFactory.Instance().getStores();
|
||||
fStores = new ViewedStore[stores.length];
|
||||
for (int i = 0; i < stores.length; i++) {
|
||||
fModel.addStore(stores[i]);
|
||||
fStores[i] = stores[i];
|
||||
|
||||
//If the first store is null, then there must not be any accounts set
|
||||
//up by the user.
|
||||
if (stores[0] != null) {
|
||||
for (int i = 0; i < stores.length; i++) {
|
||||
fModel.addStore(stores[i]);
|
||||
fStores[i] = stores[i];
|
||||
}
|
||||
}
|
||||
|
||||
fFolderTree.setDataModel(fModel);
|
||||
|
@ -491,9 +496,13 @@ public class MasterPanel extends GeneralPanel {
|
|||
ViewedStore stores[] = StoreFactory.Instance().getStores();
|
||||
fStores = new ViewedStore[stores.length];
|
||||
|
||||
for (i = 0; i < stores.length; i++) {
|
||||
fModel.addStore(stores[i]);
|
||||
fStores[i] = stores[i];
|
||||
//If the first store is null, then there must not be any accounts set
|
||||
//up by the user to add.
|
||||
if (stores[0] != null) {
|
||||
for (i = 0; i < stores.length; i++) {
|
||||
fModel.addStore(stores[i]);
|
||||
fStores[i] = stores[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
* Copyright (C) 1997 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Contributor(s):
|
||||
*
|
||||
* Created: Will Scullin <scullin@netscape.com>, 19 Nov 1997.
|
||||
*
|
||||
|
@ -103,7 +103,7 @@ public class StoreFactory {
|
|||
String proto = prefs.getType();
|
||||
URLName urlName = new URLName(proto,null,-1,null,null,null);
|
||||
|
||||
// ### Very wrong temporary hack -- these protocols should be registered
|
||||
// ### Very wrong temporary hack -- these protocols should be registered
|
||||
// correctly with JavaMail trough the javamail.providers file
|
||||
|
||||
try {
|
||||
|
@ -134,6 +134,8 @@ public class StoreFactory {
|
|||
|
||||
if (store == null) {
|
||||
try {
|
||||
if (proto.equals(""))
|
||||
return null;
|
||||
store = fSession.getStore(proto);
|
||||
} catch (MessagingException e) {
|
||||
System.out.println("Got exception " + e +
|
||||
|
@ -146,7 +148,7 @@ public class StoreFactory {
|
|||
|
||||
return viewedStore;
|
||||
}
|
||||
|
||||
|
||||
private synchronized void closeStores() {
|
||||
for (int i=0; i<fStores.length; i++) {
|
||||
try {
|
||||
|
@ -165,11 +167,11 @@ public class StoreFactory {
|
|||
if (fStores != null) {
|
||||
closeStores();
|
||||
}
|
||||
|
||||
|
||||
ServerArray prefs = ServerArray.GetMaster();
|
||||
|
||||
fStores = new ViewedStore[prefs.size()];
|
||||
|
||||
|
||||
for (int i=0; i<prefs.size(); i++) {
|
||||
fStores[i] = createStore(i);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче