Merge branch 'master' into romManager

This commit is contained in:
hneemann 2018-02-27 12:34:58 +01:00
commit 0674855221
3 changed files with 11 additions and 10 deletions

View File

@ -272,8 +272,11 @@ public class Splitter implements Element {
if (pos >= 0) {
int from = Integer.decode(strVal.substring(0, pos).trim());
int to = Integer.decode(strVal.substring(pos + 1).trim());
if (to < from)
throw new BitsException(Lang.get("err_spitterDefSyntaxError", definition));
if (to < from) {
int z = to;
to = from;
from = z;
}
add(new Port(from, to - from + 1));
} else
add(new Port(bits, Integer.decode(strVal)));

View File

@ -50,7 +50,7 @@ public class MissingShape implements Shape {
while (c != null) {
y += style.getFontSize();
String message = c.getMessage();
if (message.length() > 100)
if (message != null && message.length() > 100)
message = message.substring(0, 100) + "...";
graphic.drawText(new Vector(4, y), new Vector(5, y), message, Orientation.LEFTTOP, style);
c = c.getCause();

View File

@ -89,13 +89,11 @@ public class PortsTest extends TestCase {
}
public void testInputConsistency3() throws Exception {
Splitter.Ports p = new Splitter.Ports("4-7,4-4");
try {
p = new Splitter.Ports("4-7,4-3");
fail();
} catch (NodeException e) {
assertTrue(true);
}
Splitter.Ports p = new Splitter.Ports("7-4,4-4");
assertEquals(4, p.getPort(0).getPos());
assertEquals(4, p.getPort(0).getBits());
assertEquals(4, p.getPort(1).getPos());
assertEquals(1, p.getPort(1).getBits());
}