You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "benson margulies (JIRA)" <ji...@apache.org> on 2007/09/30 17:59:51 UTC

[jira] Created: (CXF-1083) LogUtils is missing some MissingResourceException handling

LogUtils is missing some MissingResourceException handling
----------------------------------------------------------

                 Key: CXF-1083
                 URL: https://issues.apache.org/jira/browse/CXF-1083
             Project: CXF
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.0.2
            Reporter: benson margulies
            Assignee: Daniel Kulp
            Priority: Blocker


In LogUtils.createLogger, there is no handling for MissingResourceException when there is a custom logger class.

The Log4jClass, delegating to the Abstract class, gets just the same collection of missing resource exceptions as the default case. So it blows up.

The code in createLogger only fails to handle if the name is non-null. If the name is null, it has a try block. Looks to me as if the == null test is backwards.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1083) LogUtils is missing some MissingResourceException handling

Posted by "benson margulies (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531467 ] 

benson margulies commented on CXF-1083:
---------------------------------------

What is needed first and foremost is a systest that turns this on.

Along with a bean to make it easier to do in spring :-)

When I have the trunk and karma I'll do it.


> LogUtils is missing some MissingResourceException handling
> ----------------------------------------------------------
>
>                 Key: CXF-1083
>                 URL: https://issues.apache.org/jira/browse/CXF-1083
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.2
>            Reporter: benson margulies
>            Assignee: Daniel Kulp
>            Priority: Blocker
>
> In LogUtils.createLogger, there is no handling for MissingResourceException when there is a custom logger class.
> The Log4jClass, delegating to the Abstract class, gets just the same collection of missing resource exceptions as the default case. So it blows up.
> The code in createLogger only fails to handle if the name is non-null. If the name is null, it has a try block. Looks to me as if the == null test is backwards.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-1083) LogUtils is missing some MissingResourceException handling

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-1083.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.3

> LogUtils is missing some MissingResourceException handling
> ----------------------------------------------------------
>
>                 Key: CXF-1083
>                 URL: https://issues.apache.org/jira/browse/CXF-1083
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.2
>            Reporter: benson margulies
>            Assignee: Daniel Kulp
>            Priority: Blocker
>             Fix For: 2.0.3
>
>
> In LogUtils.createLogger, there is no handling for MissingResourceException when there is a custom logger class.
> The Log4jClass, delegating to the Abstract class, gets just the same collection of missing resource exceptions as the default case. So it blows up.
> The code in createLogger only fails to handle if the name is non-null. If the name is null, it has a try block. Looks to me as if the == null test is backwards.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1083) LogUtils is missing some MissingResourceException handling

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531494 ] 

Freeman Fang commented on CXF-1083:
-----------------------------------

Benson, 

you are right, we also need do the same thing when name is not null, something like
try {
    if (name == null) {
          return (Logger) cns.newInstance(loggerName, BundleUtils.getBundleName(cls)); 
    } else {
          return (Logger) cns.newInstance(loggerName, BundleUtils.getBundleName(cls, name)); 
    }
} catch (InvocationTargetException ite) { 
    if (ite.getTargetException() instanceof MissingResourceException) { 
           return (Logger) cns.newInstance(loggerName, null); 
    } else { 
           throw ite; 
   } 

} 


> LogUtils is missing some MissingResourceException handling
> ----------------------------------------------------------
>
>                 Key: CXF-1083
>                 URL: https://issues.apache.org/jira/browse/CXF-1083
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.2
>            Reporter: benson margulies
>            Assignee: Daniel Kulp
>            Priority: Blocker
>
> In LogUtils.createLogger, there is no handling for MissingResourceException when there is a custom logger class.
> The Log4jClass, delegating to the Abstract class, gets just the same collection of missing resource exceptions as the default case. So it blows up.
> The code in createLogger only fails to handle if the name is non-null. If the name is null, it has a try block. Looks to me as if the == null test is backwards.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1083) LogUtils is missing some MissingResourceException handling

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531399 ] 

Freeman Fang commented on CXF-1083:
-----------------------------------

actually, when should catach InvocationTargetException  but not MissingResourceException here, since all exception in relect would be wrapped as InvocationTargetException  

so the code here
if (name == null) {
                    try {
                        return (Logger) cns.newInstance(loggerName, BundleUtils.getBundleName(cls));
                    } catch (InvocationTargetException ite) {
                        if (ite.getTargetException() instanceof MissingResourceException) {
                            return (Logger) cns.newInstance(loggerName, null);
                        } else {
                            throw ite;
                        }
                    } 
                } else {
                    return (Logger) cns.newInstance(loggerName, BundleUtils.getBundleName(cls, name));
                }
IMHO, is correct

