diff --git a/ext/jni/GNUmakefile b/ext/jni/GNUmakefile index 424709d413..e8cc11eeec 100644 --- a/ext/jni/GNUmakefile +++ b/ext/jni/GNUmakefile @@ -39,7 +39,29 @@ SQLite3Jni.class := $(subst .java,.class,$(SQLite3Jni.java)) # $(bin.javac) -h $(dir $@) $< #all: $(sqlite3-jni.h) -JAVA_FILES := $(wildcard $(dir.src.jni)/*.java) + +# Be explicit about which Java files to compile so that we can work on +# in-progress files without requiring them to be in a compilable statae. +JAVA_FILES := $(patsubst %,$(dir.src.jni)/%,\ + BusyHandler.java \ + Collation.java \ + CollationNeeded.java \ + CommitHook.java \ + NativePointerHolder.java \ + OutputPointer.java \ + ProgressHandler.java \ + RollbackHook.java \ + SQLFunction.java \ + sqlite3_context.java \ + sqlite3.java \ + SQLite3Jni.java \ + sqlite3_stmt.java \ + sqlite3_value.java \ + Tester1.java \ + Tracer.java \ + UpdateHook.java \ + ValueHolder.java \ +) CLASS_FILES := define DOTCLASS_DEPS $(1).class: $(1).java diff --git a/ext/jni/src/c/sqlite3-jni.c b/ext/jni/src/c/sqlite3-jni.c index 786521ead8..95f53c16ff 100644 --- a/ext/jni/src/c/sqlite3-jni.c +++ b/ext/jni/src/c/sqlite3-jni.c @@ -1797,14 +1797,12 @@ static jint create_function(JNIEnv * env, jobject jDb, jstring jFuncName, s = UDFState_alloc(env, jFunctor); if( !s ) return SQLITE_NOMEM; else if( UDF_UNKNOWN_TYPE==s->type ){ - UDFState_free(s); rc = s3jni_db_error(pDb, SQLITE_MISUSE, - "Cannot unambiguously determine function type."); + "Cannot unambiguously determine function type."); goto error_cleanup; } zFuncName = JSTR_TOC(jFuncName); if(!zFuncName){ - UDFState_free(s); rc = SQLITE_NOMEM; goto error_cleanup; } @@ -1824,12 +1822,15 @@ static jint create_function(JNIEnv * env, jobject jDb, jstring jFuncName, xFinal = udf_xFinal; } rc = sqlite3_create_function_v2(pDb, zFuncName, nArg, eTextRep, s, - xFunc, xStep, xFinal, - UDFState_finalizer); + xFunc, xStep, xFinal, UDFState_finalizer); } - s->zFuncName = sqlite3_mprintf("%s", zFuncName); - if(!s->zFuncName){ - rc = SQLITE_NOMEM; + if( 0==rc ){ + s->zFuncName = sqlite3_mprintf("%s", zFuncName); + if( !s->zFuncName ){ + rc = SQLITE_NOMEM; + } + } + if( 0!=rc ){ UDFState_free(s); } error_cleanup: diff --git a/ext/jni/src/org/sqlite/jni/SQLite3Jni.java b/ext/jni/src/org/sqlite/jni/SQLite3Jni.java index 07ab83e647..de95deb588 100644 --- a/ext/jni/src/org/sqlite/jni/SQLite3Jni.java +++ b/ext/jni/src/org/sqlite/jni/SQLite3Jni.java @@ -288,6 +288,11 @@ public final class SQLite3Jni { int eTextRep, @NotNull Collation col); + //Potential TODO, if we can sensibly map the lower-level bits to Java: + //public static native int sqlite3_create_fts5_function(@NotNull sqlite3 db, + // @NotNull String functionName, + // @NotNull Fts5Function func); + /** The Java counterpart to the C-native sqlite3_create_function(), sqlite3_create_function_v2(), and diff --git a/manifest b/manifest index 1f5c4a0567..cda4ee7596 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C More\sJNI-internal\sdocs.\sCorrect\shandling\sof\sa\sJava\sexception\sif\sa\strace\scallback\sthrows. -D 2023-08-02T17:29:18.781 +C Improve\sinternal\serror\shandling\sin\sthe\sJNI\screate_function()\simpl. +D 2023-08-04T09:53:13.893 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -230,9 +230,9 @@ F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c F ext/icu/README.txt 7ab7ced8ae78e3a645b57e78570ff589d4c672b71370f5aa9e1cd7024f400fc9 F ext/icu/icu.c c074519b46baa484bb5396c7e01e051034da8884bad1a1cb7f09bbe6be3f0282 F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8 -F ext/jni/GNUmakefile 3d1f106e7a08bb54279c12979b31492b3dea702a732eab445dbc765120995182 +F ext/jni/GNUmakefile 7b7bcd691abe0567e914b1964804efe3ebbecdd86a05c324365ed00ce632be8f F ext/jni/README.md 6ff7e1f4100dee980434a6ee37a199b653bceec62e233a6e2ccde6e7ae0c58bf -F ext/jni/src/c/sqlite3-jni.c e4ff3c044e72f6fcaee02e44603da28739c0ebdd3d88b9f23ca0642182760e82 +F ext/jni/src/c/sqlite3-jni.c d74352df0bad94caa6a239f5730d7f5c7669aa178c37ab536006d3254c2f9c85 F ext/jni/src/c/sqlite3-jni.h 74aaf87e77f99857aa3afc013517c934cbc2c16618c83d8f5d6294351bc8e7b1 F ext/jni/src/org/sqlite/jni/BusyHandler.java 1b1d3e5c86cd796a0580c81b6af6550ad943baa25e47ada0dcca3aff3ebe978c F ext/jni/src/org/sqlite/jni/Collation.java 8dffbb00938007ad0967b2ab424d3c908413af1bbd3d212b9c9899910f1218d1 @@ -243,7 +243,7 @@ F ext/jni/src/org/sqlite/jni/OutputPointer.java c7868f1f4ad63435ee44d409377df7dd F ext/jni/src/org/sqlite/jni/ProgressHandler.java 5979450e996416d28543f1d42634d308439565a99332a8bd84e424af667116cc F ext/jni/src/org/sqlite/jni/RollbackHook.java b04c8abcc6ade44a8a57129e33765793f69df0ba909e49ba18d73f4268d92564 F ext/jni/src/org/sqlite/jni/SQLFunction.java 09ce81c1c637e31c3a830d4c859cce95d65f5e02ff45f8bd1985b3479381bc46 -F ext/jni/src/org/sqlite/jni/SQLite3Jni.java d654fb8a43504b91059739eb0d435127423a195bd8f321b6c7aeedd394ed5887 +F ext/jni/src/org/sqlite/jni/SQLite3Jni.java 0139a6174d26b7703fcfa10945fdab55f28f424e212b08964038e0bd83744e0f F ext/jni/src/org/sqlite/jni/Tester1.java 9443cdbd2b10f6a8e1f3abd1694983a16b17960f8ed2f7e06bcc7e535fb5abcf F ext/jni/src/org/sqlite/jni/Tracer.java a5cece9f947b0af27669b8baec300b6dd7ff859c3e6a6e4a1bd8b50f9714775d F ext/jni/src/org/sqlite/jni/UpdateHook.java e58645a1727f8a9bbe72dc072ec5b40d9f9362cb0aa24acfe93f49ff56a9016d @@ -2071,8 +2071,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b56643644e065b03fe2c3545e02ed3b2f6fd9f77c39aa84a02a00d695e9a12dc -R e3632815d093bec50f51fd9fc57e4268 +P 306b269a01037bc5c98276276fdb17b37027d1ee0d603183f42a65966245bdff +R 6be22ebb8adf8ecf4f94561b29aff52e U stephan -Z 9bbd1b4ecbe75e7fd46dfd09cd4f460b +Z ade457d4f3c6fece0dffd75e56e9b6b4 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 7ed4f6638a..2654675090 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -306b269a01037bc5c98276276fdb17b37027d1ee0d603183f42a65966245bdff \ No newline at end of file +2c88390faa108a60c8fb1eb7aad05d90f3daf4cfef14ca73987597aaf7be83c9 \ No newline at end of file