Proguarding a Javafx application using slf4j logger - javafx

I previously built a Javafx application and successfully wrapped it with proguard, while using java.util.Logger. However, I need to switch from java.util.Logger to the Logger provided by slf4j and use qos-logback. When I use proguard on it, I run into an array of warnings, all generated from either of the slf4j or the qos-logback library. Some of the (MANYYY) warnings are:
Warning: ch.qos.logback.core.status.ViewStatusMessagesServletBase:
can't find referenced class javax.servlet.http.HttpServletResponse
Warning: ch.qos.logback.core.status.ViewStatusMessagesServletBase:
can't find referenced class javax.servlet.http.HttpServletRequest
Warning: ch.qos.logback.core.status.ViewStatusMessagesServletBase:
can't find referenced class javax.servlet.http.HttpServletResponse
Warning: ch.qos.logback.core.status.ViewStatusMessagesServletBase:
can't find referenced class javax.servlet.http.HttpServletRequest
Warning: ch.qos.logback.core.status.ViewStatusMessagesServletBase:
can't find referenced class javax.servlet.http.HttpServletResponse
Warning: ch.qos.logback.core.status.ViewStatusMessagesServletBase:
can't find referenced class javax.servlet.http.HttpServletRequest
Warning: ch.qos.logback.core.status.ViewStatusMessagesServletBase:
can't find referenced class javax.servlet.http.HttpServletResponse
Warning: org.slf4j.MDC: can't find referenced method
'org.slf4j.impl.StaticMDCBinder getSingleton()' in program class
org.slf4j.impl.StaticMDCBinder
Warning: org.slf4j.MarkerFactory:
can't find referenced method 'org.slf4j.impl.StaticMarkerBinder
getSingleton()' in program class org.slf4j.impl.StaticMarkerBinder
Note: ch.qos.logback.classic.gaffer.GafferUtil accesses a constructor
'(ch.qos.logback.classic.LoggerContext)' dynamically
If you notice, some of the warnings are even repeating. I will be really grateful if anyone can help me out regarding this, even if it's just pointing me in the right direction since I've been stuck on it for a while. Many thanks in advance.

After a lot of effort, I sort of got things done.
I had to add the following to the config:
-keep,allowshrinking class ch.qos.logback.core.status.ViewStatusMessagesServletBase {
<fields>;
<methods>;
}
I also needed to inspect the warnings to find the source and had to add servlet-api.jar separately as a library.

Related

Error when trying to instantiate class in Xamarin.Forms

Using VS 2017 and Xamarin.Forms, has anyone seen an error like this?
{Java.Lang.ClassNotFoundException} Java.Lang.ClassNotFoundException
Didn't find class "md546f3e293680064826a8f4de8cb5b1ad9.ZebraTC75" on path: DexPathList[[directory "."],nativeLibraryDirectories=[/vendor/lib64, /system/lib64]]
In the output pane, I get the following:
09-30 10:39:44.712 I/art ( 9673): Rejecting re-init on previously-failed class java.lang.Class md546f3e293680064826a8f4de8cb5b1ad9.ZebraTC75
I have multi-dex off. seems ZebraTC75 class could not be found. Am I missing a setting to include?
This class is in my Android project.
This class also is inherited from a "Base" class.
The error appears in debug mode when i step into the constructor of the "base" class.
Thanks,
Austin

The definition for "knp_paginator" has no class

hi i installed the KnpPaginatorBundle in py project and i flow all the steps in the documentation, the problem is when i open the page i got this exception :
RuntimeException in CheckDefinitionValidityPass.php line 63: The
definition for "knp_paginator" has no class. If you intend to inject
this service dynamically at runtime, please mark it as synthetic=true.
If this is an abstract definition solely used by child definitions,
please add abstract=true, otherwise specify a class to get rid of this
error.

How to make correct S4 Class declaration for a package

I am creating a personal package with some S4 classes. When I run the Build and Reload button in the Rstudio IDE I get the next message.
in method for ‘checkNewItems’ with signature ‘"webSource"’: no definition for class "webSource"
The Class declaration webSource is in a different file where the checkNewItems method is and I am guessing that is the reason why I am getting that message. In the source code that I have makes more sense to have the class declaration in other place rather than next to the methods checkNewItems.
Which is the idiomatic workaround that R programmers use for this?
Also, from the point of view of the Lazyloading that R uses I assumed that this should not happen.
You should export your class. In your namespace file you add this:
exportClasses(webSource)

