Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Sep 13, 2024
1 parent a532342 commit 254c45a
Show file tree
Hide file tree
Showing 21 changed files with 29 additions and 33 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/lucee/commons/lang/ClassUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ private static Class loadClass(ClassLoader cl, String className, Class defaultVa
if (cl != null) {
// TODO do not produce a resource classloader in the first place if there are no resources
if (cl instanceof ResourceClassLoader && ((ResourceClassLoader) cl).isEmpty()) {
ClassLoader p = ((ResourceClassLoader) cl).getParent();
ClassLoader p = (cl).getParent();
if (p != null) cl = p;
}
Class clazz = _loadClass(new ClassLoaderBasedClassLoading(cl), className, defaultValue, exceptions);
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/lucee/commons/lang/ExceptionUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public static IOException toIOException(Throwable t) {
rethrowIfNecessary(t);
if (t instanceof IOException) return (IOException) t;
if (t instanceof InvocationTargetException) return toIOException(((InvocationTargetException) t).getCause());
if (t instanceof NativeException) return toIOException(((NativeException) t).getCause());
if (t instanceof NativeException) return toIOException((t).getCause());

IOException ioe = new IOException(t.getClass().getName() + ":" + t.getMessage());
ExceptionUtil.initCauseEL(ioe, t);
Expand Down
7 changes: 3 additions & 4 deletions core/src/main/java/lucee/runtime/cache/CacheUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import lucee.runtime.PageContext;
import lucee.runtime.PageContextImpl;
import lucee.runtime.config.Config;
import lucee.runtime.config.ConfigPro;
import lucee.runtime.config.ConfigWeb;
import lucee.runtime.config.Constants;
import lucee.runtime.config.Password;
Expand Down Expand Up @@ -71,7 +70,7 @@ public static Cache getDefault(PageContext pc, int type, Cache defaultValue) {
}

// get default from config
CacheConnection cc = config == null ? null : ((ConfigPro) config).getCacheDefaultConnection(type);
CacheConnection cc = config == null ? null : config.getCacheDefaultConnection(type);
if (cc == null) return defaultValue;
try {
return cc.getInstance(config);
Expand Down Expand Up @@ -101,7 +100,7 @@ public static Cache getDefault(PageContext pc, int type) throws IOException {

// get default from config
Config config = ThreadLocalPageContext.getConfig(pc);
CacheConnection cc = ((ConfigPro) config).getCacheDefaultConnection(type);
CacheConnection cc = (config).getCacheDefaultConnection(type);
if (cc == null)
throw new CacheException("there is no default " + toStringType(type, "") + " cache defined, you need to define this default cache in the Lucee Administrator");
return cc.getInstance(config);
Expand Down Expand Up @@ -161,7 +160,7 @@ public static CacheConnection getCacheConnection(PageContext pc, String cacheNam

public static CacheException noCache(Config config, String cacheName) {
StringBuilder sb = new StringBuilder("there is no cache defined with name [").append(cacheName).append("], available caches are [");
Iterator<String> it = ((ConfigPro) config).getCacheConnections().keySet().iterator();
Iterator<String> it = config.getCacheConnections().keySet().iterator();
if (it.hasNext()) {
sb.append(it.next());
}
Expand Down
6 changes: 3 additions & 3 deletions core/src/main/java/lucee/runtime/config/ConfigWebFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -4577,14 +4577,14 @@ private static void _loadSearch(ConfigServer configServer, ConfigImpl config, St
// class
ClassDefinition<SearchEngine> cd = search != null ? getClassDefinition(search, "engine", config.getIdentification()) : null;
if (cd == null || !cd.hasClass() || "lucee.runtime.search.lucene.LuceneSearchEngine".equals(cd.getClassName())) {
if (configServer != null) cd = ((ConfigPro) configServer).getSearchEngineClassDefinition();
if (configServer != null) cd = (configServer).getSearchEngineClassDefinition();
else cd = new ClassDefinitionImpl(DummySearchEngine.class);
}

// directory
String dir = search != null ? getAttr(search, "directory") : null;
if (StringUtil.isEmpty(dir)) {
if (configServer != null) dir = ((ConfigPro) configServer).getSearchEngineDirectory();
if (configServer != null) dir = (configServer).getSearchEngineDirectory();
else dir = "{lucee-web}/search/";
}

Expand Down Expand Up @@ -4637,7 +4637,7 @@ private static void _loadDebug(ConfigServerImpl configServer, ConfigImpl config,
Array entries = ConfigWebUtil.getAsArray("debugTemplates", root);
Map<String, DebugEntry> list = new HashMap<String, DebugEntry>();
if (hasCS) {
DebugEntry[] _entries = ((ConfigPro) configServer).getDebugEntries();
DebugEntry[] _entries = configServer.getDebugEntries();
for (int i = 0; i < _entries.length; i++) {
try {
list.put(_entries[i].getId(), _entries[i].duplicate(true));
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/lucee/runtime/config/ConfigWebImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ public void setIdentification(lucee.runtime.config.IdentificationWeb arg0) {

@Override
public boolean equals(java.lang.Object arg0) {
if (instance instanceof MultiContextConfigWeb) return ((MultiContextConfigWeb) instance).equals(arg0);
else return ((SingleContextConfigWeb) instance).equals(arg0);
if (instance instanceof MultiContextConfigWeb) return instance.equals(arg0);
else return (instance).equals(arg0);
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/lucee/runtime/config/ConfigWebUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ public static boolean hasAccess(Config config, int type) {

boolean has = true;
if (config instanceof ConfigWeb) {
has = ((ConfigWeb) config)
has = config

.getSecurityManager()

Expand Down Expand Up @@ -741,7 +741,7 @@ public static Resource getConfigServerDirectory(Config config) {
if (config == null) config = ThreadLocalPageContext.getConfig();
if (config instanceof ConfigWeb) return ((ConfigWeb) config).getConfigServerDir();
if (config == null) return null;
return ((ConfigServer) config).getConfigDir();
return (config).getConfigDir();
}

public static Mapping[] getAllMappings(PageContext pc) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public DatasourceConnection create() throws IOException {

Connection conn = null;
try {
conn = ((DataSourcePro) datasource).getConnection(config, username, password);
conn = (datasource).getConnection(config, username, password);
}
catch (SQLException e) {
throw new IOException(e);
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/lucee/runtime/db/QoQ.java
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ else if (inputList.size() > 1 && first instanceof Value && ((Value) first).getSt
}
Expression input = inputList.get(0);
// count(*), count(1), or count('asdf') just count the rows
if ((input instanceof Column && ((Column) input).getAlias().equals("*")) || input instanceof Value) {
if ((input instanceof Column && (input).getAlias().equals("*")) || input instanceof Value) {
return Caster.toIntValue(source.getRecordcount());
}
// count( columnName ) returns count of non-null values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public static Struct call(PageContext pc, boolean suppressFunctions, boolean onl
sct.setEL("customTagPaths", toArray(ac.getCustomTagMappings()));
sct.setEL("componentPaths", toArray(ac.getComponentMappings()));
sct.setEL("loginStorage", AppListenerUtil.translateLoginStorage(ac.getLoginStorage()));
sct.setEL("componentDataMemberAccess", ComponentUtil.toStringAccess(((ConfigPro) pc.getConfig()).getComponentDataMemberDefaultAccess()));
sct.setEL("componentDataMemberAccess", ComponentUtil.toStringAccess((pc.getConfig()).getComponentDataMemberDefaultAccess()));
sct.setEL(KeyConstants._mappings, toStruct(ac.getMappings()));
sct.setEL(KeyConstants._name, ac.getName());
sct.setEL("scriptProtect", AppListenerUtil.translateScriptProtect(ac.getScriptProtect()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import lucee.runtime.PageContext;
import lucee.runtime.PageSource;
import lucee.runtime.config.ConfigPro;
import lucee.runtime.config.ConfigWebPro;
import lucee.runtime.engine.ThreadLocalPageContext;
import lucee.runtime.exp.PageException;
import lucee.runtime.exp.TemplateException;
Expand Down Expand Up @@ -1419,7 +1418,7 @@ private String identifier(boolean firstCanBeNumber) {
boolean doUpper;
PageSource ps = pc == null ? null : pc.getCurrentPageSource();
if (ps != null) doUpper = !isJson && ((MappingImpl) ps.getMapping()).getDotNotationUpperCase();
else doUpper = !isJson && ((ConfigWebPro) config).getDotNotationUpperCase(); // MUST .lucee should not be upper case
else doUpper = !isJson && (config).getDotNotationUpperCase(); // MUST .lucee should not be upper case

StringBuilder sb = new StringBuilder();
sb.append(doUpper ? cfml.getCurrentUpper() : cfml.getCurrent());
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/lucee/runtime/op/Caster.java
Original file line number Diff line number Diff line change
Expand Up @@ -3584,11 +3584,11 @@ public static PageException toPageException(final Throwable t, boolean rethrowIf
if (target != null) return toPageException(target);
}
if (t instanceof ExceptionInInitializerError) {
Throwable cause = ((ExceptionInInitializerError) t).getCause();
Throwable cause = (t).getCause();
if (cause != null) return toPageException(cause);
}
if (t instanceof ExecutionException) {
Throwable cause = ((ExecutionException) t).getCause();
Throwable cause = (t).getCause();
if (cause != null) return toPageException(cause);
}
if (t instanceof InterruptedException) {
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/java/lucee/runtime/op/OpUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -804,11 +804,11 @@ public static boolean eeq(PageContext pc, Object left, Object right) {

// simple vales - left and right have the same type
if (left instanceof String) return ((String) left).equalsIgnoreCase((String) right);
else if (left instanceof Number) return ((Number) left).equals(right);
else if (left instanceof Number) return (left).equals(right);
else if (left instanceof Boolean) return ((Boolean) left).equals(right);
else if (left instanceof Date) return ((Date) left).equals(right);
else if (left instanceof Locale) return ((Locale) left).equals(right);
else if (left instanceof TimeZone) return ((TimeZone) left).equals(right);
else if (left instanceof TimeZone) return (left).equals(right);
else if (left instanceof Character) return ((Character) left).equals(right);
else if (left instanceof Calendar) return ((Calendar) left).equals(right);

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/lucee/runtime/tag/Query.java
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ public int doEndTag() throws PageException {

if (data.async) {
PageSource ps = getPageSource();
((SpoolerEngineImpl) ((ConfigPro) pageContext.getConfig()).getSpoolerEngine()).add(pageContext.getConfig(),
((SpoolerEngineImpl) pageContext.getConfig().getSpoolerEngine()).add(pageContext.getConfig(),
new QuerySpoolerTask(pageContext, data, strSQL, toTemplateLine(pageContext, sourceTemplate, ps), ps));
}
else {
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/lucee/runtime/tag/Silent.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
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;

public final class Silent extends BodyTagTryCatchFinallyImpl {
Expand All @@ -41,7 +40,7 @@ public void setBufferoutput(boolean bufferOutput) {

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

if (bufferOutput.booleanValue()) bc = (BodyContentImpl) pageContext.pushBody();
else wasSilent = pageContext.setSilent();
Expand Down
3 changes: 1 addition & 2 deletions core/src/main/java/lucee/runtime/tag/ThreadTag.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import lucee.runtime.Page;
import lucee.runtime.PageContext;
import lucee.runtime.PageContextImpl;
import lucee.runtime.config.ConfigPro;
import lucee.runtime.exp.ApplicationException;
import lucee.runtime.exp.ExpressionException;
import lucee.runtime.exp.PageException;
Expand Down Expand Up @@ -320,7 +319,7 @@ public String _register(Page currentPage, int threadIndex) throws PageException
else {
ChildThreadImpl ct = new ChildThreadImpl((PageContextImpl) pc, currentPage, name.getString(), threadIndex, attrs, true, separateScopes);
ct.setPriority(priority);
((SpoolerEngineImpl) ((ConfigPro) pc.getConfig()).getSpoolerEngine()).add(pc.getConfig(), new ChildSpoolerTask(ct, plans));
((SpoolerEngineImpl) pc.getConfig().getSpoolerEngine()).add(pc.getConfig(), new ChildSpoolerTask(ct, plans));
}

}
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/lucee/runtime/type/UDFImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ public Boolean getBufferOutput() {
@Override
public boolean getBufferOutput(PageContext pc) {
if (properties.getBufferOutput() != null) return properties.getBufferOutput().booleanValue();
return ((ApplicationContextSupport) pc.getApplicationContext()).getBufferOutput();
return (pc.getApplicationContext()).getBufferOutput();
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/lucee/runtime/util/PageContextUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public static void checkRequestTimeout(PageContext pc) throws RequestTimeoutExce
}

private static boolean allowRequestTimeout(PageContext pc) {
if (!((ConfigPro) ThreadLocalPageContext.getConfig(pc)).allowRequestTimeout()) return false;
if (!ThreadLocalPageContext.getConfig(pc).allowRequestTimeout()) return false;
CFMLFactoryImpl factory = (CFMLFactoryImpl) pc.getConfig().getFactory();
return factory.reachedConcurrentReqThreshold() && factory.reachedCPUThreshold() && factory.reachedMemoryThreshold();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ else if (coll instanceof Map) {
+ "\" to address the Map";
}

throw new ExpressionException("Key [" + key.getString() + "] doesn't exist in Map (" + ((Map) coll).getClass().getName() + ")", detail);
throw new ExpressionException("Key [" + key.getString() + "] doesn't exist in Map (" + (coll).getClass().getName() + ")", detail);
}
// List
else if (coll instanceof List) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ else if (exp instanceof VariableString) {
return ((VariableString) exp).castToString(bc);
}
else if (exp instanceof Literal) {
return ((Literal) exp).toString();
return (exp).toString();
}
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion loader/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project default="core" basedir="." name="Lucee"
xmlns:resolver="antlib:org.apache.maven.resolver.ant">

<property name="version" value="6.1.1.85-SNAPSHOT"/>
<property name="version" value="6.1.1.86-SNAPSHOT"/>

<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml">
<classpath>
Expand Down
2 changes: 1 addition & 1 deletion loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>org.lucee</groupId>
<artifactId>lucee</artifactId>
<version>6.1.1.85-SNAPSHOT</version>
<version>6.1.1.86-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Lucee Loader Build</name>
Expand Down

0 comments on commit 254c45a

Please sign in to comment.