You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:05:00 UTC
[sling-org-apache-sling-scripting-java] 27/43: SLING-1732 - adding
ability to explicitly define the source file name
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.scripting.java-2.0.10
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-java.git
commit 574817cefd7689de1dfa8a8896842ed4c7a72693
Author: Justin Edelson <ju...@apache.org>
AuthorDate: Tue Oct 23 09:57:07 2012 +0000
SLING-1732 - adding ability to explicitly define the source file name
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/java@1401229 13f79535-47bb-0310-9956-ffa450edef68
---
pom.xml | 2 +-
.../apache/sling/scripting/java/impl/CompilationUnit.java | 15 ++++++++++++++-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/pom.xml b/pom.xml
index bf96000..057ff28 100644
--- a/pom.xml
+++ b/pom.xml
@@ -99,7 +99,7 @@
<dependency>
<groupId>org.apache.sling</groupId>
<artifactId>org.apache.sling.commons.compiler</artifactId>
- <version>2.0.0</version>
+ <version>2.0.7-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
diff --git a/src/main/java/org/apache/sling/scripting/java/impl/CompilationUnit.java b/src/main/java/org/apache/sling/scripting/java/impl/CompilationUnit.java
index 81d386f..ade8d8f 100644
--- a/src/main/java/org/apache/sling/scripting/java/impl/CompilationUnit.java
+++ b/src/main/java/org/apache/sling/scripting/java/impl/CompilationUnit.java
@@ -23,7 +23,7 @@ import java.io.Reader;
public class CompilationUnit
- implements org.apache.sling.commons.compiler.CompilationUnit {
+ implements org.apache.sling.commons.compiler.CompilationUnitWithSource {
private final SlingIOProvider ioProvider;
private final String className;
@@ -66,4 +66,17 @@ public class CompilationUnit
public long getLastModified() {
return this.ioProvider.lastModified(this.sourceFile);
}
+
+
+ /**
+ * @see org.apache.sling.commons.compiler.CompilationUnitWithSource#getLastModified()
+ */
+ public String getFileName() {
+ final int idx = this.sourceFile.lastIndexOf('/');
+ if (idx == -1) {
+ return this.sourceFile;
+ } else {
+ return this.sourceFile.substring(idx + 1);
+ }
+ }
}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.