Skip to content

clean code  #614

Closed
Closed
@hqq2023623

Description

branch:master
version:3.1.1-SNAPSHOT

DynamicCompilerException#getErrors

for (String key : entry.keySet()) {

                Object value = entry.get(key);
                if (value != null && !value.toString().isEmpty()) {
                    errors.append(key);
                    errors.append(": ");
                    errors.append(value);
                }
                errors.append(" , ");
            }

对entry的遍历可以用entrySet()

UserStatUtil$RemoteJob#run

           public void run() {
            if (link == null) {
                return;
            }
            try {
                link.append(resource);
                if (queryData.length() != 0) {
                    link.append("?").append(queryData);
                }
                URL url = new URL(link.toString());
                URLConnection connection = url.openConnection();
                connection.setConnectTimeout(1000);
                connection.setReadTimeout(1000);
                connection.connect();
                BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
                String line = null;
                StringBuilder result = new StringBuilder();
                while ((line = br.readLine()) != null) {
                    result.append(line);
                }
            } catch (Exception ex) {
            }
        }

用BufferReader读取了结果但是并没有用来做什么事情

ProcessImpl#close()

if (statisticsHandler != null && flushHandlerChain != null) {
                String data = statisticsHandler.result();

                if (flushHandlerChain != null) {
                    for (Function<String, String> function : flushHandlerChain) {
                        data = function.apply(data);
                        if (function instanceof StatisticsFunction) {
                            data = ((StatisticsFunction) function).result();
                        }
                    }
                }
            }

flushHandlerChain二次判空了

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions