Commit b1186c6b authored by thomas's avatar thomas
Browse files

[23157] prevent array exception, log warn invalid data of billing system

parent a190ded5
Pipeline #22506 passed with stages
in 4 minutes and 26 seconds
......@@ -19,6 +19,7 @@ import java.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.slf4j.LoggerFactory;
import ch.elexis.admin.AccessControlDefaults;
import ch.elexis.core.constants.Preferences;
......@@ -165,30 +166,37 @@ public class Fall extends PersistentObject implements IFall, ITransferable<FallD
for (String req : reqs.split(";")) { //$NON-NLS-1$
String localReq = ""; //$NON-NLS-1$
String[] r = req.split(":"); //$NON-NLS-1$
if ((r[1].equalsIgnoreCase("X")) && (r.length > 2)) { //$NON-NLS-1$
// *** support for additional field types (checkboxes with
// multiple items are
// special)
String[] items = r[2].split("\t"); //$NON-NLS-1$
if (items.length > 1) {
for (int rIx = 0; rIx < items.length; rIx++) {
localReq = getInfoString(r[0] + "_" + items[rIx]); //$NON-NLS-1$
if (StringTool.isNothing(localReq)) {
return false;
if (r != null && r.length > 1) {
if ((r[1].equalsIgnoreCase("X")) && (r.length > 2)) { //$NON-NLS-1$
// *** support for additional field types (checkboxes with
// multiple items are
// special)
String[] items = r[2].split("\t"); //$NON-NLS-1$
if (items.length > 1) {
for (int rIx = 0; rIx < items.length; rIx++) {
localReq = getInfoString(r[0] + "_" + items[rIx]); //$NON-NLS-1$
if (StringTool.isNothing(localReq)) {
return false;
}
}
}
} else {
localReq = getInfoString(r[0]);
if (StringTool.isNothing(localReq)) {
return false;
}
}
} else {
localReq = getInfoString(r[0]);
if (StringTool.isNothing(localReq)) {
return false;
}
}
if (r[1].equals("K")) { //$NON-NLS-1$
Kontakt k = Kontakt.load(localReq);
if (!k.isValid()) {
return false;
if (r[1].equals("K")) { //$NON-NLS-1$
Kontakt k = Kontakt.load(localReq);
if (!k.isValid()) {
return false;
}
}
} else {
LoggerFactory.getLogger(getClass())
.warn("Invalid requirements [" + reqs + "] on billing system ["
+ getAbrechnungsSystem()
+ "]");
}
}
}
......
......@@ -4,6 +4,7 @@ import java.util.Optional;
import org.apache.commons.lang3.StringUtils;
import org.osgi.service.component.annotations.Component;
import org.slf4j.LoggerFactory;
import ch.elexis.core.constants.Preferences;
import ch.elexis.core.constants.StringConstants;
......@@ -24,7 +25,6 @@ public class CoverageService implements ICoverageService {
if (coverage.getPatient() == null) {
return false;
}
// Check whether all user-defined requirements for this billing system
// are met
String reqs = BillingSystemServiceHolder.get().getRequirements(coverage.getBillingSystem());
......@@ -32,31 +32,36 @@ public class CoverageService implements ICoverageService {
for (String req : reqs.split(";")) { //$NON-NLS-1$
String localReq = ""; //$NON-NLS-1$
String[] r = req.split(":"); //$NON-NLS-1$
if ((r[1].equalsIgnoreCase("X")) && (r.length > 2)) { //$NON-NLS-1$
// *** support for additional field types (checkboxes with
// multiple items are
// special)
String[] items = r[2].split("\t"); //$NON-NLS-1$
if (items.length > 1) {
for (int rIx = 0; rIx < items.length; rIx++) {
localReq = (String) coverage.getExtInfo(r[0] + "_" + items[rIx]); //$NON-NLS-1$
if (StringTool.isNothing(localReq)) {
return false;
if (r != null && r.length > 1) {
if ((r[1].equalsIgnoreCase("X")) && (r.length > 2)) { //$NON-NLS-1$
// *** support for additional field types (checkboxes with
// multiple items are
// special)
String[] items = r[2].split("\t"); //$NON-NLS-1$
if (items.length > 1) {
for (int rIx = 0; rIx < items.length; rIx++) {
localReq = (String) coverage.getExtInfo(r[0] + "_" + items[rIx]); //$NON-NLS-1$
if (StringTool.isNothing(localReq)) {
return false;
}
}
}
} else {
localReq = (String) coverage.getExtInfo(r[0]);
if (StringTool.isNothing(localReq)) {
return false;
}
}
} else {
localReq = (String) coverage.getExtInfo(r[0]);
if (StringTool.isNothing(localReq)) {
return false;
}
}
if (r[1].equals("K")) { //$NON-NLS-1$
Optional<IContact> contact =
CoreModelServiceHolder.get().load(localReq, IContact.class);
if (!contact.isPresent()) {
return false;
if (r[1].equals("K")) { //$NON-NLS-1$
Optional<IContact> contact =
CoreModelServiceHolder.get().load(localReq, IContact.class);
if (!contact.isPresent()) {
return false;
}
}
} else {
LoggerFactory.getLogger(getClass()).warn("Invalid requirements [" + reqs
+ "] on billing system [" + coverage.getBillingSystem() + "]");
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment