@@ -110,6 +110,7 @@ public static void main(String[] args) throws Exception {
110110 }
111111 System .out .println ("Looking for source information for " + repoDestBaseName );
112112 File cloneDir = null ;
113+ String cloneDirString = "" ;
113114 String sourceURL = null ;// "https://github.com/" + sourceProj + "/" + sourceRepo + ".git";
114115 try {
115116 String sourceProj = teamAssignments .get (repoDestBaseName ).get (0 );
@@ -122,7 +123,8 @@ public static void main(String[] args) throws Exception {
122123 tmp .mkdirs ();
123124 }
124125 tmp .deleteOnExit ();
125- cloneDir = new File (tmp .getAbsolutePath () + "/" + sourceRepo );
126+ cloneDirString =tmp .getAbsolutePath () + "/" + sourceRepo ;
127+ cloneDir = new File (cloneDirString );
126128 if (cloneDir .exists ()) {
127129 System .out .println (cloneDir .getAbsolutePath () + " Exists" );
128130 List <String > commands = new ArrayList <String >();
@@ -152,9 +154,8 @@ public static void main(String[] args) throws Exception {
152154 }
153155 }
154156 } catch (Exception e ) {
155- e . printStackTrace ( );
157+ System . out . println ( "No source project found, leaving repos blank" );
156158 }
157-
158159 for (int i = 1 ; i <= numberOfTeams ; i ++) {
159160 String teamString = i > 9 ? "" + i : "0" + i ;
160161 GHTeam team = teams .get (teamDestBaseName + teamString );
@@ -168,21 +169,30 @@ public static void main(String[] args) throws Exception {
168169 System .out .println ("ERROR: Team has no members in JSON " + teamString );
169170 continue ;
170171 }
171-
172+ System . out . println ( "Team Found: " + team . getName ());
172173 for (String member : members ) {
174+ try {
173175 GHUser memberGH = github .getUser (member );
174176 if (memberGH == null ) {
175177 System .out .println ("ERROR GitHub user " + member + " does not exist" );
176178 continue ;
177179 }
178180 if (!team .hasMember (memberGH )) {
179- System .out .println ("Adding " + member + " to " + team .getName ());
180- team .add (memberGH , Role .MAINTAINER );
181+ try {
182+ team .add (memberGH , Role .MAINTAINER );
183+ System .out .println ("Adding " + member + " to " + team .getName ());
184+ }catch (Exception e ) {
185+ System .out .println ("Inviting " + member + " to " + team .getName ());
186+
187+ }
181188 }
182189
183190 allStudents .add (memberGH );
191+ }catch (Exception ex ) {
192+ System .err .println ("\r \n \r \n ERROR " +member +" is not a valid GitHub username\r \n \r \n " );
193+ }
184194 }
185- System . out . println ( "Team Found: " + team . getName ());
195+
186196 for (GHUser t : teachingStaff ) {
187197 if (!t .getLogin ().contains ("madhephaestus" ))
188198 team .add (t , Role .MAINTAINER );
@@ -235,8 +245,6 @@ public static void main(String[] args) throws Exception {
235245 commands .add ("master" ); // command
236246 run (commands , cloneDir );
237247
238- } else {
239- System .out .println ("Directory missing " + cloneDir .getAbsolutePath ());
240248 }
241249 }
242250 team .add (myTeamRepo , GHOrganization .Permission .ADMIN );
@@ -267,7 +275,11 @@ public static void main(String[] args) throws Exception {
267275 myTeam = dest .createTeam (hwTeam , GHOrganization .Permission .ADMIN , repositorie );
268276
269277 }
270- myTeam .add (u , Role .MAINTAINER );
278+ try {
279+ myTeam .add (u , Role .MAINTAINER );
280+ }catch (Exception ex ) {
281+ System .out .println ("Inviting " +u +" to " +hwTeam );
282+ }
271283 myTeam .add (repositorie , GHOrganization .Permission .ADMIN );
272284 for (GHUser t : teachingStaff ) {
273285 if (!t .getLogin ().contains ("madhephaestus" ))
0 commit comments