void (Map attrs, final String expectedOrActualPrefix, final String text, int fullLength) { String property = System.getProperty("idea.test.cyclic.buffer.size"); int threshold; try { threshold = Integer.parseInt(property); } catch (NumberFormatException ignored) { threshold = -1; } if (threshold > 0 && fullLength > threshold) { try { //noinspection SSBasedInspection File tempFile = File.createTempFile(expectedOrActualPrefix, ""); try (OutputStream stream = new FileOutputStream(tempFile)) { stream.write(text.getBytes(StandardCharsets.UTF_8), 0, text.length()); } attrs.put(expectedOrActualPrefix + "File", tempFile.getAbsolutePath()); attrs.put(expectedOrActualPrefix + "IsTempFile", "true"); return; } catch (Throwable ignored) {} } attrs.put(expectedOrActualPrefix, text); }