Sumit Aggarwal

Greenhorn
+ Follow
since Jul 31, 2011
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sumit Aggarwal

Hi


I've written a JUnit where it is calling a Constant class, here we are trying to access a static final List

public static final List<String> SKIPPED_DIMENSION_LIST = new ArrayList<String>();

static{
SKIPPED_DIMENSION_LIST.add(PRODUCT_CATEGORY_DISPLAY);
SKIPPED_DIMENSION_LIST.add(PRODUCT_CATEGORY_SUB);
SKIPPED_DIMENSION_LIST.add(PRODUCT_CATEGORY_SUB_GROUP);
SKIPPED_DIMENSION_LIST.add(PRODUCT_CATEGORY_SUB_GROUP_ID);
SKIPPED_DIMENSION_LIST.add(PRODUCT_CATEGORY_ID);
SKIPPED_DIMENSION_LIST.add(PRODUCT_CATEGORY_GROUP_ID);
}

Now, while accessing this List via JUnit thread I'm gettting this error.

java.lang.ExceptionInInitializerError
at java.lang.J9VMInternals.initialize(J9VMInternals.java:222)
at com.mns.commerce.searchnav.constants.MSEndecaConstants.<clinit>(MSEndecaConstants.java:169)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at com.mns.commerce.searchnav.utils.MSSearchResposeBOTransformer.getRefinementsDetails(MSSearchResposeBOTransformer.java:460)
at com.mns.commerce.searchnav.utils.MSSearchResposeBOTransformer.buildFacets(MSSearchResposeBOTransformer.java:362)
at com.mns.commerce.searchnav.utils.MSSearchResposeBOTransformer.populateResults(MSSearchResposeBOTransformer.java:106)
at com.mns.commerce.searchnavunit.test.MSSearchResposeBOTransformerTest.testPopulateResults(MSSearchResposeBOTransformerTest.java:97)

whereas, if an static Enum is defined instead of a static final list then it is working fine. Any idea why this is happening?


9 years ago
Thanks for making it an interactive and knowledgeable thread. Got my answer
9 years ago
@Bear : it is an interview question<objective screening interview>
@Kunal : One among them is correct, even i don't know the correct answer.
@Punit : Thanks for the related threads
9 years ago
I recently came across a question,

If in a web container we have two applications A & B deployed and we need to send information from a servlet of application A to a servlet of application B, so that the information is not exposed to other servlets of application A or B. Which thing we should use to achive this objective.

1. HttpServletRequest
2. HttpServletResponse
3. ServletContext
4. ServletConfig
9 years ago
I've encountered one problem while coding some solution,

In a 2D char array, if I take it on X-Y axis for ex.

a b c
d e f
g h i

here, a(0,0) b(1,0) c(2,0) d(0,1) and so on..

Now in my problem I need to write a code in which for a I need to add following in the list [b,e,d] Similarly,

for b, [a,d,e,f,c]
for c, [b,e,f]
for d, [a,b,e,h,g] and so on.

Note: All those who are getting added to the list are the surrounding member of that char.


PFB the code,



It is giving me ArrayOutOfBoundException, due to obvious reasons.

Need your inputs to get an efficient solution. Please revert for any clarification or suggestion.


9 years ago
Hi,

Please tell me if I write
and,


then, will it create two string literals "abc" in the string constant pool? And, Is it logically possible to have two same string literals in a pool, if yes, then what is the use of pool if we have two same strings present in pool ?
9 years ago
Need to call a servlet on the url pattern /_/
what should i write in the web.xml




This isn't working
10 years ago
Thanks and how do I escape a '\' backslash





How do i achieve this.
Input String : 11\20
Output String : 11\\20
10 years ago



Lets suppose this is the code, what should I write in the replace(..,..) func that should fetch me this result?


Input String : 11:20
Output String : 11\:20


This is my requirement.
10 years ago
Need to replace a string 11:20 with 11\:20, But when ever i try replacing the occurrences of ':' with '\:' it try escaping the '\' itself when used with "".
Kindly let me know how to achieve it. or in case you need more clarity.
10 years ago
Problem : I need to add a new variable DateTime(Integer type) in the current hierarchy(of dbPublish.xml) as a event attribute. For example,



Partial Solution:

I have added the code in red in dbPublish.xsl, which will give me DateTime=”20110802124026”



Now, where should I call my event template so as to put my attribute at the desired location.


Please provide your valuable inputs.