Wonder 402 Опубликовано 19 августа, 2010 В общем есть небольшой кусок кода: Скрытый текст def updateConfigValue(configName,newValue,sectionId) : conn=L2DatabaseFactory.getInstance().getConnection() getVal = conn.prepareStatement("SELECT usableValues FROM buffer_configuration WHERE configName=\""+configName+"\"") act=getVal.executeQuery() if act : act.next() try : usable = act.getString("usableValues") except : usable = "none,none,none" usable = usable.replace(","," ") extr = usable.split(" ") valType = extr[0] minVal = extr[1] maxVal = extr[2] if newValue == "" : return showText("Info","You must enter a new value!","True","Return","view_configs "+str(sectionId)) else : if valType == "bool" : upd=conn.prepareStatement("UPDATE buffer_configuration SET configValue=\""+newValue+"\" WHERE configName=\""+configName+"\"") try : upd.executeUpdate() upd.close() conn.close() configs = ["enableBuffs","enableSongs","enableDances","enableChants","enableKamael","enableSpecial"] if configName in configs : upd2=conn.prepareStatement("UPDATE buffer_scheme_list SET mod_accepted=1") try : upd2.executeUpdate() upd2.close() conn.close() except: pass return showText("Info","Value has been changed successfully!","True","Return","view_configs "+str(sectionId)) except: try : conn.close() except : pass else : if valType == "range" : if newValue.isdigit() and int(newValue) >= int(minVal) and int(newValue) <= int(maxVal) : upd=conn.prepareStatement("UPDATE buffer_configuration SET configValue=\""+newValue+"\" WHERE configName=\""+configName+"\"") try : upd.executeUpdate() upd.close() return showText("Info","Value has been changed successfully!","True","Return","view_configs "+str(sectionId)) conn.close() except: try : conn.close() except : pass else : return showText("Info","You must enter an integer from "+minVal+" to "+maxVal+"!","True","Return","view_configs "+str(sectionId)) else : if valType == "string" : newValue = newValue.replace(","," ") if len(newValue) < int(minVal) or len(newValue) > int(maxVal) : return showText("Info","You must enter a value that:<br> 1) Isn't shorter than 3 characters!<br> 2) Isn't longer than 36 characters!","True","Return","view_configs") else : upd=conn.prepareStatement("UPDATE buffer_configuration SET configValue=? WHERE configName=\""+configName+"\"") upd.setString(1, newValue) try : upd.executeUpdate() upd.close() return showText("Info","Value has been changed successfully!","True","Return","view_configs "+str(sectionId)) conn.close() except: try : conn.close() except : pass else : if valType == "custom" : upd=conn.prepareStatement("UPDATE buffer_configuration SET configValue=? WHERE configName=\""+configName+"\"") upd.setString(1, newValue) try : upd.executeUpdate() upd.close() return showText("Info","Value has been changed successfully!","True","Return","view_configs "+str(sectionId)) conn.close() except: try : conn.close() except : pass if valType == "custom2" : upd=conn.prepareStatement("UPDATE buffer_configuration SET configValue=? WHERE configName=\""+configName+"\"") upd.setString(1, newValue) try : upd.executeUpdate() upd.close() return showText("Info","Value has been changed successfully!","True","Return","view_configs "+str(sectionId)) conn.close() except: try : conn.close() except : pass Который регулярно выкидывает ошибку, которая сама по себе не критична, но очень напрягает Скрытый текст at java.lang.Thread.run(Thread.java:619) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at com.l2dc.gameserver.network.clientpackets.L2GameClientPacket.run(L2GameClientPacket.java:92) at com.l2dc.gameserver.network.clientpackets.RequestBypassToServer.runImpl(RequestBypassToServer.java:82) at com.l2dc.gameserver.model.actor.L2Npc.onBypassFeedback(L2Npc.java:890) at handlers.bypasshandlers.QuestEvent.useBypass(QuestEvent.java:43) at com.l2dc.gameserver.model.actor.instance.L2PcInstance.processQuestEvent(L2PcInstance.java:1703) at com.l2dc.gameserver.model.quest.Quest.notifyEvent(Quest.java:433) at org.python.proxies.main$Quest$391.onAdvEvent(Unknown Source) at org.python.core.PyObject._jcall(Unknown Source) at org.python.core.PyObject._jcallexc(Unknown Source) at org.python.core.PyObject.__call__(Unknown Source) at org.python.core.PyMethod.__call__(Unknown Source) at org.python.core.PyFunction.__call__(Unknown Source) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyTableCode.call(Unknown Source) at org.python.core.PyTableCode.call(Unknown Source) at org.python.pycode.serializable._pyx1282241364806.call_function(__init__.py) at org.python.pycode.serializable._pyx1282241364806.onAdvEvent$10(__init__.py:1028) at org.python.core.PyInstance.invoke(Unknown Source) at org.python.core.PyObject.__call__(Unknown Source) at org.python.core.PyMethod.__call__(Unknown Source) at org.python.core.PyReflectedFunction.__call__(Unknown Source) at java.lang.reflect.Method.invoke(Method.java:597) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source) at com.l2dc.L2DatabaseFactory.getConnection(L2DatabaseFactory.java:252) java.lang.RuntimeException Unclosed connection! Trace: Если кто знает как правильно закрыть соединение, то буду рад выслушать любые предложения. Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
Wonder 402 Опубликовано 20 августа, 2010 Справился своими силами, после недолгих эксперементов методом тыка. Кому надо исправленый баффер под сборку l2DC - обращайтесь. Закрываю. Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
SmokiMo 892 Опубликовано 25 сентября, 2012 <strong class='bbc'>Автоматическое сообщение</strong><br /><br /><br />Эта тема была перемещена из "Форум для новичков" в "Решенные проблемы". Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты