jkesselm commented on PR #125:
URL: https://github.com/apache/xalan-java/pull/125#issuecomment-1823335534

   UserIDs: Ah. Probably left the git CLI logged in as Keshlam. (Kubyc's on its 
way toward becoming my primary home domain, I think.)
   
   .whatever files: Old habits. Back when we were writing Xalan, checking in 
IDE configurations was common practice as a way of making sure everyone was 
using the same formatting rules and so on. I think I've gotten to the point 
where I'm willing to concede that as no longer practical; it took me a while to 
adjust to that.
   
   Deleted xalan projects from Eclipse. Exited Eclipse. 
   mvn clean, to ensure against cross-contamination.
   Deleted .settings, .classpath, .project in xalan-project and its subdirs.
   Restarted Eclipse. (It's currently using OpenJDK 21, though compiling in 1.8 
mode).
   Import Maven xalan-project. Open serializer Version class. Run that class as 
Java App (without changing any run parameters).
   ```
   java.lang.RuntimeException: Cannot read properties file to extract version 
number information: 
        at org.apache.xml.serializer.Version.readProperties(Version.java:74)
        at org.apache.xml.serializer.Version.<clinit>(Version.java:55)
   Caused by: java.io.FileNotFoundException: 
serializer/target/maven-archiver/pom.properties (No such file or directory)
   ```
   Project/Update: No change.
   Project/Clean: No change.
   
   Looking at filesystem, I do see that we created
       serializer/target/classes/META-INF/maven/xalan/serializer/pom.properties
       serializer/target/maven-archiver/pom.properties
   
   Insert debugging in readProperties to print 
java.io.File("").getAbsolutePath()
       Current directory when launched this way defaults to 
/usr/keshlam/git/xalan-project/serializer
       So file being fetched is 
/usr/keshlam/git/xalan-project/serializer/serializer/...etc...
   If I explicitly change cd to xalan-project,  it tries to fetch 
/usr/keshlam/git/xalan-project/serializer/...etc...
      Closer, but still looking in source trees when you generated 
pom.properties into target.
   
   So it looks like, when serializer Version is invoked directly from Eclipse, 
its default current directory is the root of the source tree of serializer, 
rather than from object tree root of xalan-package as your path assumes. We 
could generate pom.properties into source and have build copy it to object...
   
   ... butI'm still nervous about what happens when some other project sets its 
own current directory before checking values from 
org.apache.xml.serializer.Version. I don't think merely making sure it's in 
both source and object trees fixes that one; the relative path will be wrong. 
Unless we can somehow create a path relative to the class's file, which is 
starting to get signifcantly ugly.
   
   There must be some way to get path relative to the current class, else 
fetching property files wouldn't work as expected, right? Or are folks always 
putting property files in known locations so they don't have to be relative, 
and using the library functions to load them from jarfiles so those can avoid 
the current-directory issue?
   
   If it happens, it must be possible...?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@xalan.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@xalan.apache.org
For additional commands, e-mail: dev-h...@xalan.apache.org

Reply via email to