Skip to content

Array Index Issue while running Demo #44

@OGalOz

Description

@OGalOz

I got this error while running the demo through a Docker container:

'''
=========== Setting gate parts according to assigned gate names
=========== Setting gate parts according to assigned gate names
[WARNING]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:293)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
at java.util.ArrayList.rangeCheck(ArrayList.java:657)
at java.util.ArrayList.get(ArrayList.java:433)
at org.cellocad.MIT.dnacompiler.PlasmidUtil.setTxnUnits(PlasmidUtil.java:520)
at org.cellocad.MIT.dnacompiler.DNACompiler.generatePlasmids(DNACompiler.java:1136)
at org.cellocad.MIT.dnacompiler.DNACompiler.run(DNACompiler.java:1068)
at org.cellocad.MIT.dnacompiler.CelloMain.main(CelloMain.java:15)
... 6 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 17.077 s
[INFO] Finished at: 2019-11-15T00:01:12+00:00
[INFO] Final Memory: 39M/271M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java (default) on project cellocad: An exception occured while executing the Java class. null: InvocationTargetException: Index: 1, Size: 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.4.0:java (default) on project cellocad: An exception occured while executing the Java class. null '''

A possible fix is to replace the code in org.cellocad.MIT.dnacompiler.PlasmidUtil.setTxnUnits to the following:

        else {
        boolean f1 = g.getChildren().size() > 0 && (
		g.system.equals("CRISPRi") || g.getChildren().get(0).system.equals("CRISPRi") ||
		g.system.equals("Ecoligenome") || g.getChildren().get(0).system.equals("Ecoligenome") ||
		g.system.equals("Yeast") || g.getChildren().get(0).system.equals("Yeast")
	);

	boolean f2 = g.getChildren().size() > 1 && (
		g.getChildren().get(1).system.equals("Ecoligenome") ||
		g.getChildren().get(1).system.equals("Yeast")
	);

	/*
	   if(g.system.equals("CRISPRi") || g.getChildren().get(0).system.equals("CRISPRi")
	   || g.system.equals("Ecoligenome") || g.getChildren().get(0).system.equals("Ecoligenome") || g.getChildren().get(1).system.equals("Ecoligenome")
	   || g.system.equals("Yeast") || g.getChildren().get(0).system.equals("Yeast") || g.getChildren().get(1).system.equals("Yeast")) {
	   */
	if(f1 || f2) {

                for(String var: g.get_variable_names()) {

                    for(Wire w: g.get_variable_wires().get(var)) {
                        ArrayList<Part> txn_unit = new ArrayList<>();

                        txn_unit.add(w.to.get_regulable_promoter());

                        ArrayList<Part> expression_cassette = g.get_downstream_parts().get(var);

                        txn_unit.addAll(expression_cassette);

                        g.get_txn_units().add(txn_unit);
                    }

                }

The original conditional statement is commented out but left there to show where the change occurs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions