How to use Spring Security http pattern on Mule? - spring-security

Im using spring security, but some parts without been secure and some with so i implemented http pattern for my paths, but it doesnt appear to be working or even going through that part of the code...
Code done so far:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns:servlet="http://www.mulesoft.org/schema/mule/servlet"
xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf"
xmlns:vm="http://www.mulesoft.org/schema/mule/vm"
xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting"
xmlns:core="http://www.mulesoft.org/schema/mule/core" xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" xmlns:ssl="http://www.mulesoft.org/schema/mule/ssl" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:ee="http://www.mulesoft.org/schema/mule/ee/core"
xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:https="http://www.mulesoft.org/schema/mule/https"
xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:spring="http://www.springframework.org/schema/beans" xmlns:http="http://www.mulesoft.org/schema/mule/http"
xmlns:pattern="http://www.mulesoft.org/schema/mule/pattern"
xmlns:mule-ss="http://www.mulesoft.org/schema/mule/spring-security"
xmlns:ss="http://www.springframework.org/schema/security"
xsi:schemaLocation="
http://www.mulesoft.org/schema/mule/servlet http://www.mulesoft.org/schema/mule/servlet/current/mule-servlet.xsd
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd
http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd
http://www.mulesoft.org/schema/mule/pattern http://www.mulesoft.org/schema/mule/pattern/current/mule-pattern.xsd
http://www.mulesoft.org/schema/mule/ee/core http://www.mulesoft.org/schema/mule/ee/core/current/mule-ee.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/https http://www.mulesoft.org/schema/mule/https/current/mule-https.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/3.4/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/3.4/mule-http.xsd
http://www.mulesoft.org/schema/mule/pattern http://www.mulesoft.org/schema/mule/pattern/3.4/mule-pattern.xsd
http://www.mulesoft.org/schema/mule/spring-security http://www.mulesoft.org/schema/mule/spring-security/3.4/mule-spring-security.xsd
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.1.xsd
http://www.mulesoft.org/schema/mule/ssl http://www.mulesoft.org/schema/mule/ssl/current/mule-ssl.xsd" version="EE-3.4.0">
<mule-ss:security-manager>
<mule-ss:delegate-security-provider name="jdbc-provider" delegate-ref="authenticationManager"></mule-ss:delegate-security-provider>
</mule-ss:security-manager>
<spring:beans>
<spring:bean class="org.apache.cxf.interceptor.LoggingInInterceptor" id="loggingInInterceptor" />
<spring:bean class="org.apache.cxf.interceptor.LoggingOutInterceptor" id="loggingOutInterceptor"/>
<spring:bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<spring:property name="driverClassName" value="${database.driver}"/>
<spring:property name="url" value="${database.url}"/>
<spring:property name="username" value="${database.user}"/>
<spring:property name="password" value="${database.pass}"/>
</spring:bean>
<ss:http auto-config="true" use-expressions="true" request-matcher="regex">
<ss:intercept-url pattern="^/services/.*\.WSDL$" access="permitAll"/>
<ss:intercept-url pattern="^/services/${webservice.idp.in.pessoas.path}" access="hasRole('ROLE_IDP')" />
<ss:intercept-url pattern="^/services/${webservice.idp.in.setor.path}" access="hasRole('ROLE_IDP')" >
</ss:http>
<ss:authentication-manager alias="authenticationManager" >
<ss:authentication-provider>
<ss:jdbc-user-service data-source-ref="dataSource"
users-by-username-query="
select username, password, enabled
from users where username=?"
authorities-by-username-query="
select u.username, ur.authority from users u, authorities ur
where u.id = ur.user_id and u.username =? "/>
</ss:authentication-provider>
</ss:authentication-manager>
</spring:beans>
<https:connector name="httpsConnector" doc:name="HTTP\HTTPS">
<https:tls-key-store path="${mule.home}/conf/keystore.jks" keyPassword="ciasc.123" storePassword="ciasc.123"></https:tls-key-store>
</https:connector>
<scripting:transformer name="noopLoggingTransformer">
<scripting:script engine="groovy">
def props = [:]
props['User-Agent'] = message.getProperty('User-Agent', org.mule.api.transport.PropertyScope.INBOUND)
props['MULE_REMOTE_CLIENT_ADDRESS'] = message.getProperty('MULE_REMOTE_CLIENT_ADDRESS', org.mule.api.transport.PropertyScope.INBOUND)
props['http.request'] = message.getProperty('http.request', org.mule.api.transport.PropertyScope.INBOUND)
muleContext.client.dispatch('vm://log-request.in', payload, props)
message
</scripting:script>
</scripting:transformer>
<pattern:web-service-proxy name="Logradouros2" transformer-refs="noopLoggingTransformer" wsdlFile="AutenticacaoServico.wsdl">
<http:inbound-endpoint address="${serverName}/services/Logradouros/AutenticacaoServico" exchange-pattern="request-response">
<http:basic-security-filter realm="mule-realm"/>
</http:inbound-endpoint>
<http:outbound-endpoint address="${targetServer}/servicos/v2/AutenticacaoServico.svc" exchange-pattern="request-response" />
</pattern:web-service-proxy>
<jdbc-ee:postgresql-data-source name="WSA" user="${database.user}" password="${database.pass}" url="${database.url}" transactionIsolation="UNSPECIFIED" doc:name="PostgreSQL Data Source">
</jdbc-ee:postgresql-data-source>
<jdbc-ee:connector name="jdbcConnector" dataSource-ref="WSA" validateConnections="false" transactionPerMessage="true" queryTimeout="10" pollingFrequency="10000" doc:name="JDBC">
<jdbc-ee:query key="wsadb" value="insert into inbound_messages (payload, timestamp, agent, ip_from, endpoint, soap_operation) values ('', now(), #[groovy: return message.getInboundProperty('user-agent').toString()], #[groovy: return message.getInboundProperty('MULE_REMOTE_CLIENT_ADDRESS').toString()], #[groovy: return message.getInboundProperty('http.request').toString()], '');"></jdbc-ee:query>
</jdbc-ee:connector>
<flow name="log-request" doc:name="log-request">
<vm:inbound-endpoint path="log-request.in" />
<logger message="#[groovy: return message.getInboundProperty('user-agent').toString()], #[groovy: return message.getInboundProperty('MULE_REMOTE_CLIENT_ADDRESS').toString()], #[groovy: return message.getInboundProperty('http.request').toString()]" level="INFO" doc:name="Logger"/>
<jdbc-ee:outbound-endpoint exchange-pattern="one-way" queryKey="wsadb" responseTimeout="10000" queryTimeout="-1" connector-ref="jdbcConnector" doc:name="Persist raw message" />
</flow>
</mule>
What is required to do to access that?
What i intend to do with that is access the wsdl file without login requirements, and the methods with...

Since you are using Mule's inbound HTTP endpoint, most of the Spring Security you have in place is useless. For example the intercept-url are not doing anything.
I suggest your look at the source code of org.mule.transport.http.filters.HttpBasicAuthenticationFilter and extend it with your own code that will waive security for WSDL requests.
Then replace <http:basic-security-filter realm="mule-realm"/> with your own version.

Related

Log4j2: Log ERROR level into a specific file

In my log4j2 configuration, I have an AsyncRoot set to INFO because I want to log this level and upper in a file.
But I would like also to log the ERROR level into a specific file AND in the appender configured in the AsyncRoot
Here is my configuration:
<?xml version="1.0" encoding="utf-8"?>
<Configuration>
<Appenders>
<RollingFile name="file" fileName="${LOG_PATH}/${APP_NAME}.log" filePattern="${LOG_PATH}/${APP_NAME}-${FILE_PATTERN_TRAILER}.log">
<PatternLayout pattern="${PATTERN_LAYOUT}"/>
<Policies>
<SizeBasedTriggeringPolicy size="50 MB"/>
<TimeBasedTriggeringPolicy/>
</Policies>
<DefaultRolloverStrategy max="5"/>
</RollingFile>
<RollingFile name="errorFile" fileName="${LOG_PATH}/${APP_NAME}-errors.log" filePattern="${LOG_PATH}/${APP_NAME}-errors-${FILE_PATTERN_TRAILER}.log">
<PatternLayout pattern="${PATTERN_LAYOUT}"/>
<Policies>
<TimeBasedTriggeringPolicy/>
</Policies>
</RollingFile>
</Appenders>
<Loggers>
<AsyncRoot level="INFO">
<AppenderRef ref="file"/>
</AsyncRoot>
<AsyncLogger level="ERROR">
<AppenderRef ref="errorFile"/>
</AsyncLogger>
</Loggers>
</Configuration>
Here is the logging behaviour I'd like to achieve (no matter the package) :
All the logs with INFO log level are logged into the appender file
All the logs with ERROR log level are logged into the appender file and errorFile
All the logs with a lower log level (DEBUG, TRACE) aren't logged at all
Thank you
You can achieve what you want by setting the root logger's level to info since you don't want any trace or debug events to reach your appenders. Set the level on the error file appender to error so that only events of that level or more specific are written to the file.
Here's a simple example that you can adapt to your needs:
Java class to generate some log events
package example;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class SomeClass {
private static final Logger log = LogManager.getLogger();
public static void main(String[] args){
log.debug("This is some debug!");
log.info("Here's some info!");
log.error("Some error happened!");
}
}
log4j2 XML config file
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<File name="ErrorFile" fileName="logs/errors.log" immediateFlush="false"
append="false">
<PatternLayout
pattern="%d{yyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
</File>
<File name="InfoFile" fileName="logs/Info.log" immediateFlush="false"
append="false">
<PatternLayout
pattern="%d{yyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
</File>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="InfoFile" />
<AppenderRef ref="ErrorFile" level="error" />
</Root>
</Loggers>
</Configuration>
This generates 2 files: errors.log and Info.log
The error log contains only the error:
2019-12-04 10:05:34.672 [main] ERROR example.SomeClass - Some error happened!
The info log contains the info and error events:
2019-12-04 10:05:34.670 [main] INFO example.SomeClass - Here's some info!
2019-12-04 10:05:34.672 [main] ERROR example.SomeClass - Some error happened!
To do similar thing in the properties config file you can set config file as below
status = error
name = PropertiesConfig
filters = threshold
filter.threshold.type = ThresholdFilter
filter.threshold.level = debug
appenders = rolling, rollingErrorFile
appender.rolling.type = RollingFile
appender.rolling.name = RollingFile
appender.rolling.fileName = logs.log
appender.rolling.filePattern = logs.log.%i
appender.rolling.layout.type = PatternLayout
appender.rolling.layout.pattern = %d{ISO8601} %-5p %30.30c{2} : %m%n
appender.rolling.policies.type = Policies
appender.rolling.policies.size.type = SizeBasedTriggeringPolicy
appender.rolling.policies.size.size=20 MB
appender.rolling.strategy.type = DefaultRolloverStrategy
appender.rolling.strategy.max = 20
appender.rollingErrorFile.type = RollingFile
appender.rollingErrorFile.name = RollingErrorFile
appender.rollingErrorFile.fileName = logsErrors.log
appender.rollingErrorFile.filePattern = logsErrors.log.%i
appender.rollingErrorFile.layout.type = PatternLayout
appender.rollingErrorFile.layout.pattern = %d{ISO8601} %-5p %30.30c{2} : %m%n
appender.rollingErrorFile.policies.type = Policies
appender.rollingErrorFile.policies.size.type = SizeBasedTriggeringPolicy
appender.rollingErrorFile.policies.size.size=20 MB
appender.rollingErrorFile.strategy.type = DefaultRolloverStrategy
appender.rollingErrorFile.strategy.max = 20
loggers = rolling
#Make sure to change the package structure as per your application
logger.rolling.name = example
logger.rolling.level = debug
logger.rolling.additivity = false
logger.rolling.appenderRef.rolling.ref = RollingFile
logger.rolling.appenderRef.rollingErrorFile.ref = RollingErrorFile
logger.rolling.appenderRef.rollingErrorFile.level = error

