Deleting a Java object

52 views
Skip to first unread message

Greg Neyman

unread,
Oct 20, 2016, 3:52:48 PM10/20/16
to Tasker
I've just started working with Java objects, and I thought it good practice to delete after use. But I get the following error after trying to:

14.10.26/E code 3: java.util.ConcurrentModificationException.
14.10.26/E prefsException/Java Object: null
14.10.26/ java.util.HashMap$HashIterator.nextEntry(HashMap.java:787)
14.10.26/ java.util.HashMap$KeyIterator.next(HashMap.java:814)
14.10.26/ net.dinglisch.android.taskerm.alf.a(Unknown Source)
14.10.26/ net.dinglisch.android.taskerm.ExecuteService.a(Unknown Source)
14.10.26/ net.dinglisch.android.taskerm.ExecuteService.a(Unknown Source)
14.10.26/ net.dinglisch.android.taskerm.ExecuteService.a(Unknown Source)
14.10.26/E Java Object [ Mode:Delete Name:mBluetoothAdapter ]

Question 1) should I start a lower priority task to delete the object (and can I pass Java objects as parameters)?
Question 2) should I not even care because Tasker automatically deletes Java objects at the conclusion of a task?

Pent

unread,
Oct 21, 2016, 2:02:46 AM10/21/16
to Tasker

Question 1) should I start a lower priority task to delete the object


It shouldn't make any difference, there should not be a crash regardless.

(and can I pass Java objects as parameters)?


No.
 

Question 2) should I not even care because Tasker automatically deletes Java objects at the conclusion of a task?


Only local (all lower case) objects are deleted at the end of the task.

Could you post the most pared-down version of the task which still causes the exception ?

Thanks,

Pent

Greg Neyman

unread,
Oct 23, 2016, 11:05:23 AM10/23/16
to Tasker
I will change the object names to lower case for now. I had copypasta from a website.

SC BT Paired (249)
A1: Java Function [ Return:mBluetoothAdapter Class Or Object:BluetoothAdapter Function:getDefaultAdapter
{BluetoothAdapter} () Param: Param: Param: Param: Param: Param: Param: ]
A2: Java Function [ Return:%addr Class Or Object:mBluetoothAdapter Function:getBondedDevices
{Set} () Param:%addr Param: Param: Param: Param: Param: Param: ]
A3: Variable Search Replace [ Variable:%addr Search:\[ Ignore Case:Off Multi-Line:Off One Match Only:Off Store Matches In: Replace Matches:On Replace With: ]
A4: Variable Search Replace [ Variable:%addr Search:\] Ignore Case:Off Multi-Line:Off One Match Only:Off Store Matches In: Replace Matches:On Replace With: ]
A5: Java Function [ Return:mBluetoothDevice Class Or Object:mBluetoothAdapter Function:getRemoteDevice
{BluetoothDevice} (String) Param:%addr Param: Param: Param: Param: Param: Param: ]
A6: Java Function [ Return:%name Class Or Object:mBluetoothDevice Function:getName
{String} () Param: Param: Param: Param: Param: Param: Param: ]
A7: Notify [ Title:%SCTitle Text:%name - %addr Icon:null Number:0 Permanent:Off Priority:3 Actions:(2) ] If [ %SCYesAddr() !~ *%addr* & %SCNoAddr() !~ *%addr* ]
A8: Java Object [ Mode:Delete Name:mBluetoothAdapter ]
A9: Java Object [ Mode:Delete Name:mBluetoothDevice ]

Pent

unread,
Oct 23, 2016, 12:55:53 PM10/23/16
to Tasker
Sorry, I meant the XML so I could load and test it.

Do you still have the task lying around for export ?

Pent

Greg Neyman

