Skip to content

Commit 3564d9f

Browse files
committed
BUG: User-defined plugins not registered when merging two analyzers (Issue #155) + cleaning + bump libs
1 parent b0fa943 commit 3564d9f

File tree

45 files changed

+191
-119
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+191
-119
lines changed

ChangeLog.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11

22
## Changes ##
33

4+
### 17.4.1
5+
- INT: Bump logback-classic to 1.5.27, google phonenumber to 9.0.23, gradle to 9.3.1
6+
- INT: Cleaning.
7+
- BUG: User-defined plugins not registered when merging two analyzers (Issue #155)
8+
49
### 17.4.0
510
- INT: Bump testng to 7.12.0, logback-classic to 1.5.26
611
- ENH: Improve ZIP detection if have data of the form 99999- (i.e. a trailing hyphen)
@@ -16,15 +21,15 @@
1621
- ENH: Change approach to registering plugins - no longer require dataStream name. Some methods added and some deprecated.
1722

1823
### 17.2.0
19-
- INT: Bump logback-classic to 1.5.24, gradle to 9.3.0, phonenumber to 9.0.21
24+
- INT: Bump logback-classic to 1.5.24, gradle to 9.3.0, google phonenumber to 9.0.22
2025
- CLI: Add --semanticTypesPre to control whether user-defined types (--semanticType) are registered before built-ins
2126
- BUG: findByName on TextAnalyzer was not returning user-defined types
2227
- BUG: Preserve precedence on plugins registered on TextAnalyzer template for RecordAnalyzer (Issue #152)
2328
- BUG: Check for better RegExpTypes even if we have already detected a Semantic Type (Issue #152)
2429
- INT: Remove remaining references to deprecated registerPluginList()
2530

2631
### 17.1.10
27-
- INT: Bump logback-classic to 1.5.23, SpotBugs to 6.4.8, commons-text:1.15.0, google phonenumber to 9.0.21,
32+
- INT: Bump logback-classic to 1.5.23, SpotBugs to 6.4.8, commons-text:1.15.0, google phonenumber to 9.0.21
2833
- ENH: Small improvement to Semantic Type NAME.FIRST_LAST to reject more company names (Issue #151)
2934

3035
### 17.1.9

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import com.github.spotbugs.snom.Confidence
77
import com.github.spotbugs.snom.Effort
88

99
wrapper {
10-
gradleVersion = '9.3.0'
10+
gradleVersion = '9.3.1'
1111
}
1212

1313
tasks.register('examples.clean') {

cli/src/main/java/com/cobber/fta/driver/FileProcessor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,11 +458,11 @@ else if (result.getCardinality() > 20) {
458458
else {
459459
final ArrayNode enumArray = mapper.createArrayNode();
460460

461-
for (String key : result.getCardinalityDetails().keySet())
461+
for (final String key : result.getCardinalityDetails().keySet())
462462
enumArray.add(key);
463463
fieldNode.set("values", enumArray);
464464

465-
Map<String, Long> map = result.getCardinalityDetails();
465+
final Map<String, Long> map = result.getCardinalityDetails();
466466
map.keySet().stream().sorted().collect(Collectors.joining(","));
467467
}
468468
break;
@@ -513,7 +513,7 @@ else if (result.getCardinality() > 20) {
513513
}
514514

515515
if (options.validate == 2 && matched[i] != result.getMatchCount()) {
516-
String logicalType = result.isSemanticType() ? "Logical Type " : "";
516+
final String logicalType = result.isSemanticType() ? "Logical Type " : "";
517517

518518
if (matched[i] > result.getMatchCount())
519519
error.printf("\t*** NOTE: Composite: %s, field: %s (%d), match Count via RegExp (%d) > %smatch analysis (%d) ***%n",

cli/src/main/java/com/cobber/fta/driver/faker/Faker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public boolean fake() {
6363
}
6464
final FakerParameters[] parameters = new FakerParameters[params.size()];
6565
final LogicalType[] logicals = new LogicalType[params.size()];
66-
for (FakerParameters param : params) {
66+
for (final FakerParameters param : params) {
6767
parameters[param.index] = param;
6868
parameters[param.index].bind();
6969
}

cli/src/main/java/com/cobber/fta/driver/faker/FakerParameters.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ public class FakerParameters {
3131
public String distribution;
3232
public String[] values;
3333

34-
public FakerParameters() {
35-
}
36-
3734
public void bind() {
3835
if ("LOCALDATE".equals(type))
3936
clazz = "com.cobber.fta.driver.faker.FakerLocalDateLT";

cli/src/main/java/com/cobber/fta/driver/faker/FakerStringLT.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public String nextRandom() {
6767
return values[random.nextInt(values.length)];
6868

6969
if (format.startsWith(".{")) {
70-
StringBuffer buf = new StringBuffer(freeText.nextRandom());
70+
final StringBuffer buf = new StringBuffer(freeText.nextRandom());
7171
while (buf.length() < minLength)
7272
buf.append(" ").append(freeText.nextRandom());
7373

core/src/main/java/com/cobber/fta/TypeInfo.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,18 @@ int getFlag() {
5050
}
5151
}
5252

53-
public final static int SIGNED_FLAG = TypeModifier.SIGNED.getFlag();
54-
public final static int GROUPING_FLAG = TypeModifier.GROUPING.getFlag();
55-
public final static int EXPONENT_FLAG = TypeModifier.EXPONENT.getFlag();
56-
public final static int NON_LOCALIZED_FLAG = TypeModifier.NON_LOCALIZED.getFlag();
57-
public final static int SIGNED_TRAILING_FLAG = TypeModifier.SIGNED_TRAILING.getFlag();
58-
public final static int NULL_FLAG = TypeModifier.NULL.getFlag();
59-
public final static int BLANK_FLAG = TypeModifier.BLANK.getFlag();
60-
public final static int BLANKORNULL_FLAG = TypeModifier.BLANKORNULL.getFlag();
61-
public final static int TRUE_FALSE_FLAG = TypeModifier.TRUE_FALSE.getFlag();
62-
public final static int YES_NO_FLAG = TypeModifier.YES_NO.getFlag();
63-
public final static int Y_N_FLAG = TypeModifier.Y_N.getFlag();
64-
public final static int ONE_ZERO_FLAG = TypeModifier.ONE_ZERO.getFlag();
53+
public static final int SIGNED_FLAG = TypeModifier.SIGNED.getFlag();
54+
public static final int GROUPING_FLAG = TypeModifier.GROUPING.getFlag();
55+
public static final int EXPONENT_FLAG = TypeModifier.EXPONENT.getFlag();
56+
public static final int NON_LOCALIZED_FLAG = TypeModifier.NON_LOCALIZED.getFlag();
57+
public static final int SIGNED_TRAILING_FLAG = TypeModifier.SIGNED_TRAILING.getFlag();
58+
public static final int NULL_FLAG = TypeModifier.NULL.getFlag();
59+
public static final int BLANK_FLAG = TypeModifier.BLANK.getFlag();
60+
public static final int BLANKORNULL_FLAG = TypeModifier.BLANKORNULL.getFlag();
61+
public static final int TRUE_FALSE_FLAG = TypeModifier.TRUE_FALSE.getFlag();
62+
public static final int YES_NO_FLAG = TypeModifier.YES_NO.getFlag();
63+
public static final int Y_N_FLAG = TypeModifier.Y_N.getFlag();
64+
public static final int ONE_ZERO_FLAG = TypeModifier.ONE_ZERO.getFlag();
6565

6666
private FTAType baseType;
6767

@@ -267,7 +267,7 @@ public String getRegExp() {
267267
return regexp;
268268
}
269269

270-
public void setRegExp(String regexp) {
270+
public void setRegExp(final String regexp) {
271271
this.regexp = regexp;
272272
}
273273

core/src/main/java/com/cobber/fta/core/FTAType.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public String toString() {
8686
* @return A boolean indicating if the Type for this pattern is numeric.
8787
*/
8888
public boolean isNumeric() {
89-
return LONG.equals(this) || DOUBLE.equals(this);
89+
return LONG == this || DOUBLE == this;
9090
}
9191

9292
/**
@@ -95,8 +95,8 @@ public boolean isNumeric() {
9595
* @return A boolean indicating if the Type for this pattern includes a Date.
9696
*/
9797
public boolean isDateType() {
98-
return LOCALDATE.equals(this) || LOCALDATETIME.equals(this) ||
99-
OFFSETDATETIME.equals(this) || ZONEDDATETIME.equals(this);
98+
return LOCALDATE == this || LOCALDATETIME == this ||
99+
OFFSETDATETIME == this || ZONEDDATETIME == this;
100100
}
101101

102102
/**
@@ -105,6 +105,6 @@ public boolean isDateType() {
105105
* @return A boolean indicating if the Type for this pattern includes a Date.
106106
*/
107107
public boolean isDateOrTimeType() {
108-
return LOCALTIME.equals(this) || this.isDateType();
108+
return LOCALTIME == this || this.isDateType();
109109
}
110110
}

core/src/main/java/com/cobber/fta/core/PatternFG.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ public static PatternFG compile(final String wPattern) {
2828
private PatternFG(final String wPattern) {
2929
final String withSentinel = wPattern + '|';
3030

31-
long wordCount = withSentinel.codePoints().filter(ch -> ch =='|').count() + 1;
31+
final long wordCount = withSentinel.codePoints().filter(ch -> ch =='|').count() + 1;
3232
words = new String[(int)wordCount];
3333

3434
int start = 0;
3535
int wordIndex = 0;
3636
for (int i = start; i < withSentinel.length(); i++) {
3737
if (withSentinel.charAt(i) == '|') {
3838
if (i != withSentinel.length() - 1) {
39-
char ch = withSentinel.charAt(i + 1);
39+
final char ch = withSentinel.charAt(i + 1);
4040
candidates[ch] = true;
4141
if (Character.isLowerCase(ch))
4242
candidates[Character.toUpperCase(ch)] = true;
@@ -57,15 +57,15 @@ public boolean matcher(final String input) {
5757
if (input == null || input.isEmpty())
5858
return false;
5959

60-
char ch = input.charAt(0);
60+
final char ch = input.charAt(0);
6161
if (ch >= candidates.length || !candidates[ch])
6262
return false;
6363

6464
final int len = input.length();
6565
if (len == 0 || len < minLength || len > maxLength)
6666
return false;
6767

68-
for (String word : words)
68+
for (final String word : words)
6969
if (input.equalsIgnoreCase(word))
7070
return true;
7171

core/src/main/java/com/cobber/fta/core/RegExpGenerator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public static String merge(String firstRE, String secondRE) {
9898
if (firstRE.equals(secondRE))
9999
return firstRE;
100100

101-
String simpleAnswer = firstRE.compareTo(secondRE) < 0 ? firstRE + '|' + secondRE : secondRE + '|' + firstRE;
101+
final String simpleAnswer = firstRE.compareTo(secondRE) < 0 ? firstRE + '|' + secondRE : secondRE + '|' + firstRE;
102102

103103
if (!firstRE.contains(secondRE) && !secondRE.contains(firstRE))
104104
return simpleAnswer;
@@ -112,7 +112,7 @@ public static String merge(String firstRE, String secondRE) {
112112

113113
// Case 1: first starts with second (e.g. "\d{2}" and "\d{2}-\d{2}") should return "\d{2}(-\d{2})?")
114114
if (firstRE.startsWith(secondRE)) {
115-
String optionalTail = firstRE.substring(secondRE.length());
115+
final String optionalTail = firstRE.substring(secondRE.length());
116116
// We need to not merge if we have something like "\d{2}" and "\d-\d{2}" as we would NOT want to return "\d({2}-\d{2})?"
117117
if (optionalTail.charAt(0) == '{')
118118
return simpleAnswer;

0 commit comments

Comments
 (0)