Server obfuscate/minify breaks JavaScript

Discussion created by nocsupport on Mar 6, 2014
Latest reply on Mar 10, 2014 by nocsupport

The Web server is obfuscating/minifying our client-side JavaScript code

  • variable names are renamed to generic a, b, c
  • code comments are removed

that we added to the file

  c:\Program Files (x86)\Nimsoft\probes\service\wasp\webapps\ROOT\html\portlet\dockbar\view.jsp

This would be fine, except the above obfuscation/minification is also

  • removing semicolons from the last line of code in each {} code block
    (any IF statements, functions, try/catch, etc.)
  • adding a semicolon after the last "}"

which breaks the JavaScript (see attached HTML file for an example).

Since the Nimsoft app is built on other platforms such as Apache Tomcat, Liferay, etc., I am not sure exactly where this is happening or how we would disable this, but we need to turn off whatever feature modifies the JavaScript.

Can anyone please explain how to disable JavaScript obfuscation or minifiy in Nimsoft running on Windows Server 2008 R2?

PS This following pages describe a similar issue

Based on the above it seemed that we need to make sure the "" file has the line

I did a search on the Web server for that file (or any files containing "" in the contents).

The search returned 2 files:

  c:\Program Files (x86)\Nimsoft\probes\service\wasp\webapps\ROOT\WEB-INF\classes\   c:\Program Files (x86)\Nimsoft\probes\service\wasp\webapps\ROOT\WEB-INF\classes\

These are under \ROOT\ like the JSP file we are having issues with, so I am guessing these are the correct properties files.

The first file already contained the line, and I added the line to the second file.

However the JavaScript is still being changed before being rendered to the client's browser.

Someone in the above thread also mentioned solving the problem with shell commands:

  Thanks, it really helped me.   I solved the pb with two shell commands (if it could help someone else):      cat <   set -e   # Replace here YOUR_LIFERAY_HOME_DIRECTORY with your liferay's home directory   cd $YOUR_LIFERAY_HOME_DIRECTORY/tomcat-6.0.18/webapps/ROOT/WEB-INF/classes      # contains and other usefull things   cp   EOF      cat <   mv $YOUR_LIFERAY_HOME_DIRECTORY/tomcat-6.0.18/webapps/ROOT/WEB-INF/classes/ /tmp   EOF      chmod a+x

however our Nimsoft/Apache/Liferay is running on Windows Server 2008 R2 and not LINUX/UNIX, and we do not have the above .sh files.

If we did have the files I suppose we could try the following to do the chmod

Beyond this I haven't found much else on the Web about this problem - any help would be appreciated.