No you're not. You're getting null from somewhere, but not from the cloning. I've copied your code, added a main method and ran it successfully:
Sure, the output is a lot of nulls, but that's what I expected.
So, why don't you use the stack trace and find the real cause of the NullPointerException. Most likely you are using the result of the clone's getCode() method without checking if that's null. And that would cause the same error you would get if you would call the same code on the original.