Skip to content

Commit

Permalink
Merge branch '6.1.0' into 6.1
Browse files Browse the repository at this point in the history
# Conflicts:
#	loader/build.xml
#	loader/pom.xml
#	test/tickets/LDEV4895.cfc
  • Loading branch information
michaeloffner committed Jun 16, 2024
2 parents b4bbc44 + 4a77589 commit adab7b8
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 24 deletions.
10 changes: 5 additions & 5 deletions core/src/main/java/lucee/runtime/db/DataSourceSupport.java
Original file line number Diff line number Diff line change
Expand Up @@ -393,11 +393,11 @@ public int hashCode() {
@Override
public String id() {

return new StringBuilder(getConnectionStringTranslated()).append(':').append(getConnectionLimit()).append(':').append(getConnectionTimeout()).append(':')
.append(getLiveTimeout()).append(':').append(getMetaCacheTimeout()).append(':').append(getName().toLowerCase()).append(':').append(getUsername()).append(':')
.append(getPassword()).append(':').append(validate()).append(':').append(cd.toString()).append(':').append((getTimeZone() == null ? "null" : getTimeZone().getID()))
.append(':').append(isBlob()).append(':').append(isClob()).append(':').append(isReadOnly()).append(':').append(isStorage()).append(':').append(isRequestExclusive())
.append(':').append(isAlwaysResetConnections()).toString();
return new StringBuilder().append(getConnectionStringTranslated()).append(':').append(getConnectionLimit()).append(':').append(getConnectionTimeout()).append(':')
.append(getLiveTimeout()).append(':').append(getMetaCacheTimeout()).append(':').append((getName() + "").toLowerCase()).append(':').append(getUsername()).append(':')
.append(getPassword()).append(':').append(validate()).append(':').append(cd == null ? "null" : cd.toString()).append(':')
.append((getTimeZone() == null ? "null" : getTimeZone().getID())).append(':').append(isBlob()).append(':').append(isClob()).append(':').append(isReadOnly())
.append(':').append(isStorage()).append(':').append(isRequestExclusive()).append(':').append(isAlwaysResetConnections()).toString();
}

@Override
Expand Down
61 changes: 42 additions & 19 deletions test/tickets/LDEV4895.cfc
Original file line number Diff line number Diff line change
@@ -1,22 +1,45 @@
component extends="org.lucee.cfml.test.LuceeTestCase" labels="syntax" {

function run( testResults, testBox ) {
describe("Testcase for LDEV-4895 - invalid conditional operator", function() {
it( title="check syntax double ternary", body=function( currentSpec ) {
expect( function(){
internalRequest(
template="#createURI('LDEV4985')#/ldev4895.cfs"
).notToThrow();
});

// odd, same code in .cfs only crashes here
// var a = false ? true ? 1 : 2;
component extends="org.lucee.cfml.test.LuceeTestCase" labels="qoq" {


function run( testResults , testBox ) {

describe( title='LDEV-4895' , body=function(){

it( title='test single tenary' , body=function() {
var a = true ? 1 : 2;
expect( a ).toBe( 1 );
});

it( title='test double tenary, no bracket' , body=function() {
var a = true ? true ? 1 : 2 : 3;
expect( a ).toBe( 1 );
var a = true ? false ? 1 : 2 : 3;
expect( a ).toBe( 2 );
var a = false ? true ? 1 : 2 : 3;
expect( a ).toBe( 3 );
});

it( title='test double tenary with bracket' , body=function() {
var a = true ? (true ? 1 : 2) : 3;
expect( a ).toBe( 1 );
var a = true ? (false ? 1 : 2) : 3;
expect( a ).toBe( 2 );
var a = false ? (true ? 1 : 2) : 3;
expect( a ).toBe( 3 );
});

it( title='test double tenary with bracket and function calls' , body=function() {
var a = true ? true ? int(1) : 2 : 3;
expect( a ).toBe( 1 );
var a = true ? false ? 1 : int(2) : 3;
expect( a ).toBe( 2 );
var a = false ? true ? int(1) : int(2) : int(3);
expect( a ).toBe( 3 );
});
});
}

private string function createURI(string calledName){
var baseURI="/test/#listLast(getDirectoryFromPath(getCurrenttemplatepath()),"\/")#/";
return baseURI&""&calledName;

});

}
}

}

0 comments on commit adab7b8

Please sign in to comment.