Project

General

Profile

Actions

bug #3811

closed

Null pointer access in eu.etaxonomy.cdm.remote.service.DataController

Added by Patrick Plitzner over 10 years ago. Updated about 2 years ago.

Status:
Closed
Priority:
Priority14
Category:
cdmlib-remote
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Severity:
normal
Found in Version:

Description

at line 83 and 86 the out stream reference is null.

It is recommended to set the warning to error for these kind of code checks in Window->Preferences->Java->Compiler->!Errors/Warnings->Potential Programming Problems->Null Pointer Access

As a hot fix I simply commented the method body

public ModelAndView getData(@RequestParam("lsid") LSID lsid, 
                                @RequestParam("start") Integer start, 
                                @RequestParam("length") Integer length,
                                HttpServletResponse response) throws LSIDServerException, IOException  {
        OutputStream out = null;
        InputStream data = null;
        try {
            data = lsidDataService.getDataByRange(lsid,start,length);
            if(data != null) {
                response.setContentType("application/octet-stream");
                byte[] bytes = new byte[1024];
                int numbytes = data.read(bytes);
                while (numbytes != -1) {
                    out.write(bytes,0,numbytes);
                    numbytes = data.read(bytes);
                }
                out.flush();
            }
        } finally {
            if (out != null) {
                out.close();
            }

            if (data != null) {
                data.close();
            }
        }
        return null;
    }
Actions #1

Updated by Andreas Müller over 10 years ago

  • Assignee changed from Andreas Müller to Andreas Kohlbecker
Actions #2

Updated by Andreas Kohlbecker over 10 years ago

  • Category changed from cdmlib to cdmlib-remote
Actions #3

Updated by Andreas Kohlbecker over 10 years ago

  • Severity changed from normal to minor
Actions #4

Updated by Andreas Müller over 2 years ago

  • Description updated (diff)
  • Status changed from New to Feedback
  • Target version changed from cdmlib - Old Next Major Release to Release 5.45

Is this still an open issue?

Actions #5

Updated by Andreas Kohlbecker over 2 years ago

  • Private changed from Yes to No
Actions #6

Updated by Andreas Kohlbecker over 2 years ago

  • Status changed from Feedback to New
  • Priority changed from New to Priority14
  • Severity changed from minor to normal

still open and a really wired interim solution to this problem.

Actions #7

Updated by Andreas Kohlbecker over 2 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100

fixed!

Actions #8

Updated by Andreas Müller about 2 years ago

  • Target version changed from Release 5.45 to Release 5.29
Actions

Also available in: Atom PDF