Author: bpoussin Date: 2017-08-18 17:48:57 +0200 (Fri, 18 Aug 2017) New Revision: 4420 Url: http://forge.codelutin.com/projects/isis-fish/repository/revisions/4420 Log: fixes #9339: NPE sur une matrice r?\195?\169cup?\195?\169r?\195?\169 depuis le ResultStorage en dehors d'une simulation Modified: trunk/src/main/java/fr/ifremer/isisfish/datastore/ResultStorageAbstract.java Modified: trunk/src/main/java/fr/ifremer/isisfish/datastore/ResultStorageAbstract.java =================================================================== --- trunk/src/main/java/fr/ifremer/isisfish/datastore/ResultStorageAbstract.java 2017-08-18 10:10:01 UTC (rev 4419) +++ trunk/src/main/java/fr/ifremer/isisfish/datastore/ResultStorageAbstract.java 2017-08-18 15:48:57 UTC (rev 4420) @@ -160,10 +160,9 @@ if (mat != null) { // on decore la matrice resultat au dernier moment, tous les calcules // ce font avec les strings - tx = getTx(tx); + EntitySemanticsDecorator.EntityProvider provider = getProvider(tx); result = new MatrixSemanticsDecorator(mat, - new EntitySemanticsDecorator( - new EntitySemanticsDecorator.EntityTxProvider(tx))); + new EntitySemanticsDecorator(provider)); } return result; } @@ -623,9 +622,7 @@ * @param tx * @return */ - protected TopiaContext getTx(TopiaContext tx) { - TopiaContext result = tx; - + protected EntitySemanticsDecorator.EntityProvider getProvider(TopiaContext tx) { // FIXME echatellier 20140811 : when reruninig again export outside of simulation // no simulation is registred into SimulationContext thread local, so this // method return no transaction @@ -635,12 +632,17 @@ // pour recuperer la tx de la simulation if (simulation == SimulationContext.get().getSimulationStorage()) { try { - result = SimulationContext.get().getDB(); + tx = SimulationContext.get().getDB(); } catch (TopiaException eee) { throw new IsisFishRuntimeException("Can't get database from SimulationContext", eee); } } } + + EntitySemanticsDecorator.EntityProvider result = null; + if (tx != null) { + result = new EntitySemanticsDecorator.EntityTxProvider(tx); + } return result; }