BlueZ: get device name by it's mac address

Background: I'm working on OOB Pairing (via USB) between iOS device and embedded Linux board. Currently, on Linux side, I'm receiving bluetooth linkkey (needed for future connections) and mac address.
ps: if you are familiar with the subject - please, look at this question as well.
My current implementation, uses mac address as device's name (for details - see link to the question above), which is being resolved after second bluetoothd service restart.
Question: is there a way to get bluetooth name of the device having it's mac only with a help of BlueZ? I will use this in the C code with an access to BlueZ's DBus interface.
AFAIK, there is no straight forward DBus API or method to find the name from MAC address. But this can done using the method "GetManagedObjects" in "org.freedesktop.DBus.Properties" interface of the device.
Below is the pseudo code which will should work if proper error handling and variables are added. DBus XML is added at the top of the source just for reference.
#if 0
dbus-send --system --dest=org.bluez --type=method_call --print-reply /org/bluez/hci0/dev_44_D8_84_02_A3_17 org.freedesktop.DBus.Introspectable.Introspect
method return sender=:1.1 -> dest=:1.7 reply_serial=2
string "<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.freedesktop.DBus.Introspectable">
<method name="Introspect">
<arg name="xml" type="s" direction="out"/>
</method>
</interface>
<interface name="org.bluez.Device1">
<method name="Disconnect"></method>
<method name="Connect"></method>
<method name="ConnectProfile">
<arg name="UUID" type="s" direction="in"/>
</method>
<method name="DisconnectProfile">
<arg name="UUID" type="s" direction="in"/>
</method>
<method name="Pair"></method>
<method name="CancelPairing"></method>
<property name="Address" type="s" access="read"></property>
<property name="Name" type="s" access="read"></property>
<property name="Alias" type="s" access="readwrite"></property>
<property name="Class" type="u" access="read"></property>
<property name="Appearance" type="q" access="read"></property>
<property name="Icon" type="s" access="read"></property>
<property name="Paired" type="b" access="read"></property>
<property name="Trusted" type="b" access="readwrite"></property>
<property name="Blocked" type="b" access="readwrite"></property>
<property name="LegacyPairing" type="b" access="read"></property>
<property name="RSSI" type="n" access="read"></property>
<property name="Connected" type="b" access="read"></property>
<property name="UUIDs" type="as" access="read"></property>
<property name="Modalias" type="s" access="read"></property>
<property name="Adapter" type="o" access="read"></property>
</interface>
<interface name="org.freedesktop.DBus.Properties">
<method name="Get">
<arg name="interface" type="s" direction="in"/>
<arg name="name" type="s" direction="in"/>
<arg name="value" type="v" direction="out"/>
</method>
<method name="Set">
<arg name="interface" type="s" direction="in"/>
<arg name="name" type="s" direction="in"/>
<arg name="value" type="v" direction="in"/>
</method>
<method name="GetAll">
<arg name="interface" type="s" direction="in"/>
<arg name="properties" type="a{sv}" direction="out"/>
</method>
<signal name="PropertiesChanged">
<arg name="interface" type="s"/>
<arg name="changed_properties" type="a{sv}"/>
<arg name="invalidated_properties" type="as"/>
</signal>
</interface>
<node name="player0"/></node>"
#endif
#define BT_BLUEZ_NAME "org.bluez"
#define BT_MANAGER_PATH "/"
#define BT_ADAPTER_INTERFACE "org.bluez.Adapter1"
#define BT_DEVICE_IFACE "org.bluez.Device1"
#define BT_MANAGER_INTERFACE "org.freedesktop.DBus.ObjectManager"
#define BT_PROPERTIES_INTERFACE "org.freedesktop.DBus.Properties"
int main(void)
{
char *known_address = "2C:F0:A2:26:D7:F5"; /*This is your address to search */
conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &error);
proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE, NULL, BT_BLUEZ_NAME, BT_MANAGER_PATH, BT_MANAGER_INTERFACE, NULL, &err);
result = g_dbus_proxy_call_sync(proxy, "GetManagedObjects", NULL, G_DBUS_CALL_FLAGS_NONE, -1, NULL, &err);
g_variant_get(result, "(a{oa{sa{sv}}})", &iter);
char *device_path = NULL;
char device_address[18] = { 0 };
/* Parse the signature: oa{sa{sv}}} */
while (g_variant_iter_loop(iter, "{&oa{sa{sv}}}", &device_path, NULL)) {
{
char address[BT_ADDRESS_STRING_SIZE] = { 0 };
char *dev_addr;
dev_addr = strstr(device_path, "dev_");
if (dev_addr != NULL) {
char *pos = NULL;
dev_addr += 4;
g_strlcpy(address, dev_addr, sizeof(address));
while ((pos = strchr(address, '_')) != NULL) {
*pos = ':';
}
g_strlcpy(device_address, address, BT_ADDRESS_STRING_SIZE);
}
}
if (g_strcmp0(known_address, device_address) == 0) {
/* Find the name of the device */
device_property_proxy = g_dbus_proxy_new_sync(conn, G_DBUS_PROXY_FLAGS_NONE, NULL, BT_BLUEZ_NAME, &device_path, BT_PROPERTIES_INTERFACE, NULL, NULL);
result = g_dbus_proxy_call_sync(proxy, "Get", g_variant_new("(ss)", BT_DEVICE_IFACE, "Alias"), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error);
const char *local = NULL;
g_variant_get(result, "(v)", &temp);
local = g_variant_get_string(temp, NULL);
printf("Your desired name : %s\n", local);
}
}
}

