|
25 | 25 | package com.oracle.svm.hosted.image;
|
26 | 26 |
|
27 | 27 | import static com.oracle.graal.pointsto.api.PointstoOptions.UseConservativeUnsafeAccess;
|
| 28 | +import static com.oracle.svm.core.SubstrateOptions.EnableURLProtocols; |
28 | 29 | import static com.oracle.svm.core.SubstrateOptions.Preserve;
|
| 30 | +import static com.oracle.svm.core.jdk.JRTSupport.Options.AllowJRTFileSystem; |
| 31 | +import static com.oracle.svm.hosted.SecurityServicesFeature.Options.AdditionalSecurityProviders; |
| 32 | +import static com.oracle.svm.hosted.jdk.localization.LocalizationFeature.Options.AddAllCharsets; |
| 33 | +import static com.oracle.svm.hosted.jdk.localization.LocalizationFeature.Options.IncludeAllLocales; |
29 | 34 |
|
30 | 35 | import java.lang.reflect.Constructor;
|
31 | 36 | import java.lang.reflect.Field;
|
32 | 37 | import java.lang.reflect.Method;
|
33 | 38 | import java.lang.reflect.Modifier;
|
| 39 | +import java.security.Provider; |
| 40 | +import java.security.Security; |
34 | 41 | import java.util.Arrays;
|
35 | 42 | import java.util.Comparator;
|
36 | 43 | import java.util.Set;
|
| 44 | +import java.util.StringJoiner; |
37 | 45 | import java.util.stream.Stream;
|
38 | 46 |
|
39 | 47 | import org.graalvm.collections.EconomicMap;
|
@@ -139,7 +147,23 @@ public static void parsePreserveOption(EconomicMap<OptionKey<?>, Object> hostedV
|
139 | 147 | SubstrateOptionsParser.commandArgument(UseConservativeUnsafeAccess, "-"));
|
140 | 148 | }
|
141 | 149 | UseConservativeUnsafeAccess.update(hostedValues, true);
|
| 150 | + |
| 151 | + AddAllCharsets.update(hostedValues, true); |
| 152 | + IncludeAllLocales.update(hostedValues, true); |
| 153 | + AllowJRTFileSystem.update(hostedValues, true); |
| 154 | + EnableURLProtocols.update(hostedValues, "http,https,ftp,jar,file,mailto,jrt,jmod"); |
| 155 | + AdditionalSecurityProviders.update(hostedValues, getSecurityProvidersCSV()); |
| 156 | + } |
| 157 | + } |
| 158 | + |
| 159 | + private static String getSecurityProvidersCSV() { |
| 160 | + StringJoiner joiner = new StringJoiner(","); |
| 161 | + for (Provider provider : Security.getProviders()) { |
| 162 | + Class<? extends Provider> aClass = provider.getClass(); |
| 163 | + String typeName = aClass.getTypeName(); |
| 164 | + joiner.add(typeName); |
142 | 165 | }
|
| 166 | + return joiner.toString(); |
143 | 167 | }
|
144 | 168 |
|
145 | 169 | public static void registerPreservedClasses(NativeImageClassLoaderSupport classLoaderSupport) {
|
|
0 commit comments