unread,
Oct 23, 2016, 2:38:37 PM10/23/16
to Tasker
<TaskerData sr="" dvi="1" tv="4.8u5m">
<Task sr="task249">
<cdate>1475689008057</cdate>
<edate>1477247888029</edate>
<id>249</id>
<nme>SC BT Paired</nme>
<pri>100</pri>
<Action sr="act0" ve="7">
<code>664</code>
<Str sr="arg0" ve="3">mBluetoothAdapter</Str>
<Str sr="arg1" ve="3">BluetoothAdapter</Str>
<Str sr="arg2" ve="3">getDefaultAdapter
{BluetoothAdapter} ()</Str>
<Str sr="arg3" ve="3"/>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3"/>
<Str sr="arg6" ve="3"/>
<Str sr="arg7" ve="3"/>
<Str sr="arg8" ve="3"/>
<Str sr="arg9" ve="3"/>
</Action>
<Action sr="act1" ve="7">
<code>664</code>
<Str sr="arg0" ve="3">%addr</Str>
<Str sr="arg1" ve="3">mBluetoothAdapter</Str>
<Str sr="arg2" ve="3">getBondedDevices
{Set} ()</Str>
<Str sr="arg3" ve="3">%addr</Str>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3"/>
<Str sr="arg6" ve="3"/>
<Str sr="arg7" ve="3"/>
<Str sr="arg8" ve="3"/>
<Str sr="arg9" ve="3"/>
</Action>
<Action sr="act2" ve="7">
<code>598</code>
<Str sr="arg0" ve="3">%addr</Str>
<Str sr="arg1" ve="3">\[</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
<Str sr="arg5" ve="3"/>
<Int sr="arg6" val="1"/>
<Str sr="arg7" ve="3"/>
</Action>
<Action sr="act3" ve="7">
<code>598</code>
<Str sr="arg0" ve="3">%addr</Str>
<Str sr="arg1" ve="3">\]</Str>
<Int sr="arg2" val="0"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
<Str sr="arg5" ve="3"/>
<Int sr="arg6" val="1"/>
<Str sr="arg7" ve="3"/>
</Action>
<Action sr="act4" ve="7">
<code>664</code>
<Str sr="arg0" ve="3">mBluetoothDevice</Str>
<Str sr="arg1" ve="3">mBluetoothAdapter</Str>
<Str sr="arg2" ve="3">getRemoteDevice
{BluetoothDevice} (String)</Str>
<Str sr="arg3" ve="3">%addr</Str>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3"/>
<Str sr="arg6" ve="3"/>
<Str sr="arg7" ve="3"/>
<Str sr="arg8" ve="3"/>
<Str sr="arg9" ve="3"/>
</Action>
<Action sr="act5" ve="7">
<code>664</code>
<Str sr="arg0" ve="3">%name</Str>
<Str sr="arg1" ve="3">mBluetoothDevice</Str>
<Str sr="arg2" ve="3">getName
{String} ()</Str>
<Str sr="arg3" ve="3"/>
<Str sr="arg4" ve="3"/>
<Str sr="arg5" ve="3"/>
<Str sr="arg6" ve="3"/>
<Str sr="arg7" ve="3"/>
<Str sr="arg8" ve="3"/>
<Str sr="arg9" ve="3"/>
</Action>
<Action sr="act6" ve="7">
<code>523</code>
<Str sr="arg0" ve="3">%SCTitle</Str>
<Str sr="arg1" ve="3">%name - %addr</Str>
<Img sr="arg2" ve="2"/>
<Int sr="arg3" val="0"/>
<Int sr="arg4" val="0"/>
<Int sr="arg5" val="3"/>
<ConditionList sr="if">
<bool0>And</bool0>
<Condition sr="c0" ve="3">
<lhs>%SCYesAddr()</lhs>
<op>3</op>
<rhs>*%addr*</rhs>
</Condition>
<Condition sr="c1" ve="3">
<lhs>%SCNoAddr()</lhs>
<op>3</op>
<rhs>*%addr*</rhs>
</Condition>
</ConditionList>
<ListElementItem sr="item0">
<label>Yes</label>
<Action sr="action" ve="7">
<code>130</code>
<Str sr="arg0" ve="3">SC Yes</Str>
<Int sr="arg1">
<var>%priority</var>
</Int>
<Str sr="arg2" ve="3">%name</Str>
<Str sr="arg3" ve="3">%addr</Str>
<Str sr="arg4" ve="3"/>
<Int sr="arg5" val="0"/>
</Action>
<Img sr="icon" ve="2">
<nme>hd_navigation_accept</nme>
</Img>
</ListElementItem>
<ListElementItem sr="item1">
<label>No</label>
<Action sr="action" ve="7">
<code>130</code>
<Str sr="arg0" ve="3">SC No</Str>
<Int sr="arg1">
<var>%priority</var>
</Int>
<Str sr="arg2" ve="3">%name</Str>
<Str sr="arg3" ve="3">%addr</Str>
<Str sr="arg4" ve="3"/>
<Int sr="arg5" val="0"/>
</Action>
<Img sr="icon" ve="2">
<nme>hd_content_remove</nme>
</Img>
</ListElementItem>
</Action>
<Action sr="act7" ve="7">
<code>665</code>
<Int sr="arg0" val="0"/>
<Str sr="arg1" ve="3">mBluetoothAdapter</Str>
</Action>
<Action sr="act8" ve="7">
<code>665</code>
<Int sr="arg0" val="0"/>
<Str sr="arg1" ve="3">mBluetoothDevice</Str>
</Action>
</Task>
</TaskerData>

Pent

unread,
Oct 24, 2016, 3:15:22 AM10/24/16
to Tasker
Thanks, definitely a bug, fixed for next update.

It should work fine if you don't specify an object name in the delete
action, but that might cause problems with other tasks using Java
of course.

Pent

Luigi Nocco

unread,
Dec 11, 2016, 8:36:35 PM12/11/16
to Tasker
Also i want to understand why global java object are deleted randomly.

Pent

unread,
Dec 12, 2016, 2:42:49 AM12/12/16
to Tasker


Also i want to understand why global java object are deleted randomly.

Perhaps the Tasker process is being killed ?

Pent

Luigi Nocco

unread,
Dec 12, 2016, 3:21:19 AM12/12/16
to Tasker
It is possible.

When i see the problem, tasker log and system log doesn't contain possible crash cause,
because they keep info only for 2-3 minutes.

I have to find a way to store log error and keep they.
Reply all
Reply to author
Forward
0 new messages