jdk.jfr.internal.SecuritySupport Java Examples
The following examples show how to use
jdk.jfr.internal.SecuritySupport.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractDCmd.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
protected final void reportOperationComplete(String actionPrefix, String name, SafePath file) { print(actionPrefix); print(" recording"); if (name != null) { print(" \"" + name + "\""); } if (file != null) { print(","); try { print(" "); long bytes = SecuritySupport.getFileSize(file); printBytes(bytes); } catch (IOException e) { // Ignore, not essential } println(" written to:"); println(); printPath(file); } else { println("."); } }
Example #2
Source File: AbstractDCmd.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
protected final void reportOperationComplete(String actionPrefix, Recording r, SafePath file) { print(actionPrefix); print(" recording "); print("\"" + r.getName() + "\""); if (file != null) { print(","); try { print(" "); long bytes = SecuritySupport.getFileSize(file); printBytes(bytes, " "); } catch (IOException e) { // Ignore, not essential } println(" written to:"); println(); printPath(file); } else { println("."); } }
Example #3
Source File: AbstractDCmd.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
protected final void reportOperationComplete(String actionPrefix, String name, SafePath file) { print(actionPrefix); print(" recording"); if (name != null) { print(" \"" + name + "\""); } if (file != null) { print(","); try { print(" "); long bytes = SecuritySupport.getFileSize(file); printBytes(bytes); } catch (IOException e) { // Ignore, not essential } println(" written to:"); println(); printPath(file); } else { println("."); } }
Example #4
Source File: JFC.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static List<KnownConfiguration> getKnownConfigurations() { if (knownConfigurations == null) { List<KnownConfiguration> configProxies = new ArrayList<>(); for (SafePath p : SecuritySupport.getPredefinedJFCFiles()) { try { configProxies.add(new KnownConfiguration(p)); } catch (IOException ioe) { // ignore } } knownConfigurations = configProxies; } return knownConfigurations; }
Example #5
Source File: AbstractDCmd.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
protected final void printPath(SafePath path) { if (path == null) { print("N/A"); return; } try { printPath(SecuritySupport.getAbsolutePath(path).toPath()); } catch (IOException ioe) { printPath(path.toPath()); } }
Example #6
Source File: JFC.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static List<KnownConfiguration> getKnownConfigurations() { if (knownConfigurations == null) { List<KnownConfiguration> configProxies = new ArrayList<>(); for (SafePath p : SecuritySupport.getPredefinedJFCFiles()) { try { configProxies.add(new KnownConfiguration(p)); } catch (IOException ioe) { // ignore } } knownConfigurations = configProxies; } return knownConfigurations; }
Example #7
Source File: JFC.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static String readContent(SafePath knownPath) throws IOException { if (SecuritySupport.getFileSize(knownPath) > MAXIMUM_FILE_SIZE) { throw new IOException("Configuration with more than " + MAXIMUM_FILE_SIZE + " characters can't be read."); } try (InputStream r = SecuritySupport.newFileInputStream(knownPath)) { return JFC.readContent(r); } }
Example #8
Source File: JDKEvents.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unchecked") public synchronized static void initialize() { try { if (initializationTriggered == false) { for (Class<?> eventClass : eventClasses) { SecuritySupport.registerEvent((Class<? extends Event>) eventClass); } initializationTriggered = true; RequestEngine.addTrustedJDKHook(ExceptionStatisticsEvent.class, emitExceptionStatistics); } } catch (Exception e) { Logger.log(LogTag.JFR_SYSTEM, LogLevel.WARN, "Could not initialize JDK events. " + e.getMessage()); } }
Example #9
Source File: JIClassInstrumentation.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static byte[] getOriginalClassBytes(Class<?> clazz) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); String name = "/" + clazz.getName().replace(".", "/") + ".class"; InputStream is = SecuritySupport.getResourceAsStream(name); int bytesRead; byte[] buffer = new byte[16384]; while ((bytesRead = is.read(buffer, 0, buffer.length)) != -1) { baos.write(buffer, 0, bytesRead); } baos.flush(); is.close(); return baos.toByteArray(); }
Example #10
Source File: AbstractDCmd.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
protected final void printPath(SafePath path) { if (path == null) { print("N/A"); return; } try { printPath(SecuritySupport.getAbsolutePath(path).toPath()); } catch (IOException ioe) { printPath(path.toPath()); } }
Example #11
Source File: JIClassInstrumentation.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static byte[] getOriginalClassBytes(Class<?> clazz) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); String name = "/" + clazz.getName().replace(".", "/") + ".class"; InputStream is = SecuritySupport.getResourceAsStream(name); int bytesRead; byte[] buffer = new byte[16384]; while ((bytesRead = is.read(buffer, 0, buffer.length)) != -1) { baos.write(buffer, 0, bytesRead); } baos.flush(); is.close(); return baos.toByteArray(); }
Example #12
Source File: JFC.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static String readContent(SafePath knownPath) throws IOException { if (SecuritySupport.getFileSize(knownPath) > MAXIMUM_FILE_SIZE) { throw new IOException("Configuration with more than " + MAXIMUM_FILE_SIZE + " characters can't be read."); } try (InputStream r = SecuritySupport.newFileInputStream(knownPath)) { return JFC.readContent(r); } }
Example #13
Source File: JDKEvents.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unchecked") public synchronized static void initialize() { try { if (initializationTriggered == false) { for (Class<?> eventClass : eventClasses) { SecuritySupport.registerEvent((Class<? extends Event>) eventClass); } initializationTriggered = true; RequestEngine.addTrustedJDKHook(ExceptionStatisticsEvent.class, emitExceptionStatistics); } } catch (Exception e) { Logger.log(LogTag.JFR_SYSTEM, LogLevel.WARN, "Could not initialize JDK events. " + e.getMessage()); } }
Example #14
Source File: JIClassInstrumentation.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static byte[] getOriginalClassBytes(Class<?> clazz) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); String name = "/" + clazz.getName().replace(".", "/") + ".class"; InputStream is = SecuritySupport.getResourceAsStream(name); int bytesRead; byte[] buffer = new byte[16384]; while ((bytesRead = is.read(buffer, 0, buffer.length)) != -1) { baos.write(buffer, 0, bytesRead); } baos.flush(); is.close(); return baos.toByteArray(); }
Example #15
Source File: AbstractDCmd.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
protected final void printPath(SafePath path) { if (path == null) { print("N/A"); return; } try { printPath(SecuritySupport.getAbsolutePath(path).toPath()); } catch (IOException ioe) { printPath(path.toPath()); } }
Example #16
Source File: JFC.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static List<KnownConfiguration> getKnownConfigurations() { if (knownConfigurations == null) { List<KnownConfiguration> configProxies = new ArrayList<>(); for (SafePath p : SecuritySupport.getPredefinedJFCFiles()) { try { configProxies.add(new KnownConfiguration(p)); } catch (IOException ioe) { // ignore } } knownConfigurations = configProxies; } return knownConfigurations; }
Example #17
Source File: JFC.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static String readContent(SafePath knownPath) throws IOException { if (SecuritySupport.getFileSize(knownPath) > MAXIMUM_FILE_SIZE) { throw new IOException("Configuration with more than " + MAXIMUM_FILE_SIZE + " characters can't be read."); } try (InputStream r = SecuritySupport.newFileInputStream(knownPath)) { return JFC.readContent(r); } }
Example #18
Source File: JDKEvents.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("unchecked") public synchronized static void initialize() { try { if (initializationTriggered == false) { for (Class<?> eventClass : eventClasses) { SecuritySupport.registerEvent((Class<? extends Event>) eventClass); } initializationTriggered = true; FlightRecorder.addPeriodicEvent(ExceptionStatisticsEvent.class, emitExceptionStatistics); } } catch (Exception e) { Logger.log(LogTag.JFR_SYSTEM, LogLevel.WARN, "Could not initialize JDK events. " + e.getMessage()); } }