fix NullPointer
greylisting seen more common
This commit is contained in:
parent
3a386fb24e
commit
7b0315df1f
@ -155,6 +155,6 @@ INSERT INTO unixuser (name, comment, shell, homedir, locked, packet_id, userid)
|
|||||||
-- table: domain_option
|
-- table: domain_option
|
||||||
--
|
--
|
||||||
INSERT INTO domain_option (domain_option_name)
|
INSERT INTO domain_option (domain_option_name)
|
||||||
VALUES ('graylisting');
|
VALUES ('greylisting');
|
||||||
INSERT INTO domain_option (domain_option_name)
|
INSERT INTO domain_option (domain_option_name)
|
||||||
VALUES ('htdocsfallback');
|
VALUES ('htdocsfallback');
|
||||||
|
@ -159,9 +159,6 @@ public class DomainModuleImpl extends AbstractModuleImpl {
|
|||||||
DomainOption.class.getAnnotation(javax.persistence.Entity.class).name() +
|
DomainOption.class.getAnnotation(javax.persistence.Entity.class).name() +
|
||||||
" opt WHERE opt.name=:optName");
|
" opt WHERE opt.name=:optName");
|
||||||
Set<DomainOption> domainOptions = updatedDom.getDomainOptions();
|
Set<DomainOption> domainOptions = updatedDom.getDomainOptions();
|
||||||
// if (domainOptions == null) {
|
|
||||||
// updatedDom.setDomainOptions(oldDom.getDomainOptions());
|
|
||||||
// }
|
|
||||||
for (DomainOption opt : domainOptions) {
|
for (DomainOption opt : domainOptions) {
|
||||||
q.setParameter("optName", opt.getName());
|
q.setParameter("optName", opt.getName());
|
||||||
List<?> list = q.getResultList();
|
List<?> list = q.getResultList();
|
||||||
|
@ -43,8 +43,11 @@ public class DomainRemote extends AbstractRemote {
|
|||||||
}
|
}
|
||||||
List<String> domainOptionsList = new ArrayList<String>();
|
List<String> domainOptionsList = new ArrayList<String>();
|
||||||
resultMap.put("domainoptions", domainOptionsList);
|
resultMap.put("domainoptions", domainOptionsList);
|
||||||
for (DomainOption opt : dom.getDomainOptions()) {
|
Set<DomainOption> domainOptions = dom.getDomainOptions();
|
||||||
domainOptionsList.add(opt.getName());
|
if (domainOptions != null) {
|
||||||
|
for (DomainOption opt : domainOptions) {
|
||||||
|
domainOptionsList.add(opt.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ public class DomainTest {
|
|||||||
Map<String, Object> setParams = new HashMap<String, Object>();
|
Map<String, Object> setParams = new HashMap<String, Object>();
|
||||||
Map<String, String> whereParams = new HashMap<String, String>();
|
Map<String, String> whereParams = new HashMap<String, String>();
|
||||||
List<String> optionslist = new ArrayList<String>();
|
List<String> optionslist = new ArrayList<String>();
|
||||||
optionslist.add("graylisting");
|
optionslist.add("greylisting");
|
||||||
setParams.put("domainoptions", optionslist);
|
setParams.put("domainoptions", optionslist);
|
||||||
whereParams.put("name", "example01.org");
|
whereParams.put("name", "example01.org");
|
||||||
Object[] params = new Object[] { user,
|
Object[] params = new Object[] { user,
|
||||||
@ -177,7 +177,7 @@ public class DomainTest {
|
|||||||
Map<String, String> whereParams = new HashMap<String, String>();
|
Map<String, String> whereParams = new HashMap<String, String>();
|
||||||
List<String> optionslist = new ArrayList<String>();
|
List<String> optionslist = new ArrayList<String>();
|
||||||
optionslist.add("htdocsfallback");
|
optionslist.add("htdocsfallback");
|
||||||
optionslist.add("graylisting");
|
optionslist.add("greylisting");
|
||||||
setParams.put("domainoptions", optionslist);
|
setParams.put("domainoptions", optionslist);
|
||||||
whereParams.put("name", "example01.org");
|
whereParams.put("name", "example01.org");
|
||||||
Object[] params = new Object[] { user,
|
Object[] params = new Object[] { user,
|
||||||
@ -244,7 +244,7 @@ public class DomainTest {
|
|||||||
Object[] result = (Object[]) execute;
|
Object[] result = (Object[]) execute;
|
||||||
assertEquals(result.length, 1);
|
assertEquals(result.length, 1);
|
||||||
assertTrue(result[0] instanceof Map<?, ?>);
|
assertTrue(result[0] instanceof Map<?, ?>);
|
||||||
Map<String, ?> domainMap = (Map<String, ?>) result[0];
|
Map<?, ?> domainMap = (Map<?, ?>) result[0];
|
||||||
assertNotNull(domainMap);
|
assertNotNull(domainMap);
|
||||||
Object[] optsList = (Object[])domainMap.get("domainoptions");
|
Object[] optsList = (Object[])domainMap.get("domainoptions");
|
||||||
if (optsList == null) {
|
if (optsList == null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user