> LogUtils is missing some MissingResourceException handling
> ----------------------------------------------------------
>
>                 Key: CXF-1083
>                 URL: https://issues.apache.org/jira/browse/CXF-1083
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.2
>            Reporter: benson margulies
>            Assignee: Daniel Kulp
>            Priority: Blocker
>
> In LogUtils.createLogger, there is no handling for MissingResourceException when there is a custom logger class.
> The Log4jClass, delegating to the Abstract class, gets just the same collection of missing resource exceptions as the default case. So it blows up.
> The code in createLogger only fails to handle if the name is non-null. If the name is null, it has a try block. Looks to me as if the == null test is backwards.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1083) LogUtils is missing some MissingResourceException handling

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531522 ] 

Daniel Kulp commented on CXF-1083:
----------------------------------

Freeman,

I don't think so.    If the user is explicitly setting a bundle name instead of using the defaults, that bundle definitely should be there.    Allowing the exception is the right thing in that case. 

Basically, when using the j.u.l.Logger stuff, that is what happens.   If you don't specify a bundle name, it will catch the MissingResourceException and then retry with null.    If you DO specify a bundle name, we don't retry.


That said, we should catch the InvocationTargetException and pull the MissingResourceException out and throw that instead.  I'll handle that.



Dan

> LogUtils is missing some MissingResourceException handling
> ----------------------------------------------------------
>
>                 Key: CXF-1083
>                 URL: https://issues.apache.org/jira/browse/CXF-1083
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.2
>            Reporter: benson margulies
>            Assignee: Daniel Kulp
>            Priority: Blocker
>
> In LogUtils.createLogger, there is no handling for MissingResourceException when there is a custom logger class.
> The Log4jClass, delegating to the Abstract class, gets just the same collection of missing resource exceptions as the default case. So it blows up.
> The code in createLogger only fails to handle if the name is non-null. If the name is null, it has a try block. Looks to me as if the == null test is backwards.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1083) LogUtils is missing some MissingResourceException handling

Posted by "Freeman Fang (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531544 ] 

Freeman Fang commented on CXF-1083:
-----------------------------------

Dan,

I agree with you, I know my first comment is not correct. But I think my second comment should work. Would you please verify it?

Freeman

> LogUtils is missing some MissingResourceException handling
> ----------------------------------------------------------
>
>                 Key: CXF-1083
>                 URL: https://issues.apache.org/jira/browse/CXF-1083
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.2
>            Reporter: benson margulies
>            Assignee: Daniel Kulp
>            Priority: Blocker
>
> In LogUtils.createLogger, there is no handling for MissingResourceException when there is a custom logger class.
> The Log4jClass, delegating to the Abstract class, gets just the same collection of missing resource exceptions as the default case. So it blows up.
> The code in createLogger only fails to handle if the name is non-null. If the name is null, it has a try block. Looks to me as if the == null test is backwards.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1083) LogUtils is missing some MissingResourceException handling

Posted by "benson margulies (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531469 ] 

benson margulies commented on CXF-1083:
---------------------------------------

Freeman,

In 2.0.2, I watched it fail, step by step in the debugger. The problem is the LAST newInstance, which runs when the class is set, and which is outside the try.

--benson


> LogUtils is missing some MissingResourceException handling
> ----------------------------------------------------------
>
>                 Key: CXF-1083
>                 URL: https://issues.apache.org/jira/browse/CXF-1083
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.2
>            Reporter: benson margulies
>            Assignee: Daniel Kulp
>            Priority: Blocker
>
> In LogUtils.createLogger, there is no handling for MissingResourceException when there is a custom logger class.
> The Log4jClass, delegating to the Abstract class, gets just the same collection of missing resource exceptions as the default case. So it blows up.
> The code in createLogger only fails to handle if the name is non-null. If the name is null, it has a try block. Looks to me as if the == null test is backwards.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-1083) LogUtils is missing some MissingResourceException handling

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-1083?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12531491 ] 

Daniel Kulp commented on CXF-1083:
----------------------------------

Yes, this wasn't working correctly in 2.0.2.   It should be fixed on trunk now.   I did run the entire test suite with log4j last week and all but the JCA tests passed.

> LogUtils is missing some MissingResourceException handling
> ----------------------------------------------------------
>
>                 Key: CXF-1083
>                 URL: https://issues.apache.org/jira/browse/CXF-1083
>             Project: CXF
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.2
>            Reporter: benson margulies
>            Assignee: Daniel Kulp
>            Priority: Blocker
>
> In LogUtils.createLogger, there is no handling for MissingResourceException when there is a custom logger class.
> The Log4jClass, delegating to the Abstract class, gets just the same collection of missing resource exceptions as the default case. So it blows up.
> The code in createLogger only fails to handle if the name is non-null. If the name is null, it has a try block. Looks to me as if the == null test is backwards.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.