Commits

Artem Melentyev committed 75daa02

update VCSProcessor

  • Participants
  • Parent commits cf224ba

Comments (0)

Files changed (3)

demo/src/.git/index

Binary file modified.

processors/src/main/java/juast/processors/VCSProcessor.java

 import static java.lang.Math.max;
 
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 			try {
 				FileObject fo = filer.getResource(StandardLocation.SOURCE_PATH, pkg, file);
 				file = fo.toUri().getPath();
+			} catch (FileNotFoundException e) {
+				// internal class. ignore
+				return;
 			} catch (IllegalArgumentException e) {
 				// -sourcepath was not used. ignore
 			} catch (IOException e) {
 				List<String> lst = new ArrayList<String>(Arrays.asList(command.split(" ")));
 				lst.add(file.getPath());
 				Process p = new ProcessBuilder(lst).directory(base).start();
-				p.waitFor();
-				return getStatus(IOUtils.toString(p.getInputStream()));
+				return p.waitFor()!=0
+						? VCSStatus.UNKNOWN
+						: getStatus(IOUtils.toString(p.getInputStream()));
 			} catch (Exception e) {
 				throw new RuntimeException(e);
 			}
 
 		static VCSystem svn = new VCSystem("svn st", "? ", "M ", "A ");
 		static VCSystem hg = new VCSystem("hg st", "? ", "M ", "A ");
-		static VCSystem git = new VCSystem("git st -s", "?? ", "M ", "A ") {
+		static VCSystem git = new VCSystem("git status -s", "?? ", "M ", "A ") {
 			@Override
 			protected VCSStatus getStatus(String output) {
 				if (output.startsWith(" M ") || output.startsWith("MM "))

processors/src/test/sources/VCSTest.java

 import vcs.Import; // error
+import java.math.BigInteger; // ok
 public class VCSTest {
 	Class<?> clas = Import.class;
+	final BigInteger bi = BigInteger.ONE;
 }