Android - write to a file . Can't find the file

I'm new to android, so this might be prety basic.
I'm trying to write data into a file, yet I can not find the file in the device.
I'm trying to get the file in the following directory:
"Computer\Nexus 5\Internal storage\Android\data\application name"
I have tried different method but none of them has worked:
FileOutputStream stream;
try {
stream = openFileOutput(filename,Context.MODE_APPEND | Context.MODE_WORLD_READABLE);
stream.write(string.getBytes());
stream.close();
}catch(IOException e){
}}
and
String path = Environment.getExternalStorageDirectory().getAbsolutePath()+"/Android/data/" + packageName + "/files/";
try {
boolean exists = (new File(path )).exists();
if (!exists) {
new File(path ).mkdirs();
}
// Open output stream
FileOutputStream fOut = new FileOutputStream(path + filename,true);
// write integers as separated ascii's
fOut.write((Integer.valueOf(content).toString() + " ").getBytes());
// Close output stream
fOut.flush();
fOut.close();
} catch (IOException e) {
e.printStackTrace();
}
I have added the permission in the manifest :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.proLeague"
android:versionCode="1"
android:versionName="1.0" >
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_MEDIA_STORAGE"/>
<group gid="sdcard_rw" />
<group gid="media_rw" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="21" />
<application
android:allowBackup="true"
android:debuggable= "true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I thought maybe the file is logged properly but I need to pull it out from the ADB, is that possible?
I had manage to solve my issues on my own :
Evantually the code was fine, the problem was that on my nexus 5 phone I need to reboot the phone before I search for new files in the flash storage.
I saw in some blogs it is pretty common.

