If you have some reCaptcha popup or weird behavior when submit/edit issues let us know, we enabled spam detection that can flag false positives.

Commit 4363693a authored by Piotr Gawron's avatar Piotr Gawron

error reporting improved when there is a problem with exporting reaction line

parent fcaea20d
......@@ -156,8 +156,9 @@ public class ReactionToXml extends XmlParser {
* @param reaction
* reaction for which list is generated
* @return xml node with list of modification
* @throws InconsistentModelException
*/
private String getListOfModificationsXmlStringForReaction(Reaction reaction) {
private String getListOfModificationsXmlStringForReaction(Reaction reaction) throws InconsistentModelException {
StringBuilder sb = new StringBuilder();
sb.append("<celldesigner:listOfModification>\n");
......@@ -312,15 +313,16 @@ public class ReactionToXml extends XmlParser {
}
/**
* Creates xml node for given modifer.
* Creates xml node for given modifier.
*
* @param modifier
* modifier to be transaformed
* modifier to be transformed
* @param gate
* operator to which modifier is connected (if any)
* @return xml node for given modifer
* @return xml node for given modifier
* @throws InconsistentModelException
*/
private String getModifierXmlString(Modifier modifier, NodeOperator gate) {
private String getModifierXmlString(Modifier modifier, NodeOperator gate) throws InconsistentModelException {
StringBuilder sb = new StringBuilder();
ModifierTypeUtils modifierTypeUtils = new ModifierTypeUtils();
sb.append("<celldesigner:modification ");
......@@ -340,21 +342,26 @@ public class ReactionToXml extends XmlParser {
line.setStartPoint(start);
}
List<Point2D> points = lineTransformation.getPointsFromLine(line);
if (points.size() > 0) {
try {
List<Point2D> points = lineTransformation.getPointsFromLine(line);
if (points.size() > 0) {
boolean first = true;
sb.append(" editPoints=\"");
boolean first = true;
sb.append(" editPoints=\"");
for (Point2D point : points) {
if (first) {
first = false;
} else {
sb.append(" ");
for (Point2D point : points) {
if (first) {
first = false;
} else {
sb.append(" ");
}
sb.append(point.getX() + "," + point.getY());
}
sb.append(point.getX() + "," + point.getY());
sb.append("\"");
}
sb.append("\"");
} catch (InvalidArgumentException e) {
throw new InconsistentModelException(new ElementUtils().getElementTag(modifier) + "Problem with exporting line",
e);
}
sb.append(">\n");
......@@ -479,8 +486,9 @@ public class ReactionToXml extends XmlParser {
* @param reaction
* reaction to be processed
* @return xml node representing annotation part
* @throws InconsistentModelException
*/
private String getAnnotationXmlStringForReaction(Reaction reaction) {
private String getAnnotationXmlStringForReaction(Reaction reaction) throws InconsistentModelException {
ReactionLineData rdl = ReactionLineData.getByReactionType(reaction.getClass());
if (rdl == null) {
throw new InvalidArgumentException("Unknown reaction type: " + reaction.getClass());
......
......@@ -22,6 +22,10 @@ public class InconsistentModelException extends Exception {
super(message);
}
public InconsistentModelException(String message, Throwable e) {
super(message, e);
}
public InconsistentModelException(Exception e) {
super(e);
}
......
......@@ -260,7 +260,11 @@ public final class ElementUtils {
}
public String getElementTag(ReactionNode node) {
return "[" + node.getClass().getSimpleName() + "]" + getElementTag(node.getElement());
String reactionPrefix = "";
if (node.getReaction() != null) {
reactionPrefix = getElementTag(node.getReaction()).replaceAll("\t", "");
}
return reactionPrefix + "[" + node.getClass().getSimpleName() + "]" + getElementTag(node.getElement());
}
public String getElementTag(ModificationResidue mr) {
......
Markdown is supported
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