Returns an Extension subclass object obtained deserializing the given bytes, or null
if the bytes contain an extension that is not understood.

@param extensionBytes The bytes to deserialize
@throws ServiceLocationException If the deserialization fails
761594
public static Extension deserialize(byte[] extensionBytes) throws ServiceLocationException
    {
        int extensionId = readInt(extensionBytes, 0, ID_BYTES_LENGTH);
        Extension extension = createExtension(extensionId);
        if (extension != null)
        {
            byte[] bodyBytes = new byte[extensionBytes.length - ID_BYTES_LENGTH - NEXT_EXTENSION_OFFSET_BYTES_LENGTH];
            System.arraycopy(extensionBytes, ID_BYTES_LENGTH + NEXT_EXTENSION_OFFSET_BYTES_LENGTH, bodyBytes, 0, bodyBytes.length);
            extension.deserializeBody(bodyBytes);
        }
        return extension;
    }
1069161
@JsonProperty("key_hsm")
    @JsonSerialize(using = Base64UrlJsonSerializer.class)
    @JsonDeserialize(using = Base64UrlJsonDeserializer.class)
    public byte[] t() {
        return ByteExtensions.clone(this.t);
    }
686069
@JsonProperty("n")
    @JsonSerialize(using = Base64UrlJsonSerializer.class)
    @JsonDeserialize(using = Base64UrlJsonDeserializer.class)
    public byte[] n() {
        return ByteExtensions.clone(this.n);
    }
133470
@Override
    public final Object fromBytes(Class targetClass, byte[] bytes)
    {
        try
        {
            if (bytes == null)
            {
                return null;
            }
            if (targetClass != null && targetClass.equals(byte[].class))
            {
                return bytes;
            }
            ObjectInputStream ois;
            ois = new ObjectInputStream(new ByteArrayInputStream(bytes));
            Object o = ois.readObject();
            ois.close();
            return o;
        }
        catch (IOException e)
        {
            log.error("IO exception, Caused by {}.", e);
            throw new PropertyAccessException(e);
        }
        catch (ClassNotFoundException e)
        {
            log.error("Class not found exception, Caused by {}.", e);
            throw new PropertyAccessException(e);
        }

    }
257798
public static final Object deserialize(byte[] bytes) throws Exception {
		if (bytes == null || bytes.length < 4) {
			return new LinkedHashMap<>();
		}

		// Try to deserialize content as Object (type-safe serialization)
		if (bytes[0] == 1) {
			try {
				ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
				bais.skip(1);
				return new ObjectInputStream(bais).readObject();
			} catch (Throwable ignored) {
			}
		}

		// Read content as JSON
		String json = new String(Arrays.copyOfRange(bytes, 1, bytes.length), StandardCharsets.UTF_8);
		return TreeReaderRegistry.getReader(null).parse(json);
	}
1174616
private synchronized Set<ExtensionArchive> getExtensionArchives() throws CDIException {

        if (runtimeExtensionSet == null) {
            runtimeExtensionSet = new HashSet<ExtensionArchive>();
            // get hold of the container for extension bundle
            //add create the bean deployment archive from the container
            Iterator<ServiceAndServiceReferencePair<WebSphereCDIExtension>> extensions = cdiRuntime.getExtensionServices();
            while (extensions.hasNext()) {
                ServiceAndServiceReferencePair<WebSphereCDIExtension> extension = extensions.next();
                ServiceReference<WebSphereCDIExtension> sr = extension.getServiceReference();

                Bundle bundle = null;
                if (sr == null) {
                    continue;
                }

                bundle = sr.getBundle();

                String extra_classes_blob = (String) sr.getProperty(EXTENSION_API_CLASSES);
                Set<String> extra_classes = new HashSet<String>();
                //parse the list
                if (extra_classes_blob != null) {

                    String[] classes = extra_classes_blob.split(EXTENSION_API_CLASSES_SEPARATOR);
                    if ((classes != null) && (classes.length > 0)) {
                        Collections.addAll(extra_classes, classes);
                    }
                }

                String extraAnnotationsBlob = (String) sr.getProperty(EXTENSION_BEAN_DEFINING_ANNOTATIONS);
                Set<String> extraAnnotations = new HashSet<String>();
                if (extraAnnotationsBlob != null) {
                    String[] annotations = extraAnnotationsBlob.split(EXTENSION_API_CLASSES_SEPARATOR);
                    if ((annotations != null) && (annotations.length > 0)) {
                        Collections.addAll(extraAnnotations, annotations);
                    }
                }

                String applicationBDAsVisibleStr = (String) sr.getProperty(EXTENSION_APP_BDAS_VISIBLE);
                boolean applicationBDAsVisible = Boolean.parseBoolean(applicationBDAsVisibleStr);

                String extClassesOnlyStr = (String) sr.getProperty(EXTENSION_CLASSES_ONLY_MODE);
                boolean extClassesOnly = Boolean.parseBoolean(extClassesOnlyStr);

                ExtensionArchive extensionArchive = cdiRuntime.getExtensionArchiveForBundle(bundle, extra_classes, extraAnnotations,
                                                                                            applicationBDAsVisible,
                                                                                            extClassesOnly);
                runtimeExtensionSet.add(extensionArchive);

            }
            if (CDIUtils.isDevelopementMode()) {

                //add the probeExcension
                runtimeExtensionSet.add(new ProbeExtensionArchive(cdiRuntime, null));
            }
        }

        return runtimeExtensionSet;
    }