Unknown property error within item renderer's data property

I'm using an item renderer, but keep getting this actionscript error:
Error: Unknown Property: 'skillName'. at mx.collections::ListCollectionView/http://www.adobe.com/2006/actionscript/flash/proxy::getProperty()[E:\dev\4.y\frameworks\projects\framework\src\mx\collections\ListCollectionView.as:870]
at mx.binding::PropertyWatcher/updateProperty()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\PropertyWatcher.as:338]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.binding::Watcher/wrapUpdate()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\Watcher.as:192]
at mx.binding::PropertyWatcher/updateParent()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\PropertyWatcher.as:239]
at mx.binding::Watcher/updateChildren()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\Watcher.as:138]
at mx.binding::PropertyWatcher/updateProperty()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\PropertyWatcher.as:347]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.binding::Watcher/wrapUpdate()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\Watcher.as:192]
at mx.binding::PropertyWatcher/eventHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\binding\PropertyWatcher.as:375]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:13152]
at spark.components::DataRenderer/set data()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\DataRenderer.as:123]
at spark.components::SkinnableDataContainer/updateRenderer()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\SkinnableDataContainer.as:606]
at spark.components.supportClasses::ListBase/updateRenderer()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\supportClasses\ListBase.as:1106]
at spark.components::DataGroup/setUpItemRenderer()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\DataGroup.as:1157]
at spark.components::DataGroup/initializeTypicalItem()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\DataGroup.as:327]
at spark.components::DataGroup/ensureTypicalLayoutElement()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\DataGroup.as:384]
at spark.components::DataGroup/measure()[E:\dev\4.y\frameworks\projects\spark\src\spark\components\DataGroup.as:1467]
at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::measureSizes()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8506]
at mx.core::UIComponent/validateSize()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:8430]
at mx.managers::LayoutManager/validateSize()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:665]
at mx.managers::LayoutManager/doPhasedInstantiation()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:816]
at mx.managers::LayoutManager/doPhasedInstantiationCallback()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\LayoutManager.as:1180]
The weird thing is that it worked fine, until at a certain point I kept getting this error, out of the blue. I've been searching for it on Google and Stackoverflow and struck upon a few websites, but none of the answers could help me get any further. It seems this error is also mostly thrown in mobile AIR projects, but mine is a Flash Player project...
This is how the itemrenderer looks:
<?xml version="1.0" encoding="utf-8"?>
<s:ItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:components="components.*"
width="100%" height="100%" autoDrawBackground="true"
creationComplete="creationCompleteHandler(event)"
height.login_edit_state="80"
color.login_edit_state="#000000"
height.login_preview_state="80">
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.events.FlexEvent;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.utils.ArrayUtil;
public var loggedin:Boolean = true;
[Bindable]private var ac_projects:ArrayCollection;
protected function creationCompleteHandler(event:FlexEvent):void
{
currentState = "login_preview_state";
img_foldout_preview.addEventListener(MouseEvent.CLICK, changeState);
img_edit_preview.addEventListener(MouseEvent.CLICK, changeState);
http_projects.addEventListener(ResultEvent.RESULT, http_projects_resultEvent);
http_projects.addEventListener(FaultEvent.FAULT, http_projects_faultEvent);
http_projects.url = "http://localhost/sourcefoliocom.adobe.flexbuilder.project.flexbuilder/bindebug/php/getAllProjectsByUserSkill.php?id=" + data.userId + "&skill=" + data.skillId ;
trace("http://localhost/sourcefoliocom.adobe.flexbuilder.project.flexbuilder/bindebug/php/getAllProjectsByUserSkill.php?id="+ data.userId + "&skill=" + data.skillId);
http_projects.send();
}
protected function http_projects_resultEvent(event:ResultEvent):void
{
ac_projects = new ArrayCollection(ArrayUtil.toArray(event.result.projects.project));
rpt_projects.dataProvider = ac_projects;
}
protected function http_projects_faultEvent(event:FaultEvent):void
{
trace("Kon projecten niet laden");
}
]]>
</fx:Script>
<fx:Declarations>
<s:HTTPService id="http_projects"
method="GET" />
</fx:Declarations>
<s:states>
<s:State name="login_preview_state"/>
<s:State name="login_opened_state"/>
<s:State name="login_edit_state"/>
</s:states>
<s:layout.login_opened_state>
<s:VerticalLayout horizontalAlign="right"/>
</s:layout.login_opened_state>
<!-- login_opened_state -->
<s:SkinnableContainer includeIn="login_opened_state" width="100%" height="80">
<s:layout>
<s:HorizontalLayout gap="20" paddingBottom="20" paddingLeft="20" paddingRight="20" paddingTop="20" verticalAlign="middle"/>
</s:layout>
<s:Label fontSize="20" fontWeight="bold" text="{data.skillName}"/>
<s:Label fontSize="20" text="junior"/>
<s:Spacer width="100%" height="10"/>
<s:Image id="img_edit_open" width="20" height="20" source="images/edit.png" buttonMode="true" useHandCursor="true"/>
<s:Image id="img_foldin_open" width="20" height="20" buttonMode="true" source="images/foldin.png" useHandCursor="true"/>
</s:SkinnableContainer>
<s:VGroup id="vg_opened"
visible="false"
width="900" height="1000" gap="0"
horizontalAlign="right">
<mx:VBox>
<mx:Repeater id="rpt_projects" width="100%">
<components:Project currentItem= {rpt_projects.currentItem}" loggedin="true"/>
</mx:Repeater>
<components:AddProject />
</mx:VBox>
<s:Image x="824" width="76" height="51" source="images/edit_flag.png" useHandCursor="true"/>
</s:VGroup>
</s:ItemRenderer>
The error is thrown at this line:
<s:Label fontSize="20" fontWeight="bold" text="{data.skillName}"/>
The ArrayCollection filling up this renderer is an xml file my own webservice returns. I've tested the file and the use of skillName should be correct in this case.
Do you need to see more code or some more info? Let me know!
I found out I'm dealing with a two dimensional ArrayCollection. I'm not correctly referring to the items in this ArrayCollection, so that's why the properties are not recognized.

