GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge pull request #484 from xxxllluuu/master · charooo/uavstack@33066d8

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • com.creditease.uav.monitorframework/src/main/java/com/creditease/uav/profiling/handlers
    • ComponentProfileHandler.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎com.creditease.uav.monitorframework/src/main/java/com/creditease/uav/profiling/handlers/ComponentProfileHandler.java‎

Copy file name to clipboardExpand all lines: com.creditease.uav.monitorframework/src/main/java/com/creditease/uav/profiling/handlers/ComponentProfileHandler.java
+53-1Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.io.File;
2525
import java.io.FileInputStream;
2626
import java.io.FileNotFoundException;
27+
import java.io.FilenameFilter;
2728
import java.io.IOException;
2829
import java.io.UnsupportedEncodingException;
2930
import java.lang.reflect.Method;
@@ -41,6 +42,8 @@
4142
import java.util.Map;
4243
import java.util.Map.Entry;
4344
import java.util.Set;
45+
import java.util.regex.Matcher;
46+
import java.util.regex.Pattern;
4447

4548
import javax.xml.parsers.DocumentBuilder;
4649
import javax.xml.parsers.DocumentBuilderFactory;
@@ -1269,6 +1272,7 @@ protected List<String> getDescriptorFileLocations(String webAppRoot) {
12691272

12701273
String webAppClasspath = webAppRoot + File.separator + "WEB-INF" + File.separator + "classes"
12711274
+ File.separator;
1275+
12721276
String config = parseFilterParam(webAppRoot);
12731277
if (!StringHelper.isEmpty(config)) {
12741278

@@ -1312,9 +1316,57 @@ protected List<String> getDescriptorFileLocations(String webAppRoot) {
13121316
}
13131317

13141318
if (nodes != null) {
1319+
13151320
for (int i = 0; i < nodes.getLength(); i++) {
13161321
Node node = nodes.item(i);
1317-
retFiles.add(webAppClasspath + node.getTextContent());
1322+
String content = node.getTextContent();
1323+
String includeFileName = webAppClasspath + node.getTextContent();
1324+
if (content.indexOf("*") < 0) {
1325+
retFiles.add(includeFileName);
1326+
continue;
1327+
}
1328+
1329+
File f = new File(includeFileName);
1330+
String fpath = f.getParent();
1331+
final String fname = f.getName();
1332+
1333+
f = new File(fpath);
1334+
1335+
String[] includeFileNames = f.list(new FilenameFilter() {
1336+
1337+
@Override
1338+
public boolean accept(File dir, String name) {
1339+
1340+
if (!name.endsWith(".xml")) {
1341+
return false;
1342+
}
1343+
1344+
String[] parts = fname.split("\\*");
1345+
1346+
String prefix = "^(" + parts[0] + ")";
1347+
1348+
parts[0] = prefix;
1349+
1350+
String regEx = "";
1351+
1352+
for (int i = 0; i < parts.length; i++) {
1353+
if (i != parts.length - 1) {
1354+
regEx = parts[i] + ".*";
1355+
continue;
1356+
}
1357+
1358+
regEx += (parts[i].replace(".", "\\."));
1359+
}
1360+
1361+
Pattern pattern = Pattern.compile(regEx);
1362+
Matcher matcher = pattern.matcher(name);
1363+
return matcher.matches();
1364+
}
1365+
});
1366+
1367+
for (String str : includeFileNames) {
1368+
retFiles.add(fpath + File.separator + str);
1369+
}
13181370
}
13191371
}
13201372
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.