Project

General

Profile

« Previous | Next » 

Revision 613

Added by bojilova almost 24 years ago

fixed typo

View differences:

src/edu/ucsb/nceas/metacat/AccessControlList.java
67 67
   */
68 68
  public AccessControlList ( Connection conn ) throws SQLException
69 69
  {
70
    Connection dbconn = conn;
71
//    if ( dbconn == null || dbconn.isClosed() ) {
72
      System.out.println("AccessControlList: " + 
73
                         "DB connection was closed. Open a new one");
74
      try {
75
        MetaCatUtil util = new MetaCatUtil();
76
        dbconn = util.openDBConnection();
77
      } catch (Exception e) {
78
        throw new SQLException(e.getMessage());
79
      }
80
//    }
81
    this.conn = dbconn;
70
    this.conn = conn;
82 71
  }
83 72

  
84 73
  /**
......
356 345
                "SELECT 'x' FROM xml_documents " +
357 346
                "WHERE docid LIKE ? AND public_access = 1");
358 347
        // Bind the values to the query
359
        pstmt.setString(1, principal);
348
        pstmt.setString(1, resourceId);
360 349

  
361 350
        pstmt.execute();
362 351
        ResultSet rs = pstmt.getResultSet();
363 352
        boolean hasRow = rs.next();
364 353
        pstmt.close();
365 354
        if (hasRow) {
366
          conn.close();
367 355
          return true;
368 356
        }
369 357
//System.out.println("Passed the check for public access");      
......
391 379
        boolean hasRow = rs.next();
392 380
        pstmt.close();
393 381
        if (hasRow) {
394
          conn.close();
395 382
          return true;
396 383
        }
397 384
//System.out.println("Passed the check for ownership");      
......
435 422
              decreaseNumberOfAccess(accessValue,principal,resourceId,"denied");
436 423
            }
437 424
            pstmt.close();
438
            conn.close();
439 425
            return false;
440 426
          }
441 427
          hasRows = rs.next();
......
460 446
              decreaseNumberOfAccess(accessValue,principal,resourceId,"allowed");
461 447
            }
462 448
            pstmt.close();
463
            conn.close();
464 449
            return true;
465 450
          }
466 451
          hasRows = rs.next();
......
473 458
        //
474 459
      
475 460
        pstmt.close();
476
        conn.close();
477 461
        return false;
478 462
  
479 463
      } catch (SQLException e) {

Also available in: Unified diff