Anonymous | Login
Project:
RSS
  
News | My View | View Issues | Roadmap | Summary

View Issue DetailsJump to Notes ] Issue History ] Print ]
ID
0040264
TypeCategorySeverityReproducibilityDate SubmittedLast Update
defect[Openbravo ERP] Y. DBSourceManagerminorhave not tried2019-02-25 10:352019-05-30 04:01
ReporterAugustoMauchView Statuspublic 
Assigned ToAugustoMauch 
PrioritynormalResolutionfixedFixed in Version3.0PR19Q3
StatusclosedFix in branchFixed in SCM revision30d087840b55
ProjectionnoneETAnoneTarget Version3.0PR19Q3
OSAnyDatabaseAnyJava version
OS VersionDatabase versionAnt version
Product VersionSCM revision 
Review Assigned Tocaristu
Web browser
ModulesCore
Regression level
Regression date
Regression introduced in release
Regression introduced by commit
Triggers an Emergency PackNo
Summary

0040264: update.database task fails with no proper error message when a wrong function is defined in db but not excluded

DescriptionThere are some functions that are not defined as part of Openbravo model and that they must be excluded from being loaded by adding them to the exclude filter.

Whe one of those functions is not added to the exclude filter, the update.database function will fail, and the error message will not be clear enough:

 [java] 67129 INFO - Updating database model...
     [java] 67335 ERROR -
     [java] java.lang.NullPointerException
     [java] at org.apache.ddlutils.model.Parameter.getName(Parameter.java:53)
     [java] at org.apache.ddlutils.platform.postgresql.PostgreSqlBuilder.writeParameter(PostgreSqlBuilder.java:529)
     [java] at org.apache.ddlutils.platform.postgresql.PostgreSqlBuilder.writeDropFunctionStmt(PostgreSqlBuilder.java:346)
     [java] at org.apache.ddlutils.platform.SqlBuilder.dropFunction(SqlBuilder.java:4276)
     [java] at org.apache.ddlutils.platform.postgresql.PostgreSqlBuilder.dropFunction(PostgreSqlBuilder.java:519)
     [java] at org.apache.ddlutils.platform.SqlBuilder.processChange(SqlBuilder.java:1543)
     [java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     [java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
     [java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
     [java] at java.lang.reflect.Method.invoke(Method.java:498)
     [java] at org.apache.ddlutils.util.CallbackClosure.execute(CallbackClosure.java:151)
     [java] at org.apache.ddlutils.platform.SqlBuilder$1.evaluate(SqlBuilder.java:1024)
     [java] at org.apache.commons.collections.CollectionUtils.filter(CollectionUtils.java:406)
     [java] at org.apache.ddlutils.platform.SqlBuilder.applyForSelectedChanges(SqlBuilder.java:1021)

Even if the dbsourcemanager log is set to debug, it still does not what was the function that caused the error while being loaded from the database. The cause of the error is that Openbravo does not support to load functions with unnamed parameters.
Steps To ReproduceCreate this function directly in the database:

CREATE FUNCTION bad_function(integer, integer) RETURNS integer
    AS 'select $1 + $2;'
    LANGUAGE SQL
    IMMUTABLE
    RETURNS NULL ON NULL INPUT;

Run ant update.database -Dforce=yes

The process will fail and it will throw the error mentioned in the description
Proposed SolutionIt would be better to:
- Fail like now, but mentioning in the error message the function that was being loaded and telling that update.database will not work until that function is added to exclude filter / removed from database
- When a function with unnamed parameters is loaded, just ignore and show a warning message.
TagsNo tags attached.
Attached Files

- Relationships Relation Graph ] Dependency Graph ]

-  Notes
(0112198)
hgbot (developer)
2019-05-28 11:12

Repository: erp/devel/dbsm-main
Changeset: fd7db9cfa66d4320300b4bcade0bb2a7d5bd4963
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue May 28 11:05:45 2019 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/fd7db9cfa66d4320300b4bcade0bb2a7d5bd4963 [^]

Fixes issue 40264: Ignore some invalid functions when loading the database model

Openbravo does not support the definition of functions with anonymous parameters. Before this
changeset, loading from the model one of those functions resulted in a NullPointerException.

Now these functions will be ignored when loading the model from the database. This means that
export.database will not export them, and update.database will not overwrite them.

To be able to ignore a row within RowConstructor.getRow a new exception called SkipRowException has
been defined.

---
M src-test/src/org/openbravo/dbsm/test/model/Functions.java
M src/org/apache/ddlutils/platform/ModelLoaderBase.java
M src/org/apache/ddlutils/platform/RowConstructor.java
M src/org/apache/ddlutils/platform/postgresql/PostgreSqlModelLoader.java
---
(0112199)
hgbot (developer)
2019-05-28 11:14

Repository: erp/devel/pi
Changeset: 30d087840b5502ada2a775de7f2c6bf68673883c
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue May 28 11:13:47 2019 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/30d087840b5502ada2a775de7f2c6bf68673883c [^]

Fixes issue 40264: Ignore some invalid functions when loading the database model

Openbravo does not support the definition of functions with anonymous parameters. Before this
changeset, loading from the model one of those functions resulted in a NullPointerException.

Now these functions will be ignored when loading the model from the database. This means that
export.database will not export them, and update.database will not overwrite them.

To be able to ignore a row within RowConstructor.getRow a new exception called SkipRowException has
been defined.

---
M src-db/database/lib/dbsourcemanager.jar
---
(0112200)
AugustoMauch (developer)
2019-05-28 11:15

There is no need to make changes in OracleModelLoader, because Oracle does not support functions with anonymous parameters.

That's also why the new test added to Functions.java is only executed when using postgres.
(0112215)
hudsonbot (developer)
2019-05-28 20:14

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/d51097bed845 [^]
Maturity status: Test
(0112224)
caristu (developer)
2019-05-29 13:29

SkipRowException class is missing
(0112226)
hgbot (developer)
2019-05-29 13:56

Repository: erp/devel/dbsm-main
Changeset: f766e3ee8a15c2f7339c4002af68cf6cbc0a0fdb
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed May 29 13:55:51 2019 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/f766e3ee8a15c2f7339c4002af68cf6cbc0a0fdb [^]

Related with issue 40264: Adds missing class, renames it to InvalidRowException

---
M src/org/apache/ddlutils/platform/ModelLoaderBase.java
M src/org/apache/ddlutils/platform/RowConstructor.java
M src/org/apache/ddlutils/platform/postgresql/PostgreSqlModelLoader.java
A src/org/apache/ddlutils/platform/InvalidRowException.java
---
(0112229)
hgbot (developer)
2019-05-29 16:12

Repository: erp/devel/pi
Changeset: 1d550d6c5cc6672fb804a5127ba5d34acc4dcca4
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed May 29 16:11:55 2019 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/1d550d6c5cc6672fb804a5127ba5d34acc4dcca4 [^]

Related with issue 40264: Adds missing class, renames it to InvalidRowException

---
M src-db/database/lib/dbsourcemanager.jar
---
(0112230)
hgbot (developer)
2019-05-29 16:24

Repository: erp/devel/dbsm-main
Changeset: 0ef16af7a112232e452a585ae5a7dc3a76598f76
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Wed May 29 16:23:52 2019 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/0ef16af7a112232e452a585ae5a7dc3a76598f76 [^]

related to issue 40264: fix javadoc

---
M src-test/src/org/openbravo/dbsm/test/model/Functions.java
---
(0112232)
hgbot (developer)
2019-05-29 16:28

Repository: erp/devel/dbsm-main
Changeset: ff253fd0e2debe8c92ef780dcc6cd690b48e8d58
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed May 29 16:28:38 2019 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/ff253fd0e2debe8c92ef780dcc6cd690b48e8d58 [^]

Related with issue 40264: Include function name in warning message

---
M src-test/src/org/openbravo/dbsm/test/model/Functions.java
M src/org/apache/ddlutils/platform/postgresql/PostgreSqlModelLoader.java
---
(0112233)
hgbot (developer)
2019-05-29 16:30

Repository: erp/devel/pi
Changeset: 1924cce570cd55319491551e737c2cae4dab4f0a
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Wed May 29 16:29:58 2019 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/1924cce570cd55319491551e737c2cae4dab4f0a [^]

Related with issue 40264: Include function name in warning message

---
M src-db/database/lib/dbsourcemanager.jar
---
(0112234)
hgbot (developer)
2019-05-29 17:01

Repository: erp/devel/dbsm-main
Changeset: b5d75690ddba3ebf58121e80550737300c3696b3
Author: Carlos Aristu <carlos.aristu <at> openbravo.com>
Date: Wed May 29 16:59:29 2019 +0200
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/b5d75690ddba3ebf58121e80550737300c3696b3 [^]

related to issue 40264: update copyright year

---
M src-test/src/org/openbravo/dbsm/test/model/Functions.java
M src/org/apache/ddlutils/platform/RowConstructor.java
---
(0112235)
caristu (developer)
2019-05-29 17:02

Reviewed + tested OK.
(0112245)
hudsonbot (developer)
2019-05-29 20:49

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/0705db562021 [^]
Maturity status: Test
(0112248)
hudsonbot (developer)
2019-05-30 04:01

A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/2785551137d4 [^]
Maturity status: Test

- Issue History
Date Modified Username Field Change
2019-02-25 10:35 AugustoMauch New Issue
2019-02-25 10:35 AugustoMauch Assigned To => platform
2019-02-25 10:35 AugustoMauch Modules => Core
2019-02-25 10:35 AugustoMauch Triggers an Emergency Pack => No
2019-05-09 07:35 alostale Target Version => 3.0PR19Q3
2019-05-13 10:55 AugustoMauch Assigned To platform => AugustoMauch
2019-05-28 11:11 AugustoMauch Review Assigned To => caristu
2019-05-28 11:12 hgbot Checkin
2019-05-28 11:12 hgbot Note Added: 0112198
2019-05-28 11:12 hgbot Status new => resolved
2019-05-28 11:12 hgbot Resolution open => fixed
2019-05-28 11:12 hgbot Fixed in SCM revision => http://code.openbravo.com/erp/devel/dbsm-main/rev/fd7db9cfa66d4320300b4bcade0bb2a7d5bd4963 [^]
2019-05-28 11:14 hgbot Checkin
2019-05-28 11:14 hgbot Note Added: 0112199
2019-05-28 11:14 hgbot Fixed in SCM revision http://code.openbravo.com/erp/devel/dbsm-main/rev/fd7db9cfa66d4320300b4bcade0bb2a7d5bd4963 [^] => http://code.openbravo.com/erp/devel/pi/rev/30d087840b5502ada2a775de7f2c6bf68673883c [^]
2019-05-28 11:15 AugustoMauch Note Added: 0112200
2019-05-28 20:14 hudsonbot Checkin
2019-05-28 20:14 hudsonbot Note Added: 0112215
2019-05-29 13:29 caristu Note Added: 0112224
2019-05-29 13:29 caristu Status resolved => new
2019-05-29 13:29 caristu Resolution fixed => open
2019-05-29 13:56 hgbot Checkin
2019-05-29 13:56 hgbot Note Added: 0112226
2019-05-29 16:12 hgbot Checkin
2019-05-29 16:12 hgbot Note Added: 0112229
2019-05-29 16:24 hgbot Checkin
2019-05-29 16:24 hgbot Note Added: 0112230
2019-05-29 16:28 hgbot Checkin
2019-05-29 16:28 hgbot Note Added: 0112232
2019-05-29 16:30 hgbot Checkin
2019-05-29 16:30 hgbot Note Added: 0112233
2019-05-29 17:01 hgbot Checkin
2019-05-29 17:01 hgbot Note Added: 0112234
2019-05-29 17:02 caristu Status new => scheduled
2019-05-29 17:02 caristu Status scheduled => resolved
2019-05-29 17:02 caristu Resolution open => fixed
2019-05-29 17:02 caristu Note Added: 0112235
2019-05-29 17:02 caristu Status resolved => closed
2019-05-29 17:02 caristu Fixed in Version => 3.0PR19Q3
2019-05-29 20:49 hudsonbot Checkin
2019-05-29 20:49 hudsonbot Note Added: 0112245
2019-05-30 04:01 hudsonbot Checkin
2019-05-30 04:01 hudsonbot Note Added: 0112248


Copyright © 2000 - 2009 MantisBT Group
Powered by Mantis Bugtracker