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
|
||||
--
|
||||
INSERT INTO domain_option (domain_option_name)
|
||||
VALUES ('graylisting');
|
||||
VALUES ('greylisting');
|
||||
INSERT INTO domain_option (domain_option_name)
|
||||
VALUES ('htdocsfallback');
|
||||
|
@ -159,9 +159,6 @@ public class DomainModuleImpl extends AbstractModuleImpl {
|
||||
DomainOption.class.getAnnotation(javax.persistence.Entity.class).name() +
|
||||
" opt WHERE opt.name=:optName");
|
||||
Set<DomainOption> domainOptions = updatedDom.getDomainOptions();
|
||||
// if (domainOptions == null) {
|
||||
// updatedDom.setDomainOptions(oldDom.getDomainOptions());
|
||||
// }
|
||||
for (DomainOption opt : domainOptions) {
|
||||
q.setParameter("optName", opt.getName());
|
||||
List<?> list = q.getResultList();
|
||||
|
@ -43,10 +43,13 @@ public class DomainRemote extends AbstractRemote {
|
||||
}
|
||||
List<String> domainOptionsList = new ArrayList<String>();
|
||||
resultMap.put("domainoptions", domainOptionsList);
|
||||
for (DomainOption opt : dom.getDomainOptions()) {
|
||||
Set<DomainOption> domainOptions = dom.getDomainOptions();
|
||||
if (domainOptions != null) {
|
||||
for (DomainOption opt : domainOptions) {
|
||||
domainOptionsList.add(opt.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void map2entity(Map<String, Object> setParams, AbstractEntity entity) {
|
||||
|
@ -155,7 +155,7 @@ public class DomainTest {
|
||||
Map<String, Object> setParams = new HashMap<String, Object>();
|
||||
Map<String, String> whereParams = new HashMap<String, String>();
|
||||
List<String> optionslist = new ArrayList<String>();
|
||||
optionslist.add("graylisting");
|
||||
optionslist.add("greylisting");
|
||||
setParams.put("domainoptions", optionslist);
|
||||
whereParams.put("name", "example01.org");
|
||||
Object[] params = new Object[] { user,
|
||||
@ -177,7 +177,7 @@ public class DomainTest {
|
||||
Map<String, String> whereParams = new HashMap<String, String>();
|
||||
List<String> optionslist = new ArrayList<String>();
|
||||
optionslist.add("htdocsfallback");
|
||||
optionslist.add("graylisting");
|
||||
optionslist.add("greylisting");
|
||||
setParams.put("domainoptions", optionslist);
|
||||
whereParams.put("name", "example01.org");
|
||||
Object[] params = new Object[] { user,
|
||||
@ -244,7 +244,7 @@ public class DomainTest {
|
||||
Object[] result = (Object[]) execute;
|
||||
assertEquals(result.length, 1);
|
||||
assertTrue(result[0] instanceof Map<?, ?>);
|
||||
Map<String, ?> domainMap = (Map<String, ?>) result[0];
|
||||
Map<?, ?> domainMap = (Map<?, ?>) result[0];
|
||||
assertNotNull(domainMap);
|
||||
Object[] optsList = (Object[])domainMap.get("domainoptions");
|
||||
if (optsList == null) {
|
||||
|
Loading…
Reference in New Issue
Block a user