[Minor] Fix compile warnings

This commit is contained in:
Robert von Burg 2017-09-26 15:01:02 +02:00
parent 0c8b40c10a
commit 3310bb8766
6 changed files with 18 additions and 33 deletions

View File

@ -32,14 +32,6 @@ public class AndSelector<T extends StrolchElement> extends BooleanSelector<T> {
super(selectors); super(selectors);
} }
public AndSelector(@SuppressWarnings("unchecked") Selector<T>... selector) {
super(selector);
}
public AndSelector(Selector<T> leftHandSide, Selector<T> rightHandSide) {
super(leftHandSide, rightHandSide);
}
@Override @Override
public AndSelector<T> with(Selector<T> selector) { public AndSelector<T> with(Selector<T> selector) {
super.with(selector); super.with(selector);

View File

@ -32,7 +32,6 @@ public abstract class BooleanSelector<T extends StrolchElement> implements Selec
this.selectors = new ArrayList<>(1); this.selectors = new ArrayList<>(1);
} }
@SafeVarargs
public BooleanSelector(Selector<T>... selector) { public BooleanSelector(Selector<T>... selector) {
this.selectors = Arrays.asList(selector); this.selectors = Arrays.asList(selector);
} }

View File

@ -26,14 +26,10 @@ public class AndSelection extends BooleanSelection {
super(); super();
} }
@SafeVarargs
public AndSelection(Selection... selections) { public AndSelection(Selection... selections) {
super(selections); super(selections);
} }
/**
* @param selections
*/
public AndSelection(List<Selection> selections) { public AndSelection(List<Selection> selections) {
super(selections); super(selections);
} }

View File

@ -30,7 +30,6 @@ public class OrSelection extends BooleanSelection {
super(selections); super(selections);
} }
@SafeVarargs
public OrSelection(Selection... selections) { public OrSelection(Selection... selections) {
super(selections); super(selections);
} }

View File

