Uploaded image for project: 'Apache Knox'
  1. Apache Knox
  2. KNOX-877

Coverity Scan Cleanup

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 0.12.0
    • Server
    • None

    Description

        • CID 1371037: Exceptional resource leaks (RESOURCE_LEAK)
          /gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/KnoxSh.java: 191 in org.apache.hadoop.gateway.shell.KnoxSh$KnoxInit.execute()()

      ________________________________________________________________________________________________________

          • CID 1371037: Exceptional resource leaks (RESOURCE_LEAK)
            /gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/KnoxSh.java: 191 in org.apache.hadoop.gateway.shell.KnoxSh$KnoxInit.execute()()
            185 //println "Access Token: " + json.access_token
            186 System.out.println("knoxinit successful!");
            187 displayTokenDetails(json);
            188
            189 File tokenfile = new File(System.getProperty("user.home"), ".knoxtokencache");
            190 FileOutputStream fos = new FileOutputStream(tokenfile);
            CID 1371037: Exceptional resource leaks (RESOURCE_LEAK)
            Variable "fos" going out of scope leaks the resource it refers to.
            191 fos.write(text.getBytes("UTF-8"));
            192
            193 Set<PosixFilePermission> perms = new HashSet<PosixFilePermission>();
            194 fos.close();
            195
            196 //add owners permission only
        • CID 1371036: Null pointer dereferences (NULL_RETURNS)
          /gateway-service-knoxtoken/src/main/java/org/apache/hadoop/gateway/service/knoxtoken/TokenResource.java: 121 in org.apache.hadoop.gateway.service.knoxtoken.TokenResource.getAuthenticationToken()()

      ________________________________________________________________________________________________________

          • CID 1371036: Null pointer dereferences (NULL_RETURNS)
            /gateway-service-knoxtoken/src/main/java/org/apache/hadoop/gateway/service/knoxtoken/TokenResource.java: 121 in org.apache.hadoop.gateway.service.knoxtoken.TokenResource.getAuthenticationToken()()
            115 for (int i = 0; i < targetAudiences.length; i++) { 116 aud.add(targetAudiences[i]); 117 }

            118 token = ts.issueToken(p, aud, "RS256", expires);
            119 }
            120
            CID 1371036: Null pointer dereferences (NULL_RETURNS)
            Calling a method on null object "token".
            121 String accessToken = token.toString();
            122
            123 HashMap<String, Object> map = new HashMap<String, Object>();
            124 // TODO: populate map from JWT authorization code
            125 map.put(ACCESS_TOKEN, accessToken);
            126 map.put(TOKEN_TYPE, BEARER);

        • CID 1371035: (NULL_RETURNS)
          /gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/KnoxSh.java: 173 in org.apache.hadoop.gateway.shell.KnoxSh$KnoxInit.execute()()
          /gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/KnoxSh.java: 174 in org.apache.hadoop.gateway.shell.KnoxSh$KnoxInit.execute()()

      ________________________________________________________________________________________________________

          • CID 1371035: (NULL_RETURNS)
            /gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/KnoxSh.java: 173 in org.apache.hadoop.gateway.shell.KnoxSh$KnoxInit.execute()()
            167 public void execute() throws Exception {
            168 Credentials credentials = new Credentials();
            169 credentials.add("ClearInput", "Enter username: ", "user")
            170 .add("HiddenInput", "Enter pas" + "sword: ", "pass");
            171 credentials.collect();
            172
            CID 1371035: (NULL_RETURNS)
            Calling a method on null object "credentials.get("user")".
            173 String username = credentials.get("user").string();
            174 String pass = credentials.get("pass").string();
            175
            176 Hadoop session = null;
            177 Response response = null;
            178 try
            Unknown macro: {/gateway-shell/src/main/java/org/apache/hadoop/gateway/shell/KnoxSh.java}

            206
            207 private static GatewayFilter createFilter( InputStream stream, ServletContext servletContext ) throws ServletException {
            208 try {
            CID 1371034: Null pointer dereferences (FORWARD_NULL)
            Assigning: "filter" = "null".
            209 GatewayFilter filter = null;
            210 if( stream != null ) {
            211 try

            { 212 GatewayDescriptor descriptor = GatewayDescriptorFactory.load( "xml", new InputStreamReader( stream ) ); 213 filter = GatewayFactory.create( descriptor ); 214 }

            finally {

      Attachments

        Activity

          People

            lmccay Larry McCay
            lmccay Larry McCay
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: