#fixed code
                             private void updateMemoryPool() throws IOException {
		JmxMemoryPoolManager memoryPoolManager = jmxClient.getMemoryPoolManager();

		edenUsedBytes = memoryPoolManager.getEdenMemoryPool().getUsage().getUsed();
		edenMaxBytes = getMemoryPoolMaxOrCommited(memoryPoolManager.getEdenMemoryPool());

		MemoryPoolMXBean survivorMemoryPool = memoryPoolManager.getSurvivorMemoryPool();
		if (survivorMemoryPool != null) {
			surUsedBytes = survivorMemoryPool.getUsage().getUsed();
			surMaxBytes = getMemoryPoolMaxOrCommited(survivorMemoryPool);
		}

		oldUsedBytes = memoryPoolManager.getOldMemoryPool().getUsage().getUsed();
		oldMaxBytes = getMemoryPoolMaxOrCommited(memoryPoolManager.getOldMemoryPool());

		permUsedBytes = memoryPoolManager.getPermMemoryPool().getUsage().getUsed();
		permMaxBytes = getMemoryPoolMaxOrCommited(memoryPoolManager.getPermMemoryPool());

		if (jvmMajorVersion >= 8) {
			MemoryPoolMXBean compressedClassSpaceMemoryPool = memoryPoolManager.getCompressedClassSpaceMemoryPool();
			if (compressedClassSpaceMemoryPool != null) {
				ccsUsedBytes = compressedClassSpaceMemoryPool.getUsage().getUsed();
				ccsMaxBytes = getMemoryPoolMaxOrCommited(compressedClassSpaceMemoryPool);
			}
		}

		codeCacheUsedBytes = memoryPoolManager.getCodeCacheMemoryPool().getUsage().getUsed();
		codeCacheMaxBytes = getMemoryPoolMaxOrCommited(memoryPoolManager.getCodeCacheMemoryPool());

		directUsedBytes = jmxClient.getBufferPoolManager().getDirectBufferPool().getMemoryUsed();
		directMaxBytes = jmxClient.getBufferPoolManager().getDirectBufferPool().getTotalCapacity();

		mapUsedBytes = jmxClient.getBufferPoolManager().getMappedBufferPool().getMemoryUsed();
		mapMaxBytes = jmxClient.getBufferPoolManager().getMappedBufferPool().getTotalCapacity();
	}
#vulnerable code 
                             private void updateMemoryPool() throws IOException {
		MemoryPoolMXBean survivorMemoryPool = jmxClient.getMemoryPoolManager().getSurvivorMemoryPool();
		if (survivorMemoryPool != null) {
			surUsedBytes = survivorMemoryPool.getUsage().getUsed();
			surMaxBytes = getMemoryPoolMaxOrCommited(survivorMemoryPool);
		}

		edenUsedBytes = jmxClient.getMemoryPoolManager().getEdenMemoryPool().getUsage().getUsed();
		edenMaxBytes = getMemoryPoolMaxOrCommited(jmxClient.getMemoryPoolManager().getEdenMemoryPool());

		oldUsedBytes = jmxClient.getMemoryPoolManager().getOldMemoryPool().getUsage().getUsed();
		oldMaxBytes = getMemoryPoolMaxOrCommited(jmxClient.getMemoryPoolManager().getOldMemoryPool());

		permUsedBytes = jmxClient.getMemoryPoolManager().getPermMemoryPool().getUsage().getUsed();
		permMaxBytes = getMemoryPoolMaxOrCommited(jmxClient.getMemoryPoolManager().getPermMemoryPool());

		if (jvmMajorVersion >= 8) {
			ccsUsedBytes = jmxClient.getMemoryPoolManager().getCompressedClassSpaceMemoryPool().getUsage().getUsed();
			ccsMaxBytes = getMemoryPoolMaxOrCommited(jmxClient.getMemoryPoolManager()
					.getCompressedClassSpaceMemoryPool());
		}

		codeCacheUsedBytes = jmxClient.getMemoryPoolManager().getCodeCacheMemoryPool().getUsage().getUsed();
		codeCacheMaxBytes = getMemoryPoolMaxOrCommited(jmxClient.getMemoryPoolManager().getCodeCacheMemoryPool());

		directUsedBytes = jmxClient.getBufferPoolManager().getDirectBufferPool().getMemoryUsed();
		directMaxBytes = jmxClient.getBufferPoolManager().getDirectBufferPool().getTotalCapacity();

		mapUsedBytes = jmxClient.getBufferPoolManager().getMappedBufferPool().getMemoryUsed();
		mapMaxBytes = jmxClient.getBufferPoolManager().getMappedBufferPool().getTotalCapacity();
	} 
                            #location 8 
                            #vulnerability type NULL_DEREFERENCE