Skip to content

Commit cb96be0

Browse files
committed
code cleanup, proper inclusion of 3rd party libs licenses
1 parent c6a8e2f commit cb96be0

File tree

6 files changed

+143
-16
lines changed

6 files changed

+143
-16
lines changed

tda/dependency-reduced-pom.xml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,67 @@
2626
</resource>
2727
</resources>
2828
<plugins>
29+
<plugin>
30+
<artifactId>maven-dependency-plugin</artifactId>
31+
<version>3.6.0</version>
32+
<executions>
33+
<execution>
34+
<id>unpack-licenses</id>
35+
<phase>prepare-package</phase>
36+
<goals>
37+
<goal>unpack</goal>
38+
</goals>
39+
<configuration>
40+
<artifactItems>
41+
<artifactItem>
42+
<groupId>com.formdev</groupId>
43+
<artifactId>flatlaf</artifactId>
44+
<version>3.3</version>
45+
<type>jar</type>
46+
<includes>META-INF/LICENSE</includes>
47+
<outputDirectory>${project.build.directory}/licenses/flatlaf</outputDirectory>
48+
</artifactItem>
49+
<artifactItem>
50+
<groupId>com.formdev</groupId>
51+
<artifactId>flatlaf-extras</artifactId>
52+
<version>3.3</version>
53+
<type>jar</type>
54+
<includes>META-INF/LICENSE</includes>
55+
<outputDirectory>${project.build.directory}/licenses/flatlaf-extras</outputDirectory>
56+
</artifactItem>
57+
<artifactItem>
58+
<groupId>com.github.weisj</groupId>
59+
<artifactId>jsvg</artifactId>
60+
<version>1.2.0</version>
61+
<type>jar</type>
62+
<includes>META-INF/LICENSE</includes>
63+
<outputDirectory>${project.build.directory}/licenses/jsvg</outputDirectory>
64+
</artifactItem>
65+
</artifactItems>
66+
</configuration>
67+
</execution>
68+
</executions>
69+
</plugin>
70+
<plugin>
71+
<artifactId>maven-antrun-plugin</artifactId>
72+
<version>3.1.0</version>
73+
<executions>
74+
<execution>
75+
<id>rename-licenses</id>
76+
<phase>prepare-package</phase>
77+
<goals>
78+
<goal>run</goal>
79+
</goals>
80+
<configuration>
81+
<target>
82+
<copy />
83+
<copy />
84+
<copy />
85+
</target>
86+
</configuration>
87+
</execution>
88+
</executions>
89+
</plugin>
2990
<plugin>
3091
<artifactId>maven-compiler-plugin</artifactId>
3192
<version>3.8.1</version>
@@ -81,10 +142,12 @@
81142
<filter>
82143
<artifact>*:*</artifact>
83144
<excludes>
145+
<exclude>module-info.class</exclude>
84146
<exclude>META-INF/MANIFEST.MF</exclude>
85147
<exclude>META-INF/*.SF</exclude>
86148
<exclude>META-INF/*.DSA</exclude>
87149
<exclude>META-INF/*.RSA</exclude>
150+
<exclude>META-INF/LICENSE</exclude>
88151
</excludes>
89152
</filter>
90153
</filters>

tda/pom.xml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,69 @@
7171
</resource>
7272
</resources>
7373
<plugins>
74+
<plugin>
75+
<groupId>org.apache.maven.plugins</groupId>
76+
<artifactId>maven-dependency-plugin</artifactId>
77+
<version>3.6.0</version>
78+
<executions>
79+
<execution>
80+
<id>unpack-licenses</id>
81+
<phase>prepare-package</phase>
82+
<goals>
83+
<goal>unpack</goal>
84+
</goals>
85+
<configuration>
86+
<artifactItems>
87+
<artifactItem>
88+
<groupId>com.formdev</groupId>
89+
<artifactId>flatlaf</artifactId>
90+
<version>3.3</version>
91+
<type>jar</type>
92+
<includes>META-INF/LICENSE</includes>
93+
<outputDirectory>${project.build.directory}/licenses/flatlaf</outputDirectory>
94+
</artifactItem>
95+
<artifactItem>
96+
<groupId>com.formdev</groupId>
97+
<artifactId>flatlaf-extras</artifactId>
98+
<version>3.3</version>
99+
<type>jar</type>
100+
<includes>META-INF/LICENSE</includes>
101+
<outputDirectory>${project.build.directory}/licenses/flatlaf-extras</outputDirectory>
102+
</artifactItem>
103+
<artifactItem>
104+
<groupId>com.github.weisj</groupId>
105+
<artifactId>jsvg</artifactId>
106+
<version>1.2.0</version>
107+
<type>jar</type>
108+
<includes>META-INF/LICENSE</includes>
109+
<outputDirectory>${project.build.directory}/licenses/jsvg</outputDirectory>
110+
</artifactItem>
111+
</artifactItems>
112+
</configuration>
113+
</execution>
114+
</executions>
115+
</plugin>
116+
<plugin>
117+
<groupId>org.apache.maven.plugins</groupId>
118+
<artifactId>maven-antrun-plugin</artifactId>
119+
<version>3.1.0</version>
120+
<executions>
121+
<execution>
122+
<id>rename-licenses</id>
123+
<phase>prepare-package</phase>
124+
<goals>
125+
<goal>run</goal>
126+
</goals>
127+
<configuration>
128+
<target>
129+
<copy file="${project.build.directory}/licenses/flatlaf/META-INF/LICENSE" tofile="${project.build.outputDirectory}/META-INF/LICENSE_flatlaf" />
130+
<copy file="${project.build.directory}/licenses/flatlaf-extras/META-INF/LICENSE" tofile="${project.build.outputDirectory}/META-INF/LICENSE_flatlaf-extras" />
131+
<copy file="${project.build.directory}/licenses/jsvg/META-INF/LICENSE" tofile="${project.build.outputDirectory}/META-INF/LICENSE_jsvg" />
132+
</target>
133+
</configuration>
134+
</execution>
135+
</executions>
136+
</plugin>
74137
<plugin>
75138
<groupId>org.apache.maven.plugins</groupId>
76139
<artifactId>maven-compiler-plugin</artifactId>
@@ -130,10 +193,12 @@
130193
<filter>
131194
<artifact>*:*</artifact>
132195
<excludes>
196+
<exclude>module-info.class</exclude>
133197
<exclude>META-INF/MANIFEST.MF</exclude>
134198
<exclude>META-INF/*.SF</exclude>
135199
<exclude>META-INF/*.DSA</exclude>
136200
<exclude>META-INF/*.RSA</exclude>
201+
<exclude>META-INF/LICENSE</exclude>
137202
</excludes>
138203
</filter>
139204
</filters>

tda/src/main/java/de/grimmfrost/tda/InfoDialog.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ private void initPanel() {
7575
"TDA is distributed in the hope that it will be useful, but WITHOUT ANY<br>" +
7676
"WARRANTY; without even the implied warranty of MERCHANTABILITY or <br>" +
7777
"FITNESS FOR A PARTICULAR PURPOSE. See the Lesser GNU General Public<br>" +
78-
"License for more details.<p><br>";
78+
"License for more details.</p><br>" +
79+
"<p>This distribution includes 3rd-party libraries: <b>FlatLaf</b>, <b>FlatLaf-Extras</b>, and <b>JSVG</b>.<br> " +
80+
"Their licenses can be found in the <code>META-INF/</code> directory of the jar file.</p><br>";
7981

8082
javax.swing.JEditorPane infoPane = new javax.swing.JEditorPane("text/html", info);
8183
infoPane.setEditable(false);

tda/src/main/java/de/grimmfrost/tda/filter/Filter.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,17 +211,17 @@ public boolean matches(ThreadInfo ti, boolean forceEnabled) {
211211
result = getFilterExpressionPattern().matcher(ti.getContent()).matches();
212212
break;
213213
case WAITING_ON_RULE :
214-
result = (ti.getContent().indexOf("- waiting on") >= 0) && checkLine(ti, "- waiting on", '<', ')');
214+
result = (ti.getContent().contains("- waiting on")) && checkLine(ti, "- waiting on", '<', ')');
215215
break;
216216
case WAITING_FOR_RULE :
217-
result = (ti.getName().indexOf("waiting for monitor entry") >= 0) &&
217+
result = (ti.getName().contains("waiting for monitor entry")) &&
218218
checkLine(ti, "- waiting to lock", '<', ')');
219219
break;
220220
case LOCKING_RULE :
221-
result = (ti.getContent().indexOf("- locked") >= 0) && checkLine(ti, "- locked", '<', ')');
221+
result = (ti.getContent().contains("- locked")) && checkLine(ti, "- locked", '<', ')');
222222
break;
223223
case SLEEPING_RULE :
224-
result = (ti.getName().indexOf("Object.wait()") >= 0);
224+
result = (ti.getName().contains("Object.wait()"));
225225
break;
226226
case STACK_IS_LONGER_THAN_RULE :
227227
result = (ti.getStackLines() == 0) || ((ti.getStackLines() -2) > Integer.parseInt(filterExpression));
@@ -250,6 +250,6 @@ private boolean checkLine(ThreadInfo ti, String contains, char beginChar, char e
250250

251251
public String toString() {
252252
// (general) removed atm.
253-
return (getName() + (isGeneralFilter() ? "" : "") + (isEnabled() ? " (default)" : ""));
253+
return (getName() + (isEnabled() ? " (default)" : ""));
254254
}
255255
}

tda/src/main/java/de/grimmfrost/tda/model/CustomCategory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void addToFilters(Filter filter) {
7373
* @return true if found, false otherwise.
7474
*/
7575
public boolean hasInFilters(String name) {
76-
return (filters != null ? filters.containsKey(name) : false);
76+
return (filters != null && filters.containsKey(name));
7777
}
7878

7979
/**

tda/src/main/java/de/grimmfrost/tda/model/HeapInfo.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,11 @@ public void setHeapInfo(String heapInfo) {
5151
}
5252

5353
public String toString() {
54-
StringBuffer info = new StringBuffer();
55-
info.append("<tr bgcolor=\"#ffffff\"<td></td></tr>");
56-
info.append("<tr bgcolor=\"#cccccc\"><td colspan=2><font face=System ");
57-
info.append("<b><u>Heap Information:</u></b><br/>");
58-
info.append("</font><pre>\n");
59-
info.append(heapInfo);
60-
info.append("</pre></td></tr>");
61-
62-
return(info.toString());
54+
return("<tr bgcolor=\"#ffffff\"<td></td></tr>" +
55+
"<tr bgcolor=\"#cccccc\"><td colspan=2><font face=System " +
56+
"<b><u>Heap Information:</u></b><br/>" +
57+
"</font><pre>\n" +
58+
heapInfo +
59+
"</pre></td></tr>");
6360
}
6461
}

0 commit comments

Comments
 (0)