Electric field outside and within the cavity of a conductor In Griffith's book it has  written that the field in a cavity inside a conductor is zero due to any external field! And he explains it as:

"If a cavity surrounded by conducting material is itself empty of charge then the field within the cavity is zero. For any field line would have to begin and end on the cavity wall going from a plus charge to a minus charge. Letting that field line be part of a closed loop, the rest of which is entirely inside the conductor (where $E=0$) the integral $\oint \mathbf E\cdot\mathrm d\mathbf l$ distinctly positive. It follows that $E=0$ within an empty cavity and there is in fact no charge on the surface of the cavity"


Now if I draw a closed loop like the picture below: 

And try to find the line integral on this loop then from my reasoning as $E=0$ inside the conductor then the electric field outside the conductor should be zero because if not, then the line integral would not be zero. But evidently it's not zero there. So my question is where I am going wrong?
 A: The key difference is that, in the example from Griffiths' book, the portion of the loop inside the cavity follows a field line (if there are field lines), which implies that the electric field at every point in that portion of the loop is tangent to the loop and pointing in the same direction along the loop. That means, for the book's curve, the contribution to $\oint \vec{E}\cdot\mathrm{d}\vec{r}$ is either zero or positive. However, the curve you drew in the second picture doesn't necessarily follow an electric field line. If there is a nonzero electric field outside the conductor, then your curve will be going with the electric field for part of it and against the electric field for the other part. Those two contributions will cancel out.
In mathematical terms, if $\vec{r}(t)$ is a parametric curve that describes the loop, then the tangent vector to that curve as a function of $t$ is $\frac{\mathrm{d}}{\mathrm{d}t}\vec{r}(t)$. If the curve follows an electric field line (or if the electric field is zero everywhere), $\vec{E}\bigl(\vec{r}(t)\bigr) \parallel \frac{\mathrm{d}}{\mathrm{d}t}\vec{r}(t)$, so
$$\vec{E}\bigl(\vec{r}(t)\bigr)\cdot\frac{\mathrm{d}}{\mathrm{dt}}\vec{r}(t) = E\bigl(\vec{r}(t)\bigr)\biggl|\frac{\mathrm{d}}{\mathrm{dt}}\vec{r}(t)\biggr| \ge 0$$
The inequality comes from the fact that both quantities in the product are strictly nonnegative at every point. In fact, the only way this can be equal to zero is if $E\bigl(\vec{r}(t)\bigr)$ is zero at every point along the curve. Then, you can use that fact to find that
$$\oint \vec{E}\cdot\mathrm{d}\vec{r} =\int_{0}^{1}\vec{E}\bigl(\vec{r}(t)\bigr)\cdot\frac{\mathrm{d}}{\mathrm{dt}}\vec{r}(t)\ \mathrm{d}t \ge 0$$
