@@ -135,64 +135,64 @@ class SpringBootNativeInstrumentationTest extends AbstractServerSmokeTest {
135135 boolean foundSystemProps = false
136136 boolean allScrubbed = true
137137 Files . walkFileTree(testJfrDir, new SimpleFileVisitor<Path > () {
138- @Override
139- FileVisitResult visitFile (Path file , BasicFileAttributes attrs ) throws IOException {
140- if (! file. toString(). endsWith(" .jfr" )) {
138+ @Override
139+ FileVisitResult visitFile (Path file , BasicFileAttributes attrs ) throws IOException {
140+ if (! file. toString(). endsWith(" .jfr" )) {
141+ return FileVisitResult . CONTINUE
142+ }
143+ try {
144+ IItemCollection events = JfrLoaderToolkit . loadEvents(file. toFile())
145+ IItemCollection sysPropEvents = events. apply(ItemFilters . type(" jdk.InitialSystemProperty" ))
146+ if (! sysPropEvents. hasItems()) {
141147 return FileVisitResult . CONTINUE
142148 }
143- try {
144- IItemCollection events = JfrLoaderToolkit . loadEvents(file. toFile())
145- IItemCollection sysPropEvents = events. apply(ItemFilters . type(" jdk.InitialSystemProperty" ))
146- if (! sysPropEvents. hasItems()) {
147- return FileVisitResult . CONTINUE
148- }
149- foundSystemProps = true
150- IAttribute<String > valueAttr = attr(" value" , " value" , " value" , PLAIN_TEXT )
151- for (IItemIterable itemIterable : sysPropEvents) {
152- IMemberAccessor<String , IItem > accessor = valueAttr. getAccessor(itemIterable. getType())
153- for (IItem item : itemIterable) {
154- String value = accessor. getMember(item)
155- if (value != null && ! value. isEmpty()) {
156- if (! value. chars(). allMatch(c -> c == (int ) ' x' as char )) {
157- allScrubbed = false
158- }
149+ foundSystemProps = true
150+ IAttribute<String > valueAttr = attr(" value" , " value" , " value" , PLAIN_TEXT )
151+ for (IItemIterable itemIterable : sysPropEvents) {
152+ IMemberAccessor<String , IItem > accessor = valueAttr. getAccessor(itemIterable. getType())
153+ for (IItem item : itemIterable) {
154+ String value = accessor. getMember(item)
155+ if (value != null && ! value. isEmpty()) {
156+ if (! value. chars(). allMatch(c -> c == (int ) ' x' as char )) {
157+ allScrubbed = false
159158 }
160159 }
161160 }
162- } catch (InvalidJfrFileException ignored) {
163- // incomplete recording at process exit
164161 }
165- return FileVisitResult . CONTINUE
162+ } catch (InvalidJfrFileException ignored) {
163+ // incomplete recording at process exit
166164 }
167- })
165+ return FileVisitResult . CONTINUE
166+ }
167+ })
168168 foundSystemProps
169169 allScrubbed
170170 }
171171
172172 int countJfrs () {
173173 AtomicInteger jfrCount = new AtomicInteger (0 )
174174 Files . walkFileTree(testJfrDir, new SimpleFileVisitor<Path > () {
175- @Override
176- FileVisitResult preVisitDirectory (Path dir , BasicFileAttributes attrs ) throws IOException {
177- return FileVisitResult . CONTINUE
178- }
175+ @Override
176+ FileVisitResult preVisitDirectory (Path dir , BasicFileAttributes attrs ) throws IOException {
177+ return FileVisitResult . CONTINUE
178+ }
179179
180- @Override
181- FileVisitResult visitFile (Path file , BasicFileAttributes attrs ) throws IOException {
182- if (file. toString(). endsWith(" .jfr" )) {
183- try {
184- IItemCollection events = JfrLoaderToolkit . loadEvents(file. toFile())
185- if (events. apply(ItemFilters . type(" jdk.ExecutionSample" )). hasItems()) {
186- jfrCount. incrementAndGet()
187- return FileVisitResult . SKIP_SIBLINGS
188- }
189- } catch (InvalidJfrFileException ignored) {
190- // the recording captured at process exit might be incomplete
180+ @Override
181+ FileVisitResult visitFile (Path file , BasicFileAttributes attrs ) throws IOException {
182+ if (file. toString(). endsWith(" .jfr" )) {
183+ try {
184+ IItemCollection events = JfrLoaderToolkit . loadEvents(file. toFile())
185+ if (events. apply(ItemFilters . type(" jdk.ExecutionSample" )). hasItems()) {
186+ jfrCount. incrementAndGet()
187+ return FileVisitResult . SKIP_SIBLINGS
191188 }
189+ } catch (InvalidJfrFileException ignored) {
190+ // the recording captured at process exit might be incomplete
192191 }
193- return FileVisitResult . CONTINUE
194192 }
195- })
193+ return FileVisitResult . CONTINUE
194+ }
195+ })
196196 return jfrCount. get()
197197 }
198198
0 commit comments