File tree 2 files changed +7
-10
lines changed
main/java/com/google/gcloud/bigquery
test/java/com/google/gcloud/bigquery
2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -128,22 +128,19 @@ public boolean exists() {
128
128
129
129
/**
130
130
* Checks if this job has completed its execution, either failing or succeeding. If the job does
131
- * not exist this method returns {@code false}. To correctly wait for job's completion check that
132
- * the job exists first, using {@link #exists()}:
131
+ * not exist this method returns {@code true}. You can wait for job completion with:
133
132
* <pre> {@code
134
- * if (job.exists()) {
135
- * while(!job.isDone()) {
136
- * Thread.sleep(1000L);
137
- * }
133
+ * while(!job.isDone()) {
134
+ * Thread.sleep(1000L);
138
135
* }}</pre>
139
136
*
140
- * @return {@code true} if this job is in {@link JobStatus.State#DONE} state, {@code false} if the
141
- * state is not {@link JobStatus.State#DONE} or the job does not exist
137
+ * @return {@code true} if this job is in {@link JobStatus.State#DONE} state or if it does not
138
+ * exist, {@code false} if the state is not {@link JobStatus.State#DONE}
142
139
* @throws BigQueryException upon failure
143
140
*/
144
141
public boolean isDone () {
145
142
Job job = bigquery .getJob (jobId (), BigQuery .JobOption .fields (BigQuery .JobField .STATUS ));
146
- return job != null && job .status ().state () == JobStatus .State .DONE ;
143
+ return job == null || job .status ().state () == JobStatus .State .DONE ;
147
144
}
148
145
149
146
/**
Original file line number Diff line number Diff line change @@ -172,7 +172,7 @@ public void testIsDone_NotExists() throws Exception {
172
172
expect (bigquery .getJob (JOB_INFO .jobId (), expectedOptions )).andReturn (null );
173
173
replay (bigquery );
174
174
initializeJob ();
175
- assertFalse (job .isDone ());
175
+ assertTrue (job .isDone ());
176
176
}
177
177
178
178
@ Test
You can’t perform that action at this time.
0 commit comments