This is an automated email from the ASF dual-hosted git repository.
enorman pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-mime.git
The following commit(s) were added to refs/heads/master by this push:
new cd3d7f9 SLING-12983 Update to Parent 62 and apply spotless formatting
cd3d7f9 is described below
commit cd3d7f9696effd050345e1cc6944e18a6d5abfa5
Author: Eric Norman <[email protected]>
AuthorDate: Wed Oct 29 13:22:07 2025 -0700
SLING-12983 Update to Parent 62 and apply spotless formatting
---
pom.xml | 84 +++++++++++-----------
.../sling/commons/mime/MimeTypeProvider.java | 27 +++----
.../apache/sling/commons/mime/MimeTypeService.java | 27 +++----
.../commons/mime/internal/MimeBundleActivator.java | 8 +--
.../commons/mime/internal/MimeTypeServiceImpl.java | 84 +++++++++++-----------
.../mime/internal/MimeTypeWebConsolePlugin.java | 35 ++++-----
.../mime/internal/TikaMimeTypeProvider.java | 26 +++----
.../mime/internal/MimeTypeServiceImplTest.java | 53 +++++++-------
.../mime/internal/TikaMimeTypeProviderTest.java | 30 ++++----
9 files changed, 181 insertions(+), 193 deletions(-)
diff --git a/pom.xml b/pom.xml
index 3290d2e..bb19072 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<parent>
<groupId>org.apache.sling</groupId>
<artifactId>sling-bundle-parent</artifactId>
- <version>52</version>
+ <version>62</version>
<relativePath />
</parent>
@@ -31,52 +31,18 @@
<version>2.3.1-SNAPSHOT</version>
<name>Apache Sling Commons MIME</name>
- <description>
- Support for configurable MIME type mapping and querying
- </description>
+ <description>Support for configurable MIME type mapping and
querying</description>
<scm>
<connection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-mime.git</connection>
<developerConnection>scm:git:https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-mime.git</developerConnection>
-
<url>https://github.com/apache/sling-org-apache-sling-commons-mime.git</url>
- <tag>org.apache.sling.commons.mime-2.3.0</tag>
- </scm>
+ <tag>HEAD</tag>
+
<url>https://github.com/apache/sling-org-apache-sling-commons-mime/tree/${project.scm.tag}</url>
+ </scm>
- <build>
- <plugins>
- <plugin>
- <groupId>biz.aQute.bnd</groupId>
- <artifactId>bnd-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>biz.aQute.bnd</groupId>
- <artifactId>bnd-baseline-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.rat</groupId>
- <artifactId>apache-rat-plugin</artifactId>
- <configuration>
- <excludes>
-
<exclude>src/main/resources/res/jquery.treeTable.css</exclude>
-
<exclude>src/main/resources/res/jquery.treeTable.min.js</exclude>
- </excludes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <excludePackageNames>
- org.apache.sling.commons.mime.internal
- </excludePackageNames>
- </configuration>
- </plugin>
- </plugins>
- </reporting>
+ <properties>
+ <sling.java.version>11</sling.java.version>
+ </properties>
<dependencies>
<!-- OSGi -->
<dependency>
@@ -122,4 +88,38 @@
<scope>test</scope>
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>biz.aQute.bnd</groupId>
+ <artifactId>bnd-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>biz.aQute.bnd</groupId>
+ <artifactId>bnd-baseline-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.rat</groupId>
+ <artifactId>apache-rat-plugin</artifactId>
+ <configuration>
+ <excludes>
+
<exclude>src/main/resources/res/jquery.treeTable.css</exclude>
+
<exclude>src/main/resources/res/jquery.treeTable.min.js</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+
<excludePackageNames>org.apache.sling.commons.mime.internal</excludePackageNames>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
</project>
diff --git a/src/main/java/org/apache/sling/commons/mime/MimeTypeProvider.java
b/src/main/java/org/apache/sling/commons/mime/MimeTypeProvider.java
index 595f959..63f4f38 100644
--- a/src/main/java/org/apache/sling/commons/mime/MimeTypeProvider.java
+++ b/src/main/java/org/apache/sling/commons/mime/MimeTypeProvider.java
@@ -1,18 +1,20 @@
/*
- * 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 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
*
- * 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.
*/
package org.apache.sling.commons.mime;
@@ -68,5 +70,4 @@ public interface MimeTypeProvider {
* @see #getMimeType(String)
*/
String getExtension(String mimeType);
-
}
diff --git a/src/main/java/org/apache/sling/commons/mime/MimeTypeService.java
b/src/main/java/org/apache/sling/commons/mime/MimeTypeService.java
index 68fb5d6..6423b3f 100644
--- a/src/main/java/org/apache/sling/commons/mime/MimeTypeService.java
+++ b/src/main/java/org/apache/sling/commons/mime/MimeTypeService.java
@@ -1,18 +1,20 @@
/*
- * 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 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
*
- * 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.
*/
package org.apache.sling.commons.mime;
@@ -103,5 +105,4 @@ public interface MimeTypeService {
Map<String, String> getMimeMap();
Map<String, String> getExtensionMap();
-
}
diff --git
a/src/main/java/org/apache/sling/commons/mime/internal/MimeBundleActivator.java
b/src/main/java/org/apache/sling/commons/mime/internal/MimeBundleActivator.java
index a36229d..0afdeff 100644
---
a/src/main/java/org/apache/sling/commons/mime/internal/MimeBundleActivator.java
+++
b/src/main/java/org/apache/sling/commons/mime/internal/MimeBundleActivator.java
@@ -31,15 +31,13 @@ public class MimeBundleActivator implements BundleActivator
{
@Override
public void start(final BundleContext context) throws Exception {
try {
- context.registerService(MimeTypeProvider.class,
- new TikaMimeTypeProvider() {},
- null);
+ context.registerService(MimeTypeProvider.class, new
TikaMimeTypeProvider() {}, null);
logger.info("Apache Tika detected, using it for MIME type
detection");
- } catch ( final Throwable t ) {
+ } catch (final Throwable t) {
// don't care
}
}
-
+
@Override
public void stop(final BundleContext context) throws Exception {
// nothing to do
diff --git
a/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImpl.java
b/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImpl.java
index 7c57a64..3139c6a 100644
---
a/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImpl.java
+++
b/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImpl.java
@@ -1,18 +1,20 @@
/*
- * 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 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
*
- * 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.
*/
package org.apache.sling.commons.mime.internal;
@@ -49,36 +51,39 @@ import org.slf4j.LoggerFactory;
* The <code>MimeTypeServiceImpl</code> is the official implementation of the
* {@link MimeTypeService} interface.
*/
-@Component(service = MimeTypeService.class,
- property = {
+@Component(
+ service = MimeTypeService.class,
+ property = {
Constants.SERVICE_VENDOR + "=The Apache Software Foundation",
Constants.SERVICE_DESCRIPTION + "=Apache Sling Commons MIME Type
Service"
- })
+ })
@Designate(ocd = MimeTypeServiceImpl.Config.class)
public class MimeTypeServiceImpl implements MimeTypeService, BundleListener {
public static final String CORE_MIME_TYPES = "/META-INF/core_mime.types";
public static final String MIME_TYPES = "/META-INF/mime.types";
-
- @ObjectClassDefinition(name = "Apache Sling Commons MIME Type Service",
- description = "The Sling Commons MIME Type Service provides
support for " +
- "maintaining and configuring MIME Type mappings.")
+
+ @ObjectClassDefinition(
+ name = "Apache Sling Commons MIME Type Service",
+ description = "The Sling Commons MIME Type Service provides
support for "
+ + "maintaining and configuring MIME Type mappings.")
public @interface Config {
- @AttributeDefinition(name = "MIME Types",
- description = "Configures additional MIME type mappings in the
"+
- "traditional mime.types file format: Each property is a blank
space separated "+
- "list of strings where the first string is the MIME type and
the rest of the "+
- "strings are filename extensions referring to the MIME type.
Using this "+
- "property additional MIME type mappings may be defined.
Existing MIME type "+
- "mappings cannot be redefined and setting such mappings in
this property "+
- "has no effect. For a list of existing mappings refer to the
MIME Types page.")
+ @AttributeDefinition(
+ name = "MIME Types",
+ description = "Configures additional MIME type mappings in the
"
+ + "traditional mime.types file format: Each property
is a blank space separated "
+ + "list of strings where the first string is the MIME
type and the rest of the "
+ + "strings are filename extensions referring to the
MIME type. Using this "
+ + "property additional MIME type mappings may be
defined. Existing MIME type "
+ + "mappings cannot be redefined and setting such
mappings in this property "
+ + "has no effect. For a list of existing mappings
refer to the MIME Types page.")
String[] mime_types();
}
private Logger log = LoggerFactory.getLogger(this.getClass());
-
+
private Map<String, String> mimeMap = new HashMap<>();
private Map<String, String> extensionMap = new HashMap<>();
@@ -130,8 +135,7 @@ public class MimeTypeServiceImpl implements
MimeTypeService, BundleListener {
@Override
public void registerMimeType(String mimeType, String... extensions) {
- if (mimeType == null || mimeType.length() == 0 || extensions == null
- || extensions.length == 0) {
+ if (mimeType == null || mimeType.length() == 0 || extensions == null
|| extensions.length == 0) {
return;
}
@@ -146,8 +150,7 @@ public class MimeTypeServiceImpl implements
MimeTypeService, BundleListener {
String oldMimeType = mimeMap.get(extension);
if (oldMimeType == null) {
- log.debug("registerMimeType: Add mapping "
- + extension + "=" + mimeType);
+ log.debug("registerMimeType: Add mapping " + extension +
"=" + mimeType);
this.mimeMap.put(extension, mimeType);
@@ -157,13 +160,10 @@ public class MimeTypeServiceImpl implements
MimeTypeService, BundleListener {
} else {
- log.info(
- "registerMimeType: Ignoring mapping " + extension + "="
+ log.info("registerMimeType: Ignoring mapping " + extension
+ "="
+ mimeType + ": Mapping " + extension + "="
+ oldMimeType + " already exists");
-
}
-
}
}
@@ -174,8 +174,7 @@ public class MimeTypeServiceImpl implements
MimeTypeService, BundleListener {
@Override
public void registerMimeType(InputStream mimeTabStream) throws IOException
{
- BufferedReader br = new BufferedReader(new InputStreamReader(
- mimeTabStream, "ISO-8859-1"));
+ BufferedReader br = new BufferedReader(new
InputStreamReader(mimeTabStream, "ISO-8859-1"));
String line;
while ((line = br.readLine()) != null) {
@@ -203,9 +202,8 @@ public class MimeTypeServiceImpl implements
MimeTypeService, BundleListener {
// register maps of existing bundles
Bundle[] bundles = context.getBundles();
for (int i = 0; i < bundles.length; i++) {
- if ((bundles[i].getState() & (Bundle.RESOLVED | Bundle.STARTING
- | Bundle.ACTIVE | Bundle.STOPPING)) != 0
- && bundles[i].getBundleId() != bundle.getBundleId()) {
+ if ((bundles[i].getState() & (Bundle.RESOLVED | Bundle.STARTING |
Bundle.ACTIVE | Bundle.STOPPING)) != 0
+ && bundles[i].getBundleId() != bundle.getBundleId()) {
this.registerMimeType(bundles[i].getEntry(MIME_TYPES));
}
}
@@ -284,8 +282,7 @@ public class MimeTypeServiceImpl implements
MimeTypeService, BundleListener {
this.registerMimeType(ins);
} catch (IOException ioe) {
// log but don't actually care
- log.warn("An error occurred reading "
- + mimetypes, ioe);
+ log.warn("An error occurred reading " + mimetypes, ioe);
} finally {
if (ins != null) {
try {
@@ -313,5 +310,4 @@ public class MimeTypeServiceImpl implements
MimeTypeService, BundleListener {
this.registerMimeType(parts[0], extensions);
}
}
-
}
diff --git
a/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeWebConsolePlugin.java
b/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeWebConsolePlugin.java
index e5fb9c0..8033cfc 100644
---
a/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeWebConsolePlugin.java
+++
b/src/main/java/org/apache/sling/commons/mime/internal/MimeTypeWebConsolePlugin.java
@@ -18,6 +18,11 @@
*/
package org.apache.sling.commons.mime.internal;
+import javax.servlet.Servlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
import java.io.IOException;
import java.io.PrintWriter;
import java.net.URL;
@@ -27,11 +32,6 @@ import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
-import javax.servlet.Servlet;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
import org.apache.sling.commons.mime.MimeTypeService;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
@@ -39,12 +39,11 @@ import org.osgi.service.component.annotations.Reference;
@Component(
service = Servlet.class,
property = {
- "felix.webconsole.label=" + MimeTypeWebConsolePlugin.LABEL,
- "felix.webconsole.title=" + MimeTypeWebConsolePlugin.TITLE,
- "felix.webconsole.category=Sling",
- "felix.webconsole.css=" + MimeTypeWebConsolePlugin.CSS_REFS
- }
- )
+ "felix.webconsole.label=" + MimeTypeWebConsolePlugin.LABEL,
+ "felix.webconsole.title=" + MimeTypeWebConsolePlugin.TITLE,
+ "felix.webconsole.category=Sling",
+ "felix.webconsole.css=" + MimeTypeWebConsolePlugin.CSS_REFS
+ })
public class MimeTypeWebConsolePlugin extends HttpServlet {
/** Serial Version */
@@ -62,8 +61,7 @@ public class MimeTypeWebConsolePlugin extends HttpServlet {
private MimeTypeService mimeTypeService;
@Override
- protected void doGet(HttpServletRequest request,
- HttpServletResponse response) throws IOException {
+ protected void doGet(HttpServletRequest request, HttpServletResponse
response) throws IOException {
Map<String, Set<String>> mimetab = new TreeMap<String, Set<String>>();
@@ -91,8 +89,7 @@ public class MimeTypeWebConsolePlugin extends HttpServlet {
PrintWriter pw = response.getWriter();
- pw.println("<script type='text/javascript' src='" + RES_LOC
- + "/jquery.treeTable.min.js'></script>");
+ pw.println("<script type='text/javascript' src='" + RES_LOC +
"/jquery.treeTable.min.js'></script>");
pw.println("<script type='text/javascript'>");
pw.println(" $(document).ready(function() {");
pw.println(" $('#mimetabtable').treeTable({ treeColumn: 1 });");
@@ -101,8 +98,8 @@ public class MimeTypeWebConsolePlugin extends HttpServlet {
pw.println("<div id='plugin_content'>");
pw.println("<div class='fullwidth'>");
- pw.println("<div class='statusline'>Statistic: " + mimetab.size()
- + " MIME Types, " + numExt + " Extensions</div>");
+ pw.println("<div class='statusline'>Statistic: " + mimetab.size() + "
MIME Types, " + numExt
+ + " Extensions</div>");
pw.println("</div>");
pw.println("<div class='table'>");
@@ -137,8 +134,7 @@ public class MimeTypeWebConsolePlugin extends HttpServlet {
pw.println("</tr>");
}
- pw.println("<tr id='" + entry.getKey().replace('/', '-')
- + "' class='child-of-" + currentMajor + "'>");
+ pw.println("<tr id='" + entry.getKey().replace('/', '-') + "'
class='child-of-" + currentMajor + "'>");
pw.println("<td> </td>");
pw.println("<td>" + entry.getKey() + "</td>");
pw.println("<td>" + entry.getValue() + "</td>");
@@ -172,5 +168,4 @@ public class MimeTypeWebConsolePlugin extends HttpServlet {
return null;
}
-
}
diff --git
a/src/main/java/org/apache/sling/commons/mime/internal/TikaMimeTypeProvider.java
b/src/main/java/org/apache/sling/commons/mime/internal/TikaMimeTypeProvider.java
index 55ee458..02e228e 100644
---
a/src/main/java/org/apache/sling/commons/mime/internal/TikaMimeTypeProvider.java
+++
b/src/main/java/org/apache/sling/commons/mime/internal/TikaMimeTypeProvider.java
@@ -1,18 +1,20 @@
/*
- * 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 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
*
- * 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.
*/
package org.apache.sling.commons.mime.internal;
diff --git
a/src/test/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImplTest.java
b/src/test/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImplTest.java
index 097ab57..c303b18 100644
---
a/src/test/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImplTest.java
+++
b/src/test/java/org/apache/sling/commons/mime/internal/MimeTypeServiceImplTest.java
@@ -1,27 +1,28 @@
/*
- * 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 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
*
- * 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.
*/
package org.apache.sling.commons.mime.internal;
import java.io.IOException;
import java.io.InputStream;
-import org.apache.sling.commons.mime.MimeTypeProvider;
-
import junit.framework.TestCase;
+import org.apache.sling.commons.mime.MimeTypeProvider;
/**
* The <code>MimeTypeServiceImplTest</code>
@@ -68,17 +69,15 @@ public class MimeTypeServiceImplTest extends TestCase {
this.service.registerMimeType(TEXT_PLAIN, TXT, LOG, APT);
- final String [] exts = { TXT, LOG, APT };
- for(String ext : exts) {
+ final String[] exts = {TXT, LOG, APT};
+ for (String ext : exts) {
assertEquals("Extension " + ext + " (1)", TEXT_PLAIN,
this.service.getMimeType("file." + ext));
assertEquals("Extension " + ext + " (2)", TEXT_PLAIN,
this.service.getMimeType(ext));
}
- assertEquals(TEXT_PLAIN,
- this.service.getMimeType(("file." + TXT).toUpperCase()));
+ assertEquals(TEXT_PLAIN, this.service.getMimeType(("file." +
TXT).toUpperCase()));
assertEquals(TEXT_PLAIN,
this.service.getMimeType((TXT).toUpperCase()));
- assertEquals(TEXT_PLAIN,
- this.service.getMimeType(("file." + LOG).toUpperCase()));
+ assertEquals(TEXT_PLAIN, this.service.getMimeType(("file." +
LOG).toUpperCase()));
assertEquals(TEXT_PLAIN,
this.service.getMimeType((LOG).toUpperCase()));
assertNull(this.service.getMimeType(GIF));
@@ -90,17 +89,15 @@ public class MimeTypeServiceImplTest extends TestCase {
loadMimeTypes(MimeTypeServiceImpl.CORE_MIME_TYPES);
loadMimeTypes(MimeTypeServiceImpl.MIME_TYPES);
- final String [] exts = { TXT, LOG, APT };
- for(String ext : exts) {
+ final String[] exts = {TXT, LOG, APT};
+ for (String ext : exts) {
assertEquals("Extension " + ext + " (1)", TEXT_PLAIN,
this.service.getMimeType("file." + ext));
assertEquals("Extension " + ext + " (2)", TEXT_PLAIN,
this.service.getMimeType(ext));
}
- assertEquals(TEXT_PLAIN,
- this.service.getMimeType(("file." + TXT).toUpperCase()));
+ assertEquals(TEXT_PLAIN, this.service.getMimeType(("file." +
TXT).toUpperCase()));
assertEquals(TEXT_PLAIN,
this.service.getMimeType((TXT).toUpperCase()));
- assertEquals(TEXT_PLAIN,
- this.service.getMimeType(("file." + LOG).toUpperCase()));
+ assertEquals(TEXT_PLAIN, this.service.getMimeType(("file." +
LOG).toUpperCase()));
assertEquals(TEXT_PLAIN,
this.service.getMimeType((LOG).toUpperCase()));
assertEquals(IMAGE_GIF, this.service.getMimeType(GIF));
@@ -173,9 +170,8 @@ public class MimeTypeServiceImplTest extends TestCase {
}
}
};
-
}
-
+
private void loadMimeTypes(String path) throws IOException {
InputStream ins = this.getClass().getResourceAsStream(path);
assertNotNull(ins);
@@ -188,6 +184,5 @@ public class MimeTypeServiceImplTest extends TestCase {
} catch (IOException ignore) {
}
}
-
}
}
diff --git
a/src/test/java/org/apache/sling/commons/mime/internal/TikaMimeTypeProviderTest.java
b/src/test/java/org/apache/sling/commons/mime/internal/TikaMimeTypeProviderTest.java
index 498bbb8..5e41921 100644
---
a/src/test/java/org/apache/sling/commons/mime/internal/TikaMimeTypeProviderTest.java
+++
b/src/test/java/org/apache/sling/commons/mime/internal/TikaMimeTypeProviderTest.java
@@ -1,23 +1,24 @@
/*
- * 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 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
*
- * 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.
*/
package org.apache.sling.commons.mime.internal;
import junit.framework.TestCase;
-
import org.apache.sling.commons.mime.MimeTypeProvider;
/**
@@ -38,5 +39,4 @@ public class TikaMimeTypeProviderTest extends TestCase {
assertEquals("pdf", provider.getExtension("application/pdf"));
assertEquals("jpg", provider.getExtension("image/jpeg"));
}
-
-}
\ No newline at end of file
+}