[JBoss JIRA] Created: (JBRULES-756) Allow predicates and return values to use implicit bindings
by Edson Tirelli (JIRA)
Allow predicates and return values to use implicit bindings
-----------------------------------------------------------
Key: JBRULES-756
URL: http://jira.jboss.com/jira/browse/JBRULES-756
Project: JBoss Rules
Issue Type: Feature Request
Security Level: Public (Everyone can see)
Components: Drl Parser/Builder, Reteoo
Affects Versions: 3.1-m1
Reporter: Edson Tirelli
Assigned To: Edson Tirelli
Fix For: 3.1-m2
Allow for use of implicit declared/bound variables inside predicates and return value expressions. Ex:
package org.drools;
global java.util.List results;
global java.lang.Double factor;
rule "test implicit declarations"
when
// implicit binding
Cheese( type == "stilton", ( price < 20*factor ) )
// late declaration
Cheese( price < ( price * factor ), ( price < price * factor ), price : price )
then
results.add( "Rule Fired" );
end
The "price" variable is implicit declared and bound to the "price" field to be used inside the predicates and return values. It also allows for late bindings.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
19 years, 3 months
[JBoss JIRA] Updated: (JBAS-2910) minor try-finally changes to make sure that some streams and JDBC objects are always closed
by Dimitris Andreadis (JIRA)
[ http://jira.jboss.com/jira/browse/JBAS-2910?page=all ]
Dimitris Andreadis updated JBAS-2910:
-------------------------------------
Fix Version/s: JBossAS-4.2.1.CR1
(was: JBossAS-4.2.0.GA)
> minor try-finally changes to make sure that some streams and JDBC objects are always closed
> -------------------------------------------------------------------------------------------
>
> Key: JBAS-2910
> URL: http://jira.jboss.com/jira/browse/JBAS-2910
> Project: JBoss Application Server
> Issue Type: Patch
> Security Level: Public(Everyone can see)
> Components: Web (Tomcat) service, CMP service
> Reporter: Westley Weimer
> Priority: Minor
> Fix For: JBossAS-4.2.1.CR1
>
> Original Estimate: 20 minutes
> Remaining Estimate: 20 minutes
>
> Attached are minor candidate patches for jboss (against a CVS checkout of the sources on 2006 03 08) that ensure that resources are closed properly in some unlikely exceptional cases. These changse should not affect jboss functionality at all aside from ensuring that resources are closed in a few more cases.
> This is hardly the most exciting sort of bugfix in the world, but jboss does seem to be concerned with leaks and being ironclad in these situations. The patches all have the general flavor of changing "open; work; close" to "try { open; work; } finally { close; }". It should take a knowledgeable dev at most a few minutes to eyeball them and accept or reject them.
> I'm not sure how to attach the patch file, so I'm copying it here. My apologies if this is the wrong place for this sort of thing.
> --- jboss-20060308-orig/src/main/org/jboss/ejb/plugins/CMPInMemoryPersistenceManager.java 2006-03-08 16:29:45.917109700 -0500
> +++ jboss-20060308/src/main/org/jboss/ejb/plugins/CMPInMemoryPersistenceManager.java 2006-03-08 16:34:15.141058700 -0500
> @@ -355,11 +355,12 @@
> */
> public void loadEntity (EntityEnterpriseContext ctx)
> {
> + java.io.ObjectInputStream in = null;
> try
> {
> // Read fields
>
> - java.io.ObjectInputStream in = new CMPObjectInputStream
> + in = new CMPObjectInputStream
> (new java.io.ByteArrayInputStream ((byte[])this.beans.get (ctx.getId ())));
>
> Object obj = ctx.getInstance ();
> @@ -370,12 +371,15 @@
> f[i].set (obj, in.readObject ());
> }
>
> - in.close ();
> }
> catch (Exception e)
> {
> throw new EJBException ("Load failed", e);
> }
> + finally
> + {
> + if (in != null) { try { in.close(); } catch (Exception e) { } }
> + }
> }
>
> /**
> --- jboss-20060308-orig/src/main/org/jboss/invocation/http/interfaces/Util.java 2006-03-08 16:29:47.899706700 -0500
> +++ jboss-20060308/src/main/org/jboss/invocation/http/interfaces/Util.java 2006-03-08 17:32:40.259780600 -0500
> @@ -158,7 +158,9 @@
> conn.setRequestProperty("ContentType", REQUEST_CONTENT_TYPE);
> conn.setRequestMethod("POST");
> OutputStream os = conn.getOutputStream();
> + ObjectInputStream ois = null;
> ObjectOutputStream oos = new ObjectOutputStream(os);
> + try {
> try
> {
> oos.writeObject(mi);
> @@ -173,12 +175,14 @@
>
> // Get the response MarshalledValue object
> InputStream is = conn.getInputStream();
> - ObjectInputStream ois = new ObjectInputStream(is);
> + ois = new ObjectInputStream(is);
> MarshalledValue mv = (MarshalledValue) ois.readObject();
> // A hack for jsse connection pooling (see patch ).
> ois.read();
> - ois.close();
> - oos.close();
> + } finally {
> + if (ois != null) { try { ois.close(); } catch (Exception e) { } }
> + if (oos != null) { try { oos.close(); } catch (Exception e) { } }
> + }
>
> // If the encoded value is an exception throw it
> Object value = mv.get();
> --- jboss-20060308-orig/src/main/org/jboss/invocation/MarshalledValue.java 2006-03-08 16:29:48.008983700 -0500
> +++ jboss-20060308/src/main/org/jboss/invocation/MarshalledValue.java 2006-03-08 17:30:01.198298600 -0500
> @@ -89,9 +89,12 @@
>
> ByteArrayInputStream bais = new ByteArrayInputStream(serializedForm);
> MarshalledValueInputStream mvis = new MarshalledValueInputStream(bais);
> + try {
> Object retValue = mvis.readObject();
> - mvis.close();
> return retValue;
> + } finally {
> + mvis.close();
> + }
> }
>
> public byte[] toByteArray()
> --- jboss-20060308-orig/src/main/org/jboss/invocation/pooled/interfaces/PooledMarshalledValue.java 2006-03-08 16:29:48.055816700 -0500
> +++ jboss-20060308/src/main/org/jboss/invocation/pooled/interfaces/PooledMarshalledValue.java 2006-03-08 17:34:20.946787700 -0500
> @@ -90,9 +90,12 @@
>
> ByteArrayInputStream bais = new ByteArrayInputStream(serializedForm);
> ObjectInputStream mvis = new OptimizedObjectInputStream(bais);
> + try {
> Object retValue = mvis.readObject();
> - mvis.close();
> return retValue;
> + } finally {
> + try { mvis.close(); } catch (Exception e) { }
> + }
> }
>
> public byte[] toByteArray()
> --- jboss-20060308-orig/src/main/org/jboss/naming/HttpNamingContextFactory.java 2006-03-08 16:29:48.914421700 -0500
> +++ jboss-20060308/src/main/org/jboss/naming/HttpNamingContextFactory.java 2006-03-08 17:35:39.213414500 -0500
> @@ -132,8 +132,12 @@
>
> InputStream is = conn.getInputStream();
> ObjectInputStream ois = new ObjectInputStream(is);
> - MarshalledValue mv = (MarshalledValue) ois.readObject();
> - ois.close();
> + MarshalledValue mv = null;
> + try {
> + mv = (MarshalledValue) ois.readObject();
> + } finally {
> + try { ois.close(); } catch (Exception e) { }
> + }
>
> Object obj = mv.get();
> if( (obj instanceof Naming) == false )
> --- jboss-20060308-orig/src/main/org/jboss/web/AbstractWebContainer.java 2006-03-08 16:29:49.413973700 -0500
> +++ jboss-20060308/src/main/org/jboss/web/AbstractWebContainer.java 2006-03-08 17:37:40.449341300 -0500
> @@ -322,8 +322,11 @@
> throw new DeploymentException("Was unable to mkdir: "+expWarFile);
> log.debug("Unpacking war to: "+expWarFile);
> FileInputStream fis = new FileInputStream(warFile);
> + try {
> JarUtils.unjar(fis, expWarFile);
> - fis.close();
> + } finally {
> + try { fis.close(); } catch (Exception e) { }
> + }
> log.debug("Replaced war with unpacked contents");
> if (warFile.delete() == false)
> log.debug("Was unable to delete war file");
> @@ -416,6 +419,7 @@
>
> FileInputStream fis = new FileInputStream(warFile);
> JarInputStream jin = new JarInputStream(fis);
> + try {
> ZipEntry entry = jin.getNextEntry();
> while (entry != null)
> {
> @@ -426,8 +430,9 @@
> }
> entry = jin.getNextEntry();
> }
> - jin.close();
> -
> + } finally {
> + try { jin.close(); } catch (Exception e) { }
> + }
> URL[] urlArr = new URL[urlList.size()];
> urlList.toArray(urlArr);
> di.annotationsCl = new URLClassLoader(urlArr, di.ucl);
> @@ -706,6 +711,7 @@
> // First check for a WEB-INF/web.xml and a WEB-INF/jboss-web.xml
> InputStream warIS = warURL.openStream();
> java.util.zip.ZipInputStream zipIS = new java.util.zip.ZipInputStream(warIS);
> + try {
> java.util.zip.ZipEntry entry;
> byte[] buffer = new byte[512];
> int bytes;
> @@ -730,7 +736,9 @@
> jbossWebIS = new ByteArrayInputStream(baos.toByteArray());
> }
> }
> - zipIS.close();
> + } finally {
> + try { zipIS.close(); } catch (Exception e) { }
> + }
> }
>
> XmlFileLoader xmlLoader = new XmlFileLoader();
> --- jboss-20060308-orig/src/main/org/jboss/web/WebServer.java 2006-03-08 16:29:49.445195700 -0500
> +++ jboss-20060308/src/main/org/jboss/web/WebServer.java 2006-03-08 17:38:28.403080100 -0500
> @@ -1,4 +1,4 @@
> -/*
> +/* } catch (Exception e) { }
> * JBoss, Home of Professional Open Source
> * Copyright 2005, JBoss Inc., and individual contributors as indicated
> * by the @authors tag. See the copyright.txt in the distribution for a
> @@ -521,6 +521,7 @@
> protected byte[] getBytes(URL url) throws IOException
> {
> InputStream in = new BufferedInputStream(url.openStream());
> + try {
> log.debug("Retrieving " + url);
> ByteArrayOutputStream out = new ByteArrayOutputStream();
> byte[] tmp = new byte[1024];
> @@ -529,8 +530,10 @@
> {
> out.write(tmp, 0, bytes);
> }
> - in.close();
> return out.toByteArray();
> + } finally {
> + try { in.close(); } catch (Exception e) { }
> + }
> }
>
> /**
> --- jboss-20060308-orig/src/main/org/jboss/ejb/plugins/cmp/jdbc/keygen/JDBCDB2IdentityValLocalCreateCommand.java 2006-03-08 16:29:45.323891700 -0500
> +++ jboss-20060308/src/main/org/jboss/ejb/plugins/cmp/jdbc/keygen/JDBCDB2IdentityValLocalCreateCommand.java 2006-03-08 17:19:47.443491800 -0500
> @@ -44,8 +44,9 @@
> protected int executeInsert(int paramIndex, PreparedStatement ps, EntityEnterpriseContext ctx ) throws SQLException {
> int rows = ps.executeUpdate();
> ResultSet results = null;
> + Connection conn = null;
> try {
> - Connection conn = ps.getConnection();
> + conn = ps.getConnection();
> results = conn.prepareStatement( SQL ).executeQuery();
> if( !results.next() ) {
> throw new EJBException( "identity_val_local() returned an empty ResultSet" );
> @@ -58,6 +59,7 @@
> throw new EJBException( "Error extracting identity_val_local()", e );
> } finally {
> JDBCUtil.safeClose( results );
> + JDBCUtil.safeClose(con);
> }
> return rows;
> }
> --- jboss-20060308-orig/src/main/org/jboss/ejb/plugins/cmp/jdbc/keygen/JDBCPostgreSQLCreateCommand.java 2006-03-08 16:29:45.355113700 -0500
> +++ jboss-20060308/src/main/org/jboss/ejb/plugins/cmp/jdbc/keygen/JDBCPostgreSQLCreateCommand.java 2006-03-08 17:22:01.854042800 -0500
> @@ -74,11 +74,12 @@
>
> Statement s = null;
> ResultSet rs = null;
> + Connection c = null;
> try {
> if (trace) {
> log.trace("Executing SQL :"+sequenceSQL);
> }
> - Connection c = ps.getConnection();
> + c = ps.getConnection();
> s = c.createStatement();
> rs = s.executeQuery(sequenceSQL);
> if (!rs.next()) {
> @@ -93,6 +94,7 @@
> } finally {
> JDBCUtil.safeClose(rs);
> JDBCUtil.safeClose(s);
> + JDBCUtil.safeClose(c);
> }
>
> return rows;
> --- jboss-20060308-orig/src/main/org/jboss/ejb/plugins/cmp/jdbc/keygen/JDBCSQLServerCreateCommand.java 2006-03-08 16:29:45.355113700 -0500
> +++ jboss-20060308/src/main/org/jboss/ejb/plugins/cmp/jdbc/keygen/JDBCSQLServerCreateCommand.java 2006-03-08 17:23:29.513540100 -0500
> @@ -61,10 +61,10 @@
>
> protected int executeInsert(int index, PreparedStatement ps, EntityEnterpriseContext ctx) throws SQLException
> {
> - ps.execute();
> ResultSet rs = null;
> try
> {
> + ps.execute();
> int rows = ps.getUpdateCount();
> if(rows != 1)
> {
> @@ -95,6 +95,7 @@
> finally
> {
> JDBCUtil.safeClose(rs);
> + JDBCUtil.safeClose(ps);
> }
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
19 years, 3 months
[JBoss JIRA] Created: (JBTM-208) JCA Inflow fails with one phase commit
by Kevin Conner (JIRA)
JCA Inflow fails with one phase commit
--------------------------------------
Key: JBTM-208
URL: http://jira.jboss.com/jira/browse/JBTM-208
Project: JBoss Transaction Manager
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: 4.2.2
Reporter: Kevin Conner
Assigned To: Kevin Conner
Fix For: 4.2.3
The TxInflowUnitTestCase is currently failing because of a bug in the subordinate transaction implementation.
The test creates an inflow through the JCA WorkManager, enlists a single resource and then executes a one phase commit via the XATerminator. The logic in the one phase commit code is, unfortunately, incorrect.
The code attempts to invoke end on all suspended resources and, if this succeeds, marks the transaction for rollback. The result is that all successful, subordinate, one phase transactions are rolled back.
The logic should be reversed so that a failure marks the transaction for rollback.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
19 years, 3 months
[JBoss JIRA] Closed: (JBPM-621) Decision 'otherwise' choice does not appear to work.
by Tom Baeyens (JIRA)
[ http://jira.jboss.com/jira/browse/JBPM-621?page=all ]
Tom Baeyens closed JBPM-621.
----------------------------
i think this could be a duplicate of JBPM-853
Check that issue and see in the fisheye tab for more info. Basically there was a test that was fixed. And also the docs were updated. It could be that previously I was confused about the actual behaviour because of the bogus test.
> Decision 'otherwise' choice does not appear to work.
> ----------------------------------------------------
>
> Key: JBPM-621
> URL: http://jira.jboss.com/jira/browse/JBPM-621
> Project: JBoss jBPM
> Issue Type: Bug
> Components: Core Engine
> Affects Versions: jBPM 3.1
> Reporter: Michael Youngstrom
> Assigned To: Tom Baeyens
> Fix For: jBPM jPDL 3.2
>
>
> The following decision appears to always result in the "to_print" transition choosen. The decision node doesn't appear to ever check transisions who don't have conditions. So it assumes there is only one transition so it chooses the 'default' or first transition.
> <decision name="data_needed">
> <transition name="to_print" to="print_application">
> <condition expression="#{true == false}"/>
> </transition>
> <transition name="to_get_approval" to="get_approval"/>
> </decision>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
19 years, 3 months
[JBoss JIRA] Created: (JBPM-854) Condition in transition not retrieved from database JBPM_TRANSITIONS#DECISION_
by Arjan van Bentem (JIRA)
Condition in transition not retrieved from database JBPM_TRANSITIONS#DECISION_
------------------------------------------------------------------------------
Key: JBPM-854
URL: http://jira.jboss.com/jira/browse/JBPM-854
Project: JBoss jBPM
Issue Type: Bug
Components: Core Engine
Affects Versions: jBPM jPDL 3.2 beta 2
Environment: All
Reporter: Arjan van Bentem
Assigned To: Tom Baeyens
Though table JBPM_DECISIONCONDITION is replaced by column DECISION_ in table JBPM_TRANSITIONS, the Java code will still query that old table to load processes that were deployed using a previous version. For an empty query result Hibernate will return an empty List (at least for the Hypersonic database), while the code only checks for the List to be null. This fails, and results in conditions not being taken from JBPM_TRANSITIONS.
Fix: replace line 105 of Decision.java (version 1.3)
http://fisheye.jboss.com/browse/JBPM/jbpm.3/jpdl/jar/src/main/java/org/jb...
48 List decisionConditions = null;
:
105 } else if (decisionConditions!=null) {
106 // backwards compatible mode based on separate DecisionCondition
with
105 } else if (decisionConditions!=null && !decisionConditions.isEmpty()) {
To test one could replace org.jbpm.graph.node.JpdlDbTest#testDecision() to use correct EL expression, and then signal the process to invoke the troublesome code:
http://fisheye.jboss.com/browse/JBPM/jbpm.3/jpdl/jar/src/test/java/org/jb...
public void testDecision(){
ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
"<process-definition>" +
" <start-state>" +
" <transition to='d' />" +
" </start-state>" +
" <decision name='d'>" +
" <transition name='one' to='a'>" +
" <condition>#{a == 1}</condition>" +
" </transition>" +
" <transition name='two' to='b'>" +
" <condition>#{a == 2}</condition>" +
" </transition>" +
" <transition name='three' to='c'>" +
" <condition>#{a == 3}</condition>" +
" </transition>" +
" </decision>" +
" <state name='a' />" +
" <state name='b' />" +
" <state name='c' />" +
"</process-definition>");
processDefinition = saveAndReload(processDefinition);
Decision decision = (Decision) processDefinition.getNode("d");
assertEquals("#{a == 1}", decision.getLeavingTransition("one").getCondition());
assertEquals("#{a == 2}", decision.getLeavingTransition("two").getCondition());
assertEquals("#{a == 3}", decision.getLeavingTransition("three").getCondition());
// Assure org.jbpm.graph.node.Decision#execute gets the conditions from
// table JBPM_TRANSITIONS rather than the obsolete JBPM_DECISIONCONDITION:
ProcessInstance processInstance = new ProcessInstance(processDefinition);
processInstance.getContextInstance().setVariable("a", new Integer(2));
processInstance.signal();
assertEquals(processDefinition.getNode("b"), processInstance.getRootToken().getNode());
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
19 years, 3 months
[JBoss JIRA] Created: (JBPM-853) Attribute 'expression' not taken from Condition element
by Arjan van Bentem (JIRA)
Attribute 'expression' not taken from Condition element
-------------------------------------------------------
Key: JBPM-853
URL: http://jira.jboss.com/jira/browse/JBPM-853
Project: JBoss jBPM
Issue Type: Bug
Components: Core Engine
Affects Versions: jBPM jPDL 3.2 beta 2
Environment: All
Reporter: Arjan van Bentem
Assigned To: Tom Baeyens
The <condition> element allows for either specifying an attribute 'expression', or for giving the expression as the text of the element itself. So, both
<condition>#{true}</condition>
and
<condition expression="#{true}"/>
should work. However, the latter expression is ignored (and does not get stored in the database but results in a zero-length (non-null) value in column DECISION_ in JBPM_TRANSITIONS instead). This is caused by org.dom4j.Element#getTextTrim() returning en empty String rather than null.
Fix: replace line 745 of JpdlXmlReader (version 1.7)
http://fisheye.jboss.com/browse/JBPM/jbpm.3/jpdl/jar/src/main/java/org/jb...
739 String condition = transitionElement.attributeValue("condition");
740 if (condition==null) {
741 Element conditionElement = transitionElement.element("condition");
742 if (conditionElement!=null) {
743 condition = conditionElement.getTextTrim();
744 // for backwards compatibility
745 if (condition==null) {
746 condition = conditionElement.attributeValue("expression");
747 }
748 }
749 }
with
745 if (condition==null || condition.length()==0) {
In the DecisionConditionsTest Unit test one could change one (and ONLY one) of the conditions to use the attribute rather than the element text. Like on line 42 of DecisionConditionsTest (version 1.1) replace
http://fisheye.jboss.com/browse/JBPM/jbpm.3/jpdl/jar/src/test/java/org/jb...
41 " <transition name='lead' to='put it in the lead db'>" +
42 " <condition>#{budget > 100}</condition>" +
43 " </transition>" +
with
42 " <condition expression='#{budget > 100}'/>" +
Thanks to cdart_rrr for pointing this out in the forums.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
19 years, 3 months