@@ -466,7 +466,7 @@ protected IDataSet getGuiGenericDatasetToInsert(JSONObject json, UserProfile use
466466 IDataSet existingDataSet = null ;
467467
468468 try {
469- existingDataSet = DAOFactory .getDataSetDAO ().loadDataSetById (new Integer (id ));
469+ existingDataSet = DAOFactory .getDataSetDAO ().loadDataSetById (Integer . parseInt (id ));
470470 } catch (Exception e ) {
471471 LOGGER .error ("Error while getting dataset metadataa" , e );
472472 throw e ;
@@ -1665,12 +1665,6 @@ protected String datasetInsert(IDataSet ds, IDataSetDAO dsDao, Locale locale, Us
16651665
16661666 if (ds != null ) {
16671667
1668- List <String > persistenceTableNames = dsDao .loadPersistenceTableNames (ds .getId ());
1669-
1670- if (persistenceTableNames .stream ().anyMatch (tableName -> tableName != null && !tableName .isBlank () && tableName .equalsIgnoreCase (ds .getPersistTableName ()))) {
1671- throw new SpagoBIRuntimeException ("The persistence table with name <" + ds .getPersistTableName ().toUpperCase (Locale .ROOT ) + "> already exists" );
1672- }
1673-
16741668 String dsLabel = ds .getLabel ();
16751669 String dsName = ds .getName ();
16761670 logParam .put ("NAME" , dsName );
@@ -1681,9 +1675,16 @@ protected String datasetInsert(IDataSet ds, IDataSetDAO dsDao, Locale locale, Us
16811675 IDataSet existingByName = dsDao .loadDataSetByName (ds .getName ());
16821676 IDataSet existingByLabel = dsDao .loadDataSetByLabel (ds .getLabel ());
16831677
1684- if (id != null && !id .equals ( "" ) && !id .equals ("0" )) {
1678+ if (id != null && !id .isEmpty ( ) && !id .equals ("0" )) {
16851679 validateLabelAndName (id , dsName , dsLabel , existingByName , existingByLabel );
1686- ds .setId (Integer .valueOf (id ));
1680+ ds .setId (Integer .parseInt (id ));
1681+
1682+ List <String > persistenceTableNames = dsDao .loadPersistenceTableNames (ds .getId ());
1683+
1684+ if (persistenceTableNames .stream ().anyMatch (tableName -> tableName != null && !tableName .isBlank () && tableName .equalsIgnoreCase (ds .getPersistTableName ()))) {
1685+ throw new SpagoBIRuntimeException ("The persistence table with name <" + ds .getPersistTableName ().toUpperCase (Locale .ROOT ) + "> already exists" );
1686+ }
1687+
16871688 IDataSet existingDataset = dsDao .loadDataSetById (Integer .valueOf (id ));
16881689 clearCacheForDataset (existingDataset );
16891690
0 commit comments