Phoenixasuga / google-api-java-client

Automatically exported from code.google.com/p/google-api-java-client
0 stars 0 forks source link

isSuccessStatusCode() ... cannot be applied to (int) #494

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It's been several years since I've worked with Java, but it seems like some of 
these errors are not deprecation related.  Any thoughts would be appreciated.  
Thanks.

philmorew@omega:~/Downloads/google_shopping_api$ javac -version
javac 1.6.0_20

-rw-r--r-- 1 philmorew philmorew 6301319 2012-05-17 16:59 
google-api-java-client-1.9.0-beta.zip

./structuredcontent_public/src/java/com/google/api/client/sample/structuredconte
nt/batchinsert/WorkerThread.java:210: isSuccessStatusCode() in 
com.google.api.client.http.HttpResponse cannot be applied to (int)
    if (HttpResponse.isSuccessStatusCode(response.getStatusCode())) {
                    ^
./structuredcontent_public/src/java/com/google/api/client/sample/structuredconte
nt/batchinsert/WorkerThread.java:260: isSuccessStatusCode() in 
com.google.api.client.http.HttpResponse cannot be applied to (int)
        if (!HttpResponse.isSuccessStatusCode(p.batchStatus.code)) {
                         ^
2 errors
./structuredcontent_public/src/java/com/google/api/client/sample/structuredconte
nt/batchdelete/BatchDeleteSample.java:205: isSuccessStatusCode() in 
com.google.api.client.http.HttpResponse cannot be applied to (int)
      if (HttpResponse.isSuccessStatusCode(response.getStatusCode())) {
                      ^
./structuredcontent_public/src/java/com/google/api/client/sample/structuredconte
nt/batchdelete/BatchDeleteSample.java:235: isSuccessStatusCode() in 
com.google.api.client.http.HttpResponse cannot be applied to (int)
        if (!HttpResponse.isSuccessStatusCode(p.batchStatus.code)) {
                         ^
2 errors
./structuredcontent_public/src/java/com/google/api/client/sample/structuredconte
nt/basicexample/StructuredContentSample.java:230: warning: [deprecation] 
getResponse() in com.google.api.client.http.HttpResponseException has been 
deprecated
      if ("application/vnd.google.gdata.error+xml".equals(e.getResponse().getContentType())) {
                                                           ^
./structuredcontent_public/src/java/com/google/api/client/sample/structuredconte
nt/basicexample/StructuredContentSample.java:232: warning: [deprecation] 
getResponse() in com.google.api.client.http.HttpResponseException has been 
deprecated
        ServiceErrors errors = e.getResponse().parseAs(ServiceErrors.class);
                                ^
2 warnings
./structuredcontent_public/src/java/com/google/api/client/sample/structuredconte
nt/utils/ClientLibraryUtils.java:116: warning: [deprecation] gdataVersion in 
com.google.api.client.googleapis.GoogleHeaders has been deprecated
        headers.gdataVersion = "1";
               ^
1 warning

Original issue reported on code.google.com by philmo...@yahoo.com on 20 May 2012 at 2:23

GoogleCodeExporter commented 9 years ago
It looks like the sample you are using was built using an old version of the 
library.
The above will compile with 1.9.0-beta if you change
HttpResponse.isSuccessStatusCode(code) to HttpStatusCodes.isSuccess(code)

Original comment by rmis...@google.com on 21 May 2012 at 2:42

GoogleCodeExporter commented 9 years ago
The libraries I am using are the ones that came with the v1.9.0 download.  Here 
are the results of your suggested change:

./structuredcontent_public/src/java/com/google/api/client/sample/structuredconte
nt/batchinsert/WorkerThread.java:211: cannot find symbol
symbol  : variable HttpStatusCodes
location: class 
com.google.api.client.sample.structuredcontent.batchinsert.WorkerThread
    if (HttpStatusCodes.isSuccess(response.getStatusCode())) {
        ^
./structuredcontent_public/src/java/com/google/api/client/sample/structuredconte
nt/batchinsert/WorkerThread.java:262: cannot find symbol
symbol  : variable HttpStatusCodes
location: class 
com.google.api.client.sample.structuredcontent.batchinsert.WorkerThread
        if (!HttpStatusCodes.isSuccess(p.batchStatus.code)) {
             ^
2 errors
./structuredcontent_public/src/java/com/google/api/client/sample/structuredconte
nt/batchdelete/BatchDeleteSample.java:206: cannot find symbol
symbol  : variable HttpStatusCodes
location: class 
com.google.api.client.sample.structuredcontent.batchdelete.BatchDeleteSample
      if (HttpStatusCodes.isSuccess(response.getStatusCode())) {
          ^
./structuredcontent_public/src/java/com/google/api/client/sample/structuredconte
nt/batchdelete/BatchDeleteSample.java:237: cannot find symbol
symbol  : variable HttpStatusCodes
location: class 
com.google.api.client.sample.structuredcontent.batchdelete.BatchDeleteSample
        if (!HttpStatusCodes.isSuccess(p.batchStatus.code)) {
             ^
2 errors

Phil

Original comment by philmo...@yahoo.com on 22 May 2012 at 4:55

GoogleCodeExporter commented 9 years ago
You are missing an import:

import com.google.api.client.http.HttpStatusCodes;

Original comment by rmis...@google.com on 22 May 2012 at 4:59

GoogleCodeExporter commented 9 years ago
Works...!   

Many Thanks....

Phil

Original comment by philmo...@yahoo.com on 22 May 2012 at 5:16