I'm not sure why this is not passing. I meet all of the conditions except #2 and I meet that one I as through an exception if the numbers are not positive after attempting to convert them to positive. Any advice is appreciated.

package com.codegym.task.task14.task1420;
/*
GCD
*/
import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Solution {
public static void main(String[] args) throws Exception {
BufferedReader r = new BufferedReader(new InputStreamReader(System.in));
String one = r.readLine();
String two = r.readLine();
r.close();
int a = 0;
int b = 0;
try {
a = Integer.parseInt(one);
b = Integer.parseInt(two);
a = Math.abs(a);
b = Math.abs(b);
if(a <= 0 || b <= 0){
throw new Exception("Not a positive number");
}
}
catch (Exception e) {
System.out.println(e);
}
int gcd = 0;
for (int i = 1; i <= a && i <= b; i++) {
if(a%i==0 && b%i==0) {
gcd = i;
}
}
System.out.println(gcd);
}
}