You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by ru...@us.ibm.com on 1999/12/17 01:27:01 UTC

Re: Error in startup



>this might be an instance where Tomcat needs to be a bit more
>architecture-proof for portability.  This might actually be a problem
>in ProjectX (who knows?  ;-)

I wholeheartedly agree with this sentiment, and will agree to look into
this.  See my questions and comments below.

>It appears from the code, that what is desired, is knowing that the
>file is -not- an xml (I may be wrong).   Thus this little addition I put
>in the constructor of WARConnection, at line 90, seems to do the job
>fine:
>
>   public WARConnection (URL url)
>   throws MalformedURLException {
>      super(url);
>
>   parseSpecs(url);
>   setFileNameMap(new java.net.FileNameMap(){
>          public String getContentTypeFor(String fileName) {
>          if (fileName==null || fileName.length()<1)
>            return null;
>          String name=fileName.toLowerCase();
>          String type=null;
>          if (name.endsWith(".xml"))
>            type="text/xml";
>          else if (name.endsWith(".dtd"))
>            type="text/dtd";
>          else
>            type="application/unknown";
>          return type;
>          }
>
>   });
>   }

Since we don't know who sets fileNameMap in the normal case, I'm concerned
that this change may actually be destructive on platforms where this is set
correctly.  I would prefer a change to getContentType along the lines of
"if there is a fileNameMap, use it, otherwise return a type based on the
extension".  Would this work for you?

I'm also troubled by the following:

>It seems that on the platforms where I have seen Tomcat working,
>(Linux, Windows, Solaris), this call is working, thus fileNameMap
>is being previously set.

I've inserted System.out.printlns into this routine, and even intentionally
thrown exceptions.  As near as I can tell, this code isn't even being
executed on a Windows platform with 1.1.8.  I'll try 1.2.2 next and repeat
this on Linux.  I would feel much more comfortable knowing that any code I
commit was not going to cause a regression if I could at least see the if
statement being executed.

Would it be possible for you to provide a stack track so I can backtrack
and see where our execution paths diverge?