-
Notifications
You must be signed in to change notification settings - Fork 42
feat:Limit SQL length to avoid Stack Overflow #223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
2adade2
Merge pull request #1 from yanni97/feat/sqlParser
yanni97 0581f9a
Merge pull request #2 from yanni97/feat/release
yanni97 90a946b
Merge branch 'arextest:main' into main
yanni97 954a26e
Merge branch 'arextest:main' into main
yanni97 435ea13
Merge branch 'arextest:main' into main
yanni97 21bf08f
feat: limit sqlParse length
yanni97 42a7f3d
feat: modify version
yanni97 85b0e36
Merge branch 'main' into feat/catchType
yanni97 9237082
feat: modify config
yanni97 7405f9e
feat: solve comment
yanni97 b296746
Merge branch 'main' into feat/catchType
yanni97 19186ae
feat: solve comment v2
yanni97 f3c7a80
feat: solve sonar
yanni97 addcf0b
feat: modify AbstractConfig
yanni97 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
...e-web-api/src/main/java/com/arextest/storage/service/config/ApplicationDefaultConfig.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package com.arextest.storage.service.config; | ||
|
||
import com.arextest.storage.service.config.provider.ConfigProvider; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Component; | ||
|
||
import javax.annotation.Resource; | ||
|
||
/** | ||
* | ||
* @author niyan | ||
* @date 2024/6/6 | ||
* @since 1.0.0 | ||
*/ | ||
@Component | ||
@Slf4j | ||
public class ApplicationDefaultConfig { | ||
|
||
@Resource(name = "applicationPropertiesConfigProvider") | ||
yanni97 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
private ConfigProvider configProvider; | ||
|
||
|
||
public String getConfigAsString(String key) { | ||
return configProvider.getConfigAsString(key); | ||
} | ||
|
||
|
||
public int getConfigAsInt(String key, int defaultValue) { | ||
return configProvider.getConfigAsInt(key, defaultValue); | ||
} | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
...in/java/com/arextest/storage/service/config/impl/ApplicationPropertiesConfigProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.arextest.storage.service.config.impl; | ||
|
||
import com.arextest.storage.service.config.provider.ConfigProvider; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.apache.commons.lang3.StringUtils; | ||
import org.springframework.core.env.Environment; | ||
|
||
import javax.annotation.Resource; | ||
import java.util.Map; | ||
|
||
/** | ||
* @author niyan | ||
* @date 2024/6/6 | ||
* @since 1.0.0 | ||
*/ | ||
@Slf4j | ||
public class ApplicationPropertiesConfigProvider implements ConfigProvider { | ||
|
||
@Resource | ||
private Environment environment; | ||
|
||
@Override | ||
public void loadConfigs(String configName) { | ||
// nothing to do | ||
} | ||
|
||
@Override | ||
public void onChange(Map<String, String> configs) { | ||
// nothing to do | ||
} | ||
|
||
|
||
@Override | ||
public String getConfigAsString(String key) { | ||
return environment.getProperty(key, String.class, StringUtils.EMPTY); | ||
} | ||
|
||
@Override | ||
public int getConfigAsInt(String key, int defaultValue) { | ||
try { | ||
return environment.getProperty(key, Integer.class, defaultValue); | ||
} catch (Exception e) { | ||
return defaultValue; | ||
} | ||
yanni97 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
...ge-web-api/src/main/java/com/arextest/storage/service/config/provider/ConfigProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.arextest.storage.service.config.provider; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* @author niyan | ||
* @date 2024/6/6 | ||
* @since 1.0.0 | ||
*/ | ||
public interface ConfigProvider { | ||
/** | ||
* load all configs | ||
*/ | ||
void loadConfigs(String configName); | ||
|
||
/** | ||
* replace all configs | ||
*/ | ||
void onChange(Map<String, String> configs); | ||
|
||
/** | ||
* get config as string | ||
*/ | ||
String getConfigAsString(String key); | ||
|
||
/** | ||
* get config as int | ||
*/ | ||
int getConfigAsInt(String key, int defaultValue); | ||
yanni97 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,3 +47,4 @@ arex: | |
metric: false | ||
pom: | ||
version: ${project.version} | ||
maxSqlLength: 50000 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.