java 警告:以后修改

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1001662/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 14:45:22  来源:igfitidea点击:

Warning: modified in the future

javajsp

提问by user93796

I am getting the warning

我收到警告

Warning: sendmailpm.jsp modified in the future. 

What does this mean?

这是什么意思?

回答by sangretu

You aren't allowed to modify anything in the past if doing so might change the future. You might cause a temporal paradox, which could corrupt the time stream and cause our entire reality to cease to exist.

如果这样做可能会改变未来,则不允许您修改过去的任何内容。你可能会导致时间悖论,这可能会破坏时间流并导致我们的整个现实不复存在。

Please do not modify that file.

请不要修改该文件。

回答by jmanning2k

JSP files are compiled. Many servers also allow you to replace the files on a running server. It then compares the timestamp of the compiled source and the timestamp of the jsp file to determine if it needs to recompile.

JSP 文件被编译。许多服务器还允许您替换正在运行的服务器上的文件。然后比较编译源的时间戳和jsp文件的时间戳,判断是否需要重新编译。

If the file is dated in the future, the jsp file will always be newer than the class. This gives you a warning.

如果文件的日期是未来,则 jsp 文件将始终比类更新。这给你一个警告。

Check the timestamp on the file. Perhaps someone created it on a computer with an incorrect clock, and now it appears to be "created in the future". Or perhaps the server has the incorrect date (check timezone settings).

检查文件上的时间戳。也许有人在一个时钟不正确的计算机上创建了它,现在它似乎是“在未来创建的”。或者服务器的日期不正确(检查时区设置)。

Are there remote file servers involved? Clock drift between a web server and a file server can cause this error too.

是否涉及远程文件服务器?Web 服务器和文件服务器之间的时钟漂移也可能导致此错误。

To diagnose this further, you'd have to give us some hints - what jsp server, what OS, what filesystem?

要进一步诊断这一点,您必须给我们一些提示 - 什么 jsp 服务器、什么操作系统、什么文件系统?

回答by Steve Jones

During an Ant build, this warning can be output during a task.

在 Ant 构建期间,可以在任务期间输出此警告。

[copy] Warning: foo\bar.txt modified in the future.

Ant's <copy>task by default won't copy files if the destination files are newer than the source. This saves much time and disk I/O. However you can override this behavior with the option <copy overwrite="true">. This tells Ant that you know what you're doing; overwrite the destination files regardless of their modification date. This will also suppress the warning.

<copy>如果目标文件比源文件新,Ant 的任务默认不会复制文件。这可以节省大量时间和磁盘 I/O。但是,您可以使用选项覆盖此行为<copy overwrite="true">。这告诉 Ant 你知道你在做什么;无论修改日期如何,都会覆盖目标文件。这也将抑制警告。

回答by FelixD

If your code is residing on a FAT/FAT32 partition or ZIP file, this can be caused by the lack of precision in the FAT/ZIP filesystem's timestamping, which is 2 seconds (afaik). This can cause compiler / build tool output to be saved with a time slightly in the future, so that when the next build/deployment step (can be internal to a JSP container) is executed, the file will appear to be from the future and the warning is produced. Try using a different file system, e.g. NTFS on DOS/Windows boxes.

如果您的代码驻留在 FAT/FAT32 分区或 ZIP 文件中,这可能是由于 FAT/ZIP 文件系统的时间戳不精确造成的,该时间戳为 2 秒 (afaik)。这可能会导致编译器/构建工具输出在未来稍微保存一段时间,以便在执行下一个构建/部署步骤(可以在 JSP 容器内部)时,该文件将看起来来自未来并且产生警告。尝试使用不同的文件系统,例如 DOS/Windows 机器上的 NTFS。

I had the same warning message from Apache Ant when trying to do a Java build on a FAT32 TrueCrypt partition. After ruling out other causes (timezone difference, clock off etc), I eventually found a hint on this, changed to an NTFS TrueCrypt partition and the warning disappeared.

尝试在 FAT32 TrueCrypt 分区上进行 Java 构建时,我收到了来自 Apache Ant 的相同警告消息。在排除其他原因(时区差异、时钟关闭等)后,我最终找到了一个提示,更改为 NTFS TrueCrypt 分区并且警告消失了。

回答by Jon Bringhurst

Someone probably modified the file, then changed the time on the server. Try checking to see what time your box is set to and make sure it's correct. If it is, you can probably ignore that warning without any side effects.

可能有人修改了文件,然后更改了服务器上的时间。尝试检查您的盒子设置的时间,并确保它是正确的。如果是这样,您可能可以忽略该警告而不会产生任何副作用。

回答by Sushant Mane

Check whether system time is correct or not. If not sync it with Standard time for your zone. Then run your build file.

检查系统时间是否正确。如果没有与您所在区域的标准时间同步。然后运行你的构建文件。

回答by Michael Borgwardt

JSPs are compiled on-the-fly to servlets. The servlet container compares the "last modified" dates of both to see if the JSP has been changed and the servlet needs to be updated. A "last modified" date in the future indicates that something is wrong with the system clock, which is relevant because it could disrupt the abovementioned mechanism, leading to servlets that are not updated.

JSP 被即时编译为 servlet。servlet 容器比较两者的“上次修改”日期,以查看 JSP 是否已更改以及 servlet 是否需要更新。未来的“最后修改”日期表示系统时钟有问题,这是相关的,因为它可能会破坏上述机制,导致 servlet 未更新。

回答by user1344123

This is because, The time of the system is not current on which you are running the build file

这是因为,系统的时间不是您运行构建文件的当前时间

回答by maverick

If the java file that you are compiling has a time stamp that is beyond the current time of the system on which you are compiling...you will see this warning. I modified the file on one machine and put it on another and tried compiling and came across this issue.

如果您正在编译的 java 文件的时间戳超出了您正在编译的系统的当前时间...您将看到此警告。我在一台机器上修改了文件并将其放在另一台机器上并尝试编译并遇到了这个问题。

回答by Edson Sousa

I had this error too, but after reading some answers above i realized that is was due to the change i've done in the computer to some days ahead because of the test of a functionality that requires date manipulation.

我也有这个错误,但在阅读了上面的一些答案后,我意识到这是由于我在计算机中所做的更改提前几天,因为需要日期操作的功能测试。

Here is what happened:

这是发生的事情:

1 - To perform Unit Test of a new implemented functionality i had to set the computer date to 4 days in the future.

1 - 要对新实现的功能执行单元测试,我必须将计算机日期设置为未来 4 天。

2 - When i performed the test the compiler compiled the class automatically, as expected.

2 - 当我执行测试时,编译器按预期自动编译了类。

3 - Therefore when i was trying to rebuild the project the IDE detected that the file was (ironically) created in the future. (LoL - that's why i love Java you can even code in the future.).

3 - 因此,当我尝试重建项目时,IDE 检测到该文件是(具有讽刺意味的)将来创建的。(大声笑 - 这就是我喜欢 Java 的原因,你甚至可以在未来编写代码。)。

So +1 @jmanning2k.

所以+1@jmanning2k。

I hope it can help somebody facing this issue.

我希望它可以帮助遇到这个问题的人。