Skip to content

Refactor editor attribute sorting logic#453

Open
stijnpotters1 wants to merge 4 commits intomasterfrom
fix/editor-attriburte-order
Open

Refactor editor attribute sorting logic#453
stijnpotters1 wants to merge 4 commits intomasterfrom
fix/editor-attriburte-order

Conversation

@stijnpotters1
Copy link
Copy Markdown
Contributor

image

@stijnpotters1 stijnpotters1 requested a review from Matthbo April 23, 2026 08:53
@stijnpotters1 stijnpotters1 self-assigned this Apr 23, 2026
@stijnpotters1 stijnpotters1 linked an issue Apr 23, 2026 that may be closed by this pull request
Comment thread src/main/java/org/frankframework/flow/utility/XmlFormatter.java Fixed
@sonarqubecloud
Copy link
Copy Markdown

Comment on lines +111 to +116
const starts = [...configXml.matchAll(/<[Aa]dapter\b/g)].map((m) => m.index)

if (adapterIndex >= starts.length) return configXml

const start = starts[adapterIndex]
const closeRegex = /<\/[Aa]dapter>/g
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of doing 2 regex executions for the same thing, is it possible to save the tag name with correct capitalisation so the closing tag can be be something like </${closingTagName}>?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason is that using regex is discouraged since the javascript regex engine needs to be called in separate instances through the browser's execution of the code. This is understood to be slower than plain string search or replacement and in our case would mean getting the correct name from the first regex (as a capture group result?) and using that for the closing tag

'flow:x': String(roundedX),
'flow:y': String(roundedY),
'flow:width': String(width),
...(height === undefined ? {} : { 'flow:height': String(height) }),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

height should be null if not found in node instead of undefined

Comment on lines +92 to +97
@Override public void startDTD(String name, String publicId, String systemId) {}
@Override public void endDTD() {}
@Override public void startEntity(String name) {}
@Override public void endEntity(String name) {}
@Override public void startCDATA() {}
@Override public void endCDATA() {}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So many empty overriden methods, are you sure this is the way to go?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Backend automatically alphabetises attributes

3 participants