我可以使用运行参数,以修复Java坏API调用了呢? [英] Can I use runtime parameters to fix out of bad API calls in Java?

查看:215
本文介绍了我可以使用运行参数,以修复Java坏API调用了呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

不知道这是正确的位置要求,但我有一个Java的问题。我有一些Java code,在Java 6中,但不是在Java 7的工作,错误的是:

  java.lang.IllegalStateException:此功能应同时举行treeLock被称为

使用的Java6工作,但我们的一些外部用户运行Java 7的我想通了,错误是由调用引起 validateTree(),它在工作的Java6但在java7目录,我们需要调用的validate()。当我在本地测试一下它的工作原理。

下面是我的问题,我开始在一家大企业工作,他们不会让我们做的code,直到其被非常throughly看着任何改变(我工作的变化是要采取在2013年4月影响)但在那之前我们的用户越来越恼火。我不是最好的Java和想知道是否有办法,我可以通过一个运行的参数有这样的改变?或者是有什么不碰code碱基我能做什么?

我embrassed问这个问题,因为它可以很容易解决,只需执行修复,但任何意见或方向将是非常有益的。

更新:我的理想寻找的东西,我能得到支持,将在Java运行时的参数,将改变所有validateTree()引用验证()


解决方案

  

我可以使用运行时参数修复了恶劣的API调用在Java中?


作为一般规则,无

在特定的情况下,你可以看看相关的类的Java 7版本的类库的源$ C ​​$ C,看看是否有一个向后兼容性属性。


假设你不能找到一个解决方法,你是那种卡住了。我建议:


  • 推荐给你的客户,他们使用Java 6,直至修复可以发出。

  • 与管理讨论他们是否能破例他们的政策,让亟待修正了这个问题。

如果没有这些作品,那么真正的问题是您的客户和管理层之间。你已经做了,就像你可以做的。交给上级UPS处理。


您可能会感兴趣的我回答一个相关的太问题这倒是的为什么的问题的他们做了这个破的转变。我的看法是,变化是迫使人们解决一类的阴险,难以重现的应用程序的bug导致奇怪的UI行为。这是一件好事......在长期的。

在此基础上,你可以做一个更强的情况下发放出带外的修复。此修复程序来替换 validateTree()调用的validate()要求实际上是对的所有必要的修复的Java平台上,不只是对Java 7。

Not sure if this is the right spot to ask but I'm having a Java issue. I have some Java code that works in Java 6 but not in Java 7, the error is:

java.lang.IllegalStateException: This function should be called while holding treeLock

Using Java6 works but a few of our external users are running Java 7. I figured out the error was caused by a call to validateTree(), which works in java6 but in Java7 we need to call validate() . When I test it locally it works.

Here's my problem, I started working at a big corporate and they won't let us make any changes to the code until its been very throughly looked at(my working change is going to take affect in April 2013) but until then our users are getting annoyed. I'm not the best with Java and was wondering if there was a way I could pass a runtime parameters to have this changed? or is there anything I can do without touching the code base?

I'm embrassed to ask this question since it could be solved easily by just implementing the fix but any ideas or direction would be very helpful.

Update: I'm ideally looking for something that I can get support to put in the java runtime parameter that would change all validateTree() references to validate().

解决方案

Can I use runtime parameters to fix out of bad API calls in Java?

As a general rule, no.

In a specific case, you could look at the source code of the relevant classes Java 7 version of the class library to see if there is a backwards compatibility property.


Assuming that you can't find a fix, you are kind of stuck. I'd suggest:

  • Recommend to your customers that they use Java 6 until a fix can be issued.
  • Discuss with your management whether they can make an exception to their policy to allow this problem to be fixed urgently.

If neither of those works, then the real problem is between your customers and your management. You've done as much as you can do. Leave it to "the higher ups" deal with it.


You might be interested in my Answer to a related SO Question which touches on the issue of why they made this "breaking" change. My take is that the change is to force people to fix a class of insidious, hard-to-reproduce application bugs that cause strange UI behaviour. And that is a good thing ... in the long term.

Based on that, you could make a stronger case for issuing an out-of-band fix. The fix to replace validateTree() calls with validate() calls is actually a necessary fix for all Java platforms, not just for Java 7.

这篇关于我可以使用运行参数,以修复Java坏API调用了呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