Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #2958 eliminates CCE but leads to NPE #2974

Closed
cpovirk opened this issue Apr 14, 2023 · 7 comments
Closed

Fix for #2958 eliminates CCE but leads to NPE #2974

cpovirk opened this issue Apr 14, 2023 · 7 comments

Comments

@cpovirk
Copy link
Contributor

cpovirk commented Apr 14, 2023

Hi, we have one pesky test (one from an OfficeDev repo) that starts failing with the recent @InjectMocks changes. First it was the ClassCastException that was reported in #2958, but after the fix for that, it's a NullPointerException:

$ git clone git@github.com:cpovirk/ews-java-api.git -b mockitonpe # or check out 3ed334391d09f20e36ecd8e2a0efb3529085e1c6 if you prefer a SHA

$ cd ews-java-api

$ mvn clean install -Dtest=ChangeCollectionTest -Dmaven.javadoc.skip
...
java.lang.NullPointerException
  at org.mockito.internal.configuration.injection.filter.TypeBasedCandidateFilter.getSuperTypes(TypeBasedCandidateFilter.java:79)
  at org.mockito.internal.configuration.injection.filter.TypeBasedCandidateFilter.isCompatibleTypes(TypeBasedCandidateFilter.java:58)
  at org.mockito.internal.configuration.injection.filter.TypeBasedCandidateFilter.lambda$isCompatibleTypes$0(TypeBasedCandidateFilter.java:62)
  ...

I'll attach the full log, along with logs from the CCE days and from before the @InjectMocks changes.

@cpovirk
Copy link
Contributor Author

cpovirk commented Apr 14, 2023

Presumably Tim or someone is going to loop in @jfrantzius again, so let me get ahead of the game :)

(As best I can tell so far, the recent changes have been good things, just with the usual growing pains for us as we pick them up.)

@jfrantzius
Copy link
Contributor

jfrantzius commented Apr 15, 2023

Hi @cpovirk , when I try to mvn clean install that project, I get this error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project ews-java-api: Compilation failure: Compilation failure:
[ERROR] /Users/joerg.frantzius/git/ews-java-api/src/main/java/microsoft/exchange/webservices/data/core/request/ServiceRequestBase.java:[54,25] package javax.xml.ws.http does not exist
[ERROR] /Users/joerg.frantzius/git/ews-java-api/src/main/java/microsoft/exchange/webservices/data/property/complex/TimeChange.java:[43,22] package javax.xml.bind does not exist
[ERROR] /Users/joerg.frantzius/git/ews-java-api/src/main/java/microsoft/exchange/webservices/data/core/request/ServiceRequestBase.java:[406,14] cannot find symbol
[ERROR]   symbol:   class HTTPException
[ERROR]   location: class microsoft.exchange.webservices.data.core.request.ServiceRequestBase<T>
[ERROR] /Users/joerg.frantzius/git/ews-java-api/src/main/java/microsoft/exchange/webservices/data/core/response/ExecuteDiagnosticMethodResponse.java:[128,32] incompatible types: java.util.Iterator<javax.xml.stream.events.Namespace> cannot be converted to java.util.Iterator<javax.xml.stream.events.Attribute>
[ERROR] /Users/joerg.frantzius/git/ews-java-api/src/main/java/microsoft/exchange/webservices/data/property/complex/TimeChange.java:[224,22] cannot find symbol
[ERROR]   symbol:   variable DatatypeConverter
[ERROR]   location: class microsoft.exchange.webservices.data.property.complex.TimeChange
[ERROR] /Users/joerg.frantzius/git/ews-java-api/src/main/java/microsoft/exchange/webservices/data/property/complex/TimeChange.java:[229,22] cannot find symbol
[ERROR]   symbol:   variable DatatypeConverter
[ERROR]   location: class microsoft.exchange.webservices.data.property.complex.TimeChange
[ERROR] -> [Help 1]

Are there any magic incantations necessary besides mvn clean install?

@cpovirk
Copy link
Contributor Author

cpovirk commented Apr 15, 2023

Thanks for having a look!

Are you on the mockitonpe branch of my fork? The error you're seeing looks like the ones I had at master. I had to hack around some problems that arise with a Java version newer than Java 8.

@jfrantzius
Copy link
Contributor

Hm, did you push that branch? I can't find it here https://github.com/OfficeDev/ews-java-api/branches/all?query=mockitonpe

@cpovirk
Copy link
Contributor Author

cpovirk commented Apr 15, 2023

Ah, it's on my fork. (I'm not an OfficeDev developer; we just have the test imported into our own repo.)

https://github.com/cpovirk/ews-java-api/tree/mockitonpe

@jfrantzius
Copy link
Contributor

OK, I can reproduce the NPE, having a look ...

jfrantzius added a commit to jfrantzius/mockito that referenced this issue Apr 16, 2023
jfrantzius added a commit to jfrantzius/mockito that referenced this issue Apr 16, 2023
jfrantzius added a commit to jfrantzius/mockito that referenced this issue Apr 17, 2023
@cpovirk
Copy link
Contributor Author

cpovirk commented Apr 17, 2023

Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants