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 b67f1556 authored by Piotr Gawron's avatar Piotr Gawron

Merge branch 'error-message' into 'master'

Error message improved

See merge request !576
parents 04fdb2ab c635293a
Pipeline #8199 passed with stage
in 9 minutes and 7 seconds
......@@ -4,6 +4,7 @@ import org.apache.log4j.Logger;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import lcsb.mapviewer.common.exception.InvalidArgumentException;
import lcsb.mapviewer.common.exception.InvalidXmlSchemaException;
import lcsb.mapviewer.common.exception.NotImplementedException;
import lcsb.mapviewer.converter.model.celldesigner.CellDesignerElementCollection;
......@@ -150,6 +151,8 @@ public class SpeciesAliasXmlParser extends AbstractAliasXmlParser<Species> {
species.updateModelElementAfterLayoutAdded(result);
return result;
} catch (InvalidArgumentException e) {
throw new InvalidXmlSchemaException(errorPrefix + e.getMessage(), e);
} catch (NotImplementedException e) {
throw new InvalidXmlSchemaException(errorPrefix + "Problem with creating species", e);
}
......
......@@ -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());
......
......@@ -135,7 +135,7 @@ public class CellDesignerXmlParserTest extends CellDesignerTestFunctions {
CellDesignerXmlParser parser = new CellDesignerXmlParser();
parser.createModel(new ConverterParams().filename("testFiles/invalid/sample10.xml"));
fail("Exceptin expected");
} catch (InvalidArgumentException e) {
} catch (InvalidInputDataExecption e) {
assertTrue(e.getMessage().contains("No type information for modification"));
} catch (Exception e) {
e.printStackTrace();
......
......@@ -15,9 +15,6 @@ dbschemadiff=management_scripts/db_schema_and_diff.sh
#Where source file of the debian package should be placed
SRC_DIR=debian/src
#where the documentation files are stored
DOC_DIR=doc
#File that should be deployed on tomcat
TOMCAT_FILE=web/target/web-1.0.war
......@@ -42,7 +39,7 @@ mkdir $SRC_DIR
cp $TOMCAT_FILE $SRC_DIR/minerva.war
#copy manual documentation
cp $DOC_DIR/description.txt $SRC_DIR/minerva.txt
cp debian/description.txt $SRC_DIR/minerva.txt
gzip -n $SRC_DIR/minerva.txt
#copy configuration of logrotate
......
MINERVA (Molecular Interaction NEtwoRk VisuAlization) platform is a standalone webserver for visualization, exploration and management of molecular networks encoded in SBGN-compliant format. After installation, the resource is used and managed via a web browser, under the default address 'http://localhost:8080/minerva/'. You can configure your Tomcat server later to change the address.
......@@ -33,6 +33,14 @@
<version>${log4j.version}</version>
</dependency>
<!-- mockito used for testing -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
......@@ -40,6 +48,7 @@
<scope>test</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
......@@ -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