Improper integral equal to -pi with square root and Cauchy principal value

I'd like to know if the following proof for the value of $I$ is correct, and if there is a simpler solution to it. Also, I will probably encounter more improper integrals like this in the future, and I would appreciate general guidelines(if possible) for tackling such problems. (for instance if (x-x') is squared or to the power 3/2, with or without the square root next to it, or with the x' at the numerator being moved to the denominator)

All the integrals below are to be understood as principal value.

The following needs to be proven, for $x$ in $]0;1[$: $$I=\int_0^1 \frac{1}{x-x'}\sqrt{\frac{x'}{1-x'}} dx' = -\pi$$ Using $x'=\sin^2(t)$, $dx'=2 \cos t \sin t dt$ and using a partial fraction decomposition ($+x-x$): $$I=2\int_0^{\pi/2} \frac{\sin^2(t)}{x-\sin^2(t)}dt =2\left[-\frac{\pi}{2} +x\int_0^{\pi/2} \frac{1}{x-\sin^2(t)}dt \right]$$ It remains to prove that the second integral is $0$. Writing this integral $J$ and using $u=\cot(t)$,$du=-1/\sin^2(t) dt$, $1/\sin^2(t)=\cot^2(t)+1$ leads to: $$J=\int_0^{\pi/2} \frac{1}{x-\sin^2(t)}dt=\int_{+\infty}^{0}\frac{-du}{(u^2+1)x-1}dt =\frac{1}{1-x}\int_0^{+\infty} \frac{-du}{1-\frac{u^2x}{1-x}}$$ Last use $v=u\sqrt{x/(1-x)}$, $dv=du \sqrt{x/(1-x)}$ : $$J=\frac{-1}{\sqrt{x(1-x)}}\int_0^{+\infty} \frac{dv}{1-v^2}$$ The function under the remaining integral is an even function so its value is half the one taken on $R$. This function is extended to complex value and is written in the form $f(z)=1/((z-1)(z+1))$ which makes the two poles clearly visible. This function can be majored by a function proportional to $1/|z|^\alpha$ with $\alpha\in]1;2[$, so one can apply the Residue Theorem for Cauchy's integral on $R$. The residuals associated to the poles are $\mp\frac{1}{2}$. The principal value of the integral on $R$, from the Residue Theorem, is $\pi i$ times the sum of the residue, which gives $0$. $J$ will then also be $0$.