小编emo*_*ssi的帖子

MailSendException:失败的消息:com.sun.mail.smtp.SMTPSendFailedException

我尝试使用javaMail,spring-boot和yahoo发送电子邮件.我得到了这个SMTPSendFailedException,我不知道为什么.

这里是例外的一部分:

ErrorPageFilter: Forwarding to error page from request [/registration] due to exception [Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 501 Syntax error in arguments
;
  nested exception is:
    com.sun.mail.smtp.SMTPSenderFailedException: 501 Syntax error in arguments
]
org.springframework.mail.MailSendException: Failed messages: com.sun.mail.smtp.SMTPSendFailedException: 501 Syntax error in arguments
;
  nested exception is:
    com.sun.mail.smtp.SMTPSenderFailedException: 501 Syntax error in arguments
; message exception details (1) are:
Failed message 1:
com.sun.mail.smtp.SMTPSendFailedException: 501 Syntax error in arguments
;
  nested exception is:
    com.sun.mail.smtp.SMTPSenderFailedException: 501 Syntax error in arguments

    at com.sun.mail.smtp.SMTPTransport.issueSendCommand(SMTPTransport.java:2203)
    at com.sun.mail.smtp.SMTPTransport.mailFrom(SMTPTransport.java:1694) …
Run Code Online (Sandbox Code Playgroud)

java email spring smtp jakarta-mail

2
推荐指数
1
解决办法
3873
查看次数

如何使用ExpectationForPredicate并点击一个按钮

检查按钮是否启用后,如何点击它?

我在这里找到了此示例,但不适用于我的情况。

Xcode UI测试的测试用例中的延迟/等待

这是一部分代码:

    let app = XCUIApplication()
    let button = app.buttons["Tap me"]
    let exists = NSPredicate(format: "exists == 1")
    expectationForPredicate(exists, evaluatedWithObject: button){
        button.tap()
        return true
    }
 waitForExpectationsWithTimeout(5, handler: nil)
Run Code Online (Sandbox Code Playgroud)

但通过点击按钮,我的测试失败。谢谢

ios xctest swift xcode-ui-testing

2
推荐指数
1
解决办法
1224
查看次数

减少表达式中使用的条件运算符数(4)(允许的最大值为3)

如何减少运营商的复杂性?我有条件问题.

Object someObject = getSomeObject();
boolean isNotInstanceOfA = !(someObject instanceof A);
boolean isNotInstanceOfB = !(someObject instanceof B);
boolean isNotInstanceOfC = !(someObject instanceof C);
boolean isNotInstanceOfABC = isNotInstanceOfA && isNotInstanceOfB && isNotInstanceOfC;
if (isNotInstanceOfABC && (container.getChildren(itemId) == null || container.getChildren(itemId).isEmpty())) {
    return "something";
 }
Run Code Online (Sandbox Code Playgroud)

java conditional-operator

1
推荐指数
2
解决办法
7326
查看次数

类型不匹配:无法从 org.slf4j.Logger 转换为 org.apache.log4j.Logger

我在 eclipse Mars 中配置了我的环境,但是我在使用 log4j 时遇到了错误。我使用 spring 4 和 maven 作为依赖管理器。Hier 部分代码:

Eclipse 在这一行显示了一个错误,等号之后的第二部分:

private static final Logger LOGGER = LoggerFactory.getLogger(PropertyConfiguration.class);
Run Code Online (Sandbox Code Playgroud)

错误:

Type mismatch: cannot convert from org.slf4j.Logger to org.apache.log4j.Logger
Run Code Online (Sandbox Code Playgroud)

我的 propertyConfiguration 在 com.myapp.bootstrap 中,xml 文件在 src/main/resources 中。

我的 log4j.xml 文件:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">

    <appender name="defaultAppender" class="org.apache.log4j.ConsoleAppender">
        <param name="encoding" value="UTF-8" />
        <layout class="org.apache.log4j.PatternLayout">
            <param name="ConversionPattern" value="%d{ISO8601} %-5p [%t] %c{2}: %m%n" />
        </layout>
    </appender>

    <logger name="com.myapp" additivity="false">
        <level value="DEBUG" />
        <appender-ref ref="defaultAppender" />
    </logger> …
Run Code Online (Sandbox Code Playgroud)

java eclipse logging log4j maven

0
推荐指数
1
解决办法
6868
查看次数

Java 8 按键分组映射

我想按键对地图对象进行分组。我尝试使用此代码,但出现编译错误:

Non-static method cannot be referenced from a static context
Run Code Online (Sandbox Code Playgroud)

我的代码:

Map<String, List<A>> getAMap() {        
    return Arrays.stream(SomeArray.values())
            .map(map -> createObject())
            .collect(Collectors.groupingBy(Map.Entry::getKey, 
                  Collectors.mapping(Map.Entry::getValue, Collectors.toList())));
}


private Map<String, A> createObject() 
    final A a = new A(some attributes);
    Map<String, A> map = new LinkedHashMap<>();
    map.put(some key, a);
    .... // add another values. 
    return map;
}
Run Code Online (Sandbox Code Playgroud)

我需要类似的东西

{
"a", {a1, a2, a3},
"b", {a4, a5, a6},
}
Run Code Online (Sandbox Code Playgroud)

java lambda grouping java-8 collectors

-1
推荐指数
1
解决办法
5773
查看次数