You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2007/06/28 09:51:28 UTC
svn commit: r551486 [1/2] - in /maven/sandbox/trunk/shared/maven-shared-jar:
./ src/main/java/org/apache/maven/shared/jar/
src/main/java/org/apache/maven/shared/jar/classes/
src/main/java/org/apache/maven/shared/jar/identification/
src/main/java/org/ap...
Author: brett
Date: Thu Jun 28 00:51:25 2007
New Revision: 551486
URL: http://svn.apache.org/viewvc?view=rev&rev=551486
Log:
Apply license, format, inspections
Added:
maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/JarAnalyzerTest.java (contents, props changed)
- copied, changed from r551474, maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/JarTest.java
Removed:
maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/JarTest.java
Modified:
maven/sandbox/trunk/shared/maven-shared-jar/pom.xml
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/DefaultJarAnalyzerFactory.java
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/JarAnalyzer.java
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/JarAnalyzerException.java
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/JarAnalyzerFactory.java
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/classes/ImportVisitor.java
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/classes/JarClasses.java
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/classes/JarClassesAnalysis.java
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/AbstractJarIdentificationExposer.java
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/EmptyRepositoryHashSearch.java
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/JarIdentification.java
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/JarIdentificationAnalysis.java
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/JarIdentificationExposer.java
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/RepositoryHashSearch.java
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/EmbeddedMavenModelExposer.java
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/FilenameExposer.java
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/JarClassesExposer.java
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/ManifestExposer.java
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/RepositorySearchExposer.java
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/StaticMainOutputExposer.java
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/TextFileExposer.java
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/TimestampExposer.java
maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/util/JarEntryComparator.java
maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/AbstractJarTestCase.java
maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/classes/ImportVisitorTest.java
maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/classes/JarClassesAnalyzerTest.java
maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/taxon/JarIdentificationAnalyzerTest.java
maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/taxon/exposers/EmbeddedMavenModelExposerTest.java
Modified: maven/sandbox/trunk/shared/maven-shared-jar/pom.xml
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/pom.xml?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/pom.xml (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/pom.xml Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
<?xml version="1.0" ?>
<!--
- ~ Copyright 2005-2006 The Apache Software Foundation.
+ ~ Licensed to the Apache Software Foundation (ASF) under one
+ ~ or more contributor license agreements. See the NOTICE file
+ ~ distributed with this work for additional information
+ ~ regarding copyright ownership. The ASF licenses this file
+ ~ to you under the Apache License, Version 2.0 (the
+ ~ "License"); you may not use this file except in compliance
+ ~ with the License. You may obtain a copy of the License at
~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
+ ~ http://www.apache.org/licenses/LICENSE-2.0
~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
+ ~ Unless required by applicable law or agreed to in writing,
+ ~ software distributed under the License is distributed on an
+ ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ ~ KIND, either express or implied. See the License for the
+ ~ specific language governing permissions and limitations
+ ~ under the License.
-->
<project
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/DefaultJarAnalyzerFactory.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/DefaultJarAnalyzerFactory.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/DefaultJarAnalyzerFactory.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/DefaultJarAnalyzerFactory.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.codehaus.plexus.PlexusConstants;
@@ -27,12 +30,12 @@
import java.io.File;
/**
- * DefaultJarAnalyzerFactory
+ * DefaultJarAnalyzerFactory
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
* @plexus.component role="org.apache.maven.shared.jar.JarAnalyzerFactory"
- * role-hint="default"
+ * role-hint="default"
*/
public class DefaultJarAnalyzerFactory
extends AbstractLogEnabled
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/JarAnalyzer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/JarAnalyzer.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/JarAnalyzer.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/JarAnalyzer.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.maven.shared.jar.classes.JarClasses;
@@ -44,7 +47,7 @@
/**
* A JarAnalyzer Toolbox for working with Jar Files.
- *
+ * <p/>
* Use the {@link JarAnalyzerFactory#getJarAnalyzer(File)} to obtain a valid JarAnalyzer object.
*
* @plexus.component role="org.apache.maven.shared.jar.JarAnalyzer" instantiation-strategy="per-lookup"
@@ -68,15 +71,18 @@
/**
* @plexus.requirement
+ * @noinspection UnusedDeclaration
*/
private JarClassesAnalysis classesAnalyzer;
/**
* @plexus.requirement
+ * @noinspection UnusedDeclaration
*/
private JarIdentificationAnalysis taxonAnalyzer;
-
- protected void setFile( File file ) throws JarAnalyzerException
+
+ protected void setFile( File file )
+ throws JarAnalyzerException
{
if ( file == null )
{
@@ -89,6 +95,7 @@
/**
* Compute the HashCode for this JarAnalyzer File.
*
+ * @param digester the digester to use to calculate the hash
* @return the hashcode, or null if not able to be computed.
*/
public String computeFileHash( Digester digester )
@@ -109,12 +116,12 @@
* <p/>
* Useful to see thru a recompile, recompression, or timestamp change.
*
+ * @param digester the digester to use to calculate the hash
* @return the hashcode, or null if not able to be computed.
*/
public String computeBytecodeHash( StreamingDigester digester )
{
Iterator it = entries.iterator();
- InputStream is;
try
{
@@ -125,7 +132,8 @@
if ( entry.getName().endsWith( ".class" ) )
{
- is = jarfile.getInputStream( entry );
+ // TODO: check if it needs to be closed!
+ InputStream is = jarfile.getInputStream( entry );
digester.update( is );
}
@@ -186,14 +194,13 @@
List ret = new ArrayList();
Pattern pat = Pattern.compile( regex );
- Matcher mat;
Iterator it = entries.iterator();
while ( it.hasNext() )
{
JarEntry entry = (JarEntry) it.next();
- mat = pat.matcher( entry.getName() );
+ Matcher mat = pat.matcher( entry.getName() );
if ( mat.find() )
{
ret.add( entry );
@@ -240,15 +247,15 @@
Collections.sort( entries, new JarEntryComparator() );
Manifest manifest = getManifest();
-
+
isSealed = false;
-
+
if ( manifest != null )
{
String sval = manifest.getMainAttributes().getValue( Attributes.Name.SEALED );
if ( StringUtils.isNotEmpty( sval ) )
{
- isSealed = sval.trim().equalsIgnoreCase( "true" );
+ isSealed = "true".equalsIgnoreCase( sval.trim() );
}
}
}
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/JarAnalyzerException.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/JarAnalyzerException.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/JarAnalyzerException.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/JarAnalyzerException.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
/**
@@ -22,11 +25,6 @@
public class JarAnalyzerException
extends Exception
{
- public JarAnalyzerException()
- {
- super();
- }
-
public JarAnalyzerException( String message, Throwable cause )
{
super( message, cause );
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/JarAnalyzerFactory.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/JarAnalyzerFactory.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/JarAnalyzerFactory.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/JarAnalyzerFactory.java Thu Jun 28 00:51:25 2007
@@ -1,32 +1,36 @@
package org.apache.maven.shared.jar;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import java.io.File;
/**
- * JarAnalyzerFactory
+ * JarAnalyzerFactory
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
*/
public interface JarAnalyzerFactory
{
- public static final String ROLE = JarAnalyzerFactory.class.getName();
-
- public JarAnalyzer getJarAnalyzer(File file) throws JarAnalyzerException;
+ String ROLE = JarAnalyzerFactory.class.getName();
+
+ JarAnalyzer getJarAnalyzer( File file )
+ throws JarAnalyzerException;
}
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/classes/ImportVisitor.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/classes/ImportVisitor.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/classes/ImportVisitor.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/classes/ImportVisitor.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar.classes;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.bcel.classfile.ConstantClass;
@@ -74,7 +77,7 @@
String name = constantClass.getBytes( javaClass.getConstantPool() );
// only strings with '/' character are to be considered.
- if ( name.indexOf( '/' ) == ( -1 ) )
+ if ( name.indexOf( '/' ) == -1 )
{
return;
}
@@ -119,7 +122,7 @@
}
// only strings with '/' character are to be considered.
- if ( ret.indexOf( '/' ) == ( -1 ) )
+ if ( ret.indexOf( '/' ) == -1 )
{
return;
}
@@ -136,7 +139,7 @@
// Double ".." indicates a bad class fail-fast.
// Seen when ConstantUTF8 Pool has regex patterns.
- if ( ret.indexOf( ".." ) != ( -1 ) )
+ if ( ret.indexOf( ".." ) != -1 )
{
return;
}
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/classes/JarClasses.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/classes/JarClasses.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/classes/JarClasses.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/classes/JarClasses.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar.classes;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.commons.collections.list.SetUniqueList;
@@ -31,7 +34,7 @@
private List packages;
private List classNames;
-
+
private List methods;
private boolean isDebugPresent;
@@ -43,7 +46,6 @@
*/
public JarClasses()
{
- super();
imports = SetUniqueList.decorate( new ArrayList() );
packages = SetUniqueList.decorate( new ArrayList() );
classNames = SetUniqueList.decorate( new ArrayList() );
@@ -96,27 +98,6 @@
return packages;
}
- public void setClassNames( List classes )
- {
- this.classNames = classes;
- }
-
- /**
- * @param imports The imports to set.
- */
- public void setImports( List imports )
- {
- this.imports = imports;
- }
-
- /**
- * @param packages The packages to set.
- */
- public void setPackages( List packages )
- {
- this.packages = packages;
- }
-
public boolean isDebugPresent()
{
return isDebugPresent;
@@ -136,7 +117,7 @@
{
this.jdkRevision = jdkRevision;
}
-
+
public void addMethod( String method )
{
this.methods.add( method );
@@ -145,10 +126,5 @@
public List getMethods()
{
return methods;
- }
-
- public void setMethods( List methods )
- {
- this.methods = methods;
}
}
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/classes/JarClassesAnalysis.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/classes/JarClassesAnalysis.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/classes/JarClassesAnalysis.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/classes/JarClassesAnalysis.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar.classes;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.bcel.classfile.ClassFormatException;
@@ -38,43 +41,48 @@
public class JarClassesAnalysis
extends AbstractLogEnabled
{
+ private static final double JAVA_1_6_CLASS_VERSION = 50.0;
+
+ private static final double JAVA_1_5_CLASS_VERSION = 49.0;
+
+ private static final double JAVA_1_4_CLASS_VERSION = 47.0;
+
+ private static final double JAVA_1_3_CLASS_VERSION = 46.0;
+
+ private static final double JAVA_1_2_CLASS_VERSION = 45.65536;
+
+ private static final double JAVA_1_1_CLASS_VERSION = 45.3;
+
/**
* Analyze and populate the <code>jar.information.classes</code> object.
+ *
+ * @param jar the jar analyzer to use
*/
public void analyze( JarAnalyzer jar )
{
- try
- {
- String jarfilename = jar.getFile().getAbsolutePath();
- JarClasses classes = new JarClasses();
+ String jarfilename = jar.getFile().getAbsolutePath();
+ JarClasses classes = new JarClasses();
- List classList = jar.getNameRegexEntryList( "[A-Za-z0-9]*\\.class$" );
+ List classList = jar.getNameRegexEntryList( "[A-Za-z0-9]*\\.class$" );
- classes.setDebugPresent( false );
+ classes.setDebugPresent( false );
- double maxVersion = 0.0;
+ double maxVersion = 0.0;
- Iterator it = classList.iterator();
- while ( it.hasNext() )
- {
- JarEntry entry = (JarEntry) it.next();
- String classname = entry.getName();
+ Iterator it = classList.iterator();
+ while ( it.hasNext() )
+ {
+ JarEntry entry = (JarEntry) it.next();
+ String classname = entry.getName();
+ try
+ {
ClassParser classParser = new ClassParser( jarfilename, classname );
-
- JavaClass javaClass;
- try
- {
- javaClass = classParser.parse();
- }
- catch ( ClassFormatException e )
- {
- getLogger().warn( "Unable to process class " + classname + " in JarAnalyzer File " + jar.getFile(), e );
- continue;
- }
+
+ JavaClass javaClass = classParser.parse();
String classSignature = javaClass.getClassName();
-
+
if ( !classes.isDebugPresent() )
{
if ( hasDebugSymbols( javaClass ) )
@@ -86,15 +94,15 @@
double classVersion = javaClass.getMajor();
if ( javaClass.getMinor() > 0 )
{
- classVersion = classVersion + ( 1 / (double) javaClass.getMinor() );
+ classVersion = classVersion + 1 / (double) javaClass.getMinor();
}
if ( classVersion > maxVersion )
{
maxVersion = classVersion;
}
-
- Method methods[] = javaClass.getMethods();
+
+ Method[] methods = javaClass.getMethods();
for ( int i = 0; i < methods.length; i++ )
{
classes.addMethod( classSignature + "." + methods[i].getName() + methods[i].getSignature() );
@@ -111,52 +119,57 @@
addImports( classes, importVisitor.getImports() );
}
-
- if ( maxVersion >= 50.0 )
- {
- classes.setJdkRevision( "1.6" );
- }
- else if ( maxVersion >= 49.0 )
+ catch ( ClassFormatException e )
{
- classes.setJdkRevision( "1.5" );
+ getLogger().warn( "Unable to process class " + classname + " in JarAnalyzer File " + jar.getFile(), e );
}
- else if ( maxVersion > 47.0 )
+ catch ( IOException e )
{
- classes.setJdkRevision( "1.4" );
- }
- else if ( maxVersion > 46.0 )
- {
- classes.setJdkRevision( "1.3" );
- }
- else if ( maxVersion > 45.65536 )
- {
- classes.setJdkRevision( "1.2" );
- }
- else if ( maxVersion > 45.3 )
- {
- classes.setJdkRevision( "1.1" );
- }
- else
- {
- classes.setJdkRevision( "1.0" );
+ getLogger().warn( "Unable to process JarAnalyzer File " + jar.getFile(), e );
}
+ }
- jar.setClasses( classes );
+ // TODO: check these since they are > instead of >=
+ if ( maxVersion >= JAVA_1_6_CLASS_VERSION )
+ {
+ classes.setJdkRevision( "1.6" );
}
- catch ( IOException e )
+ else if ( maxVersion >= JAVA_1_5_CLASS_VERSION )
{
- getLogger().warn( "Unable to process JarAnalyzer File " + jar.getFile(), e );
+ classes.setJdkRevision( "1.5" );
}
+ else if ( maxVersion > JAVA_1_4_CLASS_VERSION )
+ {
+ classes.setJdkRevision( "1.4" );
+ }
+ else if ( maxVersion > JAVA_1_3_CLASS_VERSION )
+ {
+ classes.setJdkRevision( "1.3" );
+ }
+ else if ( maxVersion > JAVA_1_2_CLASS_VERSION )
+ {
+ classes.setJdkRevision( "1.2" );
+ }
+ else if ( maxVersion > JAVA_1_1_CLASS_VERSION )
+ {
+ classes.setJdkRevision( "1.1" );
+ }
+ else
+ {
+ classes.setJdkRevision( "1.0" );
+ }
+
+ jar.setClasses( classes );
}
private boolean hasDebugSymbols( JavaClass javaClass )
{
boolean ret = false;
- Method methods[] = javaClass.getMethods();
+ Method[] methods = javaClass.getMethods();
for ( int i = 0; i < methods.length; i++ )
{
LineNumberTable linenumbers = methods[i].getLineNumberTable();
- if ( ( linenumbers != null ) && ( linenumbers.getLength() > 0 ) )
+ if ( linenumbers != null && linenumbers.getLength() > 0 )
{
ret = true;
break;
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/AbstractJarIdentificationExposer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/AbstractJarIdentificationExposer.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/AbstractJarIdentificationExposer.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/AbstractJarIdentificationExposer.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar.identification;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.maven.shared.jar.JarAnalyzer;
@@ -33,15 +36,15 @@
{
private JarAnalyzer jar;
- private List groupIds = null;
+ private List groupIds;
- private List artifactIds = null;
+ private List artifactIds;
- private List versions = null;
+ private List versions;
- private List names = null;
+ private List names;
- private List vendors = null;
+ private List vendors;
public void initialize()
{
@@ -70,17 +73,18 @@
return list;
}
- if ( list == null )
+ List value = list;
+ if ( value == null )
{
- list = new ArrayList();
+ value = new ArrayList();
}
- if ( !list.contains( id ) )
+ if ( !value.contains( id ) )
{
- list.add( id );
+ value.add( id );
}
- return list;
+ return value;
}
protected void addGroupId( String id )
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/EmptyRepositoryHashSearch.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/EmptyRepositoryHashSearch.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/EmptyRepositoryHashSearch.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/EmptyRepositoryHashSearch.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar.identification;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import java.util.Collections;
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/JarIdentification.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/JarIdentification.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/JarIdentification.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/JarIdentification.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar.identification;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import java.util.ArrayList;
@@ -25,7 +28,7 @@
*/
public class JarIdentification
{
- private boolean wellKnown = false;
+ private boolean wellKnown;
private String groupId;
@@ -77,11 +80,6 @@
public List getPotentials()
{
return potentials;
- }
-
- public void setPotentials( List potentials )
- {
- this.potentials = potentials;
}
public String getVendor()
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/JarIdentificationAnalysis.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/JarIdentificationAnalysis.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/JarIdentificationAnalysis.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/JarIdentificationAnalysis.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar.identification;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.maven.shared.jar.JarAnalyzer;
@@ -32,6 +35,7 @@
{
/**
* @plexus.requirement role="org.apache.maven.shared.jar.identification.JarIdentificationExposer"
+ * @noinspection UnusedDeclaration,MismatchedQueryAndUpdateOfCollection
*/
private List exposers;
@@ -169,11 +173,11 @@
private boolean isEmpty( Collection coll )
{
- return ( ( coll == null ) || coll.isEmpty() );
+ return coll == null || coll.isEmpty();
}
private boolean isNotEmpty( Collection coll )
{
- return ( ( coll != null ) && !coll.isEmpty() );
+ return coll != null && !coll.isEmpty();
}
}
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/JarIdentificationExposer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/JarIdentificationExposer.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/JarIdentificationExposer.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/JarIdentificationExposer.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar.identification;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.maven.shared.jar.JarAnalyzer;
@@ -26,7 +29,7 @@
*/
public interface JarIdentificationExposer
{
- static final String ROLE = JarIdentificationExposer.class.getName();
+ String ROLE = JarIdentificationExposer.class.getName();
void setJar( JarAnalyzer jar );
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/RepositoryHashSearch.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/RepositoryHashSearch.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/RepositoryHashSearch.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/RepositoryHashSearch.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar.identification;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import java.util.List;
@@ -23,11 +26,11 @@
*/
public interface RepositoryHashSearch
{
- public static final String ROLE = RepositoryHashSearch.class.getName();
+ String ROLE = RepositoryHashSearch.class.getName();
- public boolean isValid();
+ boolean isValid();
- public List searchFileHash( String hash );
+ List searchFileHash( String hash );
- public List searchBytecodeHash( String hash );
+ List searchBytecodeHash( String hash );
}
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/EmbeddedMavenModelExposer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/EmbeddedMavenModelExposer.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/EmbeddedMavenModelExposer.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/EmbeddedMavenModelExposer.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar.identification.exposers;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.maven.model.Model;
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/FilenameExposer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/FilenameExposer.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/FilenameExposer.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/FilenameExposer.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar.identification.exposers;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.maven.shared.jar.identification.AbstractJarIdentificationExposer;
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/JarClassesExposer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/JarClassesExposer.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/JarClassesExposer.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/JarClassesExposer.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar.identification.exposers;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.maven.shared.jar.classes.JarClasses;
@@ -33,6 +36,7 @@
{
/**
* @plexus.requirement
+ * @noinspection UnusedDeclaration
*/
private JarClassesAnalysis analyzer;
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/ManifestExposer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/ManifestExposer.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/ManifestExposer.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/ManifestExposer.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar.identification.exposers;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.maven.shared.jar.identification.AbstractJarIdentificationExposer;
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/RepositorySearchExposer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/RepositorySearchExposer.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/RepositorySearchExposer.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/RepositorySearchExposer.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar.identification.exposers;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.maven.artifact.Artifact;
@@ -36,11 +39,13 @@
{
/**
* @plexus.requirement role-hint="sha1"
+ * @noinspection UnusedDeclaration
*/
private Digester digester;
/**
* @plexus.requirement role-hint="sha1"
+ * @noinspection UnusedDeclaration
*/
private StreamingDigester streamingDigester;
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/StaticMainOutputExposer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/StaticMainOutputExposer.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/StaticMainOutputExposer.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/StaticMainOutputExposer.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar.identification.exposers;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.maven.shared.jar.identification.AbstractJarIdentificationExposer;
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/TextFileExposer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/TextFileExposer.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/TextFileExposer.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/TextFileExposer.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar.identification.exposers;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.maven.shared.jar.identification.AbstractJarIdentificationExposer;
@@ -66,41 +69,35 @@
List textVersions = new ArrayList();
List hits = getJar().getNameRegexEntryList( "[Vv][Ee][Rr][Ss][Ii][Oo][Nn]" ); //$NON-NLS-1$
- int hitcount = 0;
-
Iterator it = hits.iterator();
while ( it.hasNext() )
{
JarEntry entry = (JarEntry) it.next();
- if ( entry.getName().endsWith( ".class" ) ) //$NON-NLS-1$
- {
- // skip this entry. as it's a class file.
- continue;
- }
-
- getLogger().debug( "Version Hit: " + entry.getName() );
- InputStream is = getJar().getEntryInputStream( entry );
- BufferedReader br = new BufferedReader( new InputStreamReader( is ) );
- try
+ // skip this entry if it's a class file.
+ if ( !entry.getName().endsWith( ".class" ) ) //$NON-NLS-1$
{
- String line = br.readLine();
- // TODO: check for key=value pair.
- // TODO: maybe even for groupId entries.
-
- getLogger().debug( line );
- if ( StringUtils.isNotEmpty( line ) )
+ getLogger().debug( "Version Hit: " + entry.getName() );
+ InputStream is = getJar().getEntryInputStream( entry );
+ BufferedReader br = new BufferedReader( new InputStreamReader( is ) );
+ try
{
- textVersions.add( line );
+ String line = br.readLine();
+ // TODO: check for key=value pair.
+ // TODO: maybe even for groupId entries.
+
+ getLogger().debug( line );
+ if ( StringUtils.isNotEmpty( line ) )
+ {
+ textVersions.add( line );
+ }
+ }
+ catch ( IOException e )
+ {
+ getLogger().warn( "Unable to read line from " + entry.getName(), e );
}
- hitcount++;
- }
- catch ( IOException e )
- {
- getLogger().warn( "Unable to read line from " + entry.getName(), e );
}
}
-
return textVersions;
}
}
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/TimestampExposer.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/TimestampExposer.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/TimestampExposer.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/identification/exposers/TimestampExposer.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar.identification.exposers;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.commons.collections.Bag;
@@ -25,6 +28,7 @@
import java.util.Date;
import java.util.Iterator;
import java.util.List;
+import java.util.Locale;
import java.util.jar.JarEntry;
@@ -49,7 +53,7 @@
public void expose()
{
List entries = getJar().getNameRegexEntryList( ".*" ); //$NON-NLS-1$
- SimpleDateFormat tsformat = new SimpleDateFormat( "yyyyMMdd" ); //$NON-NLS-1$
+ SimpleDateFormat tsformat = new SimpleDateFormat( "yyyyMMdd", Locale.US ); //$NON-NLS-1$
Bag timestamps = new HashBag();
Iterator it = entries.iterator();
while ( it.hasNext() )
@@ -60,9 +64,9 @@
timestamps.add( timestamp );
}
+ it = timestamps.iterator();
String ts = "";
int tsmax = 0;
- it = timestamps.iterator();
while ( it.hasNext() )
{
String timestamp = (String) it.next();
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/util/JarEntryComparator.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/util/JarEntryComparator.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/util/JarEntryComparator.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/main/java/org/apache/maven/shared/jar/util/JarEntryComparator.java Thu Jun 28 00:51:25 2007
@@ -1,26 +1,29 @@
package org.apache.maven.shared.jar.util;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import java.util.Comparator;
import java.util.jar.JarEntry;
/**
- * JarEntryComparator
+ * JarEntryComparator
*
* @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
* @version $Id$
@@ -35,12 +38,12 @@
{
return 0;
}
-
+
if ( !( o2 instanceof JarEntry ) )
{
return 0;
}
-
+
JarEntry j1 = (JarEntry) o1;
JarEntry j2 = (JarEntry) o2;
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/AbstractJarTestCase.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/AbstractJarTestCase.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/AbstractJarTestCase.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/AbstractJarTestCase.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import junit.framework.AssertionFailedError;
@@ -30,19 +33,17 @@
/**
* Abstract JarAnalyzer TestCase
*/
-public class AbstractJarTestCase
+public abstract class AbstractJarTestCase
extends PlexusTestCase
{
- protected File basedir;
-
protected File testdir;
- public AbstractJarTestCase()
+ public void setUp()
+ throws Exception
{
- super();
- String userdir = System.getProperty( "user.dir" );
- this.basedir = new File( System.getProperty( "basedir", userdir ) );
- this.testdir = new File( basedir, "src/test" );
+ super.setUp();
+
+ this.testdir = new File( getBasedir(), "src/test" );
}
public File getSampleJarsDirectory()
@@ -54,8 +55,9 @@
{
return new File( testdir, "localrepo" );
}
-
- public JarAnalyzerFactory getJarAnalyzerFactory() throws Exception
+
+ public JarAnalyzerFactory getJarAnalyzerFactory()
+ throws Exception
{
return (JarAnalyzerFactory) lookup( JarAnalyzerFactory.ROLE, "default" );
}
@@ -72,12 +74,11 @@
{
List failures = new ArrayList();
Pattern pat = Pattern.compile( regex );
- Matcher mat;
Iterator it = coll.iterator();
while ( it.hasNext() )
{
String value = (String) it.next();
- mat = pat.matcher( value );
+ Matcher mat = pat.matcher( value );
if ( mat.find() )
{
failures.add( value );
Copied: maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/JarAnalyzerTest.java (from r551474, maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/JarTest.java)
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/JarAnalyzerTest.java?view=diff&rev=551486&p1=maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/JarTest.java&r1=551474&p2=maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/JarAnalyzerTest.java&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/JarTest.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/JarAnalyzerTest.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import java.io.File;
@@ -21,33 +24,25 @@
/**
* JarAnalyzer Test Case
*/
-public class JarTest
+public class JarAnalyzerTest
extends AbstractJarTestCase
{
private JarAnalyzer getJar( String filename )
- throws JarAnalyzerException
+ throws Exception
{
- try
- {
- File jarfile = new File( getSampleJarsDirectory(), filename );
- JarAnalyzer jar = getJarAnalyzerFactory().getJarAnalyzer( jarfile );
- return jar;
- }
- catch ( Exception e )
- {
- throw new JarAnalyzerException( "Can't load the JarAnalyzer component", e );
- }
+ File jarfile = new File( getSampleJarsDirectory(), filename );
+ return getJarAnalyzerFactory().getJarAnalyzer( jarfile );
}
public void testSealed()
- throws JarAnalyzerException
+ throws Exception
{
JarAnalyzer evil = getJar( "evil-sealed-regex-1.0.jar" );
assertTrue( evil.isSealed() );
}
public void testNotSealed()
- throws JarAnalyzerException
+ throws Exception
{
JarAnalyzer codec = getJar( "codec.jar" );
assertFalse( codec.isSealed() );
Propchange: maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/JarAnalyzerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/JarAnalyzerTest.java
------------------------------------------------------------------------------
svn:keywords = "Author Date Id Revision"
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/classes/ImportVisitorTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/classes/ImportVisitorTest.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/classes/ImportVisitorTest.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/classes/ImportVisitorTest.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar.classes;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.bcel.classfile.ClassFormatException;
Modified: maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/classes/JarClassesAnalyzerTest.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/classes/JarClassesAnalyzerTest.java?view=diff&rev=551486&r1=551485&r2=551486
==============================================================================
--- maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/classes/JarClassesAnalyzerTest.java (original)
+++ maven/sandbox/trunk/shared/maven-shared-jar/src/test/java/org/apache/maven/shared/jar/classes/JarClassesAnalyzerTest.java Thu Jun 28 00:51:25 2007
@@ -1,19 +1,22 @@
package org.apache.maven.shared.jar.classes;
/*
- * Copyright 2001-2006 The Apache Software Foundation.
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
*
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
*/
import org.apache.maven.shared.jar.AbstractJarTestCase;
@@ -32,20 +35,12 @@
throws Exception
{
File jarfile = new File( getSampleJarsDirectory(), filename );
- try
- {
JarAnalyzer jar = getJarAnalyzerFactory().getJarAnalyzer( jarfile );
JarClasses jclass = jar.getClasses();
assertNotNull( "JarClasses", jclass );
- return jclass;
- }
- catch(Exception e)
- {
- e.printStackTrace( );
- throw e;
- }
+ return jclass;
}
public void testAnalyzeJXR()
@@ -53,8 +48,8 @@
{
JarClasses jclass = getJarClasses( "jxr.jar" );
- assertTrue( "classes.imports.length > 0", ( jclass.getImports().size() > 0 ) );
- assertTrue( "classes.packages.length > 0", ( jclass.getPackages().size() > 0 ) );
+ assertTrue( "classes.imports.length > 0", jclass.getImports().size() > 0 );
+ assertTrue( "classes.packages.length > 0", jclass.getPackages().size() > 0 );
assertNotContainsRegex( "Import List", "[\\[\\)\\(\\;]", jclass.getImports() );
@@ -71,8 +66,8 @@
{
JarClasses jclass = getJarClasses( "ant.jar" );
- assertTrue( "classes.imports.length > 0", ( jclass.getImports().size() > 0 ) );
- assertTrue( "classes.packages.length > 0", ( jclass.getPackages().size() > 0 ) );
+ assertTrue( "classes.imports.length > 0", jclass.getImports().size() > 0 );
+ assertTrue( "classes.packages.length > 0", jclass.getPackages().size() > 0 );
assertNotContainsRegex( "Import List", "[\\[\\)\\(\\;]", jclass.getImports() );