bugged
stringlengths
6
599k
fixed
stringlengths
10
599k
__index_level_0__
int64
0
1.13M
public void valueChanged(TreeSelectionEvent event) { if (tree.isEditing()) tree.cancelEditing(); }
public void valueChanged(TreeSelectionEvent event) { if (tree.isEditing()) tree.stopEditing(); }
14,284
public void cancelEditing(JTree tree) { if (isEditing(tree)) completeEditing(false, true, false); }
public void cancelEditing(JTree tree) { if (isEditing(tree)) completeEditing(false, true, false); }
14,285
protected void installDefaults() { LookAndFeel.installColorsAndFont(tree, "Tree.background", "Tree.foreground", "Tree.font"); tree.setOpaque(true); rightChildIndent = UIManager.getInt("Tree.rightChildIndent"); leftChildIndent = UIManager.getInt("Tree.leftChildIndent"); setRowHeight(UIManager.getInt("Tree.rowHeight")); tree.setRowHeight(getRowHeight()); tree.requestFocusInWindow(false); tree.setScrollsOnExpand(UIManager.getBoolean("Tree.scrollsOnExpand")); setExpandedIcon(UIManager.getIcon("Tree.expandedIcon")); setCollapsedIcon(UIManager.getIcon("Tree.collapsedIcon")); }
protected void installDefaults() { LookAndFeel.installColorsAndFont(tree, "Tree.background", "Tree.foreground", "Tree.font"); tree.setOpaque(true); rightChildIndent = UIManager.getInt("Tree.rightChildIndent"); leftChildIndent = UIManager.getInt("Tree.leftChildIndent"); setRowHeight(UIManager.getInt("Tree.rowHeight")); tree.setRowHeight(getRowHeight()); tree.setScrollsOnExpand(UIManager.getBoolean("Tree.scrollsOnExpand")); setExpandedIcon(UIManager.getIcon("Tree.expandedIcon")); setCollapsedIcon(UIManager.getIcon("Tree.collapsedIcon")); }
14,286
protected void paintRow(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) { boolean selected = tree.isPathSelected(path); boolean hasIcons = false; Object node = path.getLastPathComponent(); if (tree.isVisible(path)) { if (!validCachedPreferredSize) updateCachedPreferredSize(); paintExpandControl(g, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf); if (row != 0) bounds.x += gap; bounds.width = preferredSize.width + bounds.x; if (editingComponent != null && editingPath != null && isEditing(tree) && node.equals(editingPath.getLastPathComponent())) { rendererPane.paintComponent(g, editingComponent.getParent(), null, bounds); } else { TreeCellRenderer dtcr = tree.getCellRenderer(); if (dtcr == null) dtcr = createDefaultCellRenderer(); Component c = dtcr.getTreeCellRendererComponent(tree, node, selected, isExpanded, isLeaf, row, tree.hasFocus()); rendererPane.paintComponent(g, c, c.getParent(), bounds); } } }
protected void paintRow(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) { boolean selected = tree.isPathSelected(path); boolean hasIcons = false; Object node = path.getLastPathComponent(); if (tree.isVisible(path)) { if (!validCachedPreferredSize) updateCachedPreferredSize(); paintExpandControl(g, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf); if (row != 0) bounds.x += gap; bounds.width = preferredSize.width + bounds.x; if (editingComponent != null && editingPath != null && isEditing(tree) && node.equals(editingPath.getLastPathComponent())) { rendererPane.paintComponent(g, editingComponent.getParent(), null, bounds); } else { TreeCellRenderer dtcr = tree.getCellRenderer(); if (dtcr == null) dtcr = createDefaultCellRenderer(); Component c = dtcr.getTreeCellRendererComponent(tree, node, selected, isExpanded, isLeaf, row, tree.hasFocus()); rendererPane.paintComponent(g, c, c.getParent(), bounds); } } }
14,287
protected void paintRow(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) { boolean selected = tree.isPathSelected(path); boolean hasIcons = false; Object node = path.getLastPathComponent(); if (tree.isVisible(path)) { if (!validCachedPreferredSize) updateCachedPreferredSize(); paintExpandControl(g, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf); if (row != 0) bounds.x += gap; bounds.width = preferredSize.width + bounds.x; if (editingComponent != null && editingPath != null && isEditing(tree) && node.equals(editingPath.getLastPathComponent())) { rendererPane.paintComponent(g, editingComponent.getParent(), null, bounds); } else { TreeCellRenderer dtcr = tree.getCellRenderer(); if (dtcr == null) dtcr = createDefaultCellRenderer(); Component c = dtcr.getTreeCellRendererComponent(tree, node, selected, isExpanded, isLeaf, row, tree.hasFocus()); rendererPane.paintComponent(g, c, c.getParent(), bounds); } } }
protected void paintRow(Graphics g, Rectangle clipBounds, Insets insets, Rectangle bounds, TreePath path, int row, boolean isExpanded, boolean hasBeenExpanded, boolean isLeaf) { boolean selected = tree.isPathSelected(path); boolean hasIcons = false; Object node = path.getLastPathComponent(); if (tree.isVisible(path)) { if (!validCachedPreferredSize) updateCachedPreferredSize(); paintExpandControl(g, clipBounds, insets, bounds, path, row, isExpanded, hasBeenExpanded, isLeaf); if (row != 0) bounds.x += gap; bounds.width = preferredSize.width + bounds.x; if (editingComponent != null && editingPath != null && isEditing(tree) && node.equals(editingPath.getLastPathComponent())) { rendererPane.paintComponent(g, editingComponent.getParent(), null, bounds); else { TreeCellRenderer dtcr = tree.getCellRenderer(); if (dtcr == null) dtcr = createDefaultCellRenderer(); Component c = dtcr.getTreeCellRendererComponent(tree, node, selected, isExpanded, isLeaf, row, tree.hasFocus()); rendererPane.paintComponent(g, c, c.getParent(), bounds);
14,288
protected boolean startEditing(TreePath path, MouseEvent event) { int x; int y; if (event == null) { Rectangle bounds = getPathBounds(tree, path); x = bounds.x; y = bounds.y; } else { x = event.getX(); y = event.getY(); } updateCellEditor(); TreeCellEditor ed = getCellEditor(); if (ed != null && ed.shouldSelectCell(event) && ed.isCellEditable(event)) { editingPath = path; editingRow = tree.getRowForPath(editingPath); Object val = editingPath.getLastPathComponent(); cellEditor.addCellEditorListener(cellEditorListener); stopEditingInCompleteEditing = false; boolean expanded = tree.isExpanded(editingPath); isEditing = true; editingComponent = ed.getTreeCellEditorComponent(tree, val, true, expanded, isLeaf(editingRow), editingRow); editingComponent.getParent().setVisible(true); editingComponent.getParent().validate(); tree.add(editingComponent.getParent()); editingComponent.getParent().validate(); validCachedPreferredSize = false; ((JTextField) editingComponent).requestFocusInWindow(false); editorTimer.start(); return true; } return false; }
protected boolean startEditing(TreePath path, MouseEvent event) { int x; int y; if (event == null) { Rectangle bounds = getPathBounds(tree, path); x = bounds.x; y = bounds.y; } else { x = event.getX(); y = event.getY(); } updateCellEditor(); TreeCellEditor ed = getCellEditor(); if (ed != null && ed.shouldSelectCell(event) && ed.isCellEditable(event)) { editingPath = path; editingRow = tree.getRowForPath(editingPath); Object val = editingPath.getLastPathComponent(); cellEditor.addCellEditorListener(cellEditorListener); stopEditingInCompleteEditing = false; boolean expanded = tree.isExpanded(editingPath); isEditing = true; editingComponent = ed.getTreeCellEditorComponent(tree, val, true, expanded, isLeaf(editingRow), editingRow); editingComponent.getParent().setVisible(true); editingComponent.getParent().validate(); tree.add(editingComponent.getParent()); editingComponent.getParent().validate(); validCachedPreferredSize = false; ((JTextField) editingComponent).requestFocusInWindow(false); editorTimer.start(); return true; } return false; }
14,289
protected boolean startEditing(TreePath path, MouseEvent event) { int x; int y; if (event == null) { Rectangle bounds = getPathBounds(tree, path); x = bounds.x; y = bounds.y; } else { x = event.getX(); y = event.getY(); } updateCellEditor(); TreeCellEditor ed = getCellEditor(); if (ed != null && ed.shouldSelectCell(event) && ed.isCellEditable(event)) { editingPath = path; editingRow = tree.getRowForPath(editingPath); Object val = editingPath.getLastPathComponent(); cellEditor.addCellEditorListener(cellEditorListener); stopEditingInCompleteEditing = false; boolean expanded = tree.isExpanded(editingPath); isEditing = true; editingComponent = ed.getTreeCellEditorComponent(tree, val, true, expanded, isLeaf(editingRow), editingRow); editingComponent.getParent().setVisible(true); editingComponent.getParent().validate(); tree.add(editingComponent.getParent()); editingComponent.getParent().validate(); validCachedPreferredSize = false; ((JTextField) editingComponent).requestFocusInWindow(false); editorTimer.start(); return true; } return false; }
protected boolean startEditing(TreePath path, MouseEvent event) { int x; int y; if (event == null) { Rectangle bounds = getPathBounds(tree, path); x = bounds.x; y = bounds.y; } else { x = event.getX(); y = event.getY(); } updateCellEditor(); TreeCellEditor ed = getCellEditor(); if (ed != null && (event == EDIT || ed.shouldSelectCell(event)) && ed.isCellEditable(event)) { editingPath = path; editingRow = tree.getRowForPath(editingPath); Object val = editingPath.getLastPathComponent(); cellEditor.addCellEditorListener(cellEditorListener); stopEditingInCompleteEditing = false; boolean expanded = tree.isExpanded(editingPath); isEditing = true; editingComponent = ed.getTreeCellEditorComponent(tree, val, true, expanded, isLeaf(editingRow), editingRow); editingComponent.getParent().setVisible(true); editingComponent.getParent().validate(); tree.add(editingComponent.getParent()); editingComponent.getParent().validate(); validCachedPreferredSize = false; ((JTextField) editingComponent).requestFocusInWindow(false); editorTimer.start(); return true; } return false; }
14,290
protected boolean startEditing(TreePath path, MouseEvent event) { int x; int y; if (event == null) { Rectangle bounds = getPathBounds(tree, path); x = bounds.x; y = bounds.y; } else { x = event.getX(); y = event.getY(); } updateCellEditor(); TreeCellEditor ed = getCellEditor(); if (ed != null && ed.shouldSelectCell(event) && ed.isCellEditable(event)) { editingPath = path; editingRow = tree.getRowForPath(editingPath); Object val = editingPath.getLastPathComponent(); cellEditor.addCellEditorListener(cellEditorListener); stopEditingInCompleteEditing = false; boolean expanded = tree.isExpanded(editingPath); isEditing = true; editingComponent = ed.getTreeCellEditorComponent(tree, val, true, expanded, isLeaf(editingRow), editingRow); editingComponent.getParent().setVisible(true); editingComponent.getParent().validate(); tree.add(editingComponent.getParent()); editingComponent.getParent().validate(); validCachedPreferredSize = false; ((JTextField) editingComponent).requestFocusInWindow(false); editorTimer.start(); return true; } return false; }
protected boolean startEditing(TreePath path, MouseEvent event) { int x; int y; if (event == null) { Rectangle bounds = getPathBounds(tree, path); x = bounds.x; y = bounds.y; } else { x = event.getX(); y = event.getY(); } updateCellEditor(); TreeCellEditor ed = getCellEditor(); if (ed != null && ed.shouldSelectCell(event) && ed.isCellEditable(event)) { editingPath = path; editingRow = tree.getRowForPath(editingPath); Object val = editingPath.getLastPathComponent(); cellEditor.addCellEditorListener(cellEditorListener); stopEditingInCompleteEditing = false; boolean expanded = tree.isExpanded(editingPath); isEditing = true; editingComponent = ed.getTreeCellEditorComponent(tree, val, true, expanded, isLeaf(editingRow), editingRow); editingComponent.getParent().setVisible(true); editingComponent.getParent().validate(); tree.add(editingComponent.getParent()); editingComponent.getParent().validate(); validCachedPreferredSize = false; ((JTextField) editingComponent).requestFocusInWindow(false); editorTimer.start(); return true; } return false; }
14,291
protected boolean startEditing(TreePath path, MouseEvent event) { int x; int y; if (event == null) { Rectangle bounds = getPathBounds(tree, path); x = bounds.x; y = bounds.y; } else { x = event.getX(); y = event.getY(); } updateCellEditor(); TreeCellEditor ed = getCellEditor(); if (ed != null && ed.shouldSelectCell(event) && ed.isCellEditable(event)) { editingPath = path; editingRow = tree.getRowForPath(editingPath); Object val = editingPath.getLastPathComponent(); cellEditor.addCellEditorListener(cellEditorListener); stopEditingInCompleteEditing = false; boolean expanded = tree.isExpanded(editingPath); isEditing = true; editingComponent = ed.getTreeCellEditorComponent(tree, val, true, expanded, isLeaf(editingRow), editingRow); editingComponent.getParent().setVisible(true); editingComponent.getParent().validate(); tree.add(editingComponent.getParent()); editingComponent.getParent().validate(); validCachedPreferredSize = false; ((JTextField) editingComponent).requestFocusInWindow(false); editorTimer.start(); return true; } return false; }
protected boolean startEditing(TreePath path, MouseEvent event) { int x; int y; if (event == null) { Rectangle bounds = getPathBounds(tree, path); x = bounds.x; y = bounds.y; } else { x = event.getX(); y = event.getY(); } updateCellEditor(); TreeCellEditor ed = getCellEditor(); if (ed != null && ed.shouldSelectCell(event) && ed.isCellEditable(event)) { editingPath = path; editingRow = tree.getRowForPath(editingPath); Object val = editingPath.getLastPathComponent(); cellEditor.addCellEditorListener(cellEditorListener); stopEditingInCompleteEditing = false; boolean expanded = tree.isExpanded(editingPath); isEditing = true; editingComponent = ed.getTreeCellEditorComponent(tree, value, true, expanded, isLeaf(editingRow), editingRow); editingComponent.getParent().setVisible(true); editingComponent.getParent().validate(); tree.add(editingComponent.getParent()); editingComponent.getParent().validate(); validCachedPreferredSize = false; ((JTextField) editingComponent).requestFocusInWindow(false); editorTimer.start(); return true; } return false; }
14,292
protected boolean startEditing(TreePath path, MouseEvent event) { int x; int y; if (event == null) { Rectangle bounds = getPathBounds(tree, path); x = bounds.x; y = bounds.y; } else { x = event.getX(); y = event.getY(); } updateCellEditor(); TreeCellEditor ed = getCellEditor(); if (ed != null && ed.shouldSelectCell(event) && ed.isCellEditable(event)) { editingPath = path; editingRow = tree.getRowForPath(editingPath); Object val = editingPath.getLastPathComponent(); cellEditor.addCellEditorListener(cellEditorListener); stopEditingInCompleteEditing = false; boolean expanded = tree.isExpanded(editingPath); isEditing = true; editingComponent = ed.getTreeCellEditorComponent(tree, val, true, expanded, isLeaf(editingRow), editingRow); editingComponent.getParent().setVisible(true); editingComponent.getParent().validate(); tree.add(editingComponent.getParent()); editingComponent.getParent().validate(); validCachedPreferredSize = false; ((JTextField) editingComponent).requestFocusInWindow(false); editorTimer.start(); return true; } return false; }
protected boolean startEditing(TreePath path, MouseEvent event) { int x; int y; if (event == null) { Rectangle bounds = getPathBounds(tree, path); x = bounds.x; y = bounds.y; } else { x = event.getX(); y = event.getY(); } updateCellEditor(); TreeCellEditor ed = getCellEditor(); if (ed != null && ed.shouldSelectCell(event) && ed.isCellEditable(event)) { editingPath = path; editingRow = tree.getRowForPath(editingPath); Object val = editingPath.getLastPathComponent(); cellEditor.addCellEditorListener(cellEditorListener); stopEditingInCompleteEditing = false; boolean expanded = tree.isExpanded(editingPath); isEditing = true; editingComponent = ed.getTreeCellEditorComponent(tree, val, true, expanded, isLeaf(editingRow), editingRow); editingComponent.getParent().setVisible(true); editingComponent.getParent().validate(); tree.add(editingComponent.getParent()); editingComponent.getParent().validate(); validCachedPreferredSize = false; ((JTextField) editingComponent).requestFocusInWindow(false); editorTimer.start(); return true; } return false; }
14,293
protected boolean startEditing(TreePath path, MouseEvent event) { int x; int y; if (event == null) { Rectangle bounds = getPathBounds(tree, path); x = bounds.x; y = bounds.y; } else { x = event.getX(); y = event.getY(); } updateCellEditor(); TreeCellEditor ed = getCellEditor(); if (ed != null && ed.shouldSelectCell(event) && ed.isCellEditable(event)) { editingPath = path; editingRow = tree.getRowForPath(editingPath); Object val = editingPath.getLastPathComponent(); cellEditor.addCellEditorListener(cellEditorListener); stopEditingInCompleteEditing = false; boolean expanded = tree.isExpanded(editingPath); isEditing = true; editingComponent = ed.getTreeCellEditorComponent(tree, val, true, expanded, isLeaf(editingRow), editingRow); editingComponent.getParent().setVisible(true); editingComponent.getParent().validate(); tree.add(editingComponent.getParent()); editingComponent.getParent().validate(); validCachedPreferredSize = false; ((JTextField) editingComponent).requestFocusInWindow(false); editorTimer.start(); return true; } return false; }
protected boolean startEditing(TreePath path, MouseEvent event) { int x; int y; if (event == null) { Rectangle bounds = getPathBounds(tree, path); x = bounds.x; y = bounds.y; } else { x = event.getX(); y = event.getY(); } updateCellEditor(); TreeCellEditor ed = getCellEditor(); if (ed != null && ed.shouldSelectCell(event) && ed.isCellEditable(event)) { editingPath = path; editingRow = tree.getRowForPath(editingPath); Object val = editingPath.getLastPathComponent(); cellEditor.addCellEditorListener(cellEditorListener); stopEditingInCompleteEditing = false; boolean expanded = tree.isExpanded(editingPath); isEditing = true; editingComponent = ed.getTreeCellEditorComponent(tree, val, true, expanded, isLeaf(editingRow), editingRow); editingComponent.getParent().setVisible(true); editingComponent.getParent().validate(); tree.add(editingComponent.getParent()); editingComponent.getParent().validate(); validCachedPreferredSize = false; ((JTextField) editingComponent).requestFocusInWindow(false); editorTimer.start(); return true; } return false; }
14,294
public boolean stopEditing(JTree tree) { if (isEditing(tree)) completeEditing(true, false, false); return !isEditing(tree); }
public boolean stopEditing(JTree tree) { if (isEditing(tree)) { completeEditing(false, false, true); finish(); } return !isEditing(tree); }
14,295
public void openFrame(JInternalFrame frame);
void openFrame(JInternalFrame frame);
14,297
public void setBoundsForFrame(JComponent frame, int x, int y, int width, int height);
void setBoundsForFrame(JComponent frame, int x, int y, int width, int height);
14,298
public void mouseDragged(MouseEvent e) { curr = new Point(e.getX(), e.getY()); updateSelection(); }
public void mouseDragged(MouseEvent e) { curr = new Point(e.getX(), e.getY()); updateSelection(e.isControlDown()); }
14,299
public void mousePressed(MouseEvent e) { begin = new Point(e.getX(), e.getY()); curr = new Point(e.getX(), e.getY()); updateSelection(); }
public void mousePressed(MouseEvent e) { begin = new Point(e.getX(), e.getY()); curr = new Point(e.getX(), e.getY()); updateSelection(e.isControlDown()); }
14,300
private void updateSelection() { if (table.getRowSelectionAllowed()) { int lo_row = table.rowAtPoint(begin); int hi_row = table.rowAtPoint(curr); ListSelectionModel rowModel = table.getSelectionModel(); if (lo_row != -1 && hi_row != -1) rowModel.setSelectionInterval(lo_row, hi_row); } if (table.getColumnSelectionAllowed()) { int lo_col = table.columnAtPoint(begin); int hi_col = table.columnAtPoint(curr); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); if (lo_col != -1 && hi_col != -1) colModel.setSelectionInterval(lo_col, hi_col); } }
private void updateSelection(boolean controlPressed) { if (table.getRowSelectionAllowed()) { int lo_row = table.rowAtPoint(begin); int hi_row = table.rowAtPoint(curr); ListSelectionModel rowModel = table.getSelectionModel(); if (lo_row != -1 && hi_row != -1) rowModel.setSelectionInterval(lo_row, hi_row); } if (table.getColumnSelectionAllowed()) { int lo_col = table.columnAtPoint(begin); int hi_col = table.columnAtPoint(curr); ListSelectionModel colModel = table.getColumnModel().getSelectionModel(); if (lo_col != -1 && hi_col != -1) colModel.setSelectionInterval(lo_col, hi_col); } }
14,301
protected static String toIDL(String cn) { if (cn.startsWith(JAVA_PREFIX)) cn = cn.substring(JAVA_PREFIX.length()); cn = cn.replace('.', '/'); return "IDL:" + OMG_PREFIX + cn + ":1.0"; }
public static String toIDL(String cn) { if (cn.startsWith(JAVA_PREFIX)) cn = cn.substring(JAVA_PREFIX.length()); cn = cn.replace('.', '/'); return "IDL:" + OMG_PREFIX + cn + ":1.0"; }
14,305
protected static String toIDL(String cn) { if (cn.startsWith(JAVA_PREFIX)) cn = cn.substring(JAVA_PREFIX.length()); cn = cn.replace('.', '/'); return "IDL:" + OMG_PREFIX + cn + ":1.0"; }
protected static String toIDL(String cn) { if (cn.startsWith(JAVA_PREFIX)) cn = OMG_PREFIX + cn.substring(JAVA_PREFIX.length()).replace('.', '/'); else if (cn.startsWith(CLASSPATH_PREFIX)) cn = OMG_PREFIX + cn.substring(CLASSPATH_PREFIX.length()).replace('.', '/'); cn = cn.replace('.', '/'); return "IDL:" + OMG_PREFIX + cn + ":1.0"; }
14,306
protected static String toIDL(String cn) { if (cn.startsWith(JAVA_PREFIX)) cn = cn.substring(JAVA_PREFIX.length()); cn = cn.replace('.', '/'); return "IDL:" + OMG_PREFIX + cn + ":1.0"; }
protected static String toIDL(String cn) { if (cn.startsWith(JAVA_PREFIX)) cn = cn.substring(JAVA_PREFIX.length()); cn = cn.replace('.', '/'); return "IDL:" + OMG_PREFIX + cn + ":1.0"; }
14,307
private void addDirectoryRecord(Ext2DirectoryRecord dr) throws IOException, FileSystemException{ //synchronize to the inode cache to make sure that the inode does not get //flushed between reading it and locking it synchronized(((Ext2FileSystem)getFileSystem()).getInodeCache()) { //reread the inode before synchronizing to it to make sure //all threads use the same instance int iNodeNr = iNode.getINodeNr(); iNode = ((Ext2FileSystem)getFileSystem()).getINode(iNodeNr); //lock the inode into the cache so it is not flushed before synchronizing to it //(otherwise a new instance of INode referring to the same inode could be put //in the cache resulting in the possibility of two threads manipulating the same //inode at the same time because they would synchronize to different INode instances) iNode.incLocked(); } //a single inode may be represented by more than one Ext2Directory instances, //but each will use the same instance of the underlying inode (see Ext2FileSystem.getINode()), //so synchronize to the inode. synchronized(iNode) { try{ Ext2File dir = new Ext2File(iNode); //read itself as a file //find the last directory record (if any) Ext2FSEntryIterator iterator = new Ext2FSEntryIterator(iNode); Ext2DirectoryRecord rec=null; while(iterator.hasNext()) { rec = iterator.nextDirectoryRecord(); } Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); if(rec!=null) { long lastPos = rec.getFileOffset(); long lastLen = rec.getRecLen(); //truncate the last record to its minimal size (cut the padding from the end) rec.truncateRecord(); //directoryRecords may not extend over block boundaries: // see if the new record fits in the same block after truncating the last record long remainingLength = fs.getBlockSize() - (lastPos%fs.getBlockSize()) - rec.getRecLen(); log.debug("LAST-1 record: begins at: "+lastPos+", length: "+lastLen); log.debug("LAST-1 truncated length: "+rec.getRecLen()); log.debug("Remaining length: "+remainingLength); if(remainingLength >= dr.getRecLen()) { //write back the last record truncated dir.write( lastPos, rec.getData(), rec.getOffset(), rec.getRecLen() ); //pad the end of the new record with zeroes dr.expandRecord(lastPos+rec.getRecLen(), lastPos+rec.getRecLen()+remainingLength); //append the new record at the end of the list dir.write( lastPos+rec.getRecLen(), dr.getData(), dr.getOffset(), dr.getRecLen() ); log.debug("addDirectoryRecord(): LAST record: begins at: "+ (rec.getFileOffset()+rec.getRecLen())+", length: "+dr.getRecLen()); } else { //the new record must go to the next block //(the previously last record (rec) stays padded to the end of the block, so we can // append after that) dr.expandRecord(lastPos+lastLen, lastPos+lastLen+fs.getBlockSize()); dir.write( lastPos+lastLen, dr.getData(), dr.getOffset(), dr.getRecLen() ); log.debug("addDirectoryRecord(): LAST record: begins at: "+(lastPos+lastLen)+", length: "+dr.getRecLen()); } } else { //rec==null, ie. this is the first record in the directory dr.expandRecord(0, fs.getBlockSize()); dir.write(0, dr.getData(), dr.getOffset(), dr.getRecLen()); log.debug("addDirectoryRecord(): LAST record: begins at: 0, length: "+dr.getRecLen()); } //dir.flush(); iNode.setMtime(System.currentTimeMillis()/1000); // update the directory inode iNode.update(); //unlock the inode from the cache iNode.decLocked(); return; }catch(Throwable t) { //could not fininsh the operation, unlock the inode from the cache iNode.decLocked(); throw new IOException(t); } } }
private void addDirectoryRecord(Ext2DirectoryRecord dr) throws IOException, FileSystemException{ //synchronize to the inode cache to make sure that the inode does not get //flushed between reading it and locking it synchronized(((Ext2FileSystem)getFileSystem()).getInodeCache()) { //reread the inode before synchronizing to it to make sure //all threads use the same instance int iNodeNr = iNode.getINodeNr(); iNode = ((Ext2FileSystem)getFileSystem()).getINode(iNodeNr); //lock the inode into the cache so it is not flushed before synchronizing to it //(otherwise a new instance of INode referring to the same inode could be put //in the cache resulting in the possibility of two threads manipulating the same //inode at the same time because they would synchronize to different INode instances) iNode.incLocked(); } //a single inode may be represented by more than one Ext2Directory instances, //but each will use the same instance of the underlying inode (see Ext2FileSystem.getINode()), //so synchronize to the inode. synchronized(iNode) { try{ Ext2File dir = new Ext2File(iNode); //read itself as a file //find the last directory record (if any) Ext2FSEntryIterator iterator = new Ext2FSEntryIterator(iNode); Ext2DirectoryRecord rec=null; while(iterator.hasNext()) { rec = iterator.nextDirectoryRecord(); } Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); if(rec!=null) { long lastPos = rec.getFileOffset(); long lastLen = rec.getRecLen(); //truncate the last record to its minimal size (cut the padding from the end) rec.truncateRecord(); //directoryRecords may not extend over block boundaries: // see if the new record fits in the same block after truncating the last record long remainingLength = fs.getBlockSize() - (lastPos%fs.getBlockSize()) - rec.getRecLen(); log.debug("LAST-1 record: begins at: "+lastPos+", length: "+lastLen); log.debug("LAST-1 truncated length: "+rec.getRecLen()); log.debug("Remaining length: "+remainingLength); if(remainingLength >= dr.getRecLen()) { //write back the last record truncated dir.write( lastPos, rec.getData(), rec.getOffset(), rec.getRecLen() ); //pad the end of the new record with zeroes dr.expandRecord(lastPos+rec.getRecLen(), lastPos+rec.getRecLen()+remainingLength); //append the new record at the end of the list dir.write( lastPos+rec.getRecLen(), dr.getData(), dr.getOffset(), dr.getRecLen() ); log.debug("addDirectoryRecord(): LAST record: begins at: "+ (rec.getFileOffset()+rec.getRecLen())+", length: "+dr.getRecLen()); } else { //the new record must go to the next block //(the previously last record (rec) stays padded to the end of the block, so we can // append after that) dr.expandRecord(lastPos+lastLen, lastPos+lastLen+fs.getBlockSize()); dir.write( lastPos+lastLen, dr.getData(), dr.getOffset(), dr.getRecLen() ); log.debug("addDirectoryRecord(): LAST record: begins at: "+(lastPos+lastLen)+", length: "+dr.getRecLen()); } } else { //rec==null, ie. this is the first record in the directory dr.expandRecord(0, fs.getBlockSize()); dir.write(0, dr.getData(), dr.getOffset(), dr.getRecLen()); log.debug("addDirectoryRecord(): LAST record: begins at: 0, length: "+dr.getRecLen()); } //dir.flush(); iNode.setMtime(System.currentTimeMillis()/1000); // update the directory inode iNode.update(); //unlock the inode from the cache iNode.decLocked(); return; }catch(Throwable t) { //could not fininsh the operation, unlock the inode from the cache iNode.decLocked(); throw new IOException(t); } } }
14,308
private void addDirectoryRecord(Ext2DirectoryRecord dr) throws IOException, FileSystemException{ //synchronize to the inode cache to make sure that the inode does not get //flushed between reading it and locking it synchronized(((Ext2FileSystem)getFileSystem()).getInodeCache()) { //reread the inode before synchronizing to it to make sure //all threads use the same instance int iNodeNr = iNode.getINodeNr(); iNode = ((Ext2FileSystem)getFileSystem()).getINode(iNodeNr); //lock the inode into the cache so it is not flushed before synchronizing to it //(otherwise a new instance of INode referring to the same inode could be put //in the cache resulting in the possibility of two threads manipulating the same //inode at the same time because they would synchronize to different INode instances) iNode.incLocked(); } //a single inode may be represented by more than one Ext2Directory instances, //but each will use the same instance of the underlying inode (see Ext2FileSystem.getINode()), //so synchronize to the inode. synchronized(iNode) { try{ Ext2File dir = new Ext2File(iNode); //read itself as a file //find the last directory record (if any) Ext2FSEntryIterator iterator = new Ext2FSEntryIterator(iNode); Ext2DirectoryRecord rec=null; while(iterator.hasNext()) { rec = iterator.nextDirectoryRecord(); } Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); if(rec!=null) { long lastPos = rec.getFileOffset(); long lastLen = rec.getRecLen(); //truncate the last record to its minimal size (cut the padding from the end) rec.truncateRecord(); //directoryRecords may not extend over block boundaries: // see if the new record fits in the same block after truncating the last record long remainingLength = fs.getBlockSize() - (lastPos%fs.getBlockSize()) - rec.getRecLen(); log.debug("LAST-1 record: begins at: "+lastPos+", length: "+lastLen); log.debug("LAST-1 truncated length: "+rec.getRecLen()); log.debug("Remaining length: "+remainingLength); if(remainingLength >= dr.getRecLen()) { //write back the last record truncated dir.write( lastPos, rec.getData(), rec.getOffset(), rec.getRecLen() ); //pad the end of the new record with zeroes dr.expandRecord(lastPos+rec.getRecLen(), lastPos+rec.getRecLen()+remainingLength); //append the new record at the end of the list dir.write( lastPos+rec.getRecLen(), dr.getData(), dr.getOffset(), dr.getRecLen() ); log.debug("addDirectoryRecord(): LAST record: begins at: "+ (rec.getFileOffset()+rec.getRecLen())+", length: "+dr.getRecLen()); } else { //the new record must go to the next block //(the previously last record (rec) stays padded to the end of the block, so we can // append after that) dr.expandRecord(lastPos+lastLen, lastPos+lastLen+fs.getBlockSize()); dir.write( lastPos+lastLen, dr.getData(), dr.getOffset(), dr.getRecLen() ); log.debug("addDirectoryRecord(): LAST record: begins at: "+(lastPos+lastLen)+", length: "+dr.getRecLen()); } } else { //rec==null, ie. this is the first record in the directory dr.expandRecord(0, fs.getBlockSize()); dir.write(0, dr.getData(), dr.getOffset(), dr.getRecLen()); log.debug("addDirectoryRecord(): LAST record: begins at: 0, length: "+dr.getRecLen()); } //dir.flush(); iNode.setMtime(System.currentTimeMillis()/1000); // update the directory inode iNode.update(); //unlock the inode from the cache iNode.decLocked(); return; }catch(Throwable t) { //could not fininsh the operation, unlock the inode from the cache iNode.decLocked(); throw new IOException(t); } } }
private void addDirectoryRecord(Ext2DirectoryRecord dr) throws IOException, FileSystemException{ //synchronize to the inode cache to make sure that the inode does not get //flushed between reading it and locking it synchronized(((Ext2FileSystem)getFileSystem()).getInodeCache()) { //reread the inode before synchronizing to it to make sure //all threads use the same instance int iNodeNr = iNode.getINodeNr(); iNode = ((Ext2FileSystem)getFileSystem()).getINode(iNodeNr); //lock the inode into the cache so it is not flushed before synchronizing to it //(otherwise a new instance of INode referring to the same inode could be put //in the cache resulting in the possibility of two threads manipulating the same //inode at the same time because they would synchronize to different INode instances) iNode.incLocked(); } //a single inode may be represented by more than one Ext2Directory instances, //but each will use the same instance of the underlying inode (see Ext2FileSystem.getINode()), //so synchronize to the inode. synchronized(iNode) { try{ Ext2File dir = new Ext2File(iNode); //read itself as a file //find the last directory record (if any) Ext2FSEntryIterator iterator = new Ext2FSEntryIterator(iNode); Ext2DirectoryRecord rec=null; while(iterator.hasNext()) { rec = iterator.nextDirectoryRecord(); } Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); if(rec!=null) { long lastPos = rec.getFileOffset(); long lastLen = rec.getRecLen(); //truncate the last record to its minimal size (cut the padding from the end) rec.truncateRecord(); //directoryRecords may not extend over block boundaries: // see if the new record fits in the same block after truncating the last record long remainingLength = fs.getBlockSize() - (lastPos%fs.getBlockSize()) - rec.getRecLen(); log.debug("LAST-1 record: begins at: "+lastPos+", length: "+lastLen); log.debug("LAST-1 truncated length: "+rec.getRecLen()); log.debug("Remaining length: "+remainingLength); if(remainingLength >= dr.getRecLen()) { //write back the last record truncated dir.write( lastPos, rec.getData(), rec.getOffset(), rec.getRecLen() ); //pad the end of the new record with zeroes dr.expandRecord(lastPos+rec.getRecLen(), lastPos+rec.getRecLen()+remainingLength); //append the new record at the end of the list dir.write( lastPos+rec.getRecLen(), dr.getData(), dr.getOffset(), dr.getRecLen() ); log.debug("addDirectoryRecord(): LAST record: begins at: "+ (rec.getFileOffset()+rec.getRecLen())+", length: "+dr.getRecLen()); } else { //the new record must go to the next block //(the previously last record (rec) stays padded to the end of the block, so we can // append after that) dr.expandRecord(lastPos+lastLen, lastPos+lastLen+fs.getBlockSize()); dir.write( lastPos+lastLen, dr.getData(), dr.getOffset(), dr.getRecLen() ); log.debug("addDirectoryRecord(): LAST record: begins at: "+(lastPos+lastLen)+", length: "+dr.getRecLen()); } } else { //rec==null, ie. this is the first record in the directory dr.expandRecord(0, fs.getBlockSize()); dir.write(0, dr.getData(), dr.getOffset(), dr.getRecLen()); log.debug("addDirectoryRecord(): LAST record: begins at: 0, length: "+dr.getRecLen()); } //dir.flush(); iNode.setMtime(System.currentTimeMillis()/1000); // update the directory inode iNode.update(); //unlock the inode from the cache iNode.decLocked(); return; }catch(Throwable t) { //could not fininsh the operation, unlock the inode from the cache iNode.decLocked(); throw new IOException(t); } } }
14,309
protected FSEntry addINode(int iNodeNr, String linkName, int fileType) throws IOException { if(!canWrite()) throw new IOException("Filesystem or directory is mounted read-only!"); //TODO: access rights, file type, UID and GID should be passed through the FSDirectory interface Ext2DirectoryRecord dr; Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); try{ dr = new Ext2DirectoryRecord(fs, iNodeNr, fileType, linkName); addDirectoryRecord(dr); // update the directory inode iNode.update(); INode linkedINode = fs.getINode(iNodeNr); linkedINode.setLinksCount( linkedINode.getLinksCount()+1 ); return new Ext2Entry(linkedINode, linkName, fileType, fs, this); }catch(FileSystemException fse) { throw new IOException(fse); } }
protected FSEntry addINode(int iNodeNr, String linkName, int fileType) throws IOException { if(!canWrite()) throw new IOException("Filesystem or directory is mounted read-only!"); //TODO: access rights, file type, UID and GID should be passed through the FSDirectory interface Ext2DirectoryRecord dr; Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); try{ dr = new Ext2DirectoryRecord(fs, iNodeNr, fileType, linkName); addDirectoryRecord(dr); // update the directory inode iNode.update(); INode linkedINode = fs.getINode(iNodeNr); linkedINode.setLinksCount( linkedINode.getLinksCount()+1 ); return new Ext2Entry(linkedINode, linkName, fileType, fs, this); }catch(FileSystemException fse) { throw new IOException(fse); } }
14,310
protected FSEntry addINode(int iNodeNr, String linkName, int fileType) throws IOException { if(!canWrite()) throw new IOException("Filesystem or directory is mounted read-only!"); //TODO: access rights, file type, UID and GID should be passed through the FSDirectory interface Ext2DirectoryRecord dr; Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); try{ dr = new Ext2DirectoryRecord(fs, iNodeNr, fileType, linkName); addDirectoryRecord(dr); // update the directory inode iNode.update(); INode linkedINode = fs.getINode(iNodeNr); linkedINode.setLinksCount( linkedINode.getLinksCount()+1 ); return new Ext2Entry(linkedINode, linkName, fileType, fs, this); }catch(FileSystemException fse) { throw new IOException(fse); } }
protected FSEntry addINode(int iNodeNr, String linkName, int fileType) throws IOException { if(!canWrite()) throw new IOException("Filesystem or directory is mounted read-only!"); //TODO: access rights, file type, UID and GID should be passed through the FSDirectory interface Ext2DirectoryRecord dr; Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); try{ dr = new Ext2DirectoryRecord(fs, iNodeNr, fileType, linkName); addDirectoryRecord(dr); // update the directory inode iNode.update(); INode linkedINode = fs.getINode(iNodeNr); linkedINode.setLinksCount( linkedINode.getLinksCount()+1 ); return new Ext2Entry(linkedINode, linkName, fileType, fs, this); }catch(FileSystemException fse) { throw new IOException(fse); } }
14,311
public FSEntry createDirectoryEntry(String name) throws IOException { if(!canWrite()) throw new IOException("Filesystem or directory is mounted read-only!"); //create a new iNode for the file //TODO: access rights, file type, UID and GID should be passed through the FSDirectory interface INode newINode; Ext2DirectoryRecord dr; Ext2Entry newEntry; Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); try{ int rights = 0xFFFF & (Ext2Constants.EXT2_S_IRWXU | Ext2Constants.EXT2_S_IRWXG | Ext2Constants.EXT2_S_IRWXO); newINode = fs.createINode((int)iNode.getGroup(), Ext2Constants.EXT2_S_IFDIR, rights, 0, 0); dr = new Ext2DirectoryRecord(fs, newINode.getINodeNr(), Ext2Constants.EXT2_FT_DIR, name); addDirectoryRecord(dr); newINode.setLinksCount( newINode.getLinksCount()+1 ); newEntry = new Ext2Entry(newINode, name, Ext2Constants.EXT2_FT_DIR, fs, this); //add "." Ext2Directory newDir = new Ext2Directory(newEntry); Ext2DirectoryRecord drThis = new Ext2DirectoryRecord( fs, newINode.getINodeNr(), Ext2Constants.EXT2_FT_DIR, "." ); newINode.setLinksCount( 2 ); newDir.addDirectoryRecord( drThis ); //add ".." long parentINodeNr = ((Ext2Directory)entry.getDirectory()).getINode().getINodeNr(); Ext2DirectoryRecord drParent=new Ext2DirectoryRecord( fs, parentINodeNr, Ext2Constants.EXT2_FT_DIR, ".." ); newDir.addDirectoryRecord( drParent ); //increase the reference count for the parent directory INode parentINode = fs.getINode((int)parentINodeNr); parentINode.setLinksCount( parentINode.getLinksCount()+1 ); //update the number of used directories in the block group int group = (int)( (newINode.getINodeNr()-1) / fs.getSuperblock().getINodesPerGroup()) ; fs.modifyUsedDirsCount(group, 1); //update the new inode newINode.update(); }catch(FileSystemException fse) { throw new IOException(fse); } return newEntry; }
public FSEntry createDirectoryEntry(String name) throws IOException { if(!canWrite()) throw new IOException("Filesystem or directory is mounted read-only!"); //create a new iNode for the file //TODO: access rights, file type, UID and GID should be passed through the FSDirectory interface INode newINode; Ext2DirectoryRecord dr; Ext2Entry newEntry; Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); try{ int rights = 0xFFFF & (Ext2Constants.EXT2_S_IRWXU | Ext2Constants.EXT2_S_IRWXG | Ext2Constants.EXT2_S_IRWXO); newINode = fs.createINode((int)iNode.getGroup(), Ext2Constants.EXT2_S_IFDIR, rights, 0, 0); dr = new Ext2DirectoryRecord(fs, newINode.getINodeNr(), Ext2Constants.EXT2_FT_DIR, name); addDirectoryRecord(dr); newINode.setLinksCount( newINode.getLinksCount()+1 ); newEntry = new Ext2Entry(newINode, name, Ext2Constants.EXT2_FT_DIR, fs, this); //add "." Ext2Directory newDir = new Ext2Directory(newEntry); Ext2DirectoryRecord drThis = new Ext2DirectoryRecord( fs, newINode.getINodeNr(), Ext2Constants.EXT2_FT_DIR, "." ); newINode.setLinksCount( 2 ); newDir.addDirectoryRecord( drThis ); //add ".." long parentINodeNr = ((Ext2Directory)entry.getDirectory()).getINode().getINodeNr(); Ext2DirectoryRecord drParent=new Ext2DirectoryRecord( fs, parentINodeNr, Ext2Constants.EXT2_FT_DIR, ".." ); newDir.addDirectoryRecord( drParent ); //increase the reference count for the parent directory INode parentINode = fs.getINode((int)parentINodeNr); parentINode.setLinksCount( parentINode.getLinksCount()+1 ); //update the number of used directories in the block group int group = (int)( (newINode.getINodeNr()-1) / fs.getSuperblock().getINodesPerGroup()) ; fs.modifyUsedDirsCount(group, 1); //update the new inode newINode.update(); }catch(FileSystemException fse) { throw new IOException(fse); } return newEntry; }
14,312
public FSEntry createDirectoryEntry(String name) throws IOException { if(!canWrite()) throw new IOException("Filesystem or directory is mounted read-only!"); //create a new iNode for the file //TODO: access rights, file type, UID and GID should be passed through the FSDirectory interface INode newINode; Ext2DirectoryRecord dr; Ext2Entry newEntry; Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); try{ int rights = 0xFFFF & (Ext2Constants.EXT2_S_IRWXU | Ext2Constants.EXT2_S_IRWXG | Ext2Constants.EXT2_S_IRWXO); newINode = fs.createINode((int)iNode.getGroup(), Ext2Constants.EXT2_S_IFDIR, rights, 0, 0); dr = new Ext2DirectoryRecord(fs, newINode.getINodeNr(), Ext2Constants.EXT2_FT_DIR, name); addDirectoryRecord(dr); newINode.setLinksCount( newINode.getLinksCount()+1 ); newEntry = new Ext2Entry(newINode, name, Ext2Constants.EXT2_FT_DIR, fs, this); //add "." Ext2Directory newDir = new Ext2Directory(newEntry); Ext2DirectoryRecord drThis = new Ext2DirectoryRecord( fs, newINode.getINodeNr(), Ext2Constants.EXT2_FT_DIR, "." ); newINode.setLinksCount( 2 ); newDir.addDirectoryRecord( drThis ); //add ".." long parentINodeNr = ((Ext2Directory)entry.getDirectory()).getINode().getINodeNr(); Ext2DirectoryRecord drParent=new Ext2DirectoryRecord( fs, parentINodeNr, Ext2Constants.EXT2_FT_DIR, ".." ); newDir.addDirectoryRecord( drParent ); //increase the reference count for the parent directory INode parentINode = fs.getINode((int)parentINodeNr); parentINode.setLinksCount( parentINode.getLinksCount()+1 ); //update the number of used directories in the block group int group = (int)( (newINode.getINodeNr()-1) / fs.getSuperblock().getINodesPerGroup()) ; fs.modifyUsedDirsCount(group, 1); //update the new inode newINode.update(); }catch(FileSystemException fse) { throw new IOException(fse); } return newEntry; }
public FSEntry createDirectoryEntry(String name) throws IOException { if(!canWrite()) throw new IOException("Filesystem or directory is mounted read-only!"); //create a new iNode for the file //TODO: access rights, file type, UID and GID should be passed through the FSDirectory interface INode newINode; Ext2DirectoryRecord dr; Ext2Entry newEntry; Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); try{ int rights = 0xFFFF & (Ext2Constants.EXT2_S_IRWXU | Ext2Constants.EXT2_S_IRWXG | Ext2Constants.EXT2_S_IRWXO); newINode = fs.createINode((int)iNode.getGroup(), Ext2Constants.EXT2_S_IFDIR, rights, 0, 0); dr = new Ext2DirectoryRecord(fs, newINode.getINodeNr(), Ext2Constants.EXT2_FT_DIR, name); addDirectoryRecord(dr); newINode.setLinksCount( newINode.getLinksCount()+1 ); newEntry = new Ext2Entry(newINode, name, Ext2Constants.EXT2_FT_DIR, fs, this); //add "." Ext2Directory newDir = new Ext2Directory(newEntry); Ext2DirectoryRecord drThis = new Ext2DirectoryRecord( fs, newINode.getINodeNr(), Ext2Constants.EXT2_FT_DIR, "." ); newINode.setLinksCount( 2 ); newDir.addDirectoryRecord( drThis ); //add ".." long parentINodeNr = ((Ext2Directory)entry.getDirectory()).getINode().getINodeNr(); Ext2DirectoryRecord drParent=new Ext2DirectoryRecord( fs, parentINodeNr, Ext2Constants.EXT2_FT_DIR, ".." ); newDir.addDirectoryRecord( drParent ); //increase the reference count for the parent directory INode parentINode = fs.getINode((int)parentINodeNr); parentINode.setLinksCount( parentINode.getLinksCount()+1 ); //update the number of used directories in the block group int group = (int)( (newINode.getINodeNr()-1) / fs.getSuperblock().getINodesPerGroup()) ; fs.modifyUsedDirsCount(group, 1); //update the new inode newINode.update(); }catch(FileSystemException fse) { throw new IOException(fse); } return newEntry; }
14,313
public FSEntry createDirectoryEntry(String name) throws IOException { if(!canWrite()) throw new IOException("Filesystem or directory is mounted read-only!"); //create a new iNode for the file //TODO: access rights, file type, UID and GID should be passed through the FSDirectory interface INode newINode; Ext2DirectoryRecord dr; Ext2Entry newEntry; Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); try{ int rights = 0xFFFF & (Ext2Constants.EXT2_S_IRWXU | Ext2Constants.EXT2_S_IRWXG | Ext2Constants.EXT2_S_IRWXO); newINode = fs.createINode((int)iNode.getGroup(), Ext2Constants.EXT2_S_IFDIR, rights, 0, 0); dr = new Ext2DirectoryRecord(fs, newINode.getINodeNr(), Ext2Constants.EXT2_FT_DIR, name); addDirectoryRecord(dr); newINode.setLinksCount( newINode.getLinksCount()+1 ); newEntry = new Ext2Entry(newINode, name, Ext2Constants.EXT2_FT_DIR, fs, this); //add "." Ext2Directory newDir = new Ext2Directory(newEntry); Ext2DirectoryRecord drThis = new Ext2DirectoryRecord( fs, newINode.getINodeNr(), Ext2Constants.EXT2_FT_DIR, "." ); newINode.setLinksCount( 2 ); newDir.addDirectoryRecord( drThis ); //add ".." long parentINodeNr = ((Ext2Directory)entry.getDirectory()).getINode().getINodeNr(); Ext2DirectoryRecord drParent=new Ext2DirectoryRecord( fs, parentINodeNr, Ext2Constants.EXT2_FT_DIR, ".." ); newDir.addDirectoryRecord( drParent ); //increase the reference count for the parent directory INode parentINode = fs.getINode((int)parentINodeNr); parentINode.setLinksCount( parentINode.getLinksCount()+1 ); //update the number of used directories in the block group int group = (int)( (newINode.getINodeNr()-1) / fs.getSuperblock().getINodesPerGroup()) ; fs.modifyUsedDirsCount(group, 1); //update the new inode newINode.update(); }catch(FileSystemException fse) { throw new IOException(fse); } return newEntry; }
public FSEntry createDirectoryEntry(String name) throws IOException { if(!canWrite()) throw new IOException("Filesystem or directory is mounted read-only!"); //create a new iNode for the file //TODO: access rights, file type, UID and GID should be passed through the FSDirectory interface INode newINode; Ext2DirectoryRecord dr; Ext2Entry newEntry; Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); try{ int rights = 0xFFFF & (Ext2Constants.EXT2_S_IRWXU | Ext2Constants.EXT2_S_IRWXG | Ext2Constants.EXT2_S_IRWXO); newINode = fs.createINode((int)iNode.getGroup(), Ext2Constants.EXT2_S_IFDIR, rights, 0, 0); dr = new Ext2DirectoryRecord(fs, newINode.getINodeNr(), Ext2Constants.EXT2_FT_DIR, name); addDirectoryRecord(dr); newINode.setLinksCount( newINode.getLinksCount()+1 ); newEntry = new Ext2Entry(newINode, name, Ext2Constants.EXT2_FT_DIR, fs, this); //add "." Ext2Directory newDir = new Ext2Directory(newEntry); Ext2DirectoryRecord drThis = new Ext2DirectoryRecord( fs, newINode.getINodeNr(), Ext2Constants.EXT2_FT_DIR, "." ); newINode.setLinksCount( 2 ); newDir.addDirectoryRecord( drThis ); //add ".." long parentINodeNr = ((Ext2Directory)entry.getDirectory()).getINode().getINodeNr(); Ext2DirectoryRecord drParent=new Ext2DirectoryRecord( fs, parentINodeNr, Ext2Constants.EXT2_FT_DIR, ".." ); newDir.addDirectoryRecord( drParent ); //increase the reference count for the parent directory INode parentINode = fs.getINode((int)parentINodeNr); parentINode.setLinksCount( parentINode.getLinksCount()+1 ); //update the number of used directories in the block group int group = (int)( (newINode.getINodeNr()-1) / fs.getSuperblock().getINodesPerGroup()) ; fs.modifyUsedDirsCount(group, 1); //update the new inode newINode.update(); }catch(FileSystemException fse) { throw new IOException(fse); } return newEntry; }
14,314
public FSEntry createFileEntry(String name) throws IOException { if(!canWrite()) throw new IOException("Filesystem or directory is mounted read-only!"); //create a new iNode for the file //TODO: access rights, file type, UID and GID should be passed through the FSDirectory interface INode newINode; Ext2DirectoryRecord dr; Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); try{ int rights = 0xFFFF & (Ext2Constants.EXT2_S_IRWXU | Ext2Constants.EXT2_S_IRWXG | Ext2Constants.EXT2_S_IRWXO); newINode = fs.createINode((int)iNode.getGroup(), Ext2Constants.EXT2_S_IFREG, rights, 0, 0); dr = new Ext2DirectoryRecord(fs, newINode.getINodeNr(), Ext2Constants.EXT2_FT_REG_FILE, name); addDirectoryRecord(dr); newINode.setLinksCount( newINode.getLinksCount()+1 ); }catch(FileSystemException fse) { throw new IOException(fse); } return new Ext2Entry(newINode, name, Ext2Constants.EXT2_FT_REG_FILE, fs, this); }
public FSEntry createFileEntry(String name) throws IOException { if(!canWrite()) throw new IOException("Filesystem or directory is mounted read-only!"); //create a new iNode for the file //TODO: access rights, file type, UID and GID should be passed through the FSDirectory interface INode newINode; Ext2DirectoryRecord dr; Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); try{ int rights = 0xFFFF & (Ext2Constants.EXT2_S_IRWXU | Ext2Constants.EXT2_S_IRWXG | Ext2Constants.EXT2_S_IRWXO); newINode = fs.createINode((int)iNode.getGroup(), Ext2Constants.EXT2_S_IFREG, rights, 0, 0); dr = new Ext2DirectoryRecord(fs, newINode.getINodeNr(), Ext2Constants.EXT2_FT_REG_FILE, name); addDirectoryRecord(dr); newINode.setLinksCount( newINode.getLinksCount()+1 ); }catch(FileSystemException fse) { throw new IOException(fse); } return new Ext2Entry(newINode, name, Ext2Constants.EXT2_FT_REG_FILE, fs, this); }
14,315
public FSEntry createFileEntry(String name) throws IOException { if(!canWrite()) throw new IOException("Filesystem or directory is mounted read-only!"); //create a new iNode for the file //TODO: access rights, file type, UID and GID should be passed through the FSDirectory interface INode newINode; Ext2DirectoryRecord dr; Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); try{ int rights = 0xFFFF & (Ext2Constants.EXT2_S_IRWXU | Ext2Constants.EXT2_S_IRWXG | Ext2Constants.EXT2_S_IRWXO); newINode = fs.createINode((int)iNode.getGroup(), Ext2Constants.EXT2_S_IFREG, rights, 0, 0); dr = new Ext2DirectoryRecord(fs, newINode.getINodeNr(), Ext2Constants.EXT2_FT_REG_FILE, name); addDirectoryRecord(dr); newINode.setLinksCount( newINode.getLinksCount()+1 ); }catch(FileSystemException fse) { throw new IOException(fse); } return new Ext2Entry(newINode, name, Ext2Constants.EXT2_FT_REG_FILE, fs, this); }
public FSEntry createFileEntry(String name) throws IOException { if(!canWrite()) throw new IOException("Filesystem or directory is mounted read-only!"); //create a new iNode for the file //TODO: access rights, file type, UID and GID should be passed through the FSDirectory interface INode newINode; Ext2DirectoryRecord dr; Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); try{ int rights = 0xFFFF & (Ext2Constants.EXT2_S_IRWXU | Ext2Constants.EXT2_S_IRWXG | Ext2Constants.EXT2_S_IRWXO); newINode = fs.createINode((int)iNode.getGroup(), Ext2Constants.EXT2_S_IFREG, rights, 0, 0); dr = new Ext2DirectoryRecord(fs, newINode.getINodeNr(), Ext2Constants.EXT2_FT_REG_FILE, name); addDirectoryRecord(dr); newINode.setLinksCount( newINode.getLinksCount()+1 ); }catch(FileSystemException fse) { throw new IOException(fse); } return new Ext2Entry(newINode, name, Ext2Constants.EXT2_FT_REG_FILE, fs, this); }
14,316
public FSEntry createFileEntry(String name) throws IOException { if(!canWrite()) throw new IOException("Filesystem or directory is mounted read-only!"); //create a new iNode for the file //TODO: access rights, file type, UID and GID should be passed through the FSDirectory interface INode newINode; Ext2DirectoryRecord dr; Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); try{ int rights = 0xFFFF & (Ext2Constants.EXT2_S_IRWXU | Ext2Constants.EXT2_S_IRWXG | Ext2Constants.EXT2_S_IRWXO); newINode = fs.createINode((int)iNode.getGroup(), Ext2Constants.EXT2_S_IFREG, rights, 0, 0); dr = new Ext2DirectoryRecord(fs, newINode.getINodeNr(), Ext2Constants.EXT2_FT_REG_FILE, name); addDirectoryRecord(dr); newINode.setLinksCount( newINode.getLinksCount()+1 ); }catch(FileSystemException fse) { throw new IOException(fse); } return new Ext2Entry(newINode, name, Ext2Constants.EXT2_FT_REG_FILE, fs, this); }
public FSEntry createFileEntry(String name) throws IOException { if(!canWrite()) throw new IOException("Filesystem or directory is mounted read-only!"); //create a new iNode for the file //TODO: access rights, file type, UID and GID should be passed through the FSDirectory interface INode newINode; Ext2DirectoryRecord dr; Ext2FileSystem fs = (Ext2FileSystem) getFileSystem(); try{ int rights = 0xFFFF & (Ext2Constants.EXT2_S_IRWXU | Ext2Constants.EXT2_S_IRWXG | Ext2Constants.EXT2_S_IRWXO); newINode = fs.createINode((int)iNode.getGroup(), Ext2Constants.EXT2_S_IFREG, rights, 0, 0); dr = new Ext2DirectoryRecord(fs, newINode.getINodeNr(), Ext2Constants.EXT2_FT_REG_FILE, name); addDirectoryRecord(dr); newINode.setLinksCount( newINode.getLinksCount()+1 ); }catch(FileSystemException fse) { throw new IOException(fse); } return new Ext2Entry(newINode, name, Ext2Constants.EXT2_FT_REG_FILE, fs, this); }
14,317
public void installUI(JComponent c) { super.installUI(c); c.setLayout(new ViewportLayout()); installListeners(c); }
public void installUI(JComponent c) { super.installUI(c); installListeners(c); }
14,318
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); menuItem.setBackground(defaults.getColor("Menu.background")); menuItem.setBorder(defaults.getBorder("Menu.border")); menuItem.setFont(defaults.getFont("Menu.font")); menuItem.setForeground(defaults.getColor("Menu.foreground")); menuItem.setMargin(defaults.getInsets("Menu.margin")); acceleratorFont = defaults.getFont("Menu.acceleratorFont"); acceleratorForeground = defaults.getColor("Menu.acceleratorForeground"); acceleratorSelectionForeground = defaults.getColor("Menu.acceleratorSelectionForeground"); selectionBackground = defaults.getColor("Menu.selectionBackground"); selectionForeground = defaults.getColor("Menu.selectionForeground"); arrowIcon = defaults.getIcon("Menu.arrowIcon"); oldBorderPainted = defaults.getBoolean("Menu.borderPainted"); menuItem.setOpaque(true); }
protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); menuItem.setBackground(defaults.getColor("Menu.background")); menuItem.setBorder(defaults.getBorder("Menu.border")); menuItem.setFont(defaults.getFont("Menu.font")); menuItem.setForeground(defaults.getColor("Menu.foreground")); menuItem.setMargin(defaults.getInsets("Menu.margin")); acceleratorFont = defaults.getFont("Menu.acceleratorFont"); acceleratorForeground = defaults.getColor("Menu.acceleratorForeground"); acceleratorSelectionForeground = defaults.getColor("Menu.acceleratorSelectionForeground"); selectionBackground = defaults.getColor("Menu.selectionBackground"); selectionForeground = defaults.getColor("Menu.selectionForeground"); arrowIcon = defaults.getIcon("Menu.arrowIcon"); oldBorderPainted = defaults.getBoolean("Menu.borderPainted"); menuItem.setOpaque(true); }
14,319
public ColorModel(int bits) { this(bits * 4, // total bits, sRGB, four channels nArray(bits, 4), // bits for each channel ColorSpace.getInstance(ColorSpace.CS_sRGB), // sRGB true, // has alpha false, // not premultiplied TRANSLUCENT, Buffers.smallestAppropriateTransferType(bits * 4)); }
public ColorModel(int bits) { this(bits * 4, // total bits, sRGB, four channels nArray(bits, 4), // bits for each channel ColorSpace.getInstance(ColorSpace.CS_sRGB), // sRGB true, // has alpha false, // not premultiplied TRANSLUCENT, Buffers.smallestAppropriateTransferType(bits * 4)); }
14,320
protected void initialize(Address start, Address end, int slotSize) { //Unsafe.debug("bootheap.initialize"); //Unsafe.debug("start"); Unsafe.debug(Unsafe.addressToInt(start)); //Unsafe.debug("end"); Unsafe.debug(Unsafe.addressToInt(end)); this.start = start; this.end = end; initializeAbstract(slotSize); this.sizeOffset = Offset.fromIntSignExtend(-((ObjectLayout.HEADER_SLOTS + 1) * slotSize)); this.headerSize = ObjectLayout.objectAlign(this.headerSize + slotSize); // Create an allocation bitmap final int heapSize = getSize(); final int bits = ObjectLayout.objectAlign(heapSize) / ObjectLayout.OBJECT_ALIGN; final int bitmapSize = ObjectLayout.objectAlign(bits / 8); allocationBitmapPtr = helper.allocateBlock(Extent.fromIntZeroExtend(bitmapSize)); //allocationBitmapPtr = MemoryBlockManager.allocateBlock(bitmapSize); // Initialize the allocation bitmap helper.clear(allocationBitmapPtr, bitmapSize); // Go through the heap and mark all objects in the allocation bitmap. final Word heapSizeW = Word.fromIntZeroExtend(heapSize); final Word headerSizeW = Word.fromIntZeroExtend(headerSize); Word offset = Word.fromIntZeroExtend(headerSize); while (offset.LT(heapSizeW)) { final Address ptr = start.add(offset); setAllocationBit(ptr, true); final Word objSize = ptr.loadWord(sizeOffset); offset = offset.add(objSize).add(headerSizeW); } //Unsafe.debug("end of bootheap.initialize"); }
protected void initialize(Address start, Address end, int slotSize) { //Unsafe.debug("bootheap.initialize"); //Unsafe.debug("start"); Unsafe.debug(Unsafe.addressToInt(start)); //Unsafe.debug("end"); Unsafe.debug(Unsafe.addressToInt(end)); this.start = start; this.end = end; initializeAbstract(slotSize); this.sizeOffset = Offset.fromIntSignExtend(-((ObjectLayout.HEADER_SLOTS + 1) * slotSize)); this.headerSize = ObjectLayout.objectAlign(this.headerSize + slotSize); // Create an allocation bitmap final int heapSize = getSize(); final int bits = ObjectLayout.objectAlign(heapSize) / ObjectLayout.OBJECT_ALIGN; final int bitmapSize = ObjectLayout.objectAlign(bits / 8); allocationBitmapPtr = helper.allocateBlock(Extent.fromIntZeroExtend(bitmapSize)); //allocationBitmapPtr = MemoryBlockManager.allocateBlock(bitmapSize); // Initialize the allocation bitmap helper.clear(allocationBitmapPtr, bitmapSize); // Go through the heap and mark all objects in the allocation bitmap. final Word heapSizeW = Word.fromIntZeroExtend(heapSize); final Word headerSizeW = Word.fromIntZeroExtend(headerSize); Word offset = Word.fromIntZeroExtend(headerSize); while (offset.LT(heapSizeW)) { final Address ptr = start.add(offset); setAllocationBit(ptr, true); final Word objSize = ptr.loadWord(sizeOffset); offset = offset.add(objSize).add(headerSizeW); } //Unsafe.debug("end of bootheap.initialize"); }
14,321
protected void initialize(Address start, Address end, int slotSize) { //Unsafe.debug("bootheap.initialize"); //Unsafe.debug("start"); Unsafe.debug(Unsafe.addressToInt(start)); //Unsafe.debug("end"); Unsafe.debug(Unsafe.addressToInt(end)); this.start = start; this.end = end; initializeAbstract(slotSize); this.sizeOffset = Offset.fromIntSignExtend(-((ObjectLayout.HEADER_SLOTS + 1) * slotSize)); this.headerSize = ObjectLayout.objectAlign(this.headerSize + slotSize); // Create an allocation bitmap final int heapSize = getSize(); final int bits = ObjectLayout.objectAlign(heapSize) / ObjectLayout.OBJECT_ALIGN; final int bitmapSize = ObjectLayout.objectAlign(bits / 8); allocationBitmapPtr = helper.allocateBlock(Extent.fromIntZeroExtend(bitmapSize)); //allocationBitmapPtr = MemoryBlockManager.allocateBlock(bitmapSize); // Initialize the allocation bitmap helper.clear(allocationBitmapPtr, bitmapSize); // Go through the heap and mark all objects in the allocation bitmap. final Word heapSizeW = Word.fromIntZeroExtend(heapSize); final Word headerSizeW = Word.fromIntZeroExtend(headerSize); Word offset = Word.fromIntZeroExtend(headerSize); while (offset.LT(heapSizeW)) { final Address ptr = start.add(offset); setAllocationBit(ptr, true); final Word objSize = ptr.loadWord(sizeOffset); offset = offset.add(objSize).add(headerSizeW); } //Unsafe.debug("end of bootheap.initialize"); }
protected void initialize(Address start, Address end, int slotSize) { //Unsafe.debug("bootheap.initialize"); //Unsafe.debug("start"); Unsafe.debug(Unsafe.addressToInt(start)); //Unsafe.debug("end"); Unsafe.debug(Unsafe.addressToInt(end)); this.start = start; this.end = end; initializeAbstract(slotSize); this.sizeOffset = Offset.fromIntSignExtend(-((ObjectLayout.HEADER_SLOTS + 1) * slotSize)); this.headerSize = ObjectLayout.objectAlign(this.headerSize + slotSize); // Create an allocation bitmap final int heapSize = getSize(); final int bits = ObjectLayout.objectAlign(heapSize) / ObjectLayout.OBJECT_ALIGN; final int bitmapSize = ObjectLayout.objectAlign(bits / 8); allocationBitmapPtr = helper.allocateBlock(Extent.fromIntZeroExtend(bitmapSize)); //allocationBitmapPtr = MemoryBlockManager.allocateBlock(bitmapSize); // Initialize the allocation bitmap helper.clear(allocationBitmapPtr, bitmapSize); // Go through the heap and mark all objects in the allocation bitmap. final Word heapSizeW = Word.fromIntZeroExtend(heapSize); final Word headerSizeW = Word.fromIntZeroExtend(headerSize); Word offset = Word.fromIntZeroExtend(headerSize); while (offset.LT(heapSizeW)) { final Address ptr = start.add(offset); setAllocationBit(ptr, true); final Word objSize = ptr.loadWord(sizeOffset); offset = offset.add(objSize).add(headerSize); } //Unsafe.debug("end of bootheap.initialize"); }
14,322
public void show() { synchronized (getTreeLock()) { if (parent != null && !parent.isDisplayable()) parent.addNotify(); if (peer == null) addNotify(); // Show visible owned windows. Iterator e = ownedWindows.iterator(); while(e.hasNext()) { Window w = (Window)(((Reference) e.next()).get()); if (w != null) { if (w.isVisible()) w.getPeer().setVisible(true); } else // Remove null weak reference from ownedWindows. // Unfortunately this can't be done in the Window's // finalize method because there is no way to guarantee // synchronous access to ownedWindows there. e.remove(); } validate(); super.show(); toFront(); KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager (); manager.setGlobalFocusedWindow (this); if (!shown) { FocusTraversalPolicy policy = getFocusTraversalPolicy (); Component initialFocusOwner = null; if (policy != null) initialFocusOwner = policy.getInitialComponent (this); if (initialFocusOwner != null) initialFocusOwner.requestFocusInWindow (); shown = true; } } }
public void show() { synchronized (getTreeLock()) { if (parent != null && !parent.isDisplayable()) parent.addNotify(); if (peer == null) addNotify(); // Show visible owned windows. Iterator e = ownedWindows.iterator(); while(e.hasNext()) { Window w = (Window)(((Reference) e.next()).get()); if (w != null) { if (w.isVisible()) w.getPeer().setVisible(true); } else // Remove null weak reference from ownedWindows. // Unfortunately this can't be done in the Window's // finalize method because there is no way to guarantee // synchronous access to ownedWindows there. e.remove(); } validate(); super.show(); toFront(); KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager (); manager.setGlobalFocusedWindow (this); if (!shown) { FocusTraversalPolicy policy = getFocusTraversalPolicy (); Component initialFocusOwner = null; if (policy != null) initialFocusOwner = policy.getInitialComponent (this); if (initialFocusOwner != null) initialFocusOwner.requestFocusInWindow (); shown = true; } } }
14,323
public void show() { synchronized (getTreeLock()) { if (parent != null && !parent.isDisplayable()) parent.addNotify(); if (peer == null) addNotify(); // Show visible owned windows. Iterator e = ownedWindows.iterator(); while(e.hasNext()) { Window w = (Window)(((Reference) e.next()).get()); if (w != null) { if (w.isVisible()) w.getPeer().setVisible(true); } else // Remove null weak reference from ownedWindows. // Unfortunately this can't be done in the Window's // finalize method because there is no way to guarantee // synchronous access to ownedWindows there. e.remove(); } validate(); super.show(); toFront(); KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager (); manager.setGlobalFocusedWindow (this); if (!shown) { FocusTraversalPolicy policy = getFocusTraversalPolicy (); Component initialFocusOwner = null; if (policy != null) initialFocusOwner = policy.getInitialComponent (this); if (initialFocusOwner != null) initialFocusOwner.requestFocusInWindow (); shown = true; } } }
public void show() { synchronized (getTreeLock()) { if (parent != null && !parent.isDisplayable()) parent.addNotify(); if (peer == null) addNotify(); // Show visible owned windows. Iterator e = ownedWindows.iterator(); while(e.hasNext()) { Window w = (Window)(((Reference) e.next()).get()); if (w != null) { if (w.isVisible()) w.getPeer().setVisible(true); } else // Remove null weak reference from ownedWindows. // Unfortunately this can't be done in the Window's // finalize method because there is no way to guarantee // synchronous access to ownedWindows there. e.remove(); } validate(); super.show(); toFront(); KeyboardFocusManager manager = KeyboardFocusManager.getCurrentKeyboardFocusManager (); manager.setGlobalFocusedWindow (this); if (!shown) { FocusTraversalPolicy policy = getFocusTraversalPolicy (); Component initialFocusOwner = null; if (policy != null) initialFocusOwner = policy.getInitialComponent (this); if (initialFocusOwner != null) initialFocusOwner.requestFocusInWindow (); shown = true; } } }
14,324
public boolean prepareImage(Image img, int width, int height, ImageObserver ob) { Component parent = awtComponent.getParent(); ComponentPeer parentPeer = parent.getPeer(); return parentPeer.prepareImage(img, width, height, ob); }
public boolean prepareImage(Image img, int width, int height, ImageObserver ob) { Component parent = awtComponent.getParent(); ComponentPeer parentPeer = parent.getPeer(); res = parentPeer.prepareImage(img, width, height, ob); } else { res = Toolkit.getDefaultToolkit().prepareImage(img, width, height, ob); } return res; }
14,325
public DefaultTreeCellRenderer() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); setLeafIcon(getDefaultLeafIcon()); setOpenIcon(getDefaultOpenIcon()); setClosedIcon(getDefaultClosedIcon()); setTextNonSelectionColor(defaults.getColor("Tree.textForeground")); setTextSelectionColor(defaults.getColor("Tree.selectionForeground")); setBackgroundNonSelectionColor(defaults .getColor("Tree.textBackground")); setBackgroundSelectionColor(defaults .getColor("Tree.selectionBackground")); setBorderSelectionColor(defaults .getColor("Tree.selectionBorderColor")); }
public DefaultTreeCellRenderer() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); setLeafIcon(getDefaultLeafIcon()); setOpenIcon(getDefaultOpenIcon()); setClosedIcon(getDefaultClosedIcon()); setTextNonSelectionColor(defaults.getColor("Tree.textForeground")); setTextSelectionColor(defaults.getColor("Tree.selectionForeground")); setBackgroundNonSelectionColor(defaults .getColor("Tree.nonSelectionBackground")); setBackgroundSelectionColor(defaults .getColor("Tree.selectionBackground")); setBorderSelectionColor(defaults .getColor("Tree.selectionBorderColor")); }
14,326
public Component getTreeCellRendererComponent(JTree tree, Object val, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { this.selected = selected; this.hasFocus = hasFocus; setText(val.toString()); setHorizontalAlignment(LEFT); setOpaque(true); setVerticalAlignment(TOP); setEnabled(true); setFont(getFont()); if (leaf) setIcon(getLeafIcon()); else if (expanded) setIcon(getOpenIcon()); else setIcon(getClosedIcon()); if (selected) { super.setBackground(getBackgroundSelectionColor()); setForeground(getTextSelectionColor()); } else { super.setBackground((tree.getParent()).getBackground()); setForeground(getTextNonSelectionColor()); } return this; }
public Component getTreeCellRendererComponent(JTree tree, Object val, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { this.selected = selected; this.hasFocus = hasFocus; setText(val.toString()); setHorizontalAlignment(LEFT); setOpaque(true); setVerticalAlignment(TOP); setEnabled(true); setFont(getFont()); if (leaf) setIcon(getLeafIcon()); else if (expanded) setIcon(getOpenIcon()); else setIcon(getClosedIcon()); if (selected) { super.setBackground(getBackgroundSelectionColor()); setForeground(getTextSelectionColor()); } else { super.setBackground((tree.getParent()).getBackground()); setForeground(getTextNonSelectionColor()); } return this; }
14,327
public Component getTreeCellRendererComponent(JTree tree, Object val, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { this.selected = selected; this.hasFocus = hasFocus; setText(val.toString()); setHorizontalAlignment(LEFT); setOpaque(true); setVerticalAlignment(TOP); setEnabled(true); setFont(getFont()); if (leaf) setIcon(getLeafIcon()); else if (expanded) setIcon(getOpenIcon()); else setIcon(getClosedIcon()); if (selected) { super.setBackground(getBackgroundSelectionColor()); setForeground(getTextSelectionColor()); } else { super.setBackground((tree.getParent()).getBackground()); setForeground(getTextNonSelectionColor()); } return this; }
public Component getTreeCellRendererComponent(JTree tree, Object val, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { this.selected = selected; this.hasFocus = hasFocus; setText(val.toString()); setHorizontalAlignment(LEFT); setOpaque(true); setVerticalAlignment(TOP); setEnabled(true); setFont(getFont()); if (leaf) setIcon(getLeafIcon()); else if (expanded) setIcon(getOpenIcon()); else setIcon(getClosedIcon()); if (selected) { super.setBackground(getBackgroundSelectionColor()); setForeground(getTextSelectionColor()); } else { super.setBackground(getBackgroundNonSelectionColor()); setForeground(getTextNonSelectionColor()); } return this; }
14,328
public void paint(Graphics g, JComponent c) { JLabel b = (JLabel) c; Font saved_font = g.getFont(); Rectangle tr = new Rectangle(); Rectangle ir = new Rectangle(); Rectangle vr = new Rectangle(); Font f = c.getFont(); g.setFont(f); FontMetrics fm = g.getFontMetrics(f); vr = SwingUtilities.calculateInnerArea(c, vr); if (vr.width < 0) vr.width = 0; if (vr.height < 0) vr.height = 0; Icon icon = (b.isEnabled()) ? b.getIcon() : b.getDisabledIcon(); String text = layoutCL(b, fm, b.getText(), icon, vr, ir, tr); if (b.isOpaque()) { g.setColor(b.getBackground()); g.fillRect(vr.x, vr.y, vr.width, vr.height); } if (icon != null) icon.paintIcon(b, g, ir.x, ir.y); if (b.isEnabled()) paintEnabledText(b, g, text, tr.x, tr.y + fm.getAscent()); else paintDisabledText(b, g, text, tr.x, tr.y + fm.getAscent()); g.setFont(saved_font); }
public void paint(Graphics g, JComponent c) { JLabel b = (JLabel) c; Font saved_font = g.getFont(); Rectangle tr = new Rectangle(); Rectangle ir = new Rectangle(); Rectangle vr = new Rectangle(); Font f = c.getFont(); g.setFont(f); FontMetrics fm = g.getFontMetrics(f); vr = SwingUtilities.calculateInnerArea(c, vr); if (vr.width < 0) vr.width = 0; if (vr.height < 0) vr.height = 0; Icon icon = (b.isEnabled()) ? b.getIcon() : b.getDisabledIcon(); String text = layoutCL(b, fm, b.getText(), icon, vr, ir, tr); if (b.isOpaque()) { g.setColor(b.getBackground()); g.fillRect(vr.x, vr.y, vr.width, vr.height); } if (icon != null) icon.paintIcon(b, g, ir.x, ir.y); if (b.isEnabled()) paintEnabledText(b, g, text, tr.x, tr.y + fm.getAscent()); else paintDisabledText(b, g, text, tr.x, tr.y + fm.getAscent()); g.setFont(saved_font); }
14,330
public Dimension getMaximumSize(JComponent c) { return null; }
public Dimension getMaximumSize(JComponent c) { return c.getPreferredSize(); }
14,332
protected void installKeyboardActions(JScrollPane sp) throws NotImplementedException { // TODO: Is this only a hook method or should we actually do something // here? If the latter, than figure out what and implement this. }
protected void installKeyboardActions(JScrollPane sp) { // TODO: Is this only a hook method or should we actually do something // here? If the latter, than figure out what and implement this. }
14,333
protected void uninstallKeyboardActions(JScrollPane sp) throws NotImplementedException { // TODO: Is this only a hook method or should we actually do something // here? If the latter, than figure out what and implement this. }
protected void uninstallKeyboardActions(JScrollPane sp) { // TODO: Is this only a hook method or should we actually do something // here? If the latter, than figure out what and implement this. }
14,335
private IIORegistry() { super(defaultCategories.iterator()); // XXX: Register built-in Spis here. ((ClasspathToolkit)Toolkit.getDefaultToolkit()).registerImageIOSpis(this); registerApplicationClasspathSpis(); }
private IIORegistry() { super(defaultCategories.iterator()); // XXX: Register built-in Spis here. Toolkit toolkit = Toolkit.getDefaultToolkit(); if (toolkit instanceof ClasspathToolkit) ((ClasspathToolkit)toolkit).registerImageIOSpis(this); registerApplicationClasspathSpis(); }
14,338
public PolicyListHolder(Policy[] initialValue) { value = initialValue; }
public PolicyListHolder() { value = initialValue; }
14,340
public PolicyListHolder(Policy[] initialValue) { value = initialValue; }
public PolicyListHolder(Policy[] initialValue) { }
14,341
public static SortedMap availableCharsets() { TreeMap charsets = new TreeMap(String.CASE_INSENSITIVE_ORDER); CharsetProvider[] providers = providers(); for (int j = 0; j < providers.length; j++) { for (Iterator i = providers[j].charsets(); i.hasNext(); ) { Charset cs = (Charset) i.next(); charsets.put(cs.name(), cs); } } return Collections.unmodifiableSortedMap(charsets); }
public static SortedMap availableCharsets() { TreeMap charsets = new TreeMap(String.CASE_INSENSITIVE_ORDER); CharsetProvider[] providers = providers2(); for (int j = 0; j < providers.length; j++) { for (Iterator i = providers[j].charsets(); i.hasNext(); ) { Charset cs = (Charset) i.next(); charsets.put(cs.name(), cs); } } return Collections.unmodifiableSortedMap(charsets); }
14,342
private static Charset charsetForName(String charsetName) { checkName (charsetName); Charset cs = null; CharsetProvider[] providers = providers(); for (int i = 0; i < providers.length; i++) { cs = providers[i].charsetForName(charsetName); if (cs != null) break; } return cs; }
private static Charset charsetForName(String charsetName) { checkName (charsetName); Charset cs = null; CharsetProvider[] providers = providers2(); for (int i = 0; i < providers.length; i++) { cs = providers[i].charsetForName(charsetName); if (cs != null) break; } return cs; }
14,343
public static Charset defaultCharset() { String encoding; try { encoding = System.getProperty("file.encoding"); } catch(SecurityException e) { encoding = "ISO-8859-1"; } catch(IllegalArgumentException e) { encoding = "ISO-8859-1"; } try { return forName(encoding); } catch(UnsupportedCharsetException e) { } catch(IllegalCharsetNameException e) { } catch(IllegalArgumentException e) { } throw new IllegalStateException("Can't get default charset!"); }
public static Charset defaultCharset() { String encoding; try { encoding = System.getProperty("file.encoding"); } catch(SecurityException e) { encoding = "ISO-8859-1"; } catch(IllegalArgumentException e) { encoding = "ISO-8859-1"; } try { return forName(encoding); } catch(UnsupportedCharsetException e) { } catch(IllegalCharsetNameException e) { } catch(IllegalArgumentException e) { } throw new IllegalStateException("Can't get default charset!"); }
14,344
public static Charset defaultCharset() { String encoding; try { encoding = System.getProperty("file.encoding"); } catch(SecurityException e) { encoding = "ISO-8859-1"; } catch(IllegalArgumentException e) { encoding = "ISO-8859-1"; } try { return forName(encoding); } catch(UnsupportedCharsetException e) { } catch(IllegalCharsetNameException e) { } catch(IllegalArgumentException e) { } throw new IllegalStateException("Can't get default charset!"); }
public static Charset defaultCharset() { String encoding; try { encoding = System.getProperty("file.encoding"); } catch(SecurityException e) { encoding = "ISO-8859-1"; } catch(IllegalArgumentException e) { encoding = "ISO-8859-1"; } try { return forName(encoding); } catch(UnsupportedCharsetException e) { } catch(IllegalCharsetNameException e) { } catch(IllegalArgumentException e) { } throw new IllegalStateException("Can't get default charset!"); }
14,345
static Object allocateObject (Class clazz) throws InstantiationException { // TODO implement me return null; }
static Object allocateObject (Class clazzClass, Class constr_clazz, Constructor constructor) throws InstantiationException { // TODO implement me return null; }
14,348
protected void paintFocus(Graphics g, Rectangle t, Dimension d) { g.setColor(focusColor); g.drawRect(t.x - 1, t.y + 2, t.width + 2, t.height - 4); }
protected void paintFocus(Graphics g, Rectangle t, Dimension d) { g.setColor(focusColor); g.drawRect(t.x - 1, t.y - 1, t.width + 2, t.height + 2); }
14,349
public Component getComponentAfter (Container root, Component current) { if (root == null) throw new IllegalArgumentException ("focus cycle root is null"); if (current == null) throw new IllegalArgumentException ("current component is null"); if (!root.isFocusCycleRoot ()) throw new IllegalArgumentException ("root is not a focus cycle root"); Container ancestor = current.getFocusCycleRootAncestor (); Container prevAncestor = ancestor; while (ancestor != root) { ancestor = current.getFocusCycleRootAncestor (); if (ancestor == prevAncestor) { // We've reached the top focus cycle root ancestor. Check // if it is root. if (ancestor != root) throw new IllegalArgumentException ("the given container is not" + " a focus cycle root of the" + " current component"); else break; } prevAncestor = ancestor; } // FIXME: is this the right thing to do here? It moves the context // for traversal up one focus traversal cycle. We'll need a test // for this. if ((Component) root == current) root = current.getFocusCycleRootAncestor (); // Check if we've reached the top of the component hierarchy. If // so then we want to loop around to the first component in the // focus traversal cycle. if (current instanceof Window) return getFirstComponent ((Container) current); Container parent = current.getParent (); synchronized (parent.getTreeLock ()) { Component[] components = parent.getComponents (); int componentIndex = 0; int numComponents = parent.getComponentCount (); // Find component's index. for (int i = 0; i < numComponents; i++) { if (components[i] == current) componentIndex = i; } // Search forward for the next acceptable component. for (int i = componentIndex + 1; i < numComponents; i++) { if (accept (components[i])) return components[i]; if (components[i] instanceof Container) { Component result = getFirstComponent ((Container) components[i]); if (result != null && implicitDownCycleTraversal) return result; } } // No focusable components after current in its Container. So go // to the next Component after current's Container (parent). Component result = getComponentAfter (root, parent); return result; } }
public Component getComponentAfter (Container root, Component current) { if (root == null) throw new IllegalArgumentException ("focus cycle root is null"); if (current == null) throw new IllegalArgumentException ("current component is null"); if (!root.isFocusCycleRoot ()) throw new IllegalArgumentException ("root is not a focus cycle root"); Container ancestor = current.getFocusCycleRootAncestor (); Container prevAncestor = ancestor; while (ancestor != root) { ancestor = current.getFocusCycleRootAncestor (); if (ancestor == prevAncestor) { // We've reached the top focus cycle root ancestor. Check // if it is root. if (ancestor == null) ancestor = root; else if (ancestor != root) throw new IllegalArgumentException ("the given container is not" + " a focus cycle root of the" + " current component"); else break; } prevAncestor = ancestor; } // FIXME: is this the right thing to do here? It moves the context // for traversal up one focus traversal cycle. We'll need a test // for this. if ((Component) root == current) root = current.getFocusCycleRootAncestor (); // Check if we've reached the top of the component hierarchy. If // so then we want to loop around to the first component in the // focus traversal cycle. if (current instanceof Window) return getFirstComponent ((Container) current); Container parent = current.getParent (); synchronized (parent.getTreeLock ()) { Component[] components = parent.getComponents (); int componentIndex = 0; int numComponents = parent.getComponentCount (); // Find component's index. for (int i = 0; i < numComponents; i++) { if (components[i] == current) componentIndex = i; } // Search forward for the next acceptable component. for (int i = componentIndex + 1; i < numComponents; i++) { if (accept (components[i])) return components[i]; if (components[i] instanceof Container) { Component result = getFirstComponent ((Container) components[i]); if (result != null && implicitDownCycleTraversal) return result; } } // No focusable components after current in its Container. So go // to the next Component after current's Container (parent). Component result = getComponentAfter (root, parent); return result; } }
14,350
public Component getComponentAfter (Container root, Component current) { if (root == null) throw new IllegalArgumentException ("focus cycle root is null"); if (current == null) throw new IllegalArgumentException ("current component is null"); if (!root.isFocusCycleRoot ()) throw new IllegalArgumentException ("root is not a focus cycle root"); Container ancestor = current.getFocusCycleRootAncestor (); Container prevAncestor = ancestor; while (ancestor != root) { ancestor = current.getFocusCycleRootAncestor (); if (ancestor == prevAncestor) { // We've reached the top focus cycle root ancestor. Check // if it is root. if (ancestor != root) throw new IllegalArgumentException ("the given container is not" + " a focus cycle root of the" + " current component"); else break; } prevAncestor = ancestor; } // FIXME: is this the right thing to do here? It moves the context // for traversal up one focus traversal cycle. We'll need a test // for this. if ((Component) root == current) root = current.getFocusCycleRootAncestor (); // Check if we've reached the top of the component hierarchy. If // so then we want to loop around to the first component in the // focus traversal cycle. if (current instanceof Window) return getFirstComponent ((Container) current); Container parent = current.getParent (); synchronized (parent.getTreeLock ()) { Component[] components = parent.getComponents (); int componentIndex = 0; int numComponents = parent.getComponentCount (); // Find component's index. for (int i = 0; i < numComponents; i++) { if (components[i] == current) componentIndex = i; } // Search forward for the next acceptable component. for (int i = componentIndex + 1; i < numComponents; i++) { if (accept (components[i])) return components[i]; if (components[i] instanceof Container) { Component result = getFirstComponent ((Container) components[i]); if (result != null && implicitDownCycleTraversal) return result; } } // No focusable components after current in its Container. So go // to the next Component after current's Container (parent). Component result = getComponentAfter (root, parent); return result; } }
public Component getComponentAfter (Container root, Component current) { if (root == null) throw new IllegalArgumentException ("focus cycle root is null"); if (current == null) throw new IllegalArgumentException ("current component is null"); if (!root.isFocusCycleRoot ()) throw new IllegalArgumentException ("root is not a focus cycle root"); Container ancestor = current.getFocusCycleRootAncestor (); Container prevAncestor = ancestor; while (ancestor != root) { ancestor = current.getFocusCycleRootAncestor (); if (ancestor == prevAncestor) { // We've reached the top focus cycle root ancestor. Check // if it is root. if (ancestor != root) throw new IllegalArgumentException ("the given container is not" + " a focus cycle root of the" + " current component"); else break; } prevAncestor = ancestor; } // FIXME: is this the right thing to do here? It moves the context // for traversal up one focus traversal cycle. We'll need a test // for this. if ((Component) root == current) root = current.getFocusCycleRootAncestor (); // Check if we've reached the top of the component hierarchy. If // so then we want to loop around to the first component in the // focus traversal cycle. if (current instanceof Window) return getFirstComponent ((Container) current); Container parent = current.getParent (); synchronized (parent.getTreeLock ()) { Component[] components = parent.getComponents (); int componentIndex = 0; int numComponents = parent.getComponentCount (); // Find component's index. for (int i = 0; i < numComponents; i++) { if (components[i].equals(current)) componentIndex = i; } // Search forward for the next acceptable component. for (int i = componentIndex + 1; i < numComponents; i++) { if (accept (components[i])) return components[i]; if (components[i] instanceof Container) { Component result = getFirstComponent ((Container) components[i]); if (result != null && implicitDownCycleTraversal) return result; } } // No focusable components after current in its Container. So go // to the next Component after current's Container (parent). Component result = getComponentAfter (root, parent); return result; } }
14,351
public Component getComponentAfter (Container root, Component current) { if (root == null) throw new IllegalArgumentException ("focus cycle root is null"); if (current == null) throw new IllegalArgumentException ("current component is null"); if (!root.isFocusCycleRoot ()) throw new IllegalArgumentException ("root is not a focus cycle root"); Container ancestor = current.getFocusCycleRootAncestor (); Container prevAncestor = ancestor; while (ancestor != root) { ancestor = current.getFocusCycleRootAncestor (); if (ancestor == prevAncestor) { // We've reached the top focus cycle root ancestor. Check // if it is root. if (ancestor != root) throw new IllegalArgumentException ("the given container is not" + " a focus cycle root of the" + " current component"); else break; } prevAncestor = ancestor; } // FIXME: is this the right thing to do here? It moves the context // for traversal up one focus traversal cycle. We'll need a test // for this. if ((Component) root == current) root = current.getFocusCycleRootAncestor (); // Check if we've reached the top of the component hierarchy. If // so then we want to loop around to the first component in the // focus traversal cycle. if (current instanceof Window) return getFirstComponent ((Container) current); Container parent = current.getParent (); synchronized (parent.getTreeLock ()) { Component[] components = parent.getComponents (); int componentIndex = 0; int numComponents = parent.getComponentCount (); // Find component's index. for (int i = 0; i < numComponents; i++) { if (components[i] == current) componentIndex = i; } // Search forward for the next acceptable component. for (int i = componentIndex + 1; i < numComponents; i++) { if (accept (components[i])) return components[i]; if (components[i] instanceof Container) { Component result = getFirstComponent ((Container) components[i]); if (result != null && implicitDownCycleTraversal) return result; } } // No focusable components after current in its Container. So go // to the next Component after current's Container (parent). Component result = getComponentAfter (root, parent); return result; } }
public Component getComponentAfter (Container root, Component current) { if (root == null) throw new IllegalArgumentException ("focus cycle root is null"); if (current == null) throw new IllegalArgumentException ("current component is null"); if (!root.isFocusCycleRoot ()) throw new IllegalArgumentException ("root is not a focus cycle root"); Container ancestor = current.getFocusCycleRootAncestor (); Container prevAncestor = ancestor; while (ancestor != root) { ancestor = current.getFocusCycleRootAncestor (); if (ancestor == prevAncestor) { // We've reached the top focus cycle root ancestor. Check // if it is root. if (ancestor != root) throw new IllegalArgumentException ("the given container is not" + " a focus cycle root of the" + " current component"); else break; } prevAncestor = ancestor; } // FIXME: is this the right thing to do here? It moves the context // for traversal up one focus traversal cycle. We'll need a test // for this. if ((Component) root == current) root = current.getFocusCycleRootAncestor (); // Check if we've reached the top of the component hierarchy. If // so then we want to loop around to the first component in the // focus traversal cycle. if (current instanceof Window) return getFirstComponent ((Container) current); Container parent = current.getParent (); synchronized (parent.getTreeLock ()) { Component[] components = parent.getComponents (); int componentIndex = 0; int numComponents = parent.getComponentCount (); // Find component's index. for (int i = 0; i < numComponents; i++) { if (components[i] == current) componentIndex = i; } // Search forward for the next acceptable component. for (int i = componentIndex + 1; i < numComponents; i++) { if (accept (components[i])) return components[i]; if (components[i] instanceof Container) { Component result = getFirstComponent ((Container) components[i]); if (result != null && implicitDownCycleTraversal) return result; } } // No focusable components after current in its Container. So go // to the next Component after current's Container (parent). Component result = getComponentAfter (root, parent); return result; } }
14,352
public Component getComponentBefore (Container root, Component current) { if (root == null) throw new IllegalArgumentException ("focus cycle root is null"); if (current == null) throw new IllegalArgumentException ("current component is null"); if (!root.isFocusCycleRoot ()) throw new IllegalArgumentException ("root is not a focus cycle root"); Container ancestor = current.getFocusCycleRootAncestor (); Container prevAncestor = ancestor; while (ancestor != root) { ancestor = current.getFocusCycleRootAncestor (); if (ancestor == prevAncestor) { // We've reached the top focus cycle root ancestor. Check // if it is root. if (ancestor != root) throw new IllegalArgumentException ("the given container is not" + " a focus cycle root of the" + " current component"); else break; } prevAncestor = ancestor; } // FIXME: is this the right thing to do here? It moves the context // for traversal up one focus traversal cycle. We'll need a test // for this. if ((Component) root == current) root = current.getFocusCycleRootAncestor (); // Check if we've reached the top of the component hierarchy. If // so then we want to loop around to the last component in the // focus traversal cycle. if (current instanceof Window) return getLastComponent ((Container) current); Container parent = current.getParent (); synchronized (parent.getTreeLock ()) { Component[] components = parent.getComponents (); int componentIndex = 0; int numComponents = parent.getComponentCount (); // Find component's index. for (int i = 0; i < numComponents; i++) { if (components[i] == current) componentIndex = i; } // Search backward for the next acceptable component. for (int i = componentIndex - 1; i >= 0; i--) { if (accept (components[i])) return components[i]; if (components[i] instanceof Container) { Component result = getLastComponent ((Container) components[i]); if (result != null) return result; } } // No focusable components before current in its Container. So go // to the previous Component before current's Container (parent). Component result = getComponentBefore (root, parent); return result; } }
public Component getComponentBefore (Container root, Component current) { if (root == null) throw new IllegalArgumentException ("focus cycle root is null"); if (current == null) throw new IllegalArgumentException ("current component is null"); if (!root.isFocusCycleRoot ()) throw new IllegalArgumentException ("root is not a focus cycle root"); Container ancestor = current.getFocusCycleRootAncestor (); Container prevAncestor = ancestor; while (ancestor != root) { ancestor = current.getFocusCycleRootAncestor (); if (ancestor == prevAncestor) { // We've reached the top focus cycle root ancestor. Check // if it is root. if (ancestor == null) ancestor = root; else if (ancestor != root) throw new IllegalArgumentException ("the given container is not" + " a focus cycle root of the" + " current component"); else break; } prevAncestor = ancestor; } // FIXME: is this the right thing to do here? It moves the context // for traversal up one focus traversal cycle. We'll need a test // for this. if ((Component) root == current) root = current.getFocusCycleRootAncestor (); // Check if we've reached the top of the component hierarchy. If // so then we want to loop around to the last component in the // focus traversal cycle. if (current instanceof Window) return getLastComponent ((Container) current); Container parent = current.getParent (); synchronized (parent.getTreeLock ()) { Component[] components = parent.getComponents (); int componentIndex = 0; int numComponents = parent.getComponentCount (); // Find component's index. for (int i = 0; i < numComponents; i++) { if (components[i] == current) componentIndex = i; } // Search backward for the next acceptable component. for (int i = componentIndex - 1; i >= 0; i--) { if (accept (components[i])) return components[i]; if (components[i] instanceof Container) { Component result = getLastComponent ((Container) components[i]); if (result != null) return result; } } // No focusable components before current in its Container. So go // to the previous Component before current's Container (parent). Component result = getComponentBefore (root, parent); return result; } }
14,353
public Component getComponentBefore (Container root, Component current) { if (root == null) throw new IllegalArgumentException ("focus cycle root is null"); if (current == null) throw new IllegalArgumentException ("current component is null"); if (!root.isFocusCycleRoot ()) throw new IllegalArgumentException ("root is not a focus cycle root"); Container ancestor = current.getFocusCycleRootAncestor (); Container prevAncestor = ancestor; while (ancestor != root) { ancestor = current.getFocusCycleRootAncestor (); if (ancestor == prevAncestor) { // We've reached the top focus cycle root ancestor. Check // if it is root. if (ancestor != root) throw new IllegalArgumentException ("the given container is not" + " a focus cycle root of the" + " current component"); else break; } prevAncestor = ancestor; } // FIXME: is this the right thing to do here? It moves the context // for traversal up one focus traversal cycle. We'll need a test // for this. if ((Component) root == current) root = current.getFocusCycleRootAncestor (); // Check if we've reached the top of the component hierarchy. If // so then we want to loop around to the last component in the // focus traversal cycle. if (current instanceof Window) return getLastComponent ((Container) current); Container parent = current.getParent (); synchronized (parent.getTreeLock ()) { Component[] components = parent.getComponents (); int componentIndex = 0; int numComponents = parent.getComponentCount (); // Find component's index. for (int i = 0; i < numComponents; i++) { if (components[i] == current) componentIndex = i; } // Search backward for the next acceptable component. for (int i = componentIndex - 1; i >= 0; i--) { if (accept (components[i])) return components[i]; if (components[i] instanceof Container) { Component result = getLastComponent ((Container) components[i]); if (result != null) return result; } } // No focusable components before current in its Container. So go // to the previous Component before current's Container (parent). Component result = getComponentBefore (root, parent); return result; } }
public Component getComponentBefore (Container root, Component current) { if (root == null) throw new IllegalArgumentException ("focus cycle root is null"); if (current == null) throw new IllegalArgumentException ("current component is null"); if (!root.isFocusCycleRoot ()) throw new IllegalArgumentException ("root is not a focus cycle root"); Container ancestor = current.getFocusCycleRootAncestor (); Container prevAncestor = ancestor; while (ancestor != root) { ancestor = current.getFocusCycleRootAncestor (); if (ancestor == prevAncestor) { // We've reached the top focus cycle root ancestor. Check // if it is root. if (ancestor != root) throw new IllegalArgumentException ("the given container is not" + " a focus cycle root of the" + " current component"); else break; } prevAncestor = ancestor; } // FIXME: is this the right thing to do here? It moves the context // for traversal up one focus traversal cycle. We'll need a test // for this. if ((Component) root == current) root = current.getFocusCycleRootAncestor (); // Check if we've reached the top of the component hierarchy. If // so then we want to loop around to the last component in the // focus traversal cycle. if (current instanceof Window) return getLastComponent ((Container) current); Container parent = current.getParent (); synchronized (parent.getTreeLock ()) { Component[] components = parent.getComponents (); int componentIndex = 0; int numComponents = parent.getComponentCount (); // Find component's index. for (int i = 0; i < numComponents; i++) { if (components[i] == current) componentIndex = i; } // Search backward for the next acceptable component. for (int i = componentIndex - 1; i >= 0; i--) { if (accept (components[i])) return components[i]; if (components[i] instanceof Container) { Component result = getLastComponent ((Container) components[i]); if (result != null) return result; } } // No focusable components before current in its Container. So go // to the previous Component before current's Container (parent). Component result = getComponentBefore (root, parent); return result; } }
14,354
public Component getFirstComponent(Container root) { if (root == null) throw new IllegalArgumentException (); if (!root.isVisible () || !root.isDisplayable ()) return null; if (accept (root)) return root; Component[] componentArray = root.getComponents (); for (int i = 0; i < componentArray.length; i++) { Component component = componentArray [i]; if (accept (component)) return component; if (component instanceof Container) { Component result = getFirstComponent ((Container) component); if (result != null) return result; } } return null; }
public Component getFirstComponent(Container root) { if (root == null) throw new IllegalArgumentException (); if (!root.isVisible () || !root.isDisplayable ()) return null; if (root.visible && root.isDisplayable() && root.enabled && root.focusable) return root; Component[] componentArray = root.getComponents (); for (int i = 0; i < componentArray.length; i++) { Component component = componentArray [i]; if (accept (component)) return component; if (component instanceof Container) { Component result = getFirstComponent ((Container) component); if (result != null) return result; } } return null; }
14,355
public Component getFirstComponent(Container root) { if (root == null) throw new IllegalArgumentException (); if (!root.isVisible () || !root.isDisplayable ()) return null; if (accept (root)) return root; Component[] componentArray = root.getComponents (); for (int i = 0; i < componentArray.length; i++) { Component component = componentArray [i]; if (accept (component)) return component; if (component instanceof Container) { Component result = getFirstComponent ((Container) component); if (result != null) return result; } } return null; }
public Component getFirstComponent(Container root) { if (root == null) throw new IllegalArgumentException (); if (!root.isVisible () || !root.isDisplayable ()) return null; if (accept (root)) return root; Component[] componentArray = root.getComponents (); for (int i = 0; i < componentArray.length; i++) { Component component = componentArray [i]; if (component.visible && component.isDisplayable() && component.enabled && component.focusable) return component; if (component instanceof Container) { Component result = getFirstComponent ((Container) component); if (result != null) return result; } } return null; }
14,356
public Component getFirstComponent(Container root) { if (root == null) throw new IllegalArgumentException (); if (!root.isVisible () || !root.isDisplayable ()) return null; if (accept (root)) return root; Component[] componentArray = root.getComponents (); for (int i = 0; i < componentArray.length; i++) { Component component = componentArray [i]; if (accept (component)) return component; if (component instanceof Container) { Component result = getFirstComponent ((Container) component); if (result != null) return result; } } return null; }
public Component getFirstComponent(Container root) { if (root == null) throw new IllegalArgumentException (); if (!root.isVisible () || !root.isDisplayable ()) return null; if (accept (root)) return root; Component[] componentArray = root.getComponents (); for (int i = 0; i < componentArray.length; i++) { Component component = componentArray [i]; if (accept (component)) return component; if (component instanceof Container) { Component result = getFirstComponent ((Container) component); if (result != null && (result.visible && result.isDisplayable() && result.enabled && result.focusable)) return result; } } return null; }
14,357
public Component getLastComponent (Container root) { if (root == null) throw new IllegalArgumentException (); if (!root.isVisible () || !root.isDisplayable ()) return null; if (accept (root)) return root; Component[] componentArray = root.getComponents (); for (int i = componentArray.length - 1; i >= 0; i--) { Component component = componentArray [i]; if (accept (component)) return component; if (component instanceof Container) { Component result = getLastComponent ((Container) component); if (result != null) return result; } } return null; }
public Component getLastComponent (Container root) { if (root == null) throw new IllegalArgumentException (); if (!root.isVisible () || !root.isDisplayable ()) return null; if (root.visible && root.isDisplayable() && root.enabled && root.focusable) return root; Component[] componentArray = root.getComponents (); for (int i = componentArray.length - 1; i >= 0; i--) { Component component = componentArray [i]; if (accept (component)) return component; if (component instanceof Container) { Component result = getLastComponent ((Container) component); if (result != null) return result; } } return null; }
14,358
public Component getLastComponent (Container root) { if (root == null) throw new IllegalArgumentException (); if (!root.isVisible () || !root.isDisplayable ()) return null; if (accept (root)) return root; Component[] componentArray = root.getComponents (); for (int i = componentArray.length - 1; i >= 0; i--) { Component component = componentArray [i]; if (accept (component)) return component; if (component instanceof Container) { Component result = getLastComponent ((Container) component); if (result != null) return result; } } return null; }
public Component getLastComponent (Container root) { if (root == null) throw new IllegalArgumentException (); if (!root.isVisible () || !root.isDisplayable ()) return null; if (accept (root)) return root; Component[] componentArray = root.getComponents (); for (int i = componentArray.length - 1; i >= 0; i--) { Component component = componentArray [i]; if (component.visible && component.isDisplayable() && component.enabled && component.focusable) return component; if (component instanceof Container) { Component result = getLastComponent ((Container) component); if (result != null) return result; } } return null; }
14,359
public Component getLastComponent (Container root) { if (root == null) throw new IllegalArgumentException (); if (!root.isVisible () || !root.isDisplayable ()) return null; if (accept (root)) return root; Component[] componentArray = root.getComponents (); for (int i = componentArray.length - 1; i >= 0; i--) { Component component = componentArray [i]; if (accept (component)) return component; if (component instanceof Container) { Component result = getLastComponent ((Container) component); if (result != null) return result; } } return null; }
public Component getLastComponent (Container root) { if (root == null) throw new IllegalArgumentException (); if (!root.isVisible () || !root.isDisplayable ()) return null; if (accept (root)) return root; Component[] componentArray = root.getComponents (); for (int i = componentArray.length - 1; i >= 0; i--) { Component component = componentArray [i]; if (accept (component)) return component; if (component instanceof Container) { Component result = getLastComponent ((Container) component); if (result != null && result.visible && result.isDisplayable() && result.enabled && result.focusable) return result; } } return null; }
14,360
public String getMessage() { return super.getMessage() + (index >= 0 ? " at index " + index : "") + ": " + input; }
public String getMessage() { return super.getMessage() + (index >= 0 ? " at index " + index : "") + ": " + input; }
14,361
public ServiceContextListHolder(ServiceContext[] initialValue) { value = initialValue; }
public ServiceContextListHolder() { value = initialValue; }
14,362
public ServiceContextListHolder(ServiceContext[] initialValue) { value = initialValue; }
public ServiceContextListHolder(ServiceContext[] initialValue) { }
14,363
public int getViewIndex(int pos, Position.Bias b) { return getElement().getElementIndex(pos); }
public int getViewIndex(int pos, Position.Bias b) { int index = -1; int i = 0; for (Iterator it = children.iterator(); it.hasNext(); i++) { View child = (View) it.next(); if (child.getStartOffset() >= pos && child.getEndOffset() < pos) { index = i; break; } } return index; }
14,366
protected int getViewIndexAtPosition(int pos) { // We have one child view allocated for each child element in // loadChildren(), so this should work. Element el = getElement(); int index = el.getElementIndex(pos); return index; }
protected int getViewIndexAtPosition(int pos) { // We have one child view allocated for each child element in // loadChildren(), so this should work. Element el = getElement(); int index = el.getElementIndex(pos); return index; }
14,367
public void update(Graphics g, JComponent c) { if (c.isOpaque()) { g.setColor(c.getBackground()); g.fillRect(0, 0, c.getWidth(), c.getHeight()); } paint(g, c); }
public void update(Graphics g, JComponent c) { if (c.isOpaque()) { g.setColor(c.getBackground()); Rectangle clip = g.getClipBounds(); g.fillRect(clip.x, clip.y, clip.width, clip.height); } paint(g, c); }
14,368
public int getCrossFeedResolution(int units) { if (units < 1) throw new IllegalArgumentException("units may not be less then 1"); int rount = units / 2; return (crossFeedResolution + units) / units; }
public int getCrossFeedResolution(int units) { if (units < 1) throw new IllegalArgumentException("units may not be less then 1"); return (crossFeedResolution + units) / units; }
14,369
public int getFeedResolution(int units) { if (units < 1) throw new IllegalArgumentException("units may not be less then 1"); int rount = units / 2; return (crossFeedResolution + units) / units; }
public int getFeedResolution(int units) { if (units < 1) throw new IllegalArgumentException("units may not be less then 1"); return (crossFeedResolution + units) / units; }
14,370
protected void fireValueChanged(int firstIndex, int lastIndex) { fireValueChanged(firstIndex, lastIndex, getValueIsAdjusting()); }
protected void fireValueChanged(boolean isAdjusting) { fireValueChanged(firstIndex, lastIndex, getValueIsAdjusting()); }
14,371
protected void fireValueChanged(int firstIndex, int lastIndex) { fireValueChanged(firstIndex, lastIndex, getValueIsAdjusting()); }
protected void fireValueChanged(int firstIndex, int lastIndex) { fireValueChanged(getMinSelectionIndex(), getMaxSelectionIndex(), isAdjusting); }
14,372
public static Border createLineBorder(Color color) { return null; }
public static Border createLineBorder(Color color) { return createLineBorder(color, 1); }
14,374
private void installNewProvider() { log.entering("Main", "installNewProvider"); String providerName = provider.getName(); log.info("About to install new provider: " + providerName); // we need to override security checks Boolean result = (Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { int actualPosition = Security.insertProviderAt(provider, 1); return new Boolean(actualPosition != - 1); } }); log.info("Provider " + providerName + " installed successfully? " + result); providerInstalled = result.booleanValue(); log.exiting("Main", "installNewProvider"); }
private void installNewProvider() { log.entering(this.getClass().getName(), "installNewProvider"); String providerName = provider.getName(); log.info("About to install new provider: " + providerName); // we need to override security checks Boolean result = (Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { int actualPosition = Security.insertProviderAt(provider, 1); return new Boolean(actualPosition != - 1); } }); log.info("Provider " + providerName + " installed successfully? " + result); providerInstalled = result.booleanValue(); log.exiting("Main", "installNewProvider"); }
14,375
private void installNewProvider() { log.entering("Main", "installNewProvider"); String providerName = provider.getName(); log.info("About to install new provider: " + providerName); // we need to override security checks Boolean result = (Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { int actualPosition = Security.insertProviderAt(provider, 1); return new Boolean(actualPosition != - 1); } }); log.info("Provider " + providerName + " installed successfully? " + result); providerInstalled = result.booleanValue(); log.exiting("Main", "installNewProvider"); }
private void installNewProvider() { log.entering("Main", "installNewProvider"); String providerName = provider.getName(); log.info("About to install new provider: " + providerName); // we need to override security checks Boolean result = (Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { int actualPosition = Security.insertProviderAt(provider, 1); return new Boolean(actualPosition != - 1); } }); log.info("Provider " + providerName + " installed successfully? " + result); providerInstalled = result.booleanValue(); log.exiting("Main", "installNewProvider"); }
14,376
private void installNewProvider() { log.entering("Main", "installNewProvider"); String providerName = provider.getName(); log.info("About to install new provider: " + providerName); // we need to override security checks Boolean result = (Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { int actualPosition = Security.insertProviderAt(provider, 1); return new Boolean(actualPosition != - 1); } }); log.info("Provider " + providerName + " installed successfully? " + result); providerInstalled = result.booleanValue(); log.exiting("Main", "installNewProvider"); }
private void installNewProvider() { log.entering("Main", "installNewProvider"); String providerName = provider.getName(); log.info("About to install new provider: " + providerName); // we need to override security checks Boolean result = (Boolean) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { int actualPosition = Security.insertProviderAt(provider, 1); return new Boolean(actualPosition != - 1); } }); log.info("Provider " + providerName + " installed successfully? " + result); providerInstalled = result.booleanValue(); log.exiting(this.getClass().getName(), "installNewProvider"); }
14,377
public static final void main(String[] args) { log.entering("Main", "main", args); Main tool = new Main(); try { tool.processArgs(args); tool.start(); } catch (SecurityException x) { log.throwing("Main", "main", x); System.err.println("jarsigner: " + x.getMessage()); } catch (Exception x) { log.throwing("Main", "main", x); System.err.println("jarsigner error: " + x); } tool.teardown(); log.exiting("Main", "main"); // System.exit(0); }
public static final void main(String[] args) { log.entering(Main.class.getName(), "main", args); Main tool = new Main(); try { tool.processArgs(args); tool.start(); } catch (SecurityException x) { log.throwing("Main", "main", x); System.err.println("jarsigner: " + x.getMessage()); } catch (Exception x) { log.throwing("Main", "main", x); System.err.println("jarsigner error: " + x); } tool.teardown(); log.exiting("Main", "main"); // System.exit(0); }
14,378
public static final void main(String[] args) { log.entering("Main", "main", args); Main tool = new Main(); try { tool.processArgs(args); tool.start(); } catch (SecurityException x) { log.throwing("Main", "main", x); System.err.println("jarsigner: " + x.getMessage()); } catch (Exception x) { log.throwing("Main", "main", x); System.err.println("jarsigner error: " + x); } tool.teardown(); log.exiting("Main", "main"); // System.exit(0); }
public static final void main(String[] args) { log.entering("Main", "main", args); Main tool = new Main(); try { tool.processArgs(args); tool.start(); } catch (SecurityException x) { log.throwing("Main", "main", x); System.err.println("jarsigner: " + x.getMessage()); } catch (Exception x) { log.throwing("Main", "main", x); System.err.println("jarsigner error: " + x); } tool.teardown(); log.exiting("Main", "main"); // System.exit(0); }
14,379
public static final void main(String[] args) { log.entering("Main", "main", args); Main tool = new Main(); try { tool.processArgs(args); tool.start(); } catch (SecurityException x) { log.throwing("Main", "main", x); System.err.println("jarsigner: " + x.getMessage()); } catch (Exception x) { log.throwing("Main", "main", x); System.err.println("jarsigner error: " + x); } tool.teardown(); log.exiting("Main", "main"); // System.exit(0); }
public static final void main(String[] args) { log.entering("Main", "main", args); Main tool = new Main(); try { tool.processArgs(args); tool.start(); } catch (SecurityException x) { log.throwing("Main", "main", x); System.err.println("jarsigner: " + x.getMessage()); } catch (Exception x) { log.throwing("Main", "main", x); System.err.println("jarsigner error: " + x); } tool.teardown(); log.exiting("Main", "main"); // System.exit(0); }
14,380
public static final void main(String[] args) { log.entering("Main", "main", args); Main tool = new Main(); try { tool.processArgs(args); tool.start(); } catch (SecurityException x) { log.throwing("Main", "main", x); System.err.println("jarsigner: " + x.getMessage()); } catch (Exception x) { log.throwing("Main", "main", x); System.err.println("jarsigner error: " + x); } tool.teardown(); log.exiting("Main", "main"); // System.exit(0); }
public static final void main(String[] args) { log.entering("Main", "main", args); Main tool = new Main(); try { tool.processArgs(args); tool.start(); } catch (SecurityException x) { log.throwing("Main", "main", x); System.err.println("jarsigner: " + x.getMessage()); } catch (Exception x) { log.throwing("Main", "main", x); System.err.println("jarsigner error: " + x); } tool.teardown(); log.exiting("Main", "main"); // System.exit(0); }
14,381
private void processArgs(String[] args) throws Exception { log.entering("Main", "processArgs", args); HelpPrinter.checkHelpKey(args, HELP_PATH); if (args == null || args.length == 0) HelpPrinter.printHelpAndExit(HELP_PATH); int limit = args.length; log.finest("args.length=" + limit); int i = 0; String opt; while (i < limit) { opt = args[i++]; log.finest("args[" + (i - 1) + "]=" + opt); if (opt == null || opt.length() == 0) continue; if ("-verify".equals(opt)) // -verify verify = true; else if ("-keystore".equals(opt)) // -keystore URL ksURL = args[i++]; else if ("-storetype".equals(opt)) // -storetype STORE_TYPE ksType = args[i++]; else if ("-storepass".equals(opt)) // -storepass PASSWORD ksPassword = args[i++]; else if ("-keypass".equals(opt)) // -keypass PASSWORD password = args[i++]; else if ("-sigfile".equals(opt)) // -sigfile NAME sigFileName = args[i++]; else if ("-signedjar".equals(opt)) // -signedjar FILE_NAME signedJarFileName = args[i++]; else if ("-verbose".equals(opt)) // -verbose verbose = true; else if ("-certs".equals(opt)) // -certs certs = true; else if ("-internalsf".equals(opt)) // -internalsf internalSF = true; else if ("-sectionsonly".equals(opt)) // -sectionsonly sectionsOnly = true; else if ("-provider".equals(opt)) // -provider PROVIDER_CLASS_NAME providerClassName = args[i++]; else { jarFileName = opt; if (! verify) alias = args[i++]; break; } } if (i < limit) // more options than needed log.warning("Last argument is assumed at index #" + (i - 1) + ". Remaining arguments (" + args[i] + "...) will be ignored"); setupCommonParams(); if (verify) { log.info("Will verify with the following parameters:"); log.info(" jar-file = '" + jarFileName + "'"); log.info("Options:"); log.info(" provider = '" + providerClassName + "'"); log.info(" verbose ? " + verbose); log.info(" certs ? " + certs); log.info(" internalsf ? " + internalSF); log.info(" sectionsonly ? " + sectionsOnly); } else // sign { setupSigningParams(); log.info("Will sign with the following parameters:"); log.info(" jar-file = '" + jarFileName + "'"); log.info(" alias = '" + alias + "'"); log.info("Options:"); log.info(" keystore = '" + ksURL + "'"); log.info(" storetype = '" + ksType + "'"); log.info(" storepass = '" + ksPassword + "'"); log.info(" keypass = '" + password + "'"); log.info(" sigfile = '" + sigFileName + "'"); log.info(" signedjar = '" + signedJarFileName + "'"); log.info(" provider = '" + providerClassName + "'"); log.info(" verbose ? " + verbose); log.info(" internalsf ? " + internalSF); log.info(" sectionsonly ? " + sectionsOnly); } log.exiting("Main", "processArgs"); }
private void processArgs(String[] args) throws Exception { log.entering(this.getClass().getName(), "processArgs", args); HelpPrinter.checkHelpKey(args, HELP_PATH); if (args == null || args.length == 0) HelpPrinter.printHelpAndExit(HELP_PATH); int limit = args.length; log.finest("args.length=" + limit); int i = 0; String opt; while (i < limit) { opt = args[i++]; log.finest("args[" + (i - 1) + "]=" + opt); if (opt == null || opt.length() == 0) continue; if ("-verify".equals(opt)) // -verify verify = true; else if ("-keystore".equals(opt)) // -keystore URL ksURL = args[i++]; else if ("-storetype".equals(opt)) // -storetype STORE_TYPE ksType = args[i++]; else if ("-storepass".equals(opt)) // -storepass PASSWORD ksPassword = args[i++]; else if ("-keypass".equals(opt)) // -keypass PASSWORD password = args[i++]; else if ("-sigfile".equals(opt)) // -sigfile NAME sigFileName = args[i++]; else if ("-signedjar".equals(opt)) // -signedjar FILE_NAME signedJarFileName = args[i++]; else if ("-verbose".equals(opt)) // -verbose verbose = true; else if ("-certs".equals(opt)) // -certs certs = true; else if ("-internalsf".equals(opt)) // -internalsf internalSF = true; else if ("-sectionsonly".equals(opt)) // -sectionsonly sectionsOnly = true; else if ("-provider".equals(opt)) // -provider PROVIDER_CLASS_NAME providerClassName = args[i++]; else { jarFileName = opt; if (! verify) alias = args[i++]; break; } } if (i < limit) // more options than needed log.warning("Last argument is assumed at index #" + (i - 1) + ". Remaining arguments (" + args[i] + "...) will be ignored"); setupCommonParams(); if (verify) { log.info("Will verify with the following parameters:"); log.info(" jar-file = '" + jarFileName + "'"); log.info("Options:"); log.info(" provider = '" + providerClassName + "'"); log.info(" verbose ? " + verbose); log.info(" certs ? " + certs); log.info(" internalsf ? " + internalSF); log.info(" sectionsonly ? " + sectionsOnly); } else // sign { setupSigningParams(); log.info("Will sign with the following parameters:"); log.info(" jar-file = '" + jarFileName + "'"); log.info(" alias = '" + alias + "'"); log.info("Options:"); log.info(" keystore = '" + ksURL + "'"); log.info(" storetype = '" + ksType + "'"); log.info(" storepass = '" + ksPassword + "'"); log.info(" keypass = '" + password + "'"); log.info(" sigfile = '" + sigFileName + "'"); log.info(" signedjar = '" + signedJarFileName + "'"); log.info(" provider = '" + providerClassName + "'"); log.info(" verbose ? " + verbose); log.info(" internalsf ? " + internalSF); log.info(" sectionsonly ? " + sectionsOnly); } log.exiting("Main", "processArgs"); }
14,382
private void processArgs(String[] args) throws Exception { log.entering("Main", "processArgs", args); HelpPrinter.checkHelpKey(args, HELP_PATH); if (args == null || args.length == 0) HelpPrinter.printHelpAndExit(HELP_PATH); int limit = args.length; log.finest("args.length=" + limit); int i = 0; String opt; while (i < limit) { opt = args[i++]; log.finest("args[" + (i - 1) + "]=" + opt); if (opt == null || opt.length() == 0) continue; if ("-verify".equals(opt)) // -verify verify = true; else if ("-keystore".equals(opt)) // -keystore URL ksURL = args[i++]; else if ("-storetype".equals(opt)) // -storetype STORE_TYPE ksType = args[i++]; else if ("-storepass".equals(opt)) // -storepass PASSWORD ksPassword = args[i++]; else if ("-keypass".equals(opt)) // -keypass PASSWORD password = args[i++]; else if ("-sigfile".equals(opt)) // -sigfile NAME sigFileName = args[i++]; else if ("-signedjar".equals(opt)) // -signedjar FILE_NAME signedJarFileName = args[i++]; else if ("-verbose".equals(opt)) // -verbose verbose = true; else if ("-certs".equals(opt)) // -certs certs = true; else if ("-internalsf".equals(opt)) // -internalsf internalSF = true; else if ("-sectionsonly".equals(opt)) // -sectionsonly sectionsOnly = true; else if ("-provider".equals(opt)) // -provider PROVIDER_CLASS_NAME providerClassName = args[i++]; else { jarFileName = opt; if (! verify) alias = args[i++]; break; } } if (i < limit) // more options than needed log.warning("Last argument is assumed at index #" + (i - 1) + ". Remaining arguments (" + args[i] + "...) will be ignored"); setupCommonParams(); if (verify) { log.info("Will verify with the following parameters:"); log.info(" jar-file = '" + jarFileName + "'"); log.info("Options:"); log.info(" provider = '" + providerClassName + "'"); log.info(" verbose ? " + verbose); log.info(" certs ? " + certs); log.info(" internalsf ? " + internalSF); log.info(" sectionsonly ? " + sectionsOnly); } else // sign { setupSigningParams(); log.info("Will sign with the following parameters:"); log.info(" jar-file = '" + jarFileName + "'"); log.info(" alias = '" + alias + "'"); log.info("Options:"); log.info(" keystore = '" + ksURL + "'"); log.info(" storetype = '" + ksType + "'"); log.info(" storepass = '" + ksPassword + "'"); log.info(" keypass = '" + password + "'"); log.info(" sigfile = '" + sigFileName + "'"); log.info(" signedjar = '" + signedJarFileName + "'"); log.info(" provider = '" + providerClassName + "'"); log.info(" verbose ? " + verbose); log.info(" internalsf ? " + internalSF); log.info(" sectionsonly ? " + sectionsOnly); } log.exiting("Main", "processArgs"); }
private void processArgs(String[] args) throws Exception { log.entering("Main", "processArgs", args); HelpPrinter.checkHelpKey(args, HELP_PATH); if (args == null || args.length == 0) HelpPrinter.printHelpAndExit(HELP_PATH); int limit = args.length; log.finest("args.length=" + limit); int i = 0; String opt; while (i < limit) { opt = args[i++]; log.finest("args[" + (i - 1) + "]=" + opt); if (opt == null || opt.length() == 0) continue; if ("-verify".equals(opt)) // -verify verify = true; else if ("-keystore".equals(opt)) // -keystore URL ksURL = args[i++]; else if ("-storetype".equals(opt)) // -storetype STORE_TYPE ksType = args[i++]; else if ("-storepass".equals(opt)) // -storepass PASSWORD ksPassword = args[i++]; else if ("-keypass".equals(opt)) // -keypass PASSWORD password = args[i++]; else if ("-sigfile".equals(opt)) // -sigfile NAME sigFileName = args[i++]; else if ("-signedjar".equals(opt)) // -signedjar FILE_NAME signedJarFileName = args[i++]; else if ("-verbose".equals(opt)) // -verbose verbose = true; else if ("-certs".equals(opt)) // -certs certs = true; else if ("-internalsf".equals(opt)) // -internalsf internalSF = true; else if ("-sectionsonly".equals(opt)) // -sectionsonly sectionsOnly = true; else if ("-provider".equals(opt)) // -provider PROVIDER_CLASS_NAME providerClassName = args[i++]; else { jarFileName = opt; if (! verify) alias = args[i++]; break; } } if (i < limit) // more options than needed log.warning("Last argument is assumed at index #" + (i - 1) + ". Remaining arguments (" + args[i] + "...) will be ignored"); setupCommonParams(); if (verify) { log.info("Will verify with the following parameters:"); log.info(" jar-file = '" + jarFileName + "'"); log.info("Options:"); log.info(" provider = '" + providerClassName + "'"); log.info(" verbose ? " + verbose); log.info(" certs ? " + certs); log.info(" internalsf ? " + internalSF); log.info(" sectionsonly ? " + sectionsOnly); } else // sign { setupSigningParams(); log.info("Will sign with the following parameters:"); log.info(" jar-file = '" + jarFileName + "'"); log.info(" alias = '" + alias + "'"); log.info("Options:"); log.info(" keystore = '" + ksURL + "'"); log.info(" storetype = '" + ksType + "'"); log.info(" storepass = '" + ksPassword + "'"); log.info(" keypass = '" + password + "'"); log.info(" sigfile = '" + sigFileName + "'"); log.info(" signedjar = '" + signedJarFileName + "'"); log.info(" provider = '" + providerClassName + "'"); log.info(" verbose ? " + verbose); log.info(" internalsf ? " + internalSF); log.info(" sectionsonly ? " + sectionsOnly); } log.exiting("Main", "processArgs"); }
14,383
private void processArgs(String[] args) throws Exception { log.entering("Main", "processArgs", args); HelpPrinter.checkHelpKey(args, HELP_PATH); if (args == null || args.length == 0) HelpPrinter.printHelpAndExit(HELP_PATH); int limit = args.length; log.finest("args.length=" + limit); int i = 0; String opt; while (i < limit) { opt = args[i++]; log.finest("args[" + (i - 1) + "]=" + opt); if (opt == null || opt.length() == 0) continue; if ("-verify".equals(opt)) // -verify verify = true; else if ("-keystore".equals(opt)) // -keystore URL ksURL = args[i++]; else if ("-storetype".equals(opt)) // -storetype STORE_TYPE ksType = args[i++]; else if ("-storepass".equals(opt)) // -storepass PASSWORD ksPassword = args[i++]; else if ("-keypass".equals(opt)) // -keypass PASSWORD password = args[i++]; else if ("-sigfile".equals(opt)) // -sigfile NAME sigFileName = args[i++]; else if ("-signedjar".equals(opt)) // -signedjar FILE_NAME signedJarFileName = args[i++]; else if ("-verbose".equals(opt)) // -verbose verbose = true; else if ("-certs".equals(opt)) // -certs certs = true; else if ("-internalsf".equals(opt)) // -internalsf internalSF = true; else if ("-sectionsonly".equals(opt)) // -sectionsonly sectionsOnly = true; else if ("-provider".equals(opt)) // -provider PROVIDER_CLASS_NAME providerClassName = args[i++]; else { jarFileName = opt; if (! verify) alias = args[i++]; break; } } if (i < limit) // more options than needed log.warning("Last argument is assumed at index #" + (i - 1) + ". Remaining arguments (" + args[i] + "...) will be ignored"); setupCommonParams(); if (verify) { log.info("Will verify with the following parameters:"); log.info(" jar-file = '" + jarFileName + "'"); log.info("Options:"); log.info(" provider = '" + providerClassName + "'"); log.info(" verbose ? " + verbose); log.info(" certs ? " + certs); log.info(" internalsf ? " + internalSF); log.info(" sectionsonly ? " + sectionsOnly); } else // sign { setupSigningParams(); log.info("Will sign with the following parameters:"); log.info(" jar-file = '" + jarFileName + "'"); log.info(" alias = '" + alias + "'"); log.info("Options:"); log.info(" keystore = '" + ksURL + "'"); log.info(" storetype = '" + ksType + "'"); log.info(" storepass = '" + ksPassword + "'"); log.info(" keypass = '" + password + "'"); log.info(" sigfile = '" + sigFileName + "'"); log.info(" signedjar = '" + signedJarFileName + "'"); log.info(" provider = '" + providerClassName + "'"); log.info(" verbose ? " + verbose); log.info(" internalsf ? " + internalSF); log.info(" sectionsonly ? " + sectionsOnly); } log.exiting("Main", "processArgs"); }
private void processArgs(String[] args) throws Exception { log.entering("Main", "processArgs", args); HelpPrinter.checkHelpKey(args, HELP_PATH); if (args == null || args.length == 0) HelpPrinter.printHelpAndExit(HELP_PATH); int limit = args.length; log.finest("args.length=" + limit); int i = 0; String opt; while (i < limit) { opt = args[i++]; log.finest("args[" + (i - 1) + "]=" + opt); if (opt == null || opt.length() == 0) continue; if ("-verify".equals(opt)) // -verify verify = true; else if ("-keystore".equals(opt)) // -keystore URL ksURL = args[i++]; else if ("-storetype".equals(opt)) // -storetype STORE_TYPE ksType = args[i++]; else if ("-storepass".equals(opt)) // -storepass PASSWORD ksPassword = args[i++]; else if ("-keypass".equals(opt)) // -keypass PASSWORD password = args[i++]; else if ("-sigfile".equals(opt)) // -sigfile NAME sigFileName = args[i++]; else if ("-signedjar".equals(opt)) // -signedjar FILE_NAME signedJarFileName = args[i++]; else if ("-verbose".equals(opt)) // -verbose verbose = true; else if ("-certs".equals(opt)) // -certs certs = true; else if ("-internalsf".equals(opt)) // -internalsf internalSF = true; else if ("-sectionsonly".equals(opt)) // -sectionsonly sectionsOnly = true; else if ("-provider".equals(opt)) // -provider PROVIDER_CLASS_NAME providerClassName = args[i++]; else { jarFileName = opt; if (! verify) alias = args[i++]; break; } } if (i < limit) // more options than needed log.warning("Last argument is assumed at index #" + (i - 1) + ". Remaining arguments (" + args[i] + "...) will be ignored"); setupCommonParams(); if (verify) { log.info("Will verify with the following parameters:"); log.info(" jar-file = '" + jarFileName + "'"); log.info("Options:"); log.info(" provider = '" + providerClassName + "'"); log.info(" verbose ? " + verbose); log.info(" certs ? " + certs); log.info(" internalsf ? " + internalSF); log.info(" sectionsonly ? " + sectionsOnly); } else // sign { setupSigningParams(); log.info("Will sign with the following parameters:"); log.info(" jar-file = '" + jarFileName + "'"); log.info(" alias = '" + alias + "'"); log.info("Options:"); log.info(" keystore = '" + ksURL + "'"); log.info(" storetype = '" + ksType + "'"); log.info(" storepass = '" + ksPassword + "'"); log.info(" keypass = '" + password + "'"); log.info(" sigfile = '" + sigFileName + "'"); log.info(" signedjar = '" + signedJarFileName + "'"); log.info(" provider = '" + providerClassName + "'"); log.info(" verbose ? " + verbose); log.info(" internalsf ? " + internalSF); log.info(" sectionsonly ? " + sectionsOnly); } log.exiting("Main", "processArgs"); }
14,384
private void processArgs(String[] args) throws Exception { log.entering("Main", "processArgs", args); HelpPrinter.checkHelpKey(args, HELP_PATH); if (args == null || args.length == 0) HelpPrinter.printHelpAndExit(HELP_PATH); int limit = args.length; log.finest("args.length=" + limit); int i = 0; String opt; while (i < limit) { opt = args[i++]; log.finest("args[" + (i - 1) + "]=" + opt); if (opt == null || opt.length() == 0) continue; if ("-verify".equals(opt)) // -verify verify = true; else if ("-keystore".equals(opt)) // -keystore URL ksURL = args[i++]; else if ("-storetype".equals(opt)) // -storetype STORE_TYPE ksType = args[i++]; else if ("-storepass".equals(opt)) // -storepass PASSWORD ksPassword = args[i++]; else if ("-keypass".equals(opt)) // -keypass PASSWORD password = args[i++]; else if ("-sigfile".equals(opt)) // -sigfile NAME sigFileName = args[i++]; else if ("-signedjar".equals(opt)) // -signedjar FILE_NAME signedJarFileName = args[i++]; else if ("-verbose".equals(opt)) // -verbose verbose = true; else if ("-certs".equals(opt)) // -certs certs = true; else if ("-internalsf".equals(opt)) // -internalsf internalSF = true; else if ("-sectionsonly".equals(opt)) // -sectionsonly sectionsOnly = true; else if ("-provider".equals(opt)) // -provider PROVIDER_CLASS_NAME providerClassName = args[i++]; else { jarFileName = opt; if (! verify) alias = args[i++]; break; } } if (i < limit) // more options than needed log.warning("Last argument is assumed at index #" + (i - 1) + ". Remaining arguments (" + args[i] + "...) will be ignored"); setupCommonParams(); if (verify) { log.info("Will verify with the following parameters:"); log.info(" jar-file = '" + jarFileName + "'"); log.info("Options:"); log.info(" provider = '" + providerClassName + "'"); log.info(" verbose ? " + verbose); log.info(" certs ? " + certs); log.info(" internalsf ? " + internalSF); log.info(" sectionsonly ? " + sectionsOnly); } else // sign { setupSigningParams(); log.info("Will sign with the following parameters:"); log.info(" jar-file = '" + jarFileName + "'"); log.info(" alias = '" + alias + "'"); log.info("Options:"); log.info(" keystore = '" + ksURL + "'"); log.info(" storetype = '" + ksType + "'"); log.info(" storepass = '" + ksPassword + "'"); log.info(" keypass = '" + password + "'"); log.info(" sigfile = '" + sigFileName + "'"); log.info(" signedjar = '" + signedJarFileName + "'"); log.info(" provider = '" + providerClassName + "'"); log.info(" verbose ? " + verbose); log.info(" internalsf ? " + internalSF); log.info(" sectionsonly ? " + sectionsOnly); } log.exiting("Main", "processArgs"); }
private void processArgs(String[] args) throws Exception { log.entering("Main", "processArgs", args); HelpPrinter.checkHelpKey(args, HELP_PATH); if (args == null || args.length == 0) HelpPrinter.printHelpAndExit(HELP_PATH); int limit = args.length; log.finest("args.length=" + limit); int i = 0; String opt; while (i < limit) { opt = args[i++]; log.finest("args[" + (i - 1) + "]=" + opt); if (opt == null || opt.length() == 0) continue; if ("-verify".equals(opt)) // -verify verify = true; else if ("-keystore".equals(opt)) // -keystore URL ksURL = args[i++]; else if ("-storetype".equals(opt)) // -storetype STORE_TYPE ksType = args[i++]; else if ("-storepass".equals(opt)) // -storepass PASSWORD ksPassword = args[i++]; else if ("-keypass".equals(opt)) // -keypass PASSWORD password = args[i++]; else if ("-sigfile".equals(opt)) // -sigfile NAME sigFileName = args[i++]; else if ("-signedjar".equals(opt)) // -signedjar FILE_NAME signedJarFileName = args[i++]; else if ("-verbose".equals(opt)) // -verbose verbose = true; else if ("-certs".equals(opt)) // -certs certs = true; else if ("-internalsf".equals(opt)) // -internalsf internalSF = true; else if ("-sectionsonly".equals(opt)) // -sectionsonly sectionsOnly = true; else if ("-provider".equals(opt)) // -provider PROVIDER_CLASS_NAME providerClassName = args[i++]; else { jarFileName = opt; if (! verify) alias = args[i++]; break; } } if (i < limit) // more options than needed log.warning("Last argument is assumed at index #" + (i - 1) + ". Remaining arguments (" + args[i] + "...) will be ignored"); setupCommonParams(); if (verify) { log.info("Will verify with the following parameters:"); log.info(" jar-file = '" + jarFileName + "'"); log.info("Options:"); log.info(" provider = '" + providerClassName + "'"); log.info(" verbose ? " + verbose); log.info(" certs ? " + certs); log.info(" internalsf ? " + internalSF); log.info(" sectionsonly ? " + sectionsOnly); } else // sign { setupSigningParams(); log.info("Will sign with the following parameters:"); log.info(" jar-file = '" + jarFileName + "'"); log.info(" alias = '" + alias + "'"); log.info("Options:"); log.info(" keystore = '" + ksURL + "'"); log.info(" storetype = '" + ksType + "'"); log.info(" storepass = '" + ksPassword + "'"); log.info(" keypass = '" + password + "'"); log.info(" sigfile = '" + sigFileName + "'"); log.info(" signedjar = '" + signedJarFileName + "'"); log.info(" provider = '" + providerClassName + "'"); log.info(" verbose ? " + verbose); log.info(" internalsf ? " + internalSF); log.info(" sectionsonly ? " + sectionsOnly); } log.exiting("Main", "processArgs"); }
14,385
private void processArgs(String[] args) throws Exception { log.entering("Main", "processArgs", args); HelpPrinter.checkHelpKey(args, HELP_PATH); if (args == null || args.length == 0) HelpPrinter.printHelpAndExit(HELP_PATH); int limit = args.length; log.finest("args.length=" + limit); int i = 0; String opt; while (i < limit) { opt = args[i++]; log.finest("args[" + (i - 1) + "]=" + opt); if (opt == null || opt.length() == 0) continue; if ("-verify".equals(opt)) // -verify verify = true; else if ("-keystore".equals(opt)) // -keystore URL ksURL = args[i++]; else if ("-storetype".equals(opt)) // -storetype STORE_TYPE ksType = args[i++]; else if ("-storepass".equals(opt)) // -storepass PASSWORD ksPassword = args[i++]; else if ("-keypass".equals(opt)) // -keypass PASSWORD password = args[i++]; else if ("-sigfile".equals(opt)) // -sigfile NAME sigFileName = args[i++]; else if ("-signedjar".equals(opt)) // -signedjar FILE_NAME signedJarFileName = args[i++]; else if ("-verbose".equals(opt)) // -verbose verbose = true; else if ("-certs".equals(opt)) // -certs certs = true; else if ("-internalsf".equals(opt)) // -internalsf internalSF = true; else if ("-sectionsonly".equals(opt)) // -sectionsonly sectionsOnly = true; else if ("-provider".equals(opt)) // -provider PROVIDER_CLASS_NAME providerClassName = args[i++]; else { jarFileName = opt; if (! verify) alias = args[i++]; break; } } if (i < limit) // more options than needed log.warning("Last argument is assumed at index #" + (i - 1) + ". Remaining arguments (" + args[i] + "...) will be ignored"); setupCommonParams(); if (verify) { log.info("Will verify with the following parameters:"); log.info(" jar-file = '" + jarFileName + "'"); log.info("Options:"); log.info(" provider = '" + providerClassName + "'"); log.info(" verbose ? " + verbose); log.info(" certs ? " + certs); log.info(" internalsf ? " + internalSF); log.info(" sectionsonly ? " + sectionsOnly); } else // sign { setupSigningParams(); log.info("Will sign with the following parameters:"); log.info(" jar-file = '" + jarFileName + "'"); log.info(" alias = '" + alias + "'"); log.info("Options:"); log.info(" keystore = '" + ksURL + "'"); log.info(" storetype = '" + ksType + "'"); log.info(" storepass = '" + ksPassword + "'"); log.info(" keypass = '" + password + "'"); log.info(" sigfile = '" + sigFileName + "'"); log.info(" signedjar = '" + signedJarFileName + "'"); log.info(" provider = '" + providerClassName + "'"); log.info(" verbose ? " + verbose); log.info(" internalsf ? " + internalSF); log.info(" sectionsonly ? " + sectionsOnly); } log.exiting("Main", "processArgs"); }
private void processArgs(String[] args) throws Exception { log.entering("Main", "processArgs", args); HelpPrinter.checkHelpKey(args, HELP_PATH); if (args == null || args.length == 0) HelpPrinter.printHelpAndExit(HELP_PATH); int limit = args.length; log.finest("args.length=" + limit); int i = 0; String opt; while (i < limit) { opt = args[i++]; log.finest("args[" + (i - 1) + "]=" + opt); if (opt == null || opt.length() == 0) continue; if ("-verify".equals(opt)) // -verify verify = true; else if ("-keystore".equals(opt)) // -keystore URL ksURL = args[i++]; else if ("-storetype".equals(opt)) // -storetype STORE_TYPE ksType = args[i++]; else if ("-storepass".equals(opt)) // -storepass PASSWORD ksPassword = args[i++]; else if ("-keypass".equals(opt)) // -keypass PASSWORD password = args[i++]; else if ("-sigfile".equals(opt)) // -sigfile NAME sigFileName = args[i++]; else if ("-signedjar".equals(opt)) // -signedjar FILE_NAME signedJarFileName = args[i++]; else if ("-verbose".equals(opt)) // -verbose verbose = true; else if ("-certs".equals(opt)) // -certs certs = true; else if ("-internalsf".equals(opt)) // -internalsf internalSF = true; else if ("-sectionsonly".equals(opt)) // -sectionsonly sectionsOnly = true; else if ("-provider".equals(opt)) // -provider PROVIDER_CLASS_NAME providerClassName = args[i++]; else { jarFileName = opt; if (! verify) alias = args[i++]; break; } } if (i < limit) // more options than needed log.warning("Last argument is assumed at index #" + (i - 1) + ". Remaining arguments (" + args[i] + "...) will be ignored"); setupCommonParams(); if (verify) { log.info("Will verify with the following parameters:"); log.info(" jar-file = '" + jarFileName + "'"); log.info("Options:"); log.info(" provider = '" + providerClassName + "'"); log.info(" verbose ? " + verbose); log.info(" certs ? " + certs); log.info(" internalsf ? " + internalSF); log.info(" sectionsonly ? " + sectionsOnly); } else // sign { setupSigningParams(); log.info("Will sign with the following parameters:"); log.info(" jar-file = '" + jarFileName + "'"); log.info(" alias = '" + alias + "'"); log.info("Options:"); log.info(" keystore = '" + ksURL + "'"); log.info(" storetype = '" + ksType + "'"); log.info(" storepass = '" + ksPassword + "'"); log.info(" keypass = '" + password + "'"); log.info(" sigfile = '" + sigFileName + "'"); log.info(" signedjar = '" + signedJarFileName + "'"); log.info(" provider = '" + providerClassName + "'"); log.info(" verbose ? " + verbose); log.info(" internalsf ? " + internalSF); log.info(" sectionsonly ? " + sectionsOnly); } log.exiting(this.getClass().getName(), "processArgs"); }
14,386
private void setupCommonParams() throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException { log.entering("Main", "setupCommonParams"); if (jarFileName == null) HelpPrinter.printHelpAndExit(HELP_PATH); File jar = new File(jarFileName); if (! jar.exists()) throw new FileNotFoundException(jarFileName); if (jar.isDirectory()) throw new IOException("JAR file [" + jarFileName + "] is NOT a file object"); if (! jar.canRead()) throw new IOException("JAR file [" + jarFileName + "] is NOT readable"); if (providerClassName != null && providerClassName.length() > 0) { provider = (Provider) Class.forName(providerClassName).newInstance(); // is it already installed? String providerName = provider.getName(); Provider installedProvider = Security.getProvider(providerName); if (installedProvider != null) log.info("Provider " + providerName + " is already installed"); else // install it installNewProvider(); } if (! verbose && certs) { log.warning("Option <certs> is set but <verbose> is not. Ignored"); certs = false; } log.exiting("Main", "setupCommonParams"); }
private void setupCommonParams() throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException { log.entering("Main", "setupCommonParams"); if (jarFileName == null) HelpPrinter.printHelpAndExit(HELP_PATH); File jar = new File(jarFileName); if (! jar.exists()) throw new FileNotFoundException(jarFileName); if (jar.isDirectory()) throw new IOException("JAR file [" + jarFileName + "] is NOT a file object"); if (! jar.canRead()) throw new IOException("JAR file [" + jarFileName + "] is NOT readable"); if (providerClassName != null && providerClassName.length() > 0) { provider = (Provider) Class.forName(providerClassName).newInstance(); // is it already installed? String providerName = provider.getName(); Provider installedProvider = Security.getProvider(providerName); if (installedProvider != null) log.info("Provider " + providerName + " is already installed"); else // install it installNewProvider(); } if (! verbose && certs) { log.warning("Option <certs> is set but <verbose> is not. Ignored"); certs = false; } log.exiting("Main", "setupCommonParams"); }
14,387
private void setupCommonParams() throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException { log.entering("Main", "setupCommonParams"); if (jarFileName == null) HelpPrinter.printHelpAndExit(HELP_PATH); File jar = new File(jarFileName); if (! jar.exists()) throw new FileNotFoundException(jarFileName); if (jar.isDirectory()) throw new IOException("JAR file [" + jarFileName + "] is NOT a file object"); if (! jar.canRead()) throw new IOException("JAR file [" + jarFileName + "] is NOT readable"); if (providerClassName != null && providerClassName.length() > 0) { provider = (Provider) Class.forName(providerClassName).newInstance(); // is it already installed? String providerName = provider.getName(); Provider installedProvider = Security.getProvider(providerName); if (installedProvider != null) log.info("Provider " + providerName + " is already installed"); else // install it installNewProvider(); } if (! verbose && certs) { log.warning("Option <certs> is set but <verbose> is not. Ignored"); certs = false; } log.exiting("Main", "setupCommonParams"); }
private void setupCommonParams() throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException { log.entering("Main", "setupCommonParams"); if (jarFileName == null) HelpPrinter.printHelpAndExit(HELP_PATH); File jar = new File(jarFileName); if (! jar.exists()) throw new FileNotFoundException(jarFileName); if (jar.isDirectory()) throw new IOException("JAR file [" + jarFileName + "] is NOT a file object"); if (! jar.canRead()) throw new IOException("JAR file [" + jarFileName + "] is NOT readable"); if (providerClassName != null && providerClassName.length() > 0) { provider = (Provider) Class.forName(providerClassName).newInstance(); // is it already installed? String providerName = provider.getName(); Provider installedProvider = Security.getProvider(providerName); if (installedProvider != null) log.info("Provider " + providerName + " is already installed"); else // install it installNewProvider(); } if (! verbose && certs) { log.warning("Option <certs> is set but <verbose> is not. Ignored"); certs = false; } log.exiting("Main", "setupCommonParams"); }
14,388
private void setupCommonParams() throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException { log.entering("Main", "setupCommonParams"); if (jarFileName == null) HelpPrinter.printHelpAndExit(HELP_PATH); File jar = new File(jarFileName); if (! jar.exists()) throw new FileNotFoundException(jarFileName); if (jar.isDirectory()) throw new IOException("JAR file [" + jarFileName + "] is NOT a file object"); if (! jar.canRead()) throw new IOException("JAR file [" + jarFileName + "] is NOT readable"); if (providerClassName != null && providerClassName.length() > 0) { provider = (Provider) Class.forName(providerClassName).newInstance(); // is it already installed? String providerName = provider.getName(); Provider installedProvider = Security.getProvider(providerName); if (installedProvider != null) log.info("Provider " + providerName + " is already installed"); else // install it installNewProvider(); } if (! verbose && certs) { log.warning("Option <certs> is set but <verbose> is not. Ignored"); certs = false; } log.exiting("Main", "setupCommonParams"); }
private void setupCommonParams() throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException { log.entering("Main", "setupCommonParams"); if (jarFileName == null) HelpPrinter.printHelpAndExit(HELP_PATH); File jar = new File(jarFileName); if (! jar.exists()) throw new FileNotFoundException(jarFileName); if (jar.isDirectory()) throw new IOException("JAR file [" + jarFileName + "] is NOT a file object"); if (! jar.canRead()) throw new IOException(Messages.getFormattedString("Main.72", jarFileName)); if (providerClassName != null && providerClassName.length() > 0) { provider = (Provider) Class.forName(providerClassName).newInstance(); // is it already installed? String providerName = provider.getName(); Provider installedProvider = Security.getProvider(providerName); if (installedProvider != null) log.info("Provider " + providerName + " is already installed"); else // install it installNewProvider(); } if (! verbose && certs) { log.warning("Option <certs> is set but <verbose> is not. Ignored"); certs = false; } log.exiting("Main", "setupCommonParams"); }
14,389
private void setupCommonParams() throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException { log.entering("Main", "setupCommonParams"); if (jarFileName == null) HelpPrinter.printHelpAndExit(HELP_PATH); File jar = new File(jarFileName); if (! jar.exists()) throw new FileNotFoundException(jarFileName); if (jar.isDirectory()) throw new IOException("JAR file [" + jarFileName + "] is NOT a file object"); if (! jar.canRead()) throw new IOException("JAR file [" + jarFileName + "] is NOT readable"); if (providerClassName != null && providerClassName.length() > 0) { provider = (Provider) Class.forName(providerClassName).newInstance(); // is it already installed? String providerName = provider.getName(); Provider installedProvider = Security.getProvider(providerName); if (installedProvider != null) log.info("Provider " + providerName + " is already installed"); else // install it installNewProvider(); } if (! verbose && certs) { log.warning("Option <certs> is set but <verbose> is not. Ignored"); certs = false; } log.exiting("Main", "setupCommonParams"); }
private void setupCommonParams() throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException { log.entering("Main", "setupCommonParams"); if (jarFileName == null) HelpPrinter.printHelpAndExit(HELP_PATH); File jar = new File(jarFileName); if (! jar.exists()) throw new FileNotFoundException(jarFileName); if (jar.isDirectory()) throw new IOException("JAR file [" + jarFileName + "] is NOT a file object"); if (! jar.canRead()) throw new IOException("JAR file [" + jarFileName + "] is NOT readable"); if (providerClassName != null && providerClassName.length() > 0) { provider = (Provider) Class.forName(providerClassName).newInstance(); // is it already installed? String providerName = provider.getName(); Provider installedProvider = Security.getProvider(providerName); if (installedProvider != null) log.finer("Provider " + providerName + " is already installed"); else // install it installNewProvider(); } if (! verbose && certs) { log.warning("Option <certs> is set but <verbose> is not. Ignored"); certs = false; } log.exiting("Main", "setupCommonParams"); }
14,390
private void setupCommonParams() throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException { log.entering("Main", "setupCommonParams"); if (jarFileName == null) HelpPrinter.printHelpAndExit(HELP_PATH); File jar = new File(jarFileName); if (! jar.exists()) throw new FileNotFoundException(jarFileName); if (jar.isDirectory()) throw new IOException("JAR file [" + jarFileName + "] is NOT a file object"); if (! jar.canRead()) throw new IOException("JAR file [" + jarFileName + "] is NOT readable"); if (providerClassName != null && providerClassName.length() > 0) { provider = (Provider) Class.forName(providerClassName).newInstance(); // is it already installed? String providerName = provider.getName(); Provider installedProvider = Security.getProvider(providerName); if (installedProvider != null) log.info("Provider " + providerName + " is already installed"); else // install it installNewProvider(); } if (! verbose && certs) { log.warning("Option <certs> is set but <verbose> is not. Ignored"); certs = false; } log.exiting("Main", "setupCommonParams"); }
private void setupCommonParams() throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException { log.entering("Main", "setupCommonParams"); if (jarFileName == null) HelpPrinter.printHelpAndExit(HELP_PATH); File jar = new File(jarFileName); if (! jar.exists()) throw new FileNotFoundException(jarFileName); if (jar.isDirectory()) throw new IOException("JAR file [" + jarFileName + "] is NOT a file object"); if (! jar.canRead()) throw new IOException("JAR file [" + jarFileName + "] is NOT readable"); if (providerClassName != null && providerClassName.length() > 0) { provider = (Provider) Class.forName(providerClassName).newInstance(); // is it already installed? String providerName = provider.getName(); Provider installedProvider = Security.getProvider(providerName); if (installedProvider != null) log.info("Provider " + providerName + " is already installed"); else // install it installNewProvider(); } if (! verbose && certs) { log.fine("Option <certs> is set but <verbose> is not. Ignored"); certs = false; } log.exiting("Main", "setupCommonParams"); }
14,391
private void setupCommonParams() throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException { log.entering("Main", "setupCommonParams"); if (jarFileName == null) HelpPrinter.printHelpAndExit(HELP_PATH); File jar = new File(jarFileName); if (! jar.exists()) throw new FileNotFoundException(jarFileName); if (jar.isDirectory()) throw new IOException("JAR file [" + jarFileName + "] is NOT a file object"); if (! jar.canRead()) throw new IOException("JAR file [" + jarFileName + "] is NOT readable"); if (providerClassName != null && providerClassName.length() > 0) { provider = (Provider) Class.forName(providerClassName).newInstance(); // is it already installed? String providerName = provider.getName(); Provider installedProvider = Security.getProvider(providerName); if (installedProvider != null) log.info("Provider " + providerName + " is already installed"); else // install it installNewProvider(); } if (! verbose && certs) { log.warning("Option <certs> is set but <verbose> is not. Ignored"); certs = false; } log.exiting("Main", "setupCommonParams"); }
private void setupCommonParams() throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException { log.entering("Main", "setupCommonParams"); if (jarFileName == null) HelpPrinter.printHelpAndExit(HELP_PATH); File jar = new File(jarFileName); if (! jar.exists()) throw new FileNotFoundException(jarFileName); if (jar.isDirectory()) throw new IOException("JAR file [" + jarFileName + "] is NOT a file object"); if (! jar.canRead()) throw new IOException("JAR file [" + jarFileName + "] is NOT readable"); if (providerClassName != null && providerClassName.length() > 0) { provider = (Provider) Class.forName(providerClassName).newInstance(); // is it already installed? String providerName = provider.getName(); Provider installedProvider = Security.getProvider(providerName); if (installedProvider != null) log.info("Provider " + providerName + " is already installed"); else // install it installNewProvider(); } if (! verbose && certs) { log.warning("Option <certs> is set but <verbose> is not. Ignored"); certs = false; } log.exiting(this.getClass().getName(), "setupCommonParams"); }
14,392
private void setupSigningParams() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, UnsupportedCallbackException, UnrecoverableKeyException { log.entering("Main", "setupSigningParams"); if (ksURL == null || ksURL.trim().length() == 0) { String userHome = SystemProperties.getProperty("user.home"); if (userHome == null || userHome.trim().length() == 0) throw new SecurityException("Option '-keystore' is not defined or" + " is an empty string, and 'user.home'" + " is unknown"); ksURL = "file:" + userHome.trim() + "/.keystore"; } else { ksURL = ksURL.trim(); if (ksURL.indexOf(":") == -1) ksURL = "file:" + ksURL; } if (ksType == null || ksType.trim().length() == 0) ksType = KeyStore.getDefaultType(); else ksType = ksType.trim(); store = KeyStore.getInstance(ksType); if (ksPassword == null) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter keystore password: ", false); handler.handle(new Callback[] { pcb }); ksPasswordChars = pcb.getPassword(); } else ksPasswordChars = ksPassword.toCharArray(); URL url = new URL(ksURL); InputStream stream = url.openStream(); store.load(stream, ksPasswordChars); if (alias == null) HelpPrinter.printHelpAndExit(HELP_PATH); if (! store.containsAlias(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be known to the key store in use"); if (! store.isKeyEntry(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be an Alias of a Key Entry"); Key key; if (password == null) { passwordChars = ksPasswordChars; try { key = store.getKey(alias, passwordChars); } catch (UnrecoverableKeyException x) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter key password for " + alias + ": ", false); handler.handle(new Callback[] { pcb }); passwordChars = pcb.getPassword(); // take 2 key = store.getKey(alias, passwordChars); } } else { passwordChars = password.toCharArray(); key = store.getKey(alias, passwordChars); } if (! (key instanceof PrivateKey)) throw new SecurityException("Key associated with " + alias + " MUST be a private key"); signerPrivateKey = (PrivateKey) key; signerCertificateChain = store.getCertificateChain(alias); log.finest(String.valueOf(signerCertificateChain)); if (sigFileName == null) sigFileName = alias; sigFileName = sigFileName.toUpperCase(EN_US_LOCALE); if (sigFileName.length() > 8) sigFileName = sigFileName.substring(0, 8); char[] chars = sigFileName.toCharArray(); for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (! (Character.isLetter(c) || Character.isDigit(c) || c == '_' || c == '-')) chars[i] = '_'; } sigFileName = new String(chars); if (signedJarFileName == null) signedJarFileName = jarFileName; log.exiting("Main", "setupSigningParams"); }
private void setupSigningParams() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, UnsupportedCallbackException, UnrecoverableKeyException { log.entering(this.getClass().getName(), "setupSigningParams"); if (ksURL == null || ksURL.trim().length() == 0) { String userHome = SystemProperties.getProperty("user.home"); if (userHome == null || userHome.trim().length() == 0) throw new SecurityException("Option '-keystore' is not defined or" + " is an empty string, and 'user.home'" + " is unknown"); ksURL = "file:" + userHome.trim() + "/.keystore"; } else { ksURL = ksURL.trim(); if (ksURL.indexOf(":") == -1) ksURL = "file:" + ksURL; } if (ksType == null || ksType.trim().length() == 0) ksType = KeyStore.getDefaultType(); else ksType = ksType.trim(); store = KeyStore.getInstance(ksType); if (ksPassword == null) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter keystore password: ", false); handler.handle(new Callback[] { pcb }); ksPasswordChars = pcb.getPassword(); } else ksPasswordChars = ksPassword.toCharArray(); URL url = new URL(ksURL); InputStream stream = url.openStream(); store.load(stream, ksPasswordChars); if (alias == null) HelpPrinter.printHelpAndExit(HELP_PATH); if (! store.containsAlias(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be known to the key store in use"); if (! store.isKeyEntry(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be an Alias of a Key Entry"); Key key; if (password == null) { passwordChars = ksPasswordChars; try { key = store.getKey(alias, passwordChars); } catch (UnrecoverableKeyException x) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter key password for " + alias + ": ", false); handler.handle(new Callback[] { pcb }); passwordChars = pcb.getPassword(); // take 2 key = store.getKey(alias, passwordChars); } } else { passwordChars = password.toCharArray(); key = store.getKey(alias, passwordChars); } if (! (key instanceof PrivateKey)) throw new SecurityException("Key associated with " + alias + " MUST be a private key"); signerPrivateKey = (PrivateKey) key; signerCertificateChain = store.getCertificateChain(alias); log.finest(String.valueOf(signerCertificateChain)); if (sigFileName == null) sigFileName = alias; sigFileName = sigFileName.toUpperCase(EN_US_LOCALE); if (sigFileName.length() > 8) sigFileName = sigFileName.substring(0, 8); char[] chars = sigFileName.toCharArray(); for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (! (Character.isLetter(c) || Character.isDigit(c) || c == '_' || c == '-')) chars[i] = '_'; } sigFileName = new String(chars); if (signedJarFileName == null) signedJarFileName = jarFileName; log.exiting("Main", "setupSigningParams"); }
14,393
private void setupSigningParams() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, UnsupportedCallbackException, UnrecoverableKeyException { log.entering("Main", "setupSigningParams"); if (ksURL == null || ksURL.trim().length() == 0) { String userHome = SystemProperties.getProperty("user.home"); if (userHome == null || userHome.trim().length() == 0) throw new SecurityException("Option '-keystore' is not defined or" + " is an empty string, and 'user.home'" + " is unknown"); ksURL = "file:" + userHome.trim() + "/.keystore"; } else { ksURL = ksURL.trim(); if (ksURL.indexOf(":") == -1) ksURL = "file:" + ksURL; } if (ksType == null || ksType.trim().length() == 0) ksType = KeyStore.getDefaultType(); else ksType = ksType.trim(); store = KeyStore.getInstance(ksType); if (ksPassword == null) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter keystore password: ", false); handler.handle(new Callback[] { pcb }); ksPasswordChars = pcb.getPassword(); } else ksPasswordChars = ksPassword.toCharArray(); URL url = new URL(ksURL); InputStream stream = url.openStream(); store.load(stream, ksPasswordChars); if (alias == null) HelpPrinter.printHelpAndExit(HELP_PATH); if (! store.containsAlias(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be known to the key store in use"); if (! store.isKeyEntry(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be an Alias of a Key Entry"); Key key; if (password == null) { passwordChars = ksPasswordChars; try { key = store.getKey(alias, passwordChars); } catch (UnrecoverableKeyException x) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter key password for " + alias + ": ", false); handler.handle(new Callback[] { pcb }); passwordChars = pcb.getPassword(); // take 2 key = store.getKey(alias, passwordChars); } } else { passwordChars = password.toCharArray(); key = store.getKey(alias, passwordChars); } if (! (key instanceof PrivateKey)) throw new SecurityException("Key associated with " + alias + " MUST be a private key"); signerPrivateKey = (PrivateKey) key; signerCertificateChain = store.getCertificateChain(alias); log.finest(String.valueOf(signerCertificateChain)); if (sigFileName == null) sigFileName = alias; sigFileName = sigFileName.toUpperCase(EN_US_LOCALE); if (sigFileName.length() > 8) sigFileName = sigFileName.substring(0, 8); char[] chars = sigFileName.toCharArray(); for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (! (Character.isLetter(c) || Character.isDigit(c) || c == '_' || c == '-')) chars[i] = '_'; } sigFileName = new String(chars); if (signedJarFileName == null) signedJarFileName = jarFileName; log.exiting("Main", "setupSigningParams"); }
private void setupSigningParams() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, UnsupportedCallbackException, UnrecoverableKeyException { log.entering("Main", "setupSigningParams"); if (ksURL == null || ksURL.trim().length() == 0) { String userHome = SystemProperties.getProperty("user.home"); if (userHome == null || userHome.trim().length() == 0) throw new SecurityException("Option '-keystore' is not defined or" + " is an empty string, and 'user.home'" + " is unknown"); ksURL = "file:" + userHome.trim() + "/.keystore"; } else { ksURL = ksURL.trim(); if (ksURL.indexOf(":") == -1) ksURL = "file:" + ksURL; } if (ksType == null || ksType.trim().length() == 0) ksType = KeyStore.getDefaultType(); else ksType = ksType.trim(); store = KeyStore.getInstance(ksType); if (ksPassword == null) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter keystore password: ", false); handler.handle(new Callback[] { pcb }); ksPasswordChars = pcb.getPassword(); } else ksPasswordChars = ksPassword.toCharArray(); URL url = new URL(ksURL); InputStream stream = url.openStream(); store.load(stream, ksPasswordChars); if (alias == null) HelpPrinter.printHelpAndExit(HELP_PATH); if (! store.containsAlias(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be known to the key store in use"); if (! store.isKeyEntry(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be an Alias of a Key Entry"); Key key; if (password == null) { passwordChars = ksPasswordChars; try { key = store.getKey(alias, passwordChars); } catch (UnrecoverableKeyException x) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter key password for " + alias + ": ", false); handler.handle(new Callback[] { pcb }); passwordChars = pcb.getPassword(); // take 2 key = store.getKey(alias, passwordChars); } } else { passwordChars = password.toCharArray(); key = store.getKey(alias, passwordChars); } if (! (key instanceof PrivateKey)) throw new SecurityException("Key associated with " + alias + " MUST be a private key"); signerPrivateKey = (PrivateKey) key; signerCertificateChain = store.getCertificateChain(alias); log.finest(String.valueOf(signerCertificateChain)); if (sigFileName == null) sigFileName = alias; sigFileName = sigFileName.toUpperCase(EN_US_LOCALE); if (sigFileName.length() > 8) sigFileName = sigFileName.substring(0, 8); char[] chars = sigFileName.toCharArray(); for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (! (Character.isLetter(c) || Character.isDigit(c) || c == '_' || c == '-')) chars[i] = '_'; } sigFileName = new String(chars); if (signedJarFileName == null) signedJarFileName = jarFileName; log.exiting("Main", "setupSigningParams"); }
14,394
private void setupSigningParams() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, UnsupportedCallbackException, UnrecoverableKeyException { log.entering("Main", "setupSigningParams"); if (ksURL == null || ksURL.trim().length() == 0) { String userHome = SystemProperties.getProperty("user.home"); if (userHome == null || userHome.trim().length() == 0) throw new SecurityException("Option '-keystore' is not defined or" + " is an empty string, and 'user.home'" + " is unknown"); ksURL = "file:" + userHome.trim() + "/.keystore"; } else { ksURL = ksURL.trim(); if (ksURL.indexOf(":") == -1) ksURL = "file:" + ksURL; } if (ksType == null || ksType.trim().length() == 0) ksType = KeyStore.getDefaultType(); else ksType = ksType.trim(); store = KeyStore.getInstance(ksType); if (ksPassword == null) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter keystore password: ", false); handler.handle(new Callback[] { pcb }); ksPasswordChars = pcb.getPassword(); } else ksPasswordChars = ksPassword.toCharArray(); URL url = new URL(ksURL); InputStream stream = url.openStream(); store.load(stream, ksPasswordChars); if (alias == null) HelpPrinter.printHelpAndExit(HELP_PATH); if (! store.containsAlias(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be known to the key store in use"); if (! store.isKeyEntry(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be an Alias of a Key Entry"); Key key; if (password == null) { passwordChars = ksPasswordChars; try { key = store.getKey(alias, passwordChars); } catch (UnrecoverableKeyException x) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter key password for " + alias + ": ", false); handler.handle(new Callback[] { pcb }); passwordChars = pcb.getPassword(); // take 2 key = store.getKey(alias, passwordChars); } } else { passwordChars = password.toCharArray(); key = store.getKey(alias, passwordChars); } if (! (key instanceof PrivateKey)) throw new SecurityException("Key associated with " + alias + " MUST be a private key"); signerPrivateKey = (PrivateKey) key; signerCertificateChain = store.getCertificateChain(alias); log.finest(String.valueOf(signerCertificateChain)); if (sigFileName == null) sigFileName = alias; sigFileName = sigFileName.toUpperCase(EN_US_LOCALE); if (sigFileName.length() > 8) sigFileName = sigFileName.substring(0, 8); char[] chars = sigFileName.toCharArray(); for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (! (Character.isLetter(c) || Character.isDigit(c) || c == '_' || c == '-')) chars[i] = '_'; } sigFileName = new String(chars); if (signedJarFileName == null) signedJarFileName = jarFileName; log.exiting("Main", "setupSigningParams"); }
private void setupSigningParams() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, UnsupportedCallbackException, UnrecoverableKeyException { log.entering("Main", "setupSigningParams"); if (ksURL == null || ksURL.trim().length() == 0) { String userHome = SystemProperties.getProperty("user.home"); if (userHome == null || userHome.trim().length() == 0) throw new SecurityException("Option '-keystore' is not defined or" + " is an empty string, and 'user.home'" + " is unknown"); ksURL = "file:" + userHome.trim() + "/.keystore"; } else { ksURL = ksURL.trim(); if (ksURL.indexOf(":") == -1) ksURL = "file:" + ksURL; } if (ksType == null || ksType.trim().length() == 0) ksType = KeyStore.getDefaultType(); else ksType = ksType.trim(); store = KeyStore.getInstance(ksType); if (ksPassword == null) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter keystore password: ", false); handler.handle(new Callback[] { pcb }); ksPasswordChars = pcb.getPassword(); } else ksPasswordChars = ksPassword.toCharArray(); URL url = new URL(ksURL); InputStream stream = url.openStream(); store.load(stream, ksPasswordChars); if (alias == null) HelpPrinter.printHelpAndExit(HELP_PATH); if (! store.containsAlias(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be known to the key store in use"); if (! store.isKeyEntry(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be an Alias of a Key Entry"); Key key; if (password == null) { passwordChars = ksPasswordChars; try { key = store.getKey(alias, passwordChars); } catch (UnrecoverableKeyException x) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter key password for " + alias + ": ", false); handler.handle(new Callback[] { pcb }); passwordChars = pcb.getPassword(); // take 2 key = store.getKey(alias, passwordChars); } } else { passwordChars = password.toCharArray(); key = store.getKey(alias, passwordChars); } if (! (key instanceof PrivateKey)) throw new SecurityException("Key associated with " + alias + " MUST be a private key"); signerPrivateKey = (PrivateKey) key; signerCertificateChain = store.getCertificateChain(alias); log.finest(String.valueOf(signerCertificateChain)); if (sigFileName == null) sigFileName = alias; sigFileName = sigFileName.toUpperCase(EN_US_LOCALE); if (sigFileName.length() > 8) sigFileName = sigFileName.substring(0, 8); char[] chars = sigFileName.toCharArray(); for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (! (Character.isLetter(c) || Character.isDigit(c) || c == '_' || c == '-')) chars[i] = '_'; } sigFileName = new String(chars); if (signedJarFileName == null) signedJarFileName = jarFileName; log.exiting("Main", "setupSigningParams"); }
14,395
private void setupSigningParams() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, UnsupportedCallbackException, UnrecoverableKeyException { log.entering("Main", "setupSigningParams"); if (ksURL == null || ksURL.trim().length() == 0) { String userHome = SystemProperties.getProperty("user.home"); if (userHome == null || userHome.trim().length() == 0) throw new SecurityException("Option '-keystore' is not defined or" + " is an empty string, and 'user.home'" + " is unknown"); ksURL = "file:" + userHome.trim() + "/.keystore"; } else { ksURL = ksURL.trim(); if (ksURL.indexOf(":") == -1) ksURL = "file:" + ksURL; } if (ksType == null || ksType.trim().length() == 0) ksType = KeyStore.getDefaultType(); else ksType = ksType.trim(); store = KeyStore.getInstance(ksType); if (ksPassword == null) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter keystore password: ", false); handler.handle(new Callback[] { pcb }); ksPasswordChars = pcb.getPassword(); } else ksPasswordChars = ksPassword.toCharArray(); URL url = new URL(ksURL); InputStream stream = url.openStream(); store.load(stream, ksPasswordChars); if (alias == null) HelpPrinter.printHelpAndExit(HELP_PATH); if (! store.containsAlias(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be known to the key store in use"); if (! store.isKeyEntry(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be an Alias of a Key Entry"); Key key; if (password == null) { passwordChars = ksPasswordChars; try { key = store.getKey(alias, passwordChars); } catch (UnrecoverableKeyException x) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter key password for " + alias + ": ", false); handler.handle(new Callback[] { pcb }); passwordChars = pcb.getPassword(); // take 2 key = store.getKey(alias, passwordChars); } } else { passwordChars = password.toCharArray(); key = store.getKey(alias, passwordChars); } if (! (key instanceof PrivateKey)) throw new SecurityException("Key associated with " + alias + " MUST be a private key"); signerPrivateKey = (PrivateKey) key; signerCertificateChain = store.getCertificateChain(alias); log.finest(String.valueOf(signerCertificateChain)); if (sigFileName == null) sigFileName = alias; sigFileName = sigFileName.toUpperCase(EN_US_LOCALE); if (sigFileName.length() > 8) sigFileName = sigFileName.substring(0, 8); char[] chars = sigFileName.toCharArray(); for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (! (Character.isLetter(c) || Character.isDigit(c) || c == '_' || c == '-')) chars[i] = '_'; } sigFileName = new String(chars); if (signedJarFileName == null) signedJarFileName = jarFileName; log.exiting("Main", "setupSigningParams"); }
private void setupSigningParams() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, UnsupportedCallbackException, UnrecoverableKeyException { log.entering("Main", "setupSigningParams"); if (ksURL == null || ksURL.trim().length() == 0) { String userHome = SystemProperties.getProperty("user.home"); if (userHome == null || userHome.trim().length() == 0) throw new SecurityException("Option '-keystore' is not defined or" + " is an empty string, and 'user.home'" + " is unknown"); ksURL = "file:" + userHome.trim() + "/.keystore"; } else { ksURL = ksURL.trim(); if (ksURL.indexOf(":") == -1) ksURL = "file:" + ksURL; } if (ksType == null || ksType.trim().length() == 0) ksType = KeyStore.getDefaultType(); else ksType = ksType.trim(); store = KeyStore.getInstance(ksType); if (ksPassword == null) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter keystore password: ", false); getCallbackHandler().handle(new Callback[] { pcb }); ksPasswordChars = pcb.getPassword(); } else ksPasswordChars = ksPassword.toCharArray(); URL url = new URL(ksURL); InputStream stream = url.openStream(); store.load(stream, ksPasswordChars); if (alias == null) HelpPrinter.printHelpAndExit(HELP_PATH); if (! store.containsAlias(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be known to the key store in use"); if (! store.isKeyEntry(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be an Alias of a Key Entry"); Key key; if (password == null) { passwordChars = ksPasswordChars; try { key = store.getKey(alias, passwordChars); } catch (UnrecoverableKeyException x) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter key password for " + alias + ": ", false); getCallbackHandler().handle(new Callback[] { pcb }); passwordChars = pcb.getPassword(); // take 2 key = store.getKey(alias, passwordChars); } } else { passwordChars = password.toCharArray(); key = store.getKey(alias, passwordChars); } if (! (key instanceof PrivateKey)) throw new SecurityException("Key associated with " + alias + " MUST be a private key"); signerPrivateKey = (PrivateKey) key; signerCertificateChain = store.getCertificateChain(alias); log.finest(String.valueOf(signerCertificateChain)); if (sigFileName == null) sigFileName = alias; sigFileName = sigFileName.toUpperCase(EN_US_LOCALE); if (sigFileName.length() > 8) sigFileName = sigFileName.substring(0, 8); char[] chars = sigFileName.toCharArray(); for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (! (Character.isLetter(c) || Character.isDigit(c) || c == '_' || c == '-')) chars[i] = '_'; } sigFileName = new String(chars); if (signedJarFileName == null) signedJarFileName = jarFileName; log.exiting("Main", "setupSigningParams"); }
14,396
private void setupSigningParams() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, UnsupportedCallbackException, UnrecoverableKeyException { log.entering("Main", "setupSigningParams"); if (ksURL == null || ksURL.trim().length() == 0) { String userHome = SystemProperties.getProperty("user.home"); if (userHome == null || userHome.trim().length() == 0) throw new SecurityException("Option '-keystore' is not defined or" + " is an empty string, and 'user.home'" + " is unknown"); ksURL = "file:" + userHome.trim() + "/.keystore"; } else { ksURL = ksURL.trim(); if (ksURL.indexOf(":") == -1) ksURL = "file:" + ksURL; } if (ksType == null || ksType.trim().length() == 0) ksType = KeyStore.getDefaultType(); else ksType = ksType.trim(); store = KeyStore.getInstance(ksType); if (ksPassword == null) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter keystore password: ", false); handler.handle(new Callback[] { pcb }); ksPasswordChars = pcb.getPassword(); } else ksPasswordChars = ksPassword.toCharArray(); URL url = new URL(ksURL); InputStream stream = url.openStream(); store.load(stream, ksPasswordChars); if (alias == null) HelpPrinter.printHelpAndExit(HELP_PATH); if (! store.containsAlias(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be known to the key store in use"); if (! store.isKeyEntry(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be an Alias of a Key Entry"); Key key; if (password == null) { passwordChars = ksPasswordChars; try { key = store.getKey(alias, passwordChars); } catch (UnrecoverableKeyException x) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter key password for " + alias + ": ", false); handler.handle(new Callback[] { pcb }); passwordChars = pcb.getPassword(); // take 2 key = store.getKey(alias, passwordChars); } } else { passwordChars = password.toCharArray(); key = store.getKey(alias, passwordChars); } if (! (key instanceof PrivateKey)) throw new SecurityException("Key associated with " + alias + " MUST be a private key"); signerPrivateKey = (PrivateKey) key; signerCertificateChain = store.getCertificateChain(alias); log.finest(String.valueOf(signerCertificateChain)); if (sigFileName == null) sigFileName = alias; sigFileName = sigFileName.toUpperCase(EN_US_LOCALE); if (sigFileName.length() > 8) sigFileName = sigFileName.substring(0, 8); char[] chars = sigFileName.toCharArray(); for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (! (Character.isLetter(c) || Character.isDigit(c) || c == '_' || c == '-')) chars[i] = '_'; } sigFileName = new String(chars); if (signedJarFileName == null) signedJarFileName = jarFileName; log.exiting("Main", "setupSigningParams"); }
private void setupSigningParams() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, UnsupportedCallbackException, UnrecoverableKeyException { log.entering("Main", "setupSigningParams"); if (ksURL == null || ksURL.trim().length() == 0) { String userHome = SystemProperties.getProperty("user.home"); if (userHome == null || userHome.trim().length() == 0) throw new SecurityException("Option '-keystore' is not defined or" + " is an empty string, and 'user.home'" + " is unknown"); ksURL = "file:" + userHome.trim() + "/.keystore"; } else { ksURL = ksURL.trim(); if (ksURL.indexOf(":") == -1) ksURL = "file:" + ksURL; } if (ksType == null || ksType.trim().length() == 0) ksType = KeyStore.getDefaultType(); else ksType = ksType.trim(); store = KeyStore.getInstance(ksType); if (ksPassword == null) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter keystore password: ", false); handler.handle(new Callback[] { pcb }); ksPasswordChars = pcb.getPassword(); } else ksPasswordChars = ksPassword.toCharArray(); URL url = new URL(ksURL); InputStream stream = url.openStream(); store.load(stream, ksPasswordChars); if (alias == null) HelpPrinter.printHelpAndExit(HELP_PATH); if (! store.containsAlias(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be known to the key store in use"); if (! store.isKeyEntry(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be an Alias of a Key Entry"); Key key; if (password == null) { passwordChars = ksPasswordChars; try { key = store.getKey(alias, passwordChars); } catch (UnrecoverableKeyException x) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter key password for " + alias + ": ", false); handler.handle(new Callback[] { pcb }); passwordChars = pcb.getPassword(); // take 2 key = store.getKey(alias, passwordChars); } } else { passwordChars = password.toCharArray(); key = store.getKey(alias, passwordChars); } if (! (key instanceof PrivateKey)) throw new SecurityException("Key associated with " + alias + " MUST be a private key"); signerPrivateKey = (PrivateKey) key; signerCertificateChain = store.getCertificateChain(alias); log.finest(String.valueOf(signerCertificateChain)); if (sigFileName == null) sigFileName = alias; sigFileName = sigFileName.toUpperCase(EN_US_LOCALE); if (sigFileName.length() > 8) sigFileName = sigFileName.substring(0, 8); char[] chars = sigFileName.toCharArray(); for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (! (Character.isLetter(c) || Character.isDigit(c) || c == '_' || c == '-')) chars[i] = '_'; } sigFileName = new String(chars); if (signedJarFileName == null) signedJarFileName = jarFileName; log.exiting("Main", "setupSigningParams"); }
14,397
private void setupSigningParams() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, UnsupportedCallbackException, UnrecoverableKeyException { log.entering("Main", "setupSigningParams"); if (ksURL == null || ksURL.trim().length() == 0) { String userHome = SystemProperties.getProperty("user.home"); if (userHome == null || userHome.trim().length() == 0) throw new SecurityException("Option '-keystore' is not defined or" + " is an empty string, and 'user.home'" + " is unknown"); ksURL = "file:" + userHome.trim() + "/.keystore"; } else { ksURL = ksURL.trim(); if (ksURL.indexOf(":") == -1) ksURL = "file:" + ksURL; } if (ksType == null || ksType.trim().length() == 0) ksType = KeyStore.getDefaultType(); else ksType = ksType.trim(); store = KeyStore.getInstance(ksType); if (ksPassword == null) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter keystore password: ", false); handler.handle(new Callback[] { pcb }); ksPasswordChars = pcb.getPassword(); } else ksPasswordChars = ksPassword.toCharArray(); URL url = new URL(ksURL); InputStream stream = url.openStream(); store.load(stream, ksPasswordChars); if (alias == null) HelpPrinter.printHelpAndExit(HELP_PATH); if (! store.containsAlias(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be known to the key store in use"); if (! store.isKeyEntry(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be an Alias of a Key Entry"); Key key; if (password == null) { passwordChars = ksPasswordChars; try { key = store.getKey(alias, passwordChars); } catch (UnrecoverableKeyException x) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter key password for " + alias + ": ", false); handler.handle(new Callback[] { pcb }); passwordChars = pcb.getPassword(); // take 2 key = store.getKey(alias, passwordChars); } } else { passwordChars = password.toCharArray(); key = store.getKey(alias, passwordChars); } if (! (key instanceof PrivateKey)) throw new SecurityException("Key associated with " + alias + " MUST be a private key"); signerPrivateKey = (PrivateKey) key; signerCertificateChain = store.getCertificateChain(alias); log.finest(String.valueOf(signerCertificateChain)); if (sigFileName == null) sigFileName = alias; sigFileName = sigFileName.toUpperCase(EN_US_LOCALE); if (sigFileName.length() > 8) sigFileName = sigFileName.substring(0, 8); char[] chars = sigFileName.toCharArray(); for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (! (Character.isLetter(c) || Character.isDigit(c) || c == '_' || c == '-')) chars[i] = '_'; } sigFileName = new String(chars); if (signedJarFileName == null) signedJarFileName = jarFileName; log.exiting("Main", "setupSigningParams"); }
private void setupSigningParams() throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, UnsupportedCallbackException, UnrecoverableKeyException { log.entering("Main", "setupSigningParams"); if (ksURL == null || ksURL.trim().length() == 0) { String userHome = SystemProperties.getProperty("user.home"); if (userHome == null || userHome.trim().length() == 0) throw new SecurityException("Option '-keystore' is not defined or" + " is an empty string, and 'user.home'" + " is unknown"); ksURL = "file:" + userHome.trim() + "/.keystore"; } else { ksURL = ksURL.trim(); if (ksURL.indexOf(":") == -1) ksURL = "file:" + ksURL; } if (ksType == null || ksType.trim().length() == 0) ksType = KeyStore.getDefaultType(); else ksType = ksType.trim(); store = KeyStore.getInstance(ksType); if (ksPassword == null) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter keystore password: ", false); handler.handle(new Callback[] { pcb }); ksPasswordChars = pcb.getPassword(); } else ksPasswordChars = ksPassword.toCharArray(); URL url = new URL(ksURL); InputStream stream = url.openStream(); store.load(stream, ksPasswordChars); if (alias == null) HelpPrinter.printHelpAndExit(HELP_PATH); if (! store.containsAlias(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be known to the key store in use"); if (! store.isKeyEntry(alias)) throw new SecurityException("Designated alias [" + alias + "] MUST be an Alias of a Key Entry"); Key key; if (password == null) { passwordChars = ksPasswordChars; try { key = store.getKey(alias, passwordChars); } catch (UnrecoverableKeyException x) { // ask the user to provide one CallbackHandler handler = new ConsoleCallbackHandler(); PasswordCallback pcb = new PasswordCallback("Enter key password for " + alias + ": ", false); handler.handle(new Callback[] { pcb }); passwordChars = pcb.getPassword(); // take 2 key = store.getKey(alias, passwordChars); } } else { passwordChars = password.toCharArray(); key = store.getKey(alias, passwordChars); } if (! (key instanceof PrivateKey)) throw new SecurityException("Key associated with " + alias + " MUST be a private key"); signerPrivateKey = (PrivateKey) key; signerCertificateChain = store.getCertificateChain(alias); log.finest(String.valueOf(signerCertificateChain)); if (sigFileName == null) sigFileName = alias; sigFileName = sigFileName.toUpperCase(EN_US_LOCALE); if (sigFileName.length() > 8) sigFileName = sigFileName.substring(0, 8); char[] chars = sigFileName.toCharArray(); for (int i = 0; i < chars.length; i++) { char c = chars[i]; if (! (Character.isLetter(c) || Character.isDigit(c) || c == '_' || c == '-')) chars[i] = '_'; } sigFileName = new String(chars); if (signedJarFileName == null) signedJarFileName = jarFileName; log.exiting("Main", "setupSigningParams"); }
14,398