我的产品打开Web浏览器并将其指向包含本地Flash应用程序的HTML文件.如何以编程方式检测此文件是否已成功加载,以及是否未引发异常?有没有办法用Javascript做到这一点?
从外部检查文件是否存在于磁盘上是不够的,因为我已经看到其他故障发生(可能涉及竞争条件).
关于依赖当前实施是否安全似乎存在争议,String.hashCode()因为从技术上讲,它是由规范(Javadoc)保证的.
String.hashCode()在规范中指定了实现?String.hashCode()将来改变,天空会下降?(这可能由#2解释)如何配置Mercurial服务器以在关闭后限制对命名分支的提交?我只希望存储库管理员能够重新打开分支.
https://www.mercurial-scm.org/wiki/PruningDeadBranches说,关闭的变更集可以通过变更集的额外字段中的"close = 1"来识别.目前尚不清楚如何使用Mercurial API读取变更集的额外字段.
我发出一个单独的SQL查询,包含使用UNION分组的多个SELECT:
SELECT *
FROM employee
LEFT JOIN department
ON employee.DepartmentID = department.DepartmentID
UNION
SELECT *
FROM employee
RIGHT JOIN department
ON employee.DepartmentID = department.DepartmentID;
Run Code Online (Sandbox Code Playgroud)
假设我在READ_COMMITTED事务隔离下执行此查询,两个SELECT语句是否保证以原子方式执行?或者我是否存在各个SELECT语句之间数据更改的风险?SQL规范是否讨论过这种事情?
澄清:当我说"原子"时,我不是指ACID中的"A".我的意思是我希望在查询完成之前对department和employee表进行读锁定.
我正在使用CreateFile()打开一个串口.我有一个测试用例(太复杂而无法重新分配),它始终导致CreateFile()返回INVALID_HANDLE_VALUE和GetLastError()返回ERROR_SUCCESS.通过它的外观,只有当一个线程在另一个端口关闭它的同一时间打开端口时,才会出现此错误.打开端口的线程会遇到此问题.
我不知道这是否有所不同,但稍后在代码中我使用CreateIoCompletionPort将端口与CompletionPort相关联.
这是我的代码:
HANDLE port = CreateFile(L"\\\\.\\COM1",
GENERIC_READ | GENERIC_WRITE,
0, // must be opened with exclusive-access
0, // default security attributes
OPEN_EXISTING, // must use OPEN_EXISTING
FILE_FLAG_OVERLAPPED, // overlapped I/O
0); // hTemplate must be NULL for comm devices
if (port == INVALID_HANDLE_VALUE)
{
DWORD errorCode = GetLastError();
cerr << L"CreateFile() failed with error: " << errorCode << endl;
}
Run Code Online (Sandbox Code Playgroud)
我很确定这种事情不应该发生.我做错了吗?如何让API返回正确的结果?
更多细节:此代码取自我开发的串行端口库:JPeripheral
这是实际的(未经过规范化的)源代码:
JLong SerialChannel::nativeOpen(String …Run Code Online (Sandbox Code Playgroud) @RequestScopedCallable中对象的引用?seedMap?是否意味着覆盖默认绑定?根据文档,只有两种方法可以将默认日志记录级别从INFO更改为较低级别(例如DEBUG):
setprop log.tag.<YOUR_LOG_TAG> <LEVEL>, 要么log.tag.<YOUR_LOG_TAG>=<LEVEL> 在/data/local.prop中.是否可以在应用程序中捆绑日志记录配置?我正在寻找与应用程序捆绑在一起的等效logging.properties或logback.xml配置文件,并在加载时更改日志记录行为.目标是避免手动配置应用程序将运行的每个设备.
在使用连续的短裤范围填充列表的基础上,我尝试生成一组原始短裤.事实证明这比预期的要难得多.
Short[] range = IntStream.range(0, 500).mapToObj(value -> (short) value).toArray(Short[]::new) 工作但是:
short[] range = IntStream.range(0, 500).mapToObj(value -> (short) value).toArray(short[]::new) 生成编译器错误:
method toArray in interface Stream<T> cannot be applied to given types;
required: IntFunction<A[]>
found: short[]::new
reason: inference variable A has incompatible bounds
equality constraints: short
upper bounds: Object
where A,T are type-variables:
A extends Object declared in method <A>toArray(IntFunction<A[]>)
T extends Object declared in interface Stream
Run Code Online (Sandbox Code Playgroud)
这似乎是两个问题的交集:
shorts 的实现.有任何想法吗?
使用Jetty 9.4.10.v20180503,有时我的HTTP客户端失败并出现以下错误。
java.io.EOFException: HttpConnectionOverHTTP@571103e6(l:/192.168.1.100:27497 <-> r:api.kucoin.com/13.113.121.24:443,closed=false)=>HttpChannelOverHTTP@a423e61(exchange=HttpExchange@e7dbbf1 req=TERMINATED/null@null res=PENDING/null@null)[send=HttpSenderOverHTTP@4b7f345a(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator@61d4e46c{s=START}],recv=HttpReceiverOverHTTP@7a7e7f01(rsp=IDLE,failure=null)[HttpParser{s=CLOSED,0 of -1}]]<-DecryptedEndPoint@193ff18c{api.kucoin.com/13.113.121.24:443<->/192.168.1.100:27497,OPEN,fill=-,flush=-,to=22604/0}->HttpConnectionOverHTTP@571103e6(l:/192.168.1.100:27497 <-> r:api.kucoin.com/13.113.121.24:443,closed=false)=>HttpChannelOverHTTP@a423e61(exchange=HttpExchange@e7dbbf1 req=TERMINATED/null@null res=PENDING/null@null)[send=HttpSenderOverHTTP@4b7f345a(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator@61d4e46c{s=START}],recv=HttpReceiverOverHTTP@7a7e7f01(rsp=IDLE,failure=null)[HttpParser{s=CLOSED,0 of -1}]]->SocketChannelEndPoint@2b50cb15{api.kucoin.com/13.113.121.24:443<->/192.168.1.100:27497,ISHUT,fill=-,flush=-,to=21603/0}{io=0/0,kio=0,kro=1}->SslConnection@6de1ad97{NEED_WRAP,eio=-1/-1,di=-1}=>HttpConnectionOverHTTP@571103e6(l:/192.168.1.100:27497 <-> r:api.kucoin.com/13.113.121.24:443,closed=false)=>HttpChannelOverHTTP@a423e61(exchange=HttpExchange@e7dbbf1 req=TERMINATED/null@null res=PENDING/null@null)[send=HttpSenderOverHTTP@4b7f345a(req=QUEUED,snd=COMPLETED,failure=null)[HttpGenerator@61d4e46c{s=START}],recv=HttpReceiverOverHTTP@7a7e7f01(rsp=IDLE,failure=null)[HttpParser{s=CLOSED,0 of -1}]]
at java.util.concurrent.CompletableFuture.encodeRelay(CompletableFuture.java:326)
at java.util.concurrent.CompletableFuture.completeRelay(CompletableFuture.java:338)
at java.util.concurrent.CompletableFuture.uniRelay(CompletableFuture.java:911)
at java.util.concurrent.CompletableFuture$UniRelay.tryFire(CompletableFuture.java:899)
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977)
at com.myapplication.ResponseListener.onComplete(ResponseListener.java:45)
at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:193)
at org.eclipse.jetty.client.ResponseNotifier.notifyComplete(ResponseNotifier.java:185)
at org.eclipse.jetty.client.HttpReceiver.terminateResponse(HttpReceiver.java:464)
at org.eclipse.jetty.client.HttpReceiver.abort(HttpReceiver.java:545)
at org.eclipse.jetty.client.HttpReceiver.responseFailure(HttpReceiver.java:436)
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.failAndClose(HttpReceiverOverHTTP.java:369)
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.earlyEOF(HttpReceiverOverHTTP.java:338)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:1476)
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.shutdown(HttpReceiverOverHTTP.java:209)
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:147)
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:73)
at org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:133)
at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:155)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:291)
at org.eclipse.jetty.io.ssl.SslConnection$3.succeeded(SslConnection.java:151)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168) …Run Code Online (Sandbox Code Playgroud) 我正在使用Jetty客户端发送外发请求。在Java 10下完美运行的代码突然在Java 11下获得以下异常:
javax.net.ssl.SSLException: No PSK available. Unable to resume.
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:129)
at java.base/sun.security.ssl.Alert.createSSLException(Alert.java:117)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:308)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:264)
at java.base/sun.security.ssl.TransportContext.fatal(TransportContext.java:255)
at java.base/sun.security.ssl.ServerHello$T13ServerHelloConsumer.consume(ServerHello.java:1224)
at java.base/sun.security.ssl.ServerHello$ServerHelloConsumer.onServerHello(ServerHello.java:984)
at java.base/sun.security.ssl.ServerHello$ServerHelloConsumer.consume(ServerHello.java:872)
at java.base/sun.security.ssl.SSLHandshake.consume(SSLHandshake.java:392)
at java.base/sun.security.ssl.HandshakeContext.dispatch(HandshakeContext.java:444)
at java.base/sun.security.ssl.SSLEngineImpl$DelegatedTask$DelegatedAction.run(SSLEngineImpl.java:1065)
at java.base/sun.security.ssl.SSLEngineImpl$DelegatedTask$DelegatedAction.run(SSLEngineImpl.java:1052)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/sun.security.ssl.SSLEngineImpl$DelegatedTask.run(SSLEngineImpl.java:999)
at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.fill(SslConnection.java:511)
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.process(HttpReceiverOverHTTP.java:128)
at org.eclipse.jetty.client.http.HttpReceiverOverHTTP.receive(HttpReceiverOverHTTP.java:73)
at org.eclipse.jetty.client.http.HttpChannelOverHTTP.receive(HttpChannelOverHTTP.java:133)
at org.eclipse.jetty.client.http.HttpConnectionOverHTTP.onFillable(HttpConnectionOverHTTP.java:155)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ssl.SslConnection$DecryptedEndPoint.onFillable(SslConnection.java:411)
at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:305)
at org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:159)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
Run Code Online (Sandbox Code Playgroud)
我在这里向Jetty提交了错误报告,但我想知道:错误消息实际上是什么意思?我的环境有问题吗?或者该错误是否表示Jetty未正确配置连接?
java ×4
networking ×2
android ×1
branch ×1
createfile ×1
flash ×1
getlasterror ×1
guice ×1
hashcode ×1
iocp ×1
java-11 ×1
java-8 ×1
java-stream ×1
javascript ×1
jetty ×1
logging ×1
mercurial ×1
serial-port ×1
sql ×1
ssl ×1
string ×1
transactions ×1
winapi ×1