242993
private static void exploreExtensions(ByteBuffer input, List<String> alpnProtocols, ByteArrayOutputStream out)
            throws SSLException {
        ByteArrayOutputStream extensionOut = out == null ? null : new ByteArrayOutputStream();
        int length = getInt16(input);           // length of extensions
        writeInt16(extensionOut, 0); //placeholder
        while (length > 0) {
            int extType = getInt16(input);      // extenson type
            writeInt16(extensionOut, extType);
            int extLen = getInt16(input);       // length of extension data
            writeInt16(extensionOut, extLen);
            if (extType == 16) {      // 0x00: ty
                if(out == null) {
                    exploreALPNExt(input, alpnProtocols);
                } else {
                    throw new ALPNPresentException();
                }
            } else {                    // ignore other extensions
                processByteVector(input, extLen, extensionOut);
            }

            length -= extLen + 4;
        }
        if(out != null) {
            byte[] alpnBits = generateAlpnExtension(alpnProtocols);
            extensionOut.write(alpnBits,0 ,alpnBits.length);
            byte[] extensionsData = extensionOut.toByteArray();
            int newLength = extensionsData.length - 2;
            extensionsData[0] = (byte) ((newLength >> 8) & 0xFF);
            extensionsData[1] = (byte) (newLength & 0xFF);
            out.write(extensionsData, 0, extensionsData.length);
        }

    }
584177
private static String getProperty(Properties extensionProperties, String propertyName) {
        if (extensionProperties.containsKey(propertyName)) {
            Object value = extensionProperties.get(propertyName);
            if (value != null) {
                return value.toString();
            }
        }

        return null;
    }
444104
public static FacesServletMapping createExtensionMapping(
        String extension)
    {
        FacesServletMapping mapping = new FacesServletMapping();
        mapping.setExtension(extension);
        return mapping;
    }
899152
private static JSONArray parseStencilSetExtensions(ArrayList<String> extensions) {
        if (extensions != null) {
            JSONArray extensionsArray = new JSONArray();

            for (String extension : extensions) {
                extensionsArray.put(extension.toString());
            }

            return extensionsArray;
        }

        return new JSONArray();
    }
969684
public static boolean hasExtension(String extension) {
        if (extension == null || extension.length() == 0) {
            return false;
        }
        return extensionToMimeTypeMap.containsKey(extension);
    }
184131
@Override
    public Object deserialize(byte[] bytes) throws IOException {
        KryoHolder kryoHolder = null;
        if (bytes == null) throw new RuntimeException("bytes can not be null");
        try {
            kryoHolder = KryoPoolImpl.getInstance().get();
            kryoHolder.input.setBuffer(bytes, 0, bytes.length);//call it ,and then use input object  ,discard any array
            return kryoHolder.kryo.readClassAndObject(kryoHolder.input);
        } catch (RuntimeException e) {
            throw new RuntimeException(e);
		} finally {
			if (kryoHolder != null) {
				KryoPoolImpl.getInstance().offer(kryoHolder);
			}
			// bytes = null; // for gc
		}
    }
911891
public static <T> T deSerialize( byte[] bytes, Class<T> adaptee ) throws Exception {
        ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes));
        Object readObject = in.readObject();
        return adaptee.cast(readObject);
    }
79332
public static <S extends Serializable> S deserialize(byte[] bytes) throws IOException {
    if (bytes == null) {
      return null;
    }
    return deserialize(new ByteArrayInputStream(bytes));
  }
43897
@SuppressWarnings( "unchecked" )
    public <T> T getService( final Class<T> serviceType,
                             final long timeoutInMillis )
    {
        return (T) Proxy.newProxyInstance(
            getClass().getClassLoader(),
            new Class<?>[]{ serviceType },
            new InvocationHandler()
            {
                /**
                 * {@inheritDoc}
                 * Delegates the call to remote bundle context.
                 */
                public Object invoke( final Object proxy,
                                      final Method method,
                                      final Object[] params )
                    throws Throwable
                {
                    try
                    {
                        return getRemoteBundleContext().remoteCall(
                            method.getDeclaringClass(),
                            method.getName(),
                            method.getParameterTypes(),
                            timeoutInMillis,
                            params
                        );
                    }
                    catch( InvocationTargetException e )
                    {
                        throw e.getCause();
                    }
                    catch( RemoteException e )
                    {
                        throw new TestContainerException( "Remote exception", e );
                    }
                    catch( Exception e )
                    {
                        throw new TestContainerException( "Invocation exception", e );
                    }
                }
            }
        );
    }
886094
public java.rmi.Remote getPort(Class serviceEndpointInterface) throws javax.xml.rpc.ServiceException {
        try {
            if (com.google.api.ads.adwords.axis.v201809.cm.AdGroupExtensionSettingServiceInterface.class.isAssignableFrom(serviceEndpointInterface)) {
                com.google.api.ads.adwords.axis.v201809.cm.AdGroupExtensionSettingServiceSoapBindingStub _stub = new com.google.api.ads.adwords.axis.v201809.cm.AdGroupExtensionSettingServiceSoapBindingStub(new java.net.URL(AdGroupExtensionSettingServiceInterfacePort_address), this);
                _stub.setPortName(getAdGroupExtensionSettingServiceInterfacePortWSDDServiceName());
                return _stub;
            }
        }
        catch (java.lang.Throwable t) {
            throw new javax.xml.rpc.ServiceException(t);
        }
        throw new javax.xml.rpc.ServiceException("There is no stub implementation for the interface:  " + (serviceEndpointInterface == null ? "null" : serviceEndpointInterface.getName()));
    }
424880
public ExtensionArchive getExtensionArchiveForBundle(Bundle bundle,
                                                         Set<String> extraClasses,
                                                         Set<String> extraAnnotations,
                                                         boolean applicationBDAsVisible,
                                                         boolean extClassesOnly) throws CDIException {

        ExtensionArchive extensionArchive = null;
        extensionArchive = extensionArchives.get(bundle);
        if (extensionArchive == null) {
            Container container = getContainerForBundle(bundle);
            //get hold of bundle classloader
            BundleWiring bundleWiring = bundle.adapt(BundleWiring.class);
            ClassLoader loader = bundleWiring.getClassLoader();
            if (container != null) {
                ExtensionContainerInfo containerInfo = new ExtensionContainerInfo(container, loader, CDIServiceUtils.getSymbolicNameWithoutMinorOrMicroVersionPart(bundle.getSymbolicName())
                                                                                                     + "_"
                                                                                                     + CDIServiceUtils.getOSGIVersionForBndName(bundle.getVersion()), extraClasses, extraAnnotations, applicationBDAsVisible, extClassesOnly);

                extensionArchive = new ExtensionArchiveImpl(containerInfo, this);
                ExtensionArchive oldExtensionArchive = extensionArchives.putIfAbsent(bundle, extensionArchive);
                if (oldExtensionArchive != null) {
                    extensionArchive = oldExtensionArchive;
                }
            }
        }
        return extensionArchive;
    }