1046: Type was not found or was not a compile-time constant

I am following this post which has a very simple code to post tweets from flex application.
http://rjdesignz.com/adobe-flex/twitter-api-in-air-mobile-app/
This is for AIR Mobile App but i am making AIR WindowedApplication in Flex, the above post is dependent on the following external libraries:
1) AS3 oAuth Library http://code.google.com/p/oauth-as3
2) AS3 Crypto https://code.google.com/p/as3crypto/
Here is the code:
import org.istashan.oauth.OAuthConsumer;
import org.istashan.oauth.OAuthRequest;
import org.istashan.oauth.OAuthSignatureMethod_HMAC_SHA1;
import org.istashan.oauth.OAuthToken;
import org.istashan.utils.OAuthUtil;
private var requestToken:OAuthToken;
private var accessToken:OAuthToken;
private var oAuthConsumer:OAuthConsumer;
private var accessRequest:OAuthRequest;
protected var signature:OAuthSignatureMethod_HMAC_SHA1 = new OAuthSignatureMethod_HMAC_SHA1();
for all the variables i am getting the following error and therefore i am unable to compile my code:
1046: Type was not found or was not a compile-time constant: OAuthConsumer.
1046: Type was not found or was not a compile-time constant: OAuthRequest.
1046: Type was not found or was not a compile-time constant: OAuthSignatureMethod_HMAC_SHA1.
1046: Type was not found or was not a compile-time constant: OAuthToken.
1046: Type was not found or was not a compile-time constant: OAuthToken.
How can i resolve this compile-time constant issue?
Alhamdulillah, i found where i was missing from the adobe documentation. Here that is:
Error 1046
The class used as a type declaration is either unknown or is an expression that could have different values at run time. Check that you are importing the correct class and that its package location has not changed. Also, check that the package that contains the code (not the imported class) is defined correctly (for example, make sure to use proper ActionScript 3.0 package syntax, and not ActionScript 2.0 syntax). The error can also occur if the class being referenced is not defined in a namespace that is in use or is not defined as public:
public class Foo{}

Subclassing a private (support) class in AVM2

I am developing a dynamic mocking framework for Flex/AS3 and am having trouble with private/support types (ie. those declared outside the package {} in a class file).
In my ABC "file", I am declaring the instance with the PROTECTED_NAMESPACE class flag and with a PRIVATE_NS multiname. I have also experimented with giving it the same namespace as the class it is subclassing (eg. PRIVATE_NS("ContainerClass.as$123")).
No matter what I do, I always get the following error after loadBytes:
VerifyError: Error #1014: Class ContainerClass.as$123::PrivateClass could not be found.
I have experimented with loading the generated bytecode into the same ApplicationDomain as the private class (I use a child domain by default). I even tried registering a class alias before the load (though that was a bit of a stretch).
Am I forgetting anything or is it simply a restriction of the AVM?
Please note that I am fully aware that this is illegal in ActionScript 3.0, I am looking for whether this is actually possible in the AVM.
Edit: For those interested in the work so far, the project is asmock and is on sourceforge.
I'm no expert with ABC files but I just don't think this is possible in the AVM2. I did several tests a while ago with the AS3 Eval lib and they all failed.
Related to dynamic mocking, I have filed an issue in Adobe bugbase, asking for a dynamic proxy mechanism: http://bugs.adobe.com/jira/browse/ASC-3136
I'm not sure what you mean by PRIVATE_NS("ContainerClass.as$123"), My reading of avm2overview.pdf 4.4.1 is that private namespaces are not permitted to have a name, hence that the "<class name>$<number>" namespace in debug output is generated for your convenience. I would assume that would mean you would have to hack your abc into the same abc tag in the source swf to access the namespace constant index (and that sounds too much like hard work to me!)
I haven't actually managed to generate a loading swf, though, so take this with a grain of salt.
Having gone back to look at this problem in ernest, I can definitively answer this question: private classes can only be referenced from the LoaderContext that loaded them
I have been able to add support for private interfaces by reproducing the interface in the loaded ABC 'file', but it cannot be coerced/cast back to the original private interface.
This is still useful for my requirements, as a private interface can be used to combine multiple interfaces.

Resources