Coder Social home page Coder Social logo

Comments (3)

pharsfalvi avatar pharsfalvi commented on July 23, 2024

Here is the patch which made it work for me

From 81c3ea3a561b980670886087da8041825b7f44cb Mon Sep 17 00:00:00 2001
From: pharsfalvi <[email protected]>
Date: Sat, 25 Oct 2014 18:23:54 +0200
Subject: [PATCH] String handling errors while generating pojos

---
 .../src/main/java/com/felees/hbnpojogen/SyncUtils.java      | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/hbnpojogen-core/src/main/java/com/felees/hbnpojogen/SyncUtils.java b/hbnpojogen-core/src/main/java/com/felees/hbnpojogen/SyncUtils.java
index dfe7df2..34fb1e5 100755
--- a/hbnpojogen-core/src/main/java/com/felees/hbnpojogen/SyncUtils.java
+++ b/hbnpojogen-core/src/main/java/com/felees/hbnpojogen/SyncUtils.java
@@ -811,6 +811,9 @@ implements Serializable {
     * @return the same string with the first character set to uppercase
     */
    public static String upfirstChar(String s) {
+        if (s == null || s.length() == 0){
+            return "";
+        }
        return s.substring(0, 1).toUpperCase() + s.substring(1, s.length());
    }

@@ -982,8 +985,9 @@ implements Serializable {
     */
    public static String removeUnderscores(String input) {
        StringBuffer result = new StringBuffer();
-
-       if (State.getInstance().disableUnderscoreConversion) {
+        if (input == null){
+            return "";
+        } else if (State.getInstance().disableUnderscoreConversion) {
            result.append(input);
        }
        else {
@@ -1292,7 +1296,10 @@ implements Serializable {
     * @return The table catalog
     */
    public static String getTableCatalog(String dottedInput) {
-       return dottedInput.substring(0, dottedInput.indexOf("."));
+        if (dottedInput.indexOf(".") >= 0){
+            return dottedInput.substring(0, dottedInput.indexOf("."));
+        }
+        return dottedInput;
    }


-- 
2.0.1

from hbnpojogen.

wwadge avatar wwadge commented on July 23, 2024

Hi, thanks for the patch -- if possible can you raise a pull request? It just makes it easier to manage and track.

from hbnpojogen.

pharsfalvi avatar pharsfalvi commented on July 23, 2024

Yup, it's done. Cheers
Peter

from hbnpojogen.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.