[GitHub] JaroslavTulach commented on a change in pull request #502: #270552: AbstractProjectClassPathImpl subtypes generally need to process Artifact.file to handle timestamped snapshots properly
JaroslavTulach commented on a change in pull request #502: #270552: AbstractProjectClassPathImpl subtypes generally need to process Artifact.file to handle timestamped snapshots properly URL: https://github.com/apache/incubator-netbeans/pull/502#discussion_r184287551 ## File path: maven/src/org/netbeans/modules/maven/classpath/AbstractProjectClassPathImpl.java ## @@ -206,4 +211,38 @@ public void removePropertyChangeListener(PropertyChangeListener propertyChangeLi return project.hashCode() ^ getClass().hashCode(); } +/** + * Like {@link Artifact#getFile} but when a timestamped snapshot is locally downloaded, uses that instead. + */ +protected static File getFile(Artifact art) { +File f = art.getFile(); Review comment: Am I basically OK with the overall change, but if I am the one who merges it, then I'd like to see a test for this new method: - subclass `NbTestCase` - in `setUp` use `getWorkDir()` and create illustrative file structure - in `testXXX` method(s) verify the `getFile` works as expected. Once such test is created, ping me and I merge. Alternatively find another person to merge your change. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For additional commands, e-mail: notifications-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] JaroslavTulach commented on a change in pull request #502: #270552: AbstractProjectClassPathImpl subtypes generally need to process Artifact.file to handle timestamped snapshots properly
JaroslavTulach commented on a change in pull request #502: #270552: AbstractProjectClassPathImpl subtypes generally need to process Artifact.file to handle timestamped snapshots properly URL: https://github.com/apache/incubator-netbeans/pull/502#discussion_r184287551 ## File path: maven/src/org/netbeans/modules/maven/classpath/AbstractProjectClassPathImpl.java ## @@ -206,4 +211,38 @@ public void removePropertyChangeListener(PropertyChangeListener propertyChangeLi return project.hashCode() ^ getClass().hashCode(); } +/** + * Like {@link Artifact#getFile} but when a timestamped snapshot is locally downloaded, uses that instead. + */ +protected static File getFile(Artifact art) { +File f = art.getFile(); Review comment: Am I basically OK with the overall change, but if I am the one who merges it, then I'd like to see a test for this new method: - subclass `NbTestCase` - in `setUp` use `getWorkDir()` and create illustrative file structure - in `testXXX` method(s) verify the `getFile` works as expected. Once such test is created, ping me and I merge. Alternatively find another person to merge your change. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For additional commands, e-mail: notifications-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] JaroslavTulach commented on a change in pull request #502: #270552: AbstractProjectClassPathImpl subtypes generally need to process Artifact.file to handle timestamped snapshots properly
JaroslavTulach commented on a change in pull request #502: #270552: AbstractProjectClassPathImpl subtypes generally need to process Artifact.file to handle timestamped snapshots properly URL: https://github.com/apache/incubator-netbeans/pull/502#discussion_r184286466 ## File path: maven/src/org/netbeans/modules/maven/nodes/DependencyNode.java ## @@ -785,6 +785,7 @@ private Project getDependencyProject() { return null; } URI uri = org.openide.util.Utilities.toURI(art.getFile()); +// TODO should be patched, along with other uses of Artifact.getFile among nodes Review comment: OK. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For additional commands, e-mail: notifications-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] JaroslavTulach commented on a change in pull request #502: #270552: AbstractProjectClassPathImpl subtypes generally need to process Artifact.file to handle timestamped snapshots properly
JaroslavTulach commented on a change in pull request #502: #270552: AbstractProjectClassPathImpl subtypes generally need to process Artifact.file to handle timestamped snapshots properly URL: https://github.com/apache/incubator-netbeans/pull/502#discussion_r181958801 ## File path: maven/src/org/netbeans/modules/maven/classpath/AbstractProjectClassPathImpl.java ## @@ -206,4 +211,33 @@ public void removePropertyChangeListener(PropertyChangeListener propertyChangeLi return project.hashCode() ^ getClass().hashCode(); } +/** + * Like {@link Artifact#getFile} but when a timestamped snapshot is locally downloaded, uses that instead. + */ +protected static File getFile(Artifact art) { +File f = art.getFile(); +if (f != null) { +if (art.isSnapshot() && !art.getVersion().equals(art.getBaseVersion())) { +String name = f.getName(); +int dot = name.lastIndexOf(/* DefaultRepositoryLayout.GROUP_SEPARATOR */'.'); +if (dot > 0 && name.substring(0, dot).endsWith(art.getBaseVersion())) { +File f2 = new File(f.getParentFile(), name.substring(0, dot - art.getBaseVersion().length()) + art.getVersion() + name.substring(dot)); +if (f2.isFile()) { Review comment: An illustrative test for this behavior might be beneficial for future maintenance. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For additional commands, e-mail: notifications-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
[GitHub] JaroslavTulach commented on a change in pull request #502: #270552: AbstractProjectClassPathImpl subtypes generally need to process Artifact.file to handle timestamped snapshots properly
JaroslavTulach commented on a change in pull request #502: #270552: AbstractProjectClassPathImpl subtypes generally need to process Artifact.file to handle timestamped snapshots properly URL: https://github.com/apache/incubator-netbeans/pull/502#discussion_r181958387 ## File path: maven/src/org/netbeans/modules/maven/queries/RepositoryMavenCPProvider.java ## @@ -179,7 +179,7 @@ private ClassPathImplementation createCompileCPI(MavenProject project, File bina items.add(ClassPathSupport.createResource(FileUtil.urlForArchiveOrDir(binary))); if (project != null) { for (Artifact s : project.getCompileArtifacts()) { -File file = s.getFile(); +File file = s.getFile(); // TODO perhaps needs patching Review comment: I guess you should make your mind. There is nobody to answer that TODO question otherwise. Or am I wrong @mkleint? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services - To unsubscribe, e-mail: notifications-unsubscr...@netbeans.apache.org For additional commands, e-mail: notifications-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists