"Empty" exception

Repro:

import testbox.system.BaseSpec

component extends=BaseSpec {

    function run() {
        describe("Repro cases for exception-oriented bugs", () => {
            it("returns useful in the exception message (fails)", () => {
                var myDate = createObject("java", "java.sql.Date").valueOf("2011-03-24")

                try {
                    isNumeric(myDate)
                } catch (any e) {
                    expect(e.message).notToBeNull()
                }
            })
            it("returns useful in the exception detail (fails)", () => {
                var myDate = createObject("java", "java.sql.Date").valueOf("2011-03-24")

                try {
                    isNumeric(myDate)
                } catch (any e) {
                    expect(e.detail).notToBeNull()
                    expect(e.detail).notToBeEmpty()
                }
            })

            it("is a control with a CFML exception (passes)", () => {
                try {
                    throw(message="not empty", detail="not empty either")
                } catch (any e) {
                    expect(e.message).notToBeNull()
                    expect(e.detail).notToBeNull()
                    expect(e.detail).notToBeEmpty()
                }
            })

        })
    }
}

I’ve indicated passing / failing. The failing ones fail on the last expectation.

This surfaced when I was trying to use a java.sql.Date value that came back from a DB query in a TestBox expection, and it went splat. With no useful information as to why.

I plunked this test into our Java test suite to repro the error message



	@DisplayName( "It tests a date" )
	@Test
	public void testADate() {
		instance.executeSource(
		    """
		    	myDate = createObject("java", "java.sql.Date").valueOf("2011-03-24")
		    	result = isNumeric(myDate)
		    """,
		    context );
		assertFalse( variables.getAsBoolean( Key.of( "result" ) ) );
	}

but it would seem that whatever the error is, is no longer happening. I just get back false from the BIF. If you can find another way to repro the “empty” error, then let me know.

I assume were were directly throwing a Java error, and the JDK is terrible about having vague messages sometimes.