@@ -92,15 +92,15 @@ public static void main(String[] args) throws IOException {
9292 try {
9393 GetUpdateServiceResponse updateServiceStatus =
9494 serverUpdateApi .getServiceResource (projectId , serverId , region );
95- assert updateServiceStatus .getEnabled () != null ;
95+ Objects . requireNonNull ( updateServiceStatus .getEnabled ()) ;
9696 System .out .println ("* Update service enabled: " + updateServiceStatus .getEnabled ());
9797 } catch (ApiException e ) {
9898 // If response status is not found, update service is not enabled for the server
9999 if (e .getCode () == HttpURLConnection .HTTP_NOT_FOUND ) {
100100 System .out .println ("* Update service is not enabled for the server" );
101101 System .out .println ("* Enabling update service..." );
102102 String policyIdString = listUpdatePolicies .getItems ().get (0 ).getId ();
103- assert policyIdString != null ;
103+ Objects . requireNonNull ( policyIdString ) ;
104104 UUID policyId = UUID .fromString (policyIdString );
105105 serverUpdateApi .enableServiceResource (
106106 projectId ,
@@ -159,7 +159,7 @@ public static void main(String[] args) throws IOException {
159159 System .out .println ("\n List all update schedules" );
160160 GetUpdateSchedulesResponse listUpdateSchedules =
161161 serverUpdateApi .listUpdateSchedules (projectId , serverId , region );
162- assert listUpdateSchedules .getItems () != null ;
162+ Objects . requireNonNull ( listUpdateSchedules .getItems ()) ;
163163 for (UpdateSchedule schedule : listUpdateSchedules .getItems ()) {
164164 System .out .println ("*************************" );
165165 System .out .println ("* Schedule ID: " + schedule .getId ());
@@ -222,7 +222,7 @@ public static void main(String[] args) throws IOException {
222222 System .out .println ("\n List updates:" );
223223 GetUpdatesListResponse listUpdates =
224224 serverUpdateApi .listUpdates (projectId , serverId , region );
225- assert listUpdates .getItems () != null ;
225+ Objects . requireNonNull ( listUpdates .getItems ()) ;
226226 for (Update update : listUpdates .getItems ()) {
227227 System .out .println ("*************************" );
228228 System .out .println ("* ID: " + update .getId ());
0 commit comments