Null exception error in avl trees
i am doing an assignment about avl trees in java. I am getting a nullexception error when trying to balance the tree by means of the rotations. Can you pls help me in finding the error? Here is my code:
public class Node {

    private int value;
    private Node leftNode;
    private Node rightNode;

    public Node(int value) {
        this.value = value;
    }

    public Node() {
    }

    public Node(int value, Node leftNode, Node rightNode) {
        this.value = value;
        this.leftNode = leftNode;
        this.rightNode = rightNode;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public void setLeft(Node leftNode) {
        this.leftNode = leftNode;
    }

    public void setRight(Node rightNode) {
        this.rightNode = rightNode;
    }

    public int getValue() {
        return value;
    }

    public Node getLeftNode() {
        return leftNode;
    }

    public Node getRightNode() {
        return rightNode;
    }
    private Node root;

    public Node getRoot() {
        return root;
 }

    public Node insert(int n) {

        root = insert(n, root);
        root = balance(root);
        return root;
    }

    public int getLeftHeight() {
        if (this.leftNode == null) {
            return 0;
        } else {
            return this.getLeftNode().getHeight() + 1;
        }

    }

    public int getRightHeight() {
        if (this.rightNode == null) {
            return 0;
        } else {
            return this.getRightNode().getHeight() + 1;
        }
    }
    public int getHeight ()
    {
        if (this.leftNode == null && this.rightNode== null)
        {
            return 0;
        }
        else
        {
            int leftH = 0;
            int rightH = 0;
            if (this.leftNode != null)
            {
                leftH++;
                leftH += this.getLeftNode().getHeight();
            }
            if (this.rightNode != null)
            {
                rightH++;
                rightH += this.getRightNode().getHeight();
            }
            return Math.max(leftH,rightH);
        }
    }

    public Node insert(int x, Node t) {
        if (t == null) {
            t = new Node(x);
        } else if (x < t.getValue()) {
            t.setLeft(insert(x, t.getLeftNode()));
        } else if (x > t.getValue()) {
            t.setRight(insert(x, t.getRightNode()));
        }
        return t;
    }

    public Node balance(Node n) {
        if (Math.abs(n.getLeftHeight() - n.getRightHeight()) == 2) {
            if (n.rightNode == null) {
                if (n.leftNode.leftNode != null) {
                    return n.LLRotation();
                }
                if (n.leftNode.rightNode != null) {
                    return n.LRRotation();
                }
            }
            if (n.leftNode == null) {
                if (n.rightNode.rightNode != null) {
                    return this.RRRotation();
                }
                if (n.rightNode.leftNode != null) {
                    return this.RLRotation();
                }
            }
        } else {
            if (n.getLeftNode() != null) {
                return this.getLeftNode().balance(n);
            }
            if (this.getRightNode() != null) {
                return this.getRightNode().balance(n);
            }
        }
        return this;
    }

    public Node LLRotation() {
        Node temp = this.leftNode;
        this.leftNode = null;
        temp.rightNode = this;
        return temp;
    }

    public Node RRRotation() {
        Node temp = this.rightNode;
        this.rightNode = temp.leftNode;
        try {
            temp.leftNode = (Node) this.clone();
        } catch (CloneNotSupportedException ex) {
        }
        this.value = temp.value;
        this.rightNode = temp.rightNode;
        this.leftNode = temp.leftNode;
        return temp;
    }

    public Node LRRotation() {
        this.leftNode = this.leftNode.RRRotation();
        return LLRotation();
    }

    public Node RLRotation() {
        this.rightNode = this.rightNode.RRRotation();
        return RRRotation();
    }

Thanks in advance
Null exception error in avl trees
===

i am doing an assignment about avl trees in java. I am getting a nullexception error when trying to balance the tree by means of the rotations. Can you pls help me in finding the error? Here is my code:
public class Node {

    private int value;
    private Node leftNode;
    private Node rightNode;

    public Node(int value) {
        this.value = value;
    }

    public Node() {
    }

    public Node(int value, Node leftNode, Node rightNode) {
        this.value = value;
        this.leftNode = leftNode;
        this.rightNode = rightNode;
    }

    public void setValue(int value) {
        this.value = value;
    }

    public void setLeft(Node leftNode) {
        this.leftNode = leftNode;
    }

    public void setRight(Node rightNode) {
        this.rightNode = rightNode;
    }

    public int getValue() {
        return value;
    }

    public Node getLeftNode() {
        return leftNode;
    }

    public Node getRightNode() {
        return rightNode;
    }
    private Node root;

    public Node getRoot() {
        return root;
 }

    public Node insert(int n) {

        root = insert(n, root);
        root = balance(root);
        return root;
    }

    public int getLeftHeight() {
        if (this.leftNode == null) {
            return 0;
        } else {
            return this.getLeftNode().getHeight() + 1;
        }

    }

    public int getRightHeight() {
        if (this.rightNode == null) {
            return 0;
        } else {
            return this.getRightNode().getHeight() + 1;
        }
    }
    public int getHeight ()
    {
        if (this.leftNode == null && this.rightNode== null)
        {
            return 0;
        }
        else
        {
            int leftH = 0;
            int rightH = 0;
            if (this.leftNode != null)
            {
                leftH++;
                leftH += this.getLeftNode().getHeight();
            }
            if (this.rightNode != null)
            {
                rightH++;
                rightH += this.getRightNode().getHeight();
            }
            return Math.max(leftH,rightH);
        }
    }

    public Node insert(int x, Node t) {
        if (t == null) {
            t = new Node(x);
        } else if (x < t.getValue()) {
            t.setLeft(insert(x, t.getLeftNode()));
        } else if (x > t.getValue()) {
            t.setRight(insert(x, t.getRightNode()));
        }
        return t;
    }

    public Node balance(Node n) {
        if (Math.abs(n.getLeftHeight() - n.getRightHeight()) == 2) {
            if (n.rightNode == null) {
                if (n.leftNode.leftNode != null) {
                    return n.LLRotation();
                }
                if (n.leftNode.rightNode != null) {
                    return n.LRRotation();
                }
            }
            if (n.leftNode == null) {
                if (n.rightNode.rightNode != null) {
                    return this.RRRotation();
                }
                if (n.rightNode.leftNode != null) {
                    return this.RLRotation();
                }
            }
        } else {
            if (n.getLeftNode() != null) {
                return this.getLeftNode().balance(n);
            }
            if (this.getRightNode() != null) {
                return this.getRightNode().balance(n);
            }
        }
        return this;
    }

    public Node LLRotation() {
        Node temp = this.leftNode;
        this.leftNode = null;
        temp.rightNode = this;
        return temp;
    }

    public Node RRRotation() {
        Node temp = this.rightNode;
        this.rightNode = temp.leftNode;
        try {
            temp.leftNode = (Node) this.clone();
        } catch (CloneNotSupportedException ex) {
        }
        this.value = temp.value;
        this.rightNode = temp.rightNode;
        this.leftNode = temp.leftNode;
        return temp;
    }

    public Node LRRotation() {
        this.leftNode = this.leftNode.RRRotation();
        return LLRotation();
    }

    public Node RLRotation() {
        this.rightNode = this.rightNode.RRRotation();
        return RRRotation();
    }

Thanks in advance