Skip to content

Commit

Permalink
remove references to "javax" that can be avoided
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Mar 12, 2024
1 parent 77b033b commit 601c7e9
Show file tree
Hide file tree
Showing 21 changed files with 69 additions and 80 deletions.
6 changes: 6 additions & 0 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,12 @@
<artifactId>ulid-creator</artifactId>
<version>5.2.3</version>
</dependency>
<dependency>
<groupId>jakarta.platform</groupId>
<artifactId>jakarta.jakartaee-api</artifactId>
<version>10.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>

<repositories>
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/coldfusion/image/Image.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
import java.awt.RenderingHints.Key;
import java.awt.image.BufferedImage;

import javax.servlet.jsp.PageContext;

import lucee.runtime.PageContext;
import lucee.runtime.type.Struct;

public interface Image {
Expand Down
4 changes: 1 addition & 3 deletions core/src/main/java/lucee/commons/color/ColorCaster.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

import java.awt.Color;

import javax.servlet.ServletException;

import lucee.commons.lang.NumberUtil;
import lucee.commons.lang.StringUtil;
import lucee.runtime.exp.ExpressionException;
Expand All @@ -38,7 +36,7 @@ public final class ColorCaster {
* @return an int between 0 (badest) and 510 (best)
* @throws ServletException
*/
public static int contrast(Color left, Color right) throws ServletException {
public static int contrast(Color left, Color right) {
return (Math.max(left.getRed(), right.getRed()) - Math.min(left.getRed(), right.getRed()))
+ (Math.max(left.getGreen(), right.getGreen()) - Math.min(left.getGreen(), right.getGreen()))
+ (Math.max(left.getBlue(), right.getBlue()) - Math.max(left.getBlue(), right.getBlue()));
Expand Down
7 changes: 3 additions & 4 deletions core/src/main/java/lucee/runtime/ComponentPageImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

Expand Down Expand Up @@ -1043,7 +1042,7 @@ private Charset getCharset(PageContext pc) {
return cs;
}

private void callWSDL(PageContext pc, Component component) throws ServletException, IOException, PageException {
private void callWSDL(PageContext pc, Component component) throws IOException, PageException {
// take wsdl file defined by user
String wsdl = component.getWSDLFile();
if (!StringUtil.isEmpty(wsdl)) {
Expand All @@ -1068,7 +1067,7 @@ private void callWSDL(PageContext pc, Component component) throws ServletExcepti
}
}

private void callWebservice(PageContext pc, Component component) throws IOException, ServletException, PageException {
private void callWebservice(PageContext pc, Component component) throws IOException, PageException {
((ConfigWebPro) ThreadLocalPageContext.getConfig(pc)).getWSHandler().getWSServer(pc).doPost(pc, pc.getHttpServletRequest(), pc.getHttpServletResponse(), component);
}

Expand Down
10 changes: 7 additions & 3 deletions core/src/main/java/lucee/runtime/PageContextImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.el.ExpressionEvaluator;
import javax.servlet.jsp.el.VariableResolver;
Expand Down Expand Up @@ -3133,10 +3132,15 @@ public void reuse(Tag tag, String tagBundleName, String tagBundleVersion) {
}

@Override
public void initBody(BodyTag bodyTag, int state) throws JspException {
public void initBody(BodyTag bodyTag, int state) throws PageException {
if (state != Tag.EVAL_BODY_INCLUDE) {
bodyTag.setBodyContent(pushBody());
bodyTag.doInitBody();
try {
bodyTag.doInitBody();
}
catch (Exception e) {
throw Caster.toPageException(e);
}
}
}

Expand Down
12 changes: 2 additions & 10 deletions core/src/main/java/lucee/runtime/config/CFConfigImport.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.util.zip.ZipInputStream;

import javax.servlet.http.Cookie;
import javax.servlet.jsp.JspException;

import org.apache.logging.log4j.core.layout.HtmlLayout;
import org.apache.logging.log4j.core.layout.PatternLayout;
Expand Down Expand Up @@ -70,7 +69,7 @@ public class CFConfigImport {
private final boolean setPasswordIfNecessary;
private final boolean validatePassword;
private final boolean flushExistingData;
private JspException exd = null;
private PageException exd = null;

public CFConfigImport(Config config, Resource file, Charset charset, String password, String type, Struct placeHolderData, boolean setPasswordIfNecessary,
boolean validatePassword, boolean flushExistingData) throws PageException {
Expand Down Expand Up @@ -186,18 +185,11 @@ public Struct execute(boolean throwException) throws PageException {
pc.getConfig().getFactory().releaseLuceePageContext(pc, true);
}
}
if (throwException && exd != null) throw Caster.toPageException(exd);
if (throwException && exd != null) throw exd;
return json;

}

private void handleException(PageContext pc, Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
LogUtil.log(pc, "deploy", t);
if (t instanceof JspException) exd = (JspException) t;
else exd = Caster.toPageException(t);
}

private static void replacePlaceHolder(Collection coll, Struct placeHolderData) {
// ${MAILSERVER_HOST:smtp.sendgrid.net}
Iterator<Entry<Key, Object>> it = coll.entryIterator();
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/lucee/runtime/engine/CFMLEngineImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspException;

import org.apache.felix.framework.Felix;
import org.osgi.framework.BundleContext;
Expand Down Expand Up @@ -1610,7 +1609,7 @@ public ControllerState getControllerState() {
}

@Override
public void cli(Map<String, String> config, ServletConfig servletConfig) throws IOException, JspException, ServletException {
public void cli(Map<String, String> config, ServletConfig servletConfig) throws IOException, ServletException, PageException {
ServletContext servletContext = servletConfig.getServletContext();
HTTPServletImpl servlet = new HTTPServletImpl(servletConfig, servletContext, servletConfig.getServletName());

Expand Down
7 changes: 4 additions & 3 deletions core/src/main/java/lucee/runtime/ext/tag/BodyTagImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
**/
package lucee.runtime.ext.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTag;

import lucee.runtime.exp.PageException;

/**
* Implementation of the BodyTag
*/
Expand All @@ -35,12 +36,12 @@ public void setBodyContent(BodyContent bodyContent) {
}

@Override
public void doInitBody() throws JspException {
public void doInitBody() throws PageException {

}

@Override
public int doAfterBody() throws JspException {
public int doAfterBody() throws PageException {
return SKIP_BODY;
}

Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/lucee/runtime/ext/tag/TagImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
**/
package lucee.runtime.ext.tag;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.Tag;

import lucee.commons.lang.StringUtil;
import lucee.runtime.PageContext;
import lucee.runtime.exp.ApplicationException;
import lucee.runtime.exp.PageException;

/**
* Implementation of the Tag
Expand Down Expand Up @@ -63,12 +63,12 @@ public Tag getParent() {
}

@Override
public int doStartTag() throws JspException {
public int doStartTag() throws PageException {
return SKIP_BODY;
}

@Override
public int doEndTag() throws JspException {
public int doEndTag() throws PageException {
return EVAL_PAGE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import javax.servlet.DispatcherType;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletInputStream;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
Expand Down Expand Up @@ -800,7 +799,7 @@ public AsyncContext startAsync(ServletRequest arg0, ServletResponse arg1) throws
}

@Override
public boolean authenticate(HttpServletResponse arg0) throws IOException, ServletException {
public boolean authenticate(HttpServletResponse arg0) throws IOException {
throw new RuntimeException("not supported!");
}

Expand All @@ -810,27 +809,27 @@ public String changeSessionId() {
}

@Override
public Part getPart(String arg0) throws IOException, ServletException {
public Part getPart(String arg0) throws IOException {
throw new RuntimeException("not supported!");
}

@Override
public Collection<Part> getParts() throws IOException, ServletException {
public Collection<Part> getParts() throws IOException {
throw new RuntimeException("not supported!");
}

@Override
public void login(String arg0, String arg1) throws ServletException {
public void login(String arg0, String arg1) {
throw new RuntimeException("not supported!");
}

@Override
public void logout() throws ServletException {
public void logout() {
throw new RuntimeException("not supported!");
}

@Override
public <T extends HttpUpgradeHandler> T upgrade(Class<T> arg0) throws IOException, ServletException {
public <T extends HttpUpgradeHandler> T upgrade(Class<T> arg0) throws IOException {
throw new RuntimeException("not supported!");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;

Expand All @@ -31,14 +30,14 @@ public RequestDispatcherDummy(HttpServletRequestDummy dummy) {
}

@Override
public void forward(ServletRequest arg0, ServletResponse arg1) throws ServletException, IOException {
throw new ServletException("operation not supported");
public void forward(ServletRequest arg0, ServletResponse arg1) throws IOException {
throw new IOException("operation not supported");
// TODO impl
}

@Override
public void include(ServletRequest arg0, ServletResponse arg1) throws ServletException, IOException {
throw new ServletException("operation not supported");
public void include(ServletRequest arg0, ServletResponse arg1) throws IOException {
throw new IOException("operation not supported");
// TODO impl
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.ServletRegistration;
import javax.servlet.SessionCookieConfig;
import javax.servlet.SessionTrackingMode;
Expand Down Expand Up @@ -194,7 +193,7 @@ public String getServerInfo() {
}

@Override
public Servlet getServlet(String arg0) throws ServletException {
public Servlet getServlet(String arg0) {
throw new RuntimeException("not supported");
}

Expand Down Expand Up @@ -256,17 +255,17 @@ public javax.servlet.ServletRegistration.Dynamic addServlet(String arg0, Class<?
}

@Override
public <T extends Filter> T createFilter(Class<T> arg0) throws ServletException {
public <T extends Filter> T createFilter(Class<T> arg0) {
throw new RuntimeException("not supported");
}

@Override
public <T extends EventListener> T createListener(Class<T> arg0) throws ServletException {
public <T extends EventListener> T createListener(Class<T> arg0) {
throw new RuntimeException("not supported");
}

@Override
public <T extends Servlet> T createServlet(Class<T> arg0) throws ServletException {
public <T extends Servlet> T createServlet(Class<T> arg0) {
throw new RuntimeException("not supported");
}

Expand Down
5 changes: 2 additions & 3 deletions core/src/main/java/lucee/runtime/tag/Calendar.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@
**/
package lucee.runtime.tag;

import javax.servlet.jsp.JspException;

import lucee.runtime.exp.ApplicationException;
import lucee.runtime.exp.PageException;
import lucee.runtime.exp.TagNotSupported;
import lucee.runtime.ext.tag.TagImpl;
import lucee.runtime.type.dt.DateTime;
Expand Down Expand Up @@ -81,7 +80,7 @@ public void release() {
}

@Override
public int doStartTag() throws JspException {
public int doStartTag() throws PageException {
return super.doStartTag();
}

Expand Down
5 changes: 2 additions & 3 deletions core/src/main/java/lucee/runtime/tag/Logout.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@
**/
package lucee.runtime.tag;

import javax.servlet.jsp.JspException;

import lucee.runtime.exp.PageException;
import lucee.runtime.ext.tag.TagImpl;

/**
Expand All @@ -28,7 +27,7 @@
public final class Logout extends TagImpl {

@Override
public int doStartTag() throws JspException {
public int doStartTag() throws PageException {
pageContext.clearRemoteUser();
return SKIP_BODY;
}
Expand Down
5 changes: 2 additions & 3 deletions core/src/main/java/lucee/runtime/tag/Silent.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@

import java.io.IOException;

import javax.servlet.jsp.JspException;

import lucee.commons.lang.ExceptionUtil;
import lucee.runtime.exp.PageException;
import lucee.runtime.ext.tag.BodyTagTryCatchFinallyImpl;
import lucee.runtime.listener.ApplicationContextSupport;
import lucee.runtime.writer.BodyContentImpl;
Expand All @@ -41,7 +40,7 @@ public void setBufferoutput(boolean bufferOutput) {
}

@Override
public int doStartTag() throws JspException {
public int doStartTag() throws PageException {
if (bufferOutput == null) bufferOutput = ((ApplicationContextSupport) pageContext.getApplicationContext()).getBufferOutput() ? Boolean.TRUE : Boolean.FALSE;

if (bufferOutput.booleanValue()) bc = (BodyContentImpl) pageContext.pushBody();
Expand Down
Loading

0 comments on commit 601c7e9

Please sign in to comment.