You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2019/11/27 15:17:13 UTC

[Bug 63970] New: java.lang.ClassCastException: org.apache.catalina.webresources.CachedResource$CachedResourceURLConnection cannot be cast to java.net.JarURLConnection

https://bz.apache.org/bugzilla/show_bug.cgi?id=63970

            Bug ID: 63970
           Summary: java.lang.ClassCastException:
                    org.apache.catalina.webresources.CachedResource$Cached
                    ResourceURLConnection cannot be cast to
                    java.net.JarURLConnection
           Product: Tomcat 8
           Version: 8.5.49
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: dmitry.treskunov@jetbrains.com
  Target Milestone: ----

The following code starts throwing a ClassCastException after upgrading to
Tomcat 8.5.49:

URL url = this.getClass().getResource("/preset.propetries");
String scheme = url.getProtocol();
if ("jar".equals(scheme)) {
      JarURLConnection con = (JarURLConnection) url.openConnection();
}


I guess it happens because of this commit
https://github.com/apache/tomcat/commit/03e7bc8487cb706adf1f56586948a7762dd42d14#diff-b718dcafc40f187cc9aaa1518e63033d

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 63970] java.lang.ClassCastException: org.apache.catalina.webresources.CachedResource$CachedResourceURLConnection cannot be cast to java.net.JarURLConnection

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63970

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 63970] java.lang.ClassCastException: org.apache.catalina.webresources.CachedResource$CachedResourceURLConnection cannot be cast to java.net.JarURLConnection

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63970

--- Comment #6 from Mark Thomas <ma...@apache.org> ---
Already done. Test build here:
http://people.apache.org/~markt/dev/v8.5.50-dev/

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 63970] java.lang.ClassCastException: org.apache.catalina.webresources.CachedResource$CachedResourceURLConnection cannot be cast to java.net.JarURLConnection

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63970

--- Comment #9 from Dmitry Treskunov <dm...@jetbrains.com> ---
Thanks!

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 63970] java.lang.ClassCastException: org.apache.catalina.webresources.CachedResource$CachedResourceURLConnection cannot be cast to java.net.JarURLConnection

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63970

--- Comment #7 from Dmitry Treskunov <dm...@jetbrains.com> ---
Hi, thanks, it works! 
Do you have any estimates for the 8.5.50 release?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 63970] java.lang.ClassCastException: org.apache.catalina.webresources.CachedResource$CachedResourceURLConnection cannot be cast to java.net.JarURLConnection

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63970

--- Comment #8 from Mark Thomas <ma...@apache.org> ---
I'm expecting to start the release early next week so it should be available
towards the end of next week / beginning of the following week.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 63970] java.lang.ClassCastException: org.apache.catalina.webresources.CachedResource$CachedResourceURLConnection cannot be cast to java.net.JarURLConnection

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63970

--- Comment #4 from Mark Thomas <ma...@apache.org> ---
OK. The upload is complete. The dev build is here:
http://people.apache.org/~markt/dev/v9.0.30-dev/

If you could download, test and report back that would be very helpful.

Note:
- this is NOT an official release
- this is NOT for production use
- this is ONLY for testing this bug
- please don't blame me if your server catches fire during testing ;)

(Sorry to go on about this but ASF releases have various bits of QA and legal
machinery behind them whereas test/dev builds like this don't and we need to
make sure folks reading this understand there is a difference.)

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 63970] java.lang.ClassCastException: org.apache.catalina.webresources.CachedResource$CachedResourceURLConnection cannot be cast to java.net.JarURLConnection

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63970

--- Comment #5 from Dmitry Treskunov <dm...@jetbrains.com> ---
Hi, thanks for the build. We are using the 8.5.x version, could you please
backport the fix there? Otherwise, I can't test it

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 63970] java.lang.ClassCastException: org.apache.catalina.webresources.CachedResource$CachedResourceURLConnection cannot be cast to java.net.JarURLConnection

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63970

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
Yes, this is caused by that commit.

The fix looks fairly simple but we are at the limit of what the current
implementation can reasonably do in terms of guaranteeing consistency. Chances
are you are going to end up accessing the resource directly, bypassing the
cache and running the risk of seeing inconsistent results. That said, the
chances of a resource inside a JAR changing should be a lot lower.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 63970] java.lang.ClassCastException: org.apache.catalina.webresources.CachedResource$CachedResourceURLConnection cannot be cast to java.net.JarURLConnection

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63970

--- Comment #3 from Mark Thomas <ma...@apache.org> ---
Don't worry - I've already fixed it. I was just waiting for a couple of test
builds to upload so I could point you towards them for testing. I'd like to try
and avoid further regressions in the next round of releases.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


[Bug 63970] java.lang.ClassCastException: org.apache.catalina.webresources.CachedResource$CachedResourceURLConnection cannot be cast to java.net.JarURLConnection

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63970

--- Comment #2 from Dmitry Treskunov <dm...@jetbrains.com> ---
Thanks for the answer. Sorry, I didn't quite understand, does it mean that you
are not going to fix it?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org