You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ol...@apache.org on 2011/10/21 11:15:38 UTC
svn commit: r1187232 -
/tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
Author: olamy
Date: Fri Oct 21 09:15:37 2011
New Revision: 1187232
URL: http://svn.apache.org/viewvc?rev=1187232&view=rev
Log:
prefer Set to prevent duplicate entries
Modified:
tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
Modified: tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java?rev=1187232&r1=1187231&r2=1187232&view=diff
==============================================================================
--- tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java (original)
+++ tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java Fri Oct 21 09:15:37 2011
@@ -38,7 +38,9 @@ import java.io.FilenameFilter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
/**
* @author Olivier Lamy
@@ -56,7 +58,8 @@ public class DefaultClassLoaderEntriesCa
public List<String> calculateClassPathEntries( ClassLoaderEntriesCalculatorRequest request )
throws TomcatRunException
{
- List<String> classLoaderEntries = new ArrayList<String>();
+ Set<String> classLoaderEntries = new HashSet<String>();
+ //List<String> classLoaderEntries = new ArrayList<String>( );
// add classes directories to loader
try
@@ -158,7 +161,8 @@ public class DefaultClassLoaderEntriesCa
}
}
}
- return classLoaderEntries;
+ return new ArrayList<String>( classLoaderEntries );
+ //return classLoaderEntries;
}
private void deleteDirectory( File directory, Log log )
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1187232 - /tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
Posted by Olivier Lamy <ol...@apache.org>.
2011/10/21 Konstantin Kolinko <kn...@gmail.com>:
> 2011/10/21 Olivier Lamy <ol...@apache.org>:
>
>> During dev on tomcat7 integration, I have just noticed that using the
>> embeded Tomcat class and adding a webapp as it:
>> tomcat.addWebapp( contextPath, path to a war file );
>> If the war file contains a context file ( META-INF/context.xml ) it's
>> not use automatically when adding the context/webapp.
>> So I have to manually add it with: setConfigFile ( new URL(
>> "jar:file:" + warPath + "!/META-INF/context.xml" ) ) (if exists in the
>> war).
>>
>> Do you consider that as an issue ?
>>
>
> Do you run unpacked war?
nope a packed war.
just using tomcat.addWebapp( contextPath, path to a war file );
>
> What if there is <appname>.xml in conf/Catalina/localhost? Currently
> it would take priority over the one inside the war file. Should it be
> ignored in your use case?
>
> (HostConfig#deployWAR(...)).
>
>
> I think that we use Tomcat class mostly for testing, but there is no
> test that covers this use case, so no wonder that there is no such
> code there. I think you can file an enhancement request.
k
>
> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>
--
Olivier Lamy
Talend : http://talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1187232 - /tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/10/21 Olivier Lamy <ol...@apache.org>:
> During dev on tomcat7 integration, I have just noticed that using the
> embeded Tomcat class and adding a webapp as it:
> tomcat.addWebapp( contextPath, path to a war file );
> If the war file contains a context file ( META-INF/context.xml ) it's
> not use automatically when adding the context/webapp.
> So I have to manually add it with: setConfigFile ( new URL(
> "jar:file:" + warPath + "!/META-INF/context.xml" ) ) (if exists in the
> war).
>
> Do you consider that as an issue ?
>
Do you run unpacked war?
What if there is <appname>.xml in conf/Catalina/localhost? Currently
it would take priority over the one inside the war file. Should it be
ignored in your use case?
(HostConfig#deployWAR(...)).
I think that we use Tomcat class mostly for testing, but there is no
test that covers this use case, so no wonder that there is no such
code there. I think you can file an enhancement request.
Best regards,
Konstantin Kolinko
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1187232 - /tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
Posted by Olivier Lamy <ol...@apache.org>.
2011/10/21 Konstantin Kolinko <kn...@gmail.com>:
> 2011/10/21 <ol...@apache.org>:
>> Author: olamy
>> Date: Fri Oct 21 09:15:37 2011
>> New Revision: 1187232
>>
>> URL: http://svn.apache.org/viewvc?rev=1187232&view=rev
>> Log:
>> prefer Set to prevent duplicate entries
>
>>
>> Modified:
>> tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
>>
>> Modified: tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
>> URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java?rev=1187232&r1=1187231&r2=1187232&view=diff
>> ==============================================================================
>> --- tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java (original)
>> +++ tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java Fri Oct 21 09:15:37 2011
>> @@ -38,7 +38,9 @@ import java.io.FilenameFilter;
>> import java.io.IOException;
>> import java.util.ArrayList;
>> import java.util.Collection;
>> +import java.util.HashSet;
>> import java.util.List;
>> +import java.util.Set;
>>
>> /**
>> * @author Olivier Lamy
>> @@ -56,7 +58,8 @@ public class DefaultClassLoaderEntriesCa
>> public List<String> calculateClassPathEntries( ClassLoaderEntriesCalculatorRequest request )
>> throws TomcatRunException
>> {
>> - List<String> classLoaderEntries = new ArrayList<String>();
>> + Set<String> classLoaderEntries = new HashSet<String>();
>> + //List<String> classLoaderEntries = new ArrayList<String>( );
>
>
> Maybe java.util.LinkedHashSet like Tomcat does in
> org.apache.catalina.startup.ClassLoaderFactory ?
>
> So that it will preserve order.
> (Though I do not know whether it is important for your use case or not).
Agree that can be important in a particular use case when users has
dependencies on an other war artifact. (thanks for the catch! )
During dev on tomcat7 integration, I have just noticed that using the
embeded Tomcat class and adding a webapp as it:
tomcat.addWebapp( contextPath, path to a war file );
If the war file contains a context file ( META-INF/context.xml ) it's
not use automatically when adding the context/webapp.
So I have to manually add it with: setConfigFile ( new URL(
"jar:file:" + warPath + "!/META-INF/context.xml" ) ) (if exists in the
war).
Do you consider that as an issue ?
>
>> // add classes directories to loader
>>
>
> Best regards,
> Konstantin Kolinko
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>
--
Olivier Lamy
Talend : http://talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1187232 - /tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
Posted by Konstantin Kolinko <kn...@gmail.com>.
2011/10/21 <ol...@apache.org>:
> Author: olamy
> Date: Fri Oct 21 09:15:37 2011
> New Revision: 1187232
>
> URL: http://svn.apache.org/viewvc?rev=1187232&view=rev
> Log:
> prefer Set to prevent duplicate entries
>
> Modified:
> tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
>
> Modified: tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java
> URL: http://svn.apache.org/viewvc/tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java?rev=1187232&r1=1187231&r2=1187232&view=diff
> ==============================================================================
> --- tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java (original)
> +++ tomcat/maven-plugin/trunk/common-tomcat-maven-plugin/src/main/java/org/apache/tomcat/maven/common/run/DefaultClassLoaderEntriesCalculator.java Fri Oct 21 09:15:37 2011
> @@ -38,7 +38,9 @@ import java.io.FilenameFilter;
> import java.io.IOException;
> import java.util.ArrayList;
> import java.util.Collection;
> +import java.util.HashSet;
> import java.util.List;
> +import java.util.Set;
>
> /**
> * @author Olivier Lamy
> @@ -56,7 +58,8 @@ public class DefaultClassLoaderEntriesCa
> public List<String> calculateClassPathEntries( ClassLoaderEntriesCalculatorRequest request )
> throws TomcatRunException
> {
> - List<String> classLoaderEntries = new ArrayList<String>();
> + Set<String> classLoaderEntries = new HashSet<String>();
> + //List<String> classLoaderEntries = new ArrayList<String>( );
Maybe java.util.LinkedHashSet like Tomcat does in
org.apache.catalina.startup.ClassLoaderFactory ?
So that it will preserve order.
(Though I do not know whether it is important for your use case or not).
> // add classes directories to loader
>
Best regards,
Konstantin Kolinko
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org