+1 for updating this logic to gracefully stop the Cartridge Agent after
logging the errors.

Thanks


On Thu, Jan 9, 2014 at 4:45 AM, Pradeep Fernando <[email protected]>wrote:

>
>
>
> On Thu, Jan 9, 2014 at 3:08 PM, Lahiru Sandaruwan <[email protected]>wrote:
>
>>
>>
>>
>> On Thu, Jan 9, 2014 at 2:58 PM, Nirmal Fernando 
>> <[email protected]>wrote:
>>
>>> Yes, we should throw exceptions carefully. However, we should analyse
>>> this particular code segment.
>>>
>>> Looking at the code Lahiru sent, I tend to agree with the original
>>> author. Cause, I don't think without the presence of those properties
>>> Cartridge Agent could survive.
>>>
>>
>> yeah. that is the point to consider...
>>
>> I think the first two are mandatory,
>>
> Then fail gracefully after logging the exception scenario. We don't have
> to proceed further.
>
> third we can proceed without having.
>>
>>
>>  wdyt?
>>>
>>>
>>> On Thu, Jan 9, 2014 at 2:47 PM, Pradeep Fernando <[email protected]>wrote:
>>>
>>>> The original author has opted for Runtime exceptions.
>>>>
>>>> - It is somewhat controversial to use runtime exceptions in your code.
>>>> - if you really mean it, we should not log it IMO.
>>>> - Those get handled by the JVM at the end of the day. (like
>>>> nullpointers)
>>>>
>>>> I think we should use checked exceptions here..
>>>>
>>>>
>>>> On Thu, Jan 9, 2014 at 2:21 PM, Lahiru Sandaruwan <[email protected]>wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> $subject. I think the correct way is to log without throwing...
>>>>>
>>>>>
>>>>>
>>>>>         String jndiPropertiesDir =
>>>>> System.getProperty(CartridgeAgentConstants.JNDI_PROPERTIES_DIR);
>>>>>         if(StringUtils.isBlank(jndiPropertiesDir)) {
>>>>>             throw new RuntimeException(String.format("System property
>>>>> not found: %s", CartridgeAgentConstants.JNDI_PROPERTIES_DIR));
>>>>>         }
>>>>>
>>>>>         String payloadPath =
>>>>> System.getProperty(CartridgeAgentConstants.PARAM_FILE_PATH);
>>>>>         if(StringUtils.isBlank(payloadPath)) {
>>>>>             throw new RuntimeException(String.format("System property
>>>>> not found: %s", CartridgeAgentConstants.PARAM_FILE_PATH));
>>>>>         }
>>>>>
>>>>>         String extensionsDir =
>>>>> System.getProperty(CartridgeAgentConstants.EXTENSIONS_DIR);
>>>>>         if(StringUtils.isBlank(extensionsDir)) {
>>>>>             throw new RuntimeException(String.format("System property
>>>>> not found: %s", CartridgeAgentConstants.EXTENSIONS_DIR));
>>>>>         }
>>>>>
>>>>> Thanks.
>>>>> --
>>>>> --
>>>>> Lahiru Sandaruwan
>>>>> Software Engineer,
>>>>> Platform Technologies,
>>>>> WSO2 Inc., http://wso2.com
>>>>> lean.enterprise.middleware
>>>>>
>>>>> email: [email protected] cell: (+94) 773 325 954
>>>>> blog: http://lahiruwrites.blogspot.com/
>>>>> twitter: http://twitter.com/lahirus
>>>>> linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Pradeep Fernando.
>>>> http://pradeepfernando.blogspot.com/
>>>>
>>>
>>>
>>>
>>> --
>>> Best Regards,
>>> Nirmal
>>>
>>> Nirmal Fernando.
>>> PPMC Member & Committer of Apache Stratos,
>>> Senior Software Engineer, WSO2 Inc.
>>>
>>> Blog: http://nirmalfdo.blogspot.com/
>>>
>>
>>
>>
>> --
>> --
>> Lahiru Sandaruwan
>> Software Engineer,
>> Platform Technologies,
>> WSO2 Inc., http://wso2.com
>> lean.enterprise.middleware
>>
>> email: [email protected] cell: (+94) 773 325 954
>> blog: http://lahiruwrites.blogspot.com/
>> twitter: http://twitter.com/lahirus
>> linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146
>>
>>
>
>
> --
> Pradeep Fernando.
> http://pradeepfernando.blogspot.com/
>

Reply via email to