• my name (unregistered)

    ah, jackcess. I once used it in an AWS lambda to transfer the data from an Access db to a Db in the AWS environment. The code and the architecture were admittedly horrible. and I hope this code is not still in use, but OTOH I wouldn't doubt that one of my successors will eventually post my code to TDWTF

  • (nodebb)

    In fact, there's barely anything in here that really merits a WTF. Barely.

    Dunno. Maybe it's my lack of specific knowledge of these things, but this line of code makes me ... uneasy:

    private static Logger sysLog = Logger.getLogger(ResultLoader.class);

    Is it normal to pass a class object to a logger?

  • TheCPUWizard (unregistered)

    It does (in its own special way) propogate the exception - after a transformation <wink>..

    In some languages

    Thing x = null;
    x.Method(); 
    

    is perfectly Valid provided Method is not virtual, and does not acces any member variables :) :) :)

  • (nodebb) in reply to Steve_The_Cynic

    Yes, Logger.getLogger(ResultLoader.class) is not just a normal thing, it is the correct way to initialize logger.

  • (nodebb) in reply to Steve_The_Cynic

    I'm assuming that the logging system has a map of object -> logger, so that you can handle logging in different ways (such as logging at different levels, or have separate log files) in different parts of the system. That line would just mean that all logging from the class is kept together. It isn't a WTF on its own, though it may be part of a WTF (such as if they have the logging set up to use a different file for every class).

  • linepro (unregistered) in reply to Kamil Podlesak

    @Log // use Lombok everyone else does.

  • Naomi (unregistered)

    The class passed to getLogger is used for a couple things:

    • By default, it's included in the log line.
    • Minimum log levels can be configured per class or package (typically used to selectively enable debug or trace logging while tracking down a bug).
    • Various integrations can consume it; Datadog, for example, can use it as one of its search filters.
  • L (unregistered)

    nobody commenting on the last Result result = new Result(00, new Date(), consumptions); that doesn't get returned?

  • Progenitus (unregistered)

    This may be because the snippet was changed a bit to not reveal too much information, but in the line instantiating the "Result" object: Where does the "consumptions" come from? And why is the "result" object not used/returned after creation?

  • Argle (unregistered)

    The whole story became clear when I saw the programmer call it "Jackcess" in a comment. I was immediately on his side.

    I'm reminded of the client I worked with for some years. They weren't small. Perhaps 400 employees. But at some point, not too long before I began helping them, someone made the decision to maintain all company data in Access. Then came the need to have a company website on their intranet. Somehow, they were managing employees and manufacturing traffic via Access. Such a nightmare. Little by little I migrated to SQL server, but the data was still a mess. Fun times.

  • Sou Eu (unregistered) in reply to Steve_The_Cynic

    Steve, we often either pass a class or the name of a class to the Logger. There is a configuration file which can set the logging level based on package (or subpackage!) or class. The configuration file also indicates where to log the messages (syserr, sysout, or some file) and the format to use.

  • (author)

    Remy, unless that snipped-out code has side-effects, loadResult will do nothing except iterate over the entire table. Also, we can't see what "consumptions" is (but if new Result has a side effect there it's a gigantic wtf) and the "yearConsumption" map just falls out of scope. It's plenty wtfy.

  • Klimax (unregistered) in reply to Lyle Seaman

    Maybe class Result is DAO and stores automatically on construction data in database table? Aka, yes have fun with (side)effects… Also everything is static. I suspect there might be more fun then article covered...

  • some guy (unregistered)

    I have a different gripe: the exception in the first method is treated to a printStackTrace(). Does this automagically end up in Logger? If not, dubbelyouteheff.

  • Duston (unregistered)

    A place where I worked built their own ASPx logging framework which could send emails with the error (not entirely unuseful), but insisted on two things: The application be built in three layers (Data Access, Business Logic and Presentation) and each layer use this logging framework. So if a database call failed, you'd get three emails. And if a database server went down, you'd get flooded x 3 with error messages. I'm retired now. I'm retired now. I'm retired now.

Leave a comment on “Accessed Nulls”

Log In or post as a guest

Replying to comment #:

« Return to Article