C2DM registration results never receive

I have used "Android Cloud to Device Messaging (C2DM) - Tutorial" by Lars Vogel.
When i start my applcation, registration response never received.
How It can be solved?
my Manifest file:
<?xml version="1.0" encoding="utf-8"?>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<application android:icon="#drawable/appicon" android:label="#string/app_name" android:debuggable="true">
<activity android:name=".activities.MainActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ui.DailyTripList" android:screenOrientation="portrait" />
<activity android:name=".ui.TripActivity" android:screenOrientation="portrait" />
<activity android:name=".ui.StationsList" android:screenOrientation="portrait" />
<activity android:name=".ui.StationActivity" android:screenOrientation="portrait" />
<activity android:name=".ui.PassengerList" android:screenOrientation="portrait" />
<activity android:name=".ui.DriverMsgList" android:screenOrientation="portrait" />
<service android:name=".services.SecurityReqestTransmitter" android:exported="false"/>
<service android:name=".services.LocationTransmitter" android:exported="false"/>
<activity android:name=".cardReader.IDTUniMagActivity" android:screenOrientation="portrait" />
<receiver android:name="com.google.android.c2dm.C2DMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<!-- Receive the actual message -->
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="com.em_projects.MyWay.receivers" />
</intent-filter>
<!-- Receive the registration id -->
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="com.em_projects.MyWay.receivers" />
</intent-filter>
</receiver>
</application>
CatLog
08-15 23:57:41.624: WARN/KeyCharacterMap(959): No keyboard for id 0
08-15 23:57:41.634: WARN/KeyCharacterMap(959): Using default keymap: /system/usr/keychars/qwerty.kcm.bin
08-15 23:57:44.645: DEBUG/dalvikvm(150): GC_EXTERNAL_ALLOC freed 698 objects / 37712 bytes in 273ms
08-15 23:58:01.374: DEBUG/SntpClient(70): request time failed: java.net.SocketException: Address family not supported by protocol
08-15 23:58:17.365: INFO/EventLogService(236): Aggregate from 1313450896472 (log), 1313450896472 (data)
08-15 23:58:22.704: DEBUG/dalvikvm(236): GC_EXPLICIT freed 473 objects / 120056 bytes in 276ms
08-15 23:58:29.744: DEBUG/dalvikvm(150): GC_EXTERNAL_ALLOC freed 611 objects / 29936 bytes in 198ms
08-15 23:58:32.754: DEBUG/MainActivity(959): onClick
08-15 23:58:33.944: INFO/global(959): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
08-15 23:58:33.974: DEBUG/Communicator(959): # parseData <?xml version="1.0" encoding="UTF-8"?><root><row internal_code="644" external_code="1442" ws_string="http://wap.y-it.co.il:8080/wapdb/ws_redirect/http://localhost:8080/fltctrl_11" report_location_period="60" reject_mission="1"/></root>
08-15 23:58:34.124: DEBUG/MainActivity(959): Rows counter = 1
08-15 23:58:34.155: DEBUG/MainActivity(959): handleMessage
08-15 23:58:34.184: INFO/ActivityManager(70): Starting activity: Intent { flg=0x4000000 cmp=com.em_projects.MyWay/.ui.DailyTripList }
08-15 23:58:34.494: DEBUG/DailyTripList(959): onCreate
08-15 23:58:35.444: DEBUG/dalvikvm(959): GC_FOR_MALLOC freed 7436 objects / 493624 bytes in 90ms
08-15 23:58:43.254: ERROR/C2DMRegistrar(236): [C2DMReg] handleRequest caught java.io.IOException: SSL shutdown failed: I/O error during system call, Broken pipe
08-15 23:58:43.534: DEBUG/SecurityReqestTransmitter(959): onCreate
08-15 23:58:43.584: DEBUG/SecurityReqestTransmitter(959): initServiceThread
08-15 23:58:43.624: DEBUG/SecurityReqestTransmitter(959): run
08-15 23:58:43.634: DEBUG/SecurityReqestTransmitter(959): onStartCommand
08-15 23:58:43.875: DEBUG/LocationTransmitter(959): onCreate
08-15 23:58:43.944: DEBUG/LocationTransmitter(959): spd = 0.0
08-15 23:58:44.024: WARN/GpsLocationProvider(70): Duplicate add listener for uid 10040
08-15 23:58:44.224: WARN/ActivityManager(70): Launch timeout has expired, giving up wake lock!
08-15 23:58:44.414: INFO/global(959): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
08-15 23:58:44.454: WARN/ActivityManager(70): Activity idle timeout for HistoryRecord{44ec58c0 com.em_projects.MyWay/.ui.DailyTripList}
08-15 23:58:44.534: DEBUG/Communicator(959): # parseData <?xml version="1.0" encoding="UTF-8"?><root><row line_code="90476" acc_name="אי סי אי" order_start_time="08:00" order_end_time="08:30" line_description="איסוף עובדים איזור הדרום" line_status="-1" t_Pass_QTY="4" Pass_QTY="4" group_name="שם הקבוצה" department_name="שם המחלקה" line_date="2011-08-15" long_remarks="הערות ארוכות...
שורה שניה
שורה שלישית
שורה רביעית
שורה אחרונה !" short_remarks="הערות קצרות של הנסיעה"/><row line_code="90377" acc_name="מפעל תע"ש רכש" order_start_time="12:00" order_end_time="12:45" line_description="מרוחובות+נס ציונה לתע"ש" line_status="-1" t_Pass_QTY="0" Pass_QTY="0" line_date="2011-08-15" long_remarks="" short_remarks=""/><row line_code="90406" acc_name="משתלת ציפורן" order_start_time="15:00" order_end_time="15:40" line_description="הסעות עובדים אמצע שבוע" line_status="5" t_Pass_QTY="0" Pass_QTY="0" department_name="מחלקה 1" line_date="2011-08-15" long_remarks="על הנהג להתקשר לשלמה 050-3344334 בעל המשתלה
כל יום לאחר סיום ההסעה." short_remarks="הערה ליום ב'"/><row line_code="90439" acc_name="טבע כפר סבא" order_start_time="18:00" order_end_time="18:00" line_description="נתב"ג כ"ס" line_status="-1" t_Pass_QTY="0" Pass_QTY="0" line_date="2011-08-15" long_remarks="" short_remarks=""/></root>
08-15 23:58:47.554: INFO/ActivityManager(70): Displayed activity com.em_projects.MyWay/.ui.DailyTripList: 13122 ms (total 13122 ms)
Is your app package name com.em_projects.MyWay.receivers?
If no, try to use only your package name instead of com.em_projects.MyWay.receivers in categories
<receiver android:name="com.google.android.c2dm.C2DMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND">
<!-- Receive the actual message -->
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="***your_app_package_name***" />
</intent-filter>
<!-- Receive the registration id -->
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="***your_app_package_name***" />
</intent-filter>
</receiver>

Resources