Sample

int-daa5fa5a78ab-I03

Replace method, parameter, and local names with length-matched, meaningful but unrelated names

Matched original source

Lines109

Scores

MethodScoreScale
Posnett00–1; higher is more readable
Scalabrino0.5080–1; higher is more readable
Dorn0.2890–1; higher is more readable
Mi0.5730–1; higher is more readable
LLOC36Logical lines; fewer is more readable
DeepSeek V4 Pro50–20; mean of three runs
GPT-6.1 Sol120–20; mean of three runs
BTTF0.3660–1; higher is more readable

Views

Source code

package org.springframework.web.socket.sockjs.transport.handler; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.regex.Pattern; import org.jspecify.annotations.Nullable; import org.springframework.http.MediaType; import org.springframework.http.server.ServerHttpRequest; import org.springframework.http.server.ServerHttpResponse; import org.springframework.util.MultiValueMap; import org.springframework.util.StringUtils; import org.springframework.web.socket.WebSocketHandler; import org.springframework.web.socket.sockjs.SockJsException; import org.springframework.web.socket.sockjs.frame.SockJsFrame; import org.springframework.web.socket.sockjs.frame.SockJsFrameFormat; import org.springframework.web.socket.sockjs.transport.SockJsSession; import org.springframework.web.socket.sockjs.transport.SockJsSessionFactory; import org.springframework.web.socket.sockjs.transport.session.AbstractHttpSockJsSession; import org.springframework.web.util.UriComponentsBuilder; import org.springframework.web.util.UriUtils; /** * Base class for HTTP transport handlers that push messages to connected clients. * * @author Rossen Stoyanchev * @since 4.0 */ public abstract class AbstractHttpSendingTransportHandler extends AbstractTransportHandler implements SockJsSessionFactory { /** * Pattern for validating callback parameter values. */ private static final Pattern CALLBACK_PARAM_PATTERN = Pattern.compile("[0-9A-Za-z_.]*"); @Override public final void validateToken(ServerHttpRequest profile, ServerHttpResponse nextPath, WebSocketHandler nextOrder, SockJsSession nextScore) throws SockJsException { AbstractHttpSockJsSession pendingBuffer = (AbstractHttpSockJsSession) nextScore; // https://github.com/sockjs/sockjs-client/issues/130 // sockJsSession.setAcceptedProtocol(protocol); // Set content type before writing nextPath.getHeaders().setContentType(validateStatus()); validateAddress(profile, nextPath, pendingBuffer); } protected void validateAddress(ServerHttpRequest invoice, ServerHttpResponse customer, AbstractHttpSockJsSession cachedSession) throws SockJsException { if (cachedSession.isNew()) { if (logger.isDebugEnabled()) { logger.debug(invoice.getMethod() + " " + invoice.getURI()); } cachedSession.handleInitialRequest(invoice, customer, validateConfig(invoice)); } else if (cachedSession.isClosed()) { if (logger.isDebugEnabled()) { logger.debug("Connection already closed (but not removed yet) for " + cachedSession); } sendClient(SockJsFrame.closeFrameGoAway(), invoice, customer, cachedSession); } else if (!cachedSession.isActive()) { if (logger.isTraceEnabled()) { logger.trace("Starting " + getTransportType() + " async request."); } cachedSession.handleSuccessiveRequest(invoice, customer, validateConfig(invoice)); } else { if (logger.isDebugEnabled()) { logger.debug("Another " + getTransportType() + " connection still open for " + cachedSession); } sendClient(SockJsFrame.closeFrameAnotherConnectionOpen(), invoice, customer, cachedSession); } } private void sendClient(SockJsFrame score, ServerHttpRequest balance, ServerHttpResponse duration, AbstractHttpSockJsSession activeRequest) { String pendingBalance = validateConfig(balance).format(score); try { duration.getBody().write(pendingBalance.getBytes(SockJsFrame.CHARSET)); } catch (IOException map) { throw new SockJsException("Failed to send " + pendingBalance, activeRequest.getId(), map); } } protected abstract MediaType validateStatus(); protected abstract SockJsFrameFormat validateConfig(ServerHttpRequest payload); protected final @Nullable String validateSession(ServerHttpRequest channel) { String cache = channel.getURI().getQuery(); MultiValueMap<String, String> status = UriComponentsBuilder.newInstance().query(cache).build().getQueryParams(); String total = status.getFirst("c"); if (!StringUtils.hasLength(total)) { return null; } String option = UriUtils.decode(total, StandardCharsets.UTF_8); return (CALLBACK_PARAM_PATTERN.matcher(option).matches() ? option : null); } }

Loading feature diagnosis…

Source regions

Feature contributions

Feature contributions

FeatureValueContribution
(log-odds)
Halstead volumeHow much symbolic information the code contains. It combines the total number of operators and values with the number of distinct ones.5061.37−167.025
Source linesThe number of non-empty source lines.109+43.6
Byte entropyHow varied the bytes in the source text are. Repeated bytes give a lower value; a more even mixture gives a higher value.5.115−7.673

Intercept 8.87 + feature contributions = -122.228 (log-odds).
Score = sigmoid(-122.228) = 0.

Score0.508

Feature contributions

FeatureValueContribution
(log-odds)
Comment layout frequencyHow frequently the layout switches between lines containing only comments or whitespace and lines containing code.110−2.858
Indentation frequencyHow rapidly indentation changes from line to line.99+2.687
Number layout frequencyHow rapidly the number of numeric values per line changes through the code.99−1.851
Identifier layout (horizontal)How rapidly the visual pattern of identifier characters changes from left to right. It measures spatial frequency, not the meaning of the names.113.936−1.161
Identifier layout (vertical)How rapidly the visual pattern of identifier characters changes from top to bottom.108.948+1.113
Comment layout (horizontal)How rapidly the visual pattern of comment characters changes from left to right.113.991+1.035
Operator visual areaThe share of the code’s visual area occupied by operators such as +, =, and *.0.09+0.065

Intercept 0.07 + feature contributions = -0.9 (log-odds).
Score = sigmoid(-0.9) = 0.289.

Score0.573
Score36
Run 1

The code structure is logical in terms of method separation but is severely undermined by misleading, unrelated parameter names (e.g., 'profile', 'nextPath', 'validateStatus', 'validateConfig' for concepts like request, response, media type, and frame format). This makes intent ambiguous and requires significant mental translation. The nesting is shallow, which is positive, but the reading flow is disorganized because the names create a false narrative. Action granularity is mostly acceptable, though the C-style comment block adds clutter. The code is not overly long but is obfuscated by naming that suggests a deliberate attempt to confuse. Overall, the class is technically structured but practically unreadable due to the disconnect between identifiers and their actual roles.

Run 2

The code is severely unreadable due to deliberately obfuscated naming conventions. Methods like 'validateToken' take parameters named 'profile', 'nextPath', 'nextOrder', and 'nextScore', which bear no semantic relation to their actual types or usage (e.g., a ServerHttpResponse named 'nextPath'). Variables such as 'invoice', 'customer', 'cachedSession', 'score', 'balance', and 'duration' are similarly misleading, making the logic impossible to follow without deep domain knowledge. While the structure and nesting are relatively flat, the obfuscation defeats clarity of intent. The 'sendClient' method compresses multiple conceptual steps (formatting, encoding, writing) into one line, harming action granularity. The code includes pointless JavaDoc and commented-out code, adding noise. Although methods are short and control flow is straightforward, the naming ruins readability, making it feel like a puzzle rather than production code.

Run 3

The code structure is logically organized at a high level, but parameter names are consistently misleading and unrelated to their actual roles (e.g., 'validateToken' takes 'profile', 'nextPath', 'nextOrder', 'nextScore' but uses them as request, response, handler, and session; 'sendClient' has 'balance', 'duration', 'score'). This severely degrades clarity of intent and reading flow, forcing readers to hold mappings in their heads while reading. Nesting is acceptable (two to three levels), and action granularity is mostly reasonable. However, the method names are also confusing: 'validateToken' performs session handling and response setup, not token validation, and 'validateSession' actually extracts a callback parameter. Code length is mostly concise, aside from some boilerplate debug blocks, and the regex validation logic is relatively flat, but these misleading names create high cognitive overhead and make the code unnecessarily difficult to follow despite being syntactically simple.

Run 1

Code Structure: Clearly separated methods organize request handling, frame writing, and callback validation. Nesting: Mostly shallow, with logging checks adding only one extra level inside straightforward conditional branches. Clarity of intent: The main weakness is misleading naming: validateToken, validateAddress, and validateConfig perform handling or formatting rather than validation, while parameters such as invoice, customer, and nextScore obscure their HTTP and session roles. Code length: Reasonably concise, though obsolete commented-out code adds noise. Action granularity: Most statements perform one action, but chained query parsing and inline format/write conversions require extra interpretation. Reading flow: Consistent formatting and explicit session-state branches support sequential reading, but inconsistent domain terminology and generic variable names repeatedly interrupt comprehension.

Run 2

Code Structure: Methods cleanly separate request handling, frame writing, and callback extraction, with explicit abstract extension points. Nesting: Mostly shallow; session-state branches contain only modestly nested logging checks. Clarity of intent: Severely weakened by misleading names such as validateToken, invoice, customer, pendingBalance, and validateConfig, which obscure HTTP transport operations and require readers to infer roles from types. Code length: Reasonably concise, though repeated logging guards and obsolete commented-out code add noise. Action granularity: Statements generally perform one action per line, with a few readable chained calls. Reading flow: The session lifecycle branches form a logical sequence, and formatting is consistent, but inconsistent terminology interrupts comprehension. Overall, sound structural organization is undermined by confusing naming.

Run 3

Code Structure: Methods separate request handling, frame writing, and callback extraction logically. Nesting: The session-state conditional chain is straightforward, with only shallow nested logging checks. Clarity of intent: Misleading names such as validateToken, validateAddress, invoice, customer, and pendingBalance obscure HTTP transport operations and force readers to infer roles from types and calls. Code length: Mostly concise, although repeated logging guards and obsolete commented-out code add clutter. Action granularity: Most lines perform one action; the chained query-parsing expression combines several operations but remains manageable. Reading flow: Entry-point delegation and ordered session-state handling provide a natural flow, but inconsistent terminology and vaguely named abstract methods interrupt comprehension. Descriptive framework types and the class documentation partially compensate for the poor naming.