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) { if (pos >= 0) {
int from = Integer.decode(strVal.substring(0, pos).trim()); int from = Integer.decode(strVal.substring(0, pos).trim());
int to = Integer.decode(strVal.substring(pos + 1).trim()); int to = Integer.decode(strVal.substring(pos + 1).trim());
if (to < from) if (to < from) {
throw new BitsException(Lang.get("err_spitterDefSyntaxError", definition)); int z = to;
to = from;
from = z;
}
add(new Port(from, to - from + 1)); add(new Port(from, to - from + 1));
} else } else
add(new Port(bits, Integer.decode(strVal))); add(new Port(bits, Integer.decode(strVal)));

View File

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

View File

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