This is an automated email from the ASF dual-hosted git repository.
doebele pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/empire-db.git
The following commit(s) were added to refs/heads/master by this push:
new 9dca19cc EMPIREDB-455 TextInputControl small fix.
9dca19cc is described below
commit 9dca19cc35670dbce57a50349f830d9c529e890e
Author: Rainer Döbele <[email protected]>
AuthorDate: Wed Mar 5 19:23:33 2025 +0100
EMPIREDB-455
TextInputControl small fix.
---
CHANGELOG.txt | 1 +
.../org/apache/empire/jakarta/controls/TextInputControl.java | 10 +++++++++-
.../java/org/apache/empire/jsf2/controls/TextInputControl.java | 10 +++++++++-
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index dc058f77..cdd3b687 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -11,6 +11,7 @@ Release 3.3.0:
Summary: Release 3.3 has new features and improvements as well as several
bugfixes
** Improvements / Features
+ EMPIREDB-455 JSF: TextInputControl: Add converter for numeric
ValueExpressions
EMPIREDB-454 Core: DBCommand generate Select without OrderBy
EMPIREDB-451 JSF: Improve FacesUtils and FacesMessage handling
EMPIREDB-450 JSF: TabPageTag: allow label facet and label style
class
diff --git
a/empire-db-jakarta-faces/src/main/java/org/apache/empire/jakarta/controls/TextInputControl.java
b/empire-db-jakarta-faces/src/main/java/org/apache/empire/jakarta/controls/TextInputControl.java
index dd1e40bc..92794646 100644
---
a/empire-db-jakarta-faces/src/main/java/org/apache/empire/jakarta/controls/TextInputControl.java
+++
b/empire-db-jakarta-faces/src/main/java/org/apache/empire/jakarta/controls/TextInputControl.java
@@ -122,7 +122,15 @@ public class TextInputControl extends InputControl
@Override
public String getAsString(FacesContext context, UIComponent component,
Object value)
{
- return (nf!=null ? nf.format(value) : StringUtils.valueOf(value));
+ if (ObjectUtils.isEmpty(value))
+ return StringUtils.EMPTY;
+ // Check number
+ if (!(value instanceof Number)) {
+ log.error("getAsString: \"{}\" is not a number!",
value.getClass().getName());
+ return value.toString();
+ }
+ // format
+ return (nf!=null ? nf.format(value) : value.toString());
}
@Override
diff --git
a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java
b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java
index 066f9020..169321fd 100644
---
a/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java
+++
b/empire-db-jsf2/src/main/java/org/apache/empire/jsf2/controls/TextInputControl.java
@@ -122,7 +122,15 @@ public class TextInputControl extends InputControl
@Override
public String getAsString(FacesContext context, UIComponent component,
Object value)
{
- return (nf!=null ? nf.format(value) : StringUtils.valueOf(value));
+ if (ObjectUtils.isEmpty(value))
+ return StringUtils.EMPTY;
+ // Check number
+ if (!(value instanceof Number)) {
+ log.error("getAsString: \"{}\" is not a number!",
value.getClass().getName());
+ return value.toString();
+ }
+ // format
+ return (nf!=null ? nf.format(value) : value.toString());
}
@Override