From d3fa0c66f502abfd5c302cbfa313ecb5ad7864e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Euzenat?= <Jerome.Euzenat@inria.fr> Date: Tue, 8 Sep 2015 14:48:55 +0000 Subject: [PATCH] - corrected a bug in cell storage (unsafe casting to EDOALCell) --- src/fr/inrialpes/exmo/align/service/SQLCache.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/fr/inrialpes/exmo/align/service/SQLCache.java b/src/fr/inrialpes/exmo/align/service/SQLCache.java index 701e16c6..11ecefb1 100644 --- a/src/fr/inrialpes/exmo/align/service/SQLCache.java +++ b/src/fr/inrialpes/exmo/align/service/SQLCache.java @@ -352,14 +352,13 @@ public class SQLCache extends VolatilCache implements Cache { ResultSet rs = st.executeQuery( "SELECT * FROM cell WHERE id = '" + id + "'" ); while( rs.next() ) { logger.trace( "Loading cell {}", rs.getString( "cell_id" ) ); - try { // To suppress Cell cell; if ( alignment instanceof URIAlignment ) { URI ent1 = new URI( rs.getString("uri1") ); URI ent2 = new URI( rs.getString("uri2") ); if ( ent1 == null || ent2 == null ) break; cell = ((URIAlignment)alignment).addAlignCell( ent1, ent2, rs.getString("relation"), Double.parseDouble(rs.getString("measure")) ); - } else { // load the cell + } else { // load the cell (if this is not a URIAlignment, this is an EDOALAlignment) esrv = new EDOALSQLCache( service ); esrv.init(); Object ent1 = esrv.extractExpression( Long.parseLong( rs.getString("uri1") ) ); @@ -384,8 +383,6 @@ public class SQLCache extends VolatilCache implements Cache { } } cell.setSemantics( rs.getString( "semantics" ) ); - // To suppress - } catch (Exception toto) { toto.printStackTrace(); } } // reset @@ -611,9 +608,10 @@ public class SQLCache extends VolatilCache implements Cache { cellid = alignment.getExtension( Namespace.ALIGNMENT.uri, Annotations.ID ) + cellid; } } else if ( ( c.getExtensions() != null ) || - ( ((EDOALCell)c).transformations() != null && !((EDOALCell)c).transformations().isEmpty() ) || - ( ((EDOALCell)c).linkkeys() != null && !((EDOALCell)c).linkkeys().isEmpty() ) ) { - // if no id => generate one. + ( ( c instanceof EDOALCell ) && + ( ( ((EDOALCell)c).transformations() != null && !((EDOALCell)c).transformations().isEmpty() ) || + ( ((EDOALCell)c).linkkeys() != null && !((EDOALCell)c).linkkeys().isEmpty() ) ) ) ) { + // if no id and we need one for => generate one. cellid = generateCellId(); } else cellid = ""; -- GitLab