@ -64,7 +64,6 @@ public class XmlModelSaxReader extends DefaultHandler {
private Deque<Activity> activityStack; private Deque<Activity> activityStack;
private ParameterBag pBag; private ParameterBag pBag;
private StrolchTimedState<? extends IValue<?>> state; private StrolchTimedState<? extends IValue<?>> state;
private StrolchValueType stateType;
private PolicyDefs policies; private PolicyDefs policies;
public XmlModelSaxReader(StrolchElementListener listener) { public XmlModelSaxReader(StrolchElementListener listener) {
@ -94,9 +93,8 @@ public class XmlModelSaxReader extends DefaultHandler {
String resId = attributes.getValue(Tags.ID); String resId = attributes.getValue(Tags.ID);
String resName = attributes.getValue(Tags.NAME); String resName = attributes.getValue(Tags.NAME);
String resType = attributes.getValue(Tags.TYPE); String resType = attributes.getValue(Tags.TYPE);
Resource resource = new Resource(resId, resName, resType);
this.parameterizedElement = resource; this.parameterizedElement = new Resource(resId, resName, resType);
break; break;
@ -172,8 +170,7 @@ public class XmlModelSaxReader extends DefaultHandler {
String pBagId = attributes.getValue(Tags.ID); String pBagId = attributes.getValue(Tags.ID);
String pBagName = attributes.getValue(Tags.NAME); String pBagName = attributes.getValue(Tags.NAME);
String pBagType = attributes.getValue(Tags.TYPE); String pBagType = attributes.getValue(Tags.TYPE);
ParameterBag pBag = new ParameterBag(pBagId, pBagName, pBagType); this.pBag = new ParameterBag(pBagId, pBagName, pBagType);
this.pBag = pBag;
break; break;
@ -189,8 +186,7 @@ public class XmlModelSaxReader extends DefaultHandler {
String paramIndexS = attributes.getValue(Tags.INDEX); String paramIndexS = attributes.getValue(Tags.INDEX);
int index = StringHelper.isEmpty(paramIndexS) ? 0 : Integer.valueOf(paramIndexS); int index = StringHelper.isEmpty(paramIndexS) ? 0 : Integer.valueOf(paramIndexS);
boolean paramHidden = StringHelper.isEmpty(paramHiddenS) ? false boolean paramHidden = !StringHelper.isEmpty(paramHiddenS) && StringHelper.parseBoolean(paramHiddenS);
: StringHelper.parseBoolean(paramHiddenS);
String paramUom = attributes.getValue(Tags.UOM); String paramUom = attributes.getValue(Tags.UOM);
String paramInterpretation = attributes.getValue(Tags.INTERPRETATION); String paramInterpretation = attributes.getValue(Tags.INTERPRETATION);
@ -209,8 +205,9 @@ public class XmlModelSaxReader extends DefaultHandler {
this.pBag.addParameter(param); this.pBag.addParameter(param);
} catch (Exception e) { } catch (Exception e) {
throw new StrolchException("Failed to instantiate parameter " + paramId + " for bag " throw new StrolchException(
+ this.pBag.getLocator() + " due to " + e.getMessage(), e); "Failed to instantiate parameter " + paramId + " for bag " + this.pBag.getLocator() + " due to "
+ e.getMessage(), e);
} }
break; break;
@ -220,17 +217,16 @@ public class XmlModelSaxReader extends DefaultHandler {
String stateId = attributes.getValue(Tags.ID); String stateId = attributes.getValue(Tags.ID);
try { try {
String stateName = attributes.getValue(Tags.NAME); String stateName = attributes.getValue(Tags.NAME);
String stateType = attributes.getValue(Tags.TYPE); String stateTypeS = attributes.getValue(Tags.TYPE);
String stateHiddenS = attributes.getValue(Tags.HIDDEN); String stateHiddenS = attributes.getValue(Tags.HIDDEN);
String stateIndexS = attributes.getValue(Tags.INDEX); String stateIndexS = attributes.getValue(Tags.INDEX);
String stateUom = attributes.getValue(Tags.UOM); String stateUom = attributes.getValue(Tags.UOM);
String stateInterpretation = attributes.getValue(Tags.INTERPRETATION); String stateInterpretation = attributes.getValue(Tags.INTERPRETATION);
int stateIndex = StringHelper.isEmpty(stateIndexS) ? 0 : Integer.valueOf(stateIndexS); int stateIndex = StringHelper.isEmpty(stateIndexS) ? 0 : Integer.valueOf(stateIndexS);
boolean stateHidden = StringHelper.isEmpty(stateHiddenS) ? false boolean stateHidden = !StringHelper.isEmpty(stateHiddenS) && StringHelper.parseBoolean(stateHiddenS);
: StringHelper.parseBoolean(stateHiddenS);
this.stateType = StrolchValueType.parse(stateType); StrolchValueType stateType = StrolchValueType.parse(stateTypeS);
this.state = this.stateType.timedStateInstance(); this.state = stateType.timedStateInstance();
this.state.setId(stateId); this.state.setId(stateId);
this.state.setName(stateName); this.state.setName(stateName);
this.state.setIndex(stateIndex); this.state.setIndex(stateIndex);
@ -239,8 +235,9 @@ public class XmlModelSaxReader extends DefaultHandler {
this.state.setUom(stateUom); this.state.setUom(stateUom);
} catch (Exception e) { } catch (Exception e) {
throw new StrolchException("Failed to instantiate TimedState " + stateId + " for resource " throw new StrolchException(
+ this.parameterizedElement.getLocator() + " due to " + e.getMessage(), e); "Failed to instantiate TimedState " + stateId + " for resource " + this.parameterizedElement
.getLocator() + " due to " + e.getMessage(), e);
} }
break; break;
@ -294,7 +291,8 @@ public class XmlModelSaxReader extends DefaultHandler {
break; break;
default: default:
throw new IllegalArgumentException(MessageFormat.format("The element ''{0}'' is unhandled!", qName)); //$NON-NLS-1$ throw new IllegalArgumentException(
MessageFormat.format("The element ''{0}'' is unhandled!", qName)); //$NON-NLS-1$
} }
} }
@ -378,7 +376,8 @@ public class XmlModelSaxReader extends DefaultHandler {
break; break;
default: default:
throw new IllegalArgumentException(MessageFormat.format("The element ''{0}'' is unhandled!", qName)); //$NON-NLS-1$ throw new IllegalArgumentException(
MessageFormat.format("The element ''{0}'' is unhandled!", qName)); //$NON-NLS-1$
} }
} }
} }

View File

@ -145,7 +145,7 @@ public class Paging<T> {
} else { } else {
paging.lastOffset = paging.size % limit == 0 ? paging.size - limit : ((int) paging.size / limit) * limit; paging.lastOffset = paging.size % limit == 0 ? paging.size - limit : (paging.size / limit) * limit;
paging.nextOffset = Math.min(paging.lastOffset, limit + offset); paging.nextOffset = Math.min(paging.lastOffset, limit + offset);
paging.previousOffset = Math.max(0, offset - limit); paging.previousOffset = Math.max(0, offset - limit);
} }