bugged
stringlengths
6
599k
fixed
stringlengths
6
40.8M
__index_level_0__
int64
0
3.24M
public void run() { CursorableLinkedList.Cursor cursor = null; while(!_cancelled) { long sleeptime = 0L; synchronized(GenericObjectPool.this) { sleeptime = _timeBetweenEvictionRunsMillis; } try { Thread.currentThread().sleep(_timeBetweenEvictionRunsMillis); } catch(Exception e) { ; // ignored } try { synchronized(GenericObjectPool.this) { if(!_pool.isEmpty()) { if(null == cursor) { cursor = (CursorableLinkedList.Cursor)(_pool.cursor(_pool.size())); } else if(!cursor.hasPrevious()) { cursor.close(); cursor = (CursorableLinkedList.Cursor)(_pool.cursor(_pool.size())); } for(int i=0,m=getNumTests();i<m;i++) { if(!cursor.hasPrevious()) { cursor.close(); cursor = (CursorableLinkedList.Cursor)(_pool.cursor(_pool.size())); } else { ObjectTimestampPair pair = (ObjectTimestampPair)(cursor.previous()); if(_minEvictableIdleTimeMillis > 0 && System.currentTimeMillis() - pair.tstamp > _minEvictableIdleTimeMillis) { try { cursor.remove(); _factory.destroyObject(pair.value); } catch(Exception e) { ; // ignored } } else if(_testWhileIdle) { boolean active = false; try { _factory.activateObject(pair.value); active = true; } catch(Exception e) { cursor.remove(); try { _factory.passivateObject(pair.value); } catch(Exception ex) { ; // ignored } _factory.destroyObject(pair.value); } if(active) { if(!_factory.validateObject(pair.value)) { cursor.remove(); try { _factory.passivateObject(pair.value); } catch(Exception ex) { ; // ignored } _factory.destroyObject(pair.value); } else { try { _factory.passivateObject(pair.value); } catch(Exception e) { cursor.remove(); _factory.destroyObject(pair.value); } } } } } } } } } catch(Exception e) { // ignored } } if(null != cursor) { cursor.close(); } }
public void run() { CursorableLinkedList.Cursor cursor = null; while(!_cancelled) { long sleeptime = 0L; synchronized(GenericObjectPool.this) { sleeptime = _timeBetweenEvictionRunsMillis; } try { Thread.currentThread().sleep(sleeptime); } catch(Exception e) { ; // ignored } try { synchronized(GenericObjectPool.this) { if(!_pool.isEmpty()) { if(null == cursor) { cursor = (CursorableLinkedList.Cursor)(_pool.cursor(_pool.size())); } else if(!cursor.hasPrevious()) { cursor.close(); cursor = (CursorableLinkedList.Cursor)(_pool.cursor(_pool.size())); } for(int i=0,m=getNumTests();i<m;i++) { if(!cursor.hasPrevious()) { cursor.close(); cursor = (CursorableLinkedList.Cursor)(_pool.cursor(_pool.size())); } else { ObjectTimestampPair pair = (ObjectTimestampPair)(cursor.previous()); if(_minEvictableIdleTimeMillis > 0 && System.currentTimeMillis() - pair.tstamp > _minEvictableIdleTimeMillis) { try { cursor.remove(); _factory.destroyObject(pair.value); } catch(Exception e) { ; // ignored } } else if(_testWhileIdle) { boolean active = false; try { _factory.activateObject(pair.value); active = true; } catch(Exception e) { cursor.remove(); try { _factory.passivateObject(pair.value); } catch(Exception ex) { ; // ignored } _factory.destroyObject(pair.value); } if(active) { if(!_factory.validateObject(pair.value)) { cursor.remove(); try { _factory.passivateObject(pair.value); } catch(Exception ex) { ; // ignored } _factory.destroyObject(pair.value); } else { try { _factory.passivateObject(pair.value); } catch(Exception e) { cursor.remove(); _factory.destroyObject(pair.value); } } } } } } } } } catch(Exception e) { // ignored } } if(null != cursor) { cursor.close(); } }
3,240,496
ObjectTimestampPair(Object val) { value = val; tstamp = System.currentTimeMillis(); }
ObjectTimestampPair(Object val) { value = val; tstamp = System.currentTimeMillis(); }
3,240,497
public HTMLLicencePanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout layout = new GridBagLayout(); gbConstraints = new GridBagConstraints(); setLayout(layout); // We load the licence loadLicence(); // We put our components infoLabel = LabelFactory.create(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, 0, 2, 1, 1.0, 0.0); gbConstraints.insets = new Insets(5, 5, 5, 5); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(infoLabel, gbConstraints); add(infoLabel); try { textArea = new JEditorPane(); textArea.setEditable(false); textArea.addHyperlinkListener(this); JScrollPane scroller = new JScrollPane(textArea); textArea.setPage(loadLicence()); parent.buildConstraints(gbConstraints, 0, 1, 2, 1, 1.0, 1.0); gbConstraints.anchor = GridBagConstraints.CENTER; gbConstraints.fill = GridBagConstraints.BOTH; layout.addLayoutComponent(scroller, gbConstraints); add(scroller); } catch (Exception err) { err.printStackTrace(); } ButtonGroup group = new ButtonGroup(); yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.agree"), false); group.add(yesRadio); parent.buildConstraints(gbConstraints, 0, 2, 1, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; gbConstraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(yesRadio, gbConstraints); add(yesRadio); yesRadio.addActionListener(this); noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.notagree"), true); group.add(noRadio); parent.buildConstraints(gbConstraints, 0, 3, 1, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.insets = new Insets(0, 5, 5, 5); layout.addLayoutComponent(noRadio, gbConstraints); add(noRadio); noRadio.addActionListener(this); setInitialFocus(textArea); }
public HTMLLicencePanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout layout = new GridBagLayout(); gbConstraints = new GridBagConstraints(); setLayout(layout); // We load the licence loadLicence(); // We put our components infoLabel = LabelFactory.create(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, 0, 2, 1, 1.0, 0.0); gbConstraints.insets = new Insets(5, 5, 5, 5); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(infoLabel, gbConstraints); add(infoLabel); try { textArea = new JEditorPane(); textArea.setEditable(false); textArea.addHyperlinkListener(this); JScrollPane scroller = new JScrollPane(textArea); textArea.setPage(loadLicence()); parent.buildConstraints(gbConstraints, 0, 1, 2, 1, 1.0, 1.0); gbConstraints.anchor = GridBagConstraints.CENTER; gbConstraints.fill = GridBagConstraints.BOTH; layout.addLayoutComponent(scroller, gbConstraints); add(scroller); } catch (Exception err) { err.printStackTrace(); } ButtonGroup group = new ButtonGroup(); yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.agree"), false); group.add(yesRadio); parent.buildConstraints(gbConstraints, 0, 2, 1, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; gbConstraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(yesRadio, gbConstraints); add(yesRadio); yesRadio.addActionListener(this); noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.notagree"), true); group.add(noRadio); parent.buildConstraints(gbConstraints, 0, 3, 1, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.insets = new Insets(0, 5, 5, 5); layout.addLayoutComponent(noRadio, gbConstraints); add(noRadio); noRadio.addActionListener(this); setInitialFocus(textArea); }
3,240,499
public HTMLLicencePanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout layout = new GridBagLayout(); gbConstraints = new GridBagConstraints(); setLayout(layout); // We load the licence loadLicence(); // We put our components infoLabel = LabelFactory.create(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, 0, 2, 1, 1.0, 0.0); gbConstraints.insets = new Insets(5, 5, 5, 5); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(infoLabel, gbConstraints); add(infoLabel); try { textArea = new JEditorPane(); textArea.setEditable(false); textArea.addHyperlinkListener(this); JScrollPane scroller = new JScrollPane(textArea); textArea.setPage(loadLicence()); parent.buildConstraints(gbConstraints, 0, 1, 2, 1, 1.0, 1.0); gbConstraints.anchor = GridBagConstraints.CENTER; gbConstraints.fill = GridBagConstraints.BOTH; layout.addLayoutComponent(scroller, gbConstraints); add(scroller); } catch (Exception err) { err.printStackTrace(); } ButtonGroup group = new ButtonGroup(); yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.agree"), false); group.add(yesRadio); parent.buildConstraints(gbConstraints, 0, 2, 1, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; gbConstraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(yesRadio, gbConstraints); add(yesRadio); yesRadio.addActionListener(this); noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.notagree"), true); group.add(noRadio); parent.buildConstraints(gbConstraints, 0, 3, 1, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.insets = new Insets(0, 5, 5, 5); layout.addLayoutComponent(noRadio, gbConstraints); add(noRadio); noRadio.addActionListener(this); setInitialFocus(textArea); }
public HTMLLicencePanel(InstallerFrame parent, InstallData idata) { super(parent, idata); // We initialize our layout layout = new GridBagLayout(); gbConstraints = new GridBagConstraints(); setLayout(layout); // We load the licence loadLicence(); // We put our components JLabel infoLabel = LabelFactory.create(parent.langpack.getString("LicencePanel.info"), parent.icons.getImageIcon("history"), JLabel.TRAILING); parent.buildConstraints(gbConstraints, 0, 0, 2, 1, 1.0, 0.0); gbConstraints.insets = new Insets(5, 5, 5, 5); gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.WEST; layout.addLayoutComponent(infoLabel, gbConstraints); add(infoLabel); try { textArea = new JEditorPane(); textArea.setEditable(false); textArea.addHyperlinkListener(this); JScrollPane scroller = new JScrollPane(textArea); textArea.setPage(loadLicence()); parent.buildConstraints(gbConstraints, 0, 1, 2, 1, 1.0, 1.0); gbConstraints.anchor = GridBagConstraints.CENTER; gbConstraints.fill = GridBagConstraints.BOTH; layout.addLayoutComponent(scroller, gbConstraints); add(scroller); } catch (Exception err) { err.printStackTrace(); } ButtonGroup group = new ButtonGroup(); yesRadio = new JRadioButton(parent.langpack.getString("LicencePanel.agree"), false); group.add(yesRadio); parent.buildConstraints(gbConstraints, 0, 2, 1, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; gbConstraints.fill = GridBagConstraints.NONE; layout.addLayoutComponent(yesRadio, gbConstraints); add(yesRadio); yesRadio.addActionListener(this); noRadio = new JRadioButton(parent.langpack.getString("LicencePanel.notagree"), true); group.add(noRadio); parent.buildConstraints(gbConstraints, 0, 3, 1, 1, 1.0, 0.0); gbConstraints.anchor = GridBagConstraints.WEST; gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.insets = new Insets(0, 5, 5, 5); layout.addLayoutComponent(noRadio, gbConstraints); add(noRadio); noRadio.addActionListener(this); setInitialFocus(textArea); }
3,240,500
public void generatePerlCode( String fileName ) { boolean _existBack = false; _vertices = _graph.getVertices().toArray(); _edges = _graph.getEdges().toArray(); ArrayList writtenVertices = new ArrayList(); ArrayList writtenEdges = new ArrayList(); StringBuffer sourceFile = new StringBuffer(); /** * Read the original file first. If the methods already are defined in the file, * leave those methods alone. */ BufferedReader input = null; try { _logger.debug( "Try to open file: " + fileName ); input = new BufferedReader( new FileReader( fileName ) ); String line = null; while ( ( line = input.readLine() ) != null ) { sourceFile.append( line ); sourceFile.append( System.getProperty( "line.separator" ) ); } } catch ( FileNotFoundException e ) { _logger.error( "File not found exception: " + e.getMessage() ); } catch ( IOException e ) { _logger.error( "IO exception: " + e.getMessage() ); } finally { try { if ( input != null ) { input.close(); } } catch ( IOException e ) { _logger.error( "IO exception: " + e.getMessage() ); } } _logger.debug( sourceFile.toString() ); for ( int i = 0; i < _vertices.length; i++ ) { DirectedSparseVertex vertex = (DirectedSparseVertex)_vertices[ i ]; boolean duplicated = false; for ( Iterator iter = writtenVertices.iterator(); iter.hasNext(); ) { String str = (String) iter.next(); if ( str.equals( (String)vertex.getUserDatum( LABEL_KEY ) ) == true ) { duplicated = true; break; } } if ( _existBack == false ) { _existBack = true; Pattern p = Pattern.compile( "sub PressBackButton\\(\\)(.|[\\n\\r])*?\\{(.|[\\n\\r])*?\\}", Pattern.MULTILINE ); Matcher m = p.matcher( sourceFile ); if ( m.find() == false ) { sourceFile.append( "#\n" ); sourceFile.append( "# This method implements the edge: PressBackButton\n" ); sourceFile.append( "#\n" ); sourceFile.append( "sub PressBackButton()\n" ); sourceFile.append( "{\n" ); sourceFile.append( " print \"Edge: PressBackButton\n\";" ); sourceFile.append( " die \"Not implemented.\";\n" ); sourceFile.append( "}\n\n" ); } } if ( duplicated == false ) { Pattern p = Pattern.compile( "sub " + (String)vertex.getUserDatum( LABEL_KEY ) + "\\(\\)(.|[\\n\\r])*?\\{(.|[\\n\\r])*?\\}", Pattern.MULTILINE ); Matcher m = p.matcher( sourceFile ); if ( m.find() == false ) { sourceFile.append( "#\n" ); sourceFile.append( "# This method implements the verification of the vertex: " + (String)vertex.getUserDatum( LABEL_KEY ) + "\n" ); sourceFile.append( "#\n" ); sourceFile.append( "sub " + (String)vertex.getUserDatum( LABEL_KEY ) + "()\n" ); sourceFile.append( "{\n" ); sourceFile.append( " print \"Vertex: " + (String)vertex.getUserDatum( LABEL_KEY ) + "\n\";" ); sourceFile.append( " die \"Not implemented.\";\n" ); sourceFile.append( "}\n\n" ); } } writtenVertices.add( (String)vertex.getUserDatum( LABEL_KEY ) ); } for ( int i = 0; i < _edges.length; i++ ) { DirectedSparseEdge edge = (DirectedSparseEdge)_edges[ i ]; boolean duplicated = false; for ( Iterator iter = writtenEdges.iterator(); iter.hasNext(); ) { String str = (String) iter.next(); if ( str.equals( (String)edge.getUserDatum( LABEL_KEY ) ) == true ) { duplicated = true; break; } } if ( duplicated == false ) { Pattern p = Pattern.compile( "sub " + (String)edge.getUserDatum( LABEL_KEY ) + "\\(\\)(.|[\\n\\r])*?\\{(.|[\\n\\r])*?\\}", Pattern.MULTILINE ); Matcher m = p.matcher( sourceFile ); if ( m.find() == false ) { sourceFile.append( "#\n" ); sourceFile.append( "# This method implemets the edge: " + (String)edge.getUserDatum( LABEL_KEY ) + "\n" ); sourceFile.append( "#\n" ); sourceFile.append( "sub " + (String)edge.getUserDatum( LABEL_KEY ) + "()\n" ); sourceFile.append( "{\n" ); sourceFile.append( " print \"Edge: " + (String)edge.getUserDatum( LABEL_KEY ) + "\n\";" ); sourceFile.append( " die \"Not implemented.\";\n" ); sourceFile.append( "}\n\n" ); } } writtenEdges.add( (String)edge.getUserDatum( LABEL_KEY ) ); } try { FileWriter file = new FileWriter( fileName ); file.write( sourceFile.toString() ); file.flush(); } catch ( IOException e ) { _logger.error( e.getMessage() ); } }
public void generatePerlCode( String fileName ) { boolean _existBack = false; _vertices = _graph.getVertices().toArray(); _edges = _graph.getEdges().toArray(); ArrayList writtenVertices = new ArrayList(); ArrayList writtenEdges = new ArrayList(); StringBuffer sourceFile = new StringBuffer(); /** * Read the original file first. If the methods already are defined in the file, * leave those methods alone. */ BufferedReader input = null; try { _logger.debug( "Try to open file: " + fileName ); input = new BufferedReader( new FileReader( fileName ) ); String line = null; while ( ( line = input.readLine() ) != null ) { sourceFile.append( line ); sourceFile.append( System.getProperty( "line.separator" ) ); } } catch ( FileNotFoundException e ) { _logger.error( "File not found exception: " + e.getMessage() ); } catch ( IOException e ) { _logger.error( "IO exception: " + e.getMessage() ); } finally { try { if ( input != null ) { input.close(); } } catch ( IOException e ) { _logger.error( "IO exception: " + e.getMessage() ); } } _logger.debug( sourceFile.toString() ); for ( int i = 0; i < _vertices.length; i++ ) { DirectedSparseVertex vertex = (DirectedSparseVertex)_vertices[ i ]; boolean duplicated = false; for ( Iterator iter = writtenVertices.iterator(); iter.hasNext(); ) { String str = (String) iter.next(); if ( str.equals( (String)vertex.getUserDatum( LABEL_KEY ) ) == true ) { duplicated = true; break; } } if ( _existBack == false ) { _existBack = true; Pattern p = Pattern.compile( "sub PressBackButton\\(\\)(.|[\\n\\r])*?\\{(.|[\\n\\r])*?\\}", Pattern.MULTILINE ); Matcher m = p.matcher( sourceFile ); if ( m.find() == false ) { sourceFile.append( "#\n" ); sourceFile.append( "# This method implements the edge: PressBackButton\n" ); sourceFile.append( "#\n" ); sourceFile.append( "sub PressBackButton()\n" ); sourceFile.append( "{\n" ); sourceFile.append( " print \"Edge: PressBackButton\n\";" ); sourceFile.append( " die \"Not implemented.\";\n" ); sourceFile.append( "}\n\n" ); } } if ( duplicated == false ) { Pattern p = Pattern.compile( "sub " + (String)vertex.getUserDatum( LABEL_KEY ) + "\\(\\)(.|[\\n\\r])*?\\{(.|[\\n\\r])*?\\}", Pattern.MULTILINE ); Matcher m = p.matcher( sourceFile ); if ( m.find() == false ) { sourceFile.append( "#\n" ); sourceFile.append( "# This method implements the verification of the vertex: " + (String)vertex.getUserDatum( LABEL_KEY ) + "\n" ); sourceFile.append( "#\n" ); sourceFile.append( "sub " + (String)vertex.getUserDatum( LABEL_KEY ) + "()\n" ); sourceFile.append( "{\n" ); sourceFile.append( " print \"Vertex: " + (String)vertex.getUserDatum( LABEL_KEY ) + "\n\";" ); sourceFile.append( " die \"Not implemented.\";\n" ); sourceFile.append( "}\n\n" ); } } writtenVertices.add( (String)vertex.getUserDatum( LABEL_KEY ) ); } for ( int i = 0; i < _edges.length; i++ ) { DirectedSparseEdge edge = (DirectedSparseEdge)_edges[ i ]; boolean duplicated = false; for ( Iterator iter = writtenEdges.iterator(); iter.hasNext(); ) { String str = (String) iter.next(); if ( str.equals( (String)edge.getUserDatum( LABEL_KEY ) ) == true ) { duplicated = true; break; } } if ( duplicated == false ) { Pattern p = Pattern.compile( "sub " + (String)edge.getUserDatum( LABEL_KEY ) + "\\(\\)(.|[\\n\\r])*?\\{(.|[\\n\\r])*?\\}", Pattern.MULTILINE ); Matcher m = p.matcher( sourceFile ); if ( m.find() == false ) { sourceFile.append( "#\n" ); sourceFile.append( "# This method implemets the edge: " + (String)edge.getUserDatum( LABEL_KEY ) + "\n" ); sourceFile.append( "#\n" ); sourceFile.append( "sub " + (String)edge.getUserDatum( LABEL_KEY ) + "()\n" ); sourceFile.append( "{\n" ); sourceFile.append( " print \"Edge: " + (String)edge.getUserDatum( LABEL_KEY ) + "\n\";" ); sourceFile.append( " die \"Not implemented.\";\n" ); sourceFile.append( "}\n\n" ); } } writtenEdges.add( (String)edge.getUserDatum( LABEL_KEY ) ); } try { FileWriter file = new FileWriter( fileName ); file.write( sourceFile.toString() ); file.flush(); } catch ( IOException e ) { _logger.error( e.getMessage() ); } }
3,240,501
public void generatePerlCode( String fileName ) { boolean _existBack = false; _vertices = _graph.getVertices().toArray(); _edges = _graph.getEdges().toArray(); ArrayList writtenVertices = new ArrayList(); ArrayList writtenEdges = new ArrayList(); StringBuffer sourceFile = new StringBuffer(); /** * Read the original file first. If the methods already are defined in the file, * leave those methods alone. */ BufferedReader input = null; try { _logger.debug( "Try to open file: " + fileName ); input = new BufferedReader( new FileReader( fileName ) ); String line = null; while ( ( line = input.readLine() ) != null ) { sourceFile.append( line ); sourceFile.append( System.getProperty( "line.separator" ) ); } } catch ( FileNotFoundException e ) { _logger.error( "File not found exception: " + e.getMessage() ); } catch ( IOException e ) { _logger.error( "IO exception: " + e.getMessage() ); } finally { try { if ( input != null ) { input.close(); } } catch ( IOException e ) { _logger.error( "IO exception: " + e.getMessage() ); } } _logger.debug( sourceFile.toString() ); for ( int i = 0; i < _vertices.length; i++ ) { DirectedSparseVertex vertex = (DirectedSparseVertex)_vertices[ i ]; boolean duplicated = false; for ( Iterator iter = writtenVertices.iterator(); iter.hasNext(); ) { String str = (String) iter.next(); if ( str.equals( (String)vertex.getUserDatum( LABEL_KEY ) ) == true ) { duplicated = true; break; } } if ( _existBack == false ) { _existBack = true; Pattern p = Pattern.compile( "sub PressBackButton\\(\\)(.|[\\n\\r])*?\\{(.|[\\n\\r])*?\\}", Pattern.MULTILINE ); Matcher m = p.matcher( sourceFile ); if ( m.find() == false ) { sourceFile.append( "#\n" ); sourceFile.append( "# This method implements the edge: PressBackButton\n" ); sourceFile.append( "#\n" ); sourceFile.append( "sub PressBackButton()\n" ); sourceFile.append( "{\n" ); sourceFile.append( " print \"Edge: PressBackButton\n\";" ); sourceFile.append( " die \"Not implemented.\";\n" ); sourceFile.append( "}\n\n" ); } } if ( duplicated == false ) { Pattern p = Pattern.compile( "sub " + (String)vertex.getUserDatum( LABEL_KEY ) + "\\(\\)(.|[\\n\\r])*?\\{(.|[\\n\\r])*?\\}", Pattern.MULTILINE ); Matcher m = p.matcher( sourceFile ); if ( m.find() == false ) { sourceFile.append( "#\n" ); sourceFile.append( "# This method implements the verification of the vertex: " + (String)vertex.getUserDatum( LABEL_KEY ) + "\n" ); sourceFile.append( "#\n" ); sourceFile.append( "sub " + (String)vertex.getUserDatum( LABEL_KEY ) + "()\n" ); sourceFile.append( "{\n" ); sourceFile.append( " print \"Vertex: " + (String)vertex.getUserDatum( LABEL_KEY ) + "\n\";" ); sourceFile.append( " die \"Not implemented.\";\n" ); sourceFile.append( "}\n\n" ); } } writtenVertices.add( (String)vertex.getUserDatum( LABEL_KEY ) ); } for ( int i = 0; i < _edges.length; i++ ) { DirectedSparseEdge edge = (DirectedSparseEdge)_edges[ i ]; boolean duplicated = false; for ( Iterator iter = writtenEdges.iterator(); iter.hasNext(); ) { String str = (String) iter.next(); if ( str.equals( (String)edge.getUserDatum( LABEL_KEY ) ) == true ) { duplicated = true; break; } } if ( duplicated == false ) { Pattern p = Pattern.compile( "sub " + (String)edge.getUserDatum( LABEL_KEY ) + "\\(\\)(.|[\\n\\r])*?\\{(.|[\\n\\r])*?\\}", Pattern.MULTILINE ); Matcher m = p.matcher( sourceFile ); if ( m.find() == false ) { sourceFile.append( "#\n" ); sourceFile.append( "# This method implemets the edge: " + (String)edge.getUserDatum( LABEL_KEY ) + "\n" ); sourceFile.append( "#\n" ); sourceFile.append( "sub " + (String)edge.getUserDatum( LABEL_KEY ) + "()\n" ); sourceFile.append( "{\n" ); sourceFile.append( " print \"Edge: " + (String)edge.getUserDatum( LABEL_KEY ) + "\n\";" ); sourceFile.append( " die \"Not implemented.\";\n" ); sourceFile.append( "}\n\n" ); } } writtenEdges.add( (String)edge.getUserDatum( LABEL_KEY ) ); } try { FileWriter file = new FileWriter( fileName ); file.write( sourceFile.toString() ); file.flush(); } catch ( IOException e ) { _logger.error( e.getMessage() ); } }
public void generatePerlCode( String fileName ) { boolean _existBack = false; _vertices = _graph.getVertices().toArray(); _edges = _graph.getEdges().toArray(); ArrayList writtenVertices = new ArrayList(); ArrayList writtenEdges = new ArrayList(); StringBuffer sourceFile = new StringBuffer(); /** * Read the original file first. If the methods already are defined in the file, * leave those methods alone. */ BufferedReader input = null; try { _logger.debug( "Try to open file: " + fileName ); input = new BufferedReader( new FileReader( fileName ) ); String line = null; while ( ( line = input.readLine() ) != null ) { sourceFile.append( line ); sourceFile.append( System.getProperty( "line.separator" ) ); } } catch ( FileNotFoundException e ) { _logger.error( "File not found exception: " + e.getMessage() ); } catch ( IOException e ) { _logger.error( "IO exception: " + e.getMessage() ); } finally { try { if ( input != null ) { input.close(); } } catch ( IOException e ) { _logger.error( "IO exception: " + e.getMessage() ); } } _logger.debug( sourceFile.toString() ); for ( int i = 0; i < _vertices.length; i++ ) { DirectedSparseVertex vertex = (DirectedSparseVertex)_vertices[ i ]; boolean duplicated = false; for ( Iterator iter = writtenVertices.iterator(); iter.hasNext(); ) { String str = (String) iter.next(); if ( str.equals( (String)vertex.getUserDatum( LABEL_KEY ) ) == true ) { duplicated = true; break; } } if ( _existBack == false ) { _existBack = true; Pattern p = Pattern.compile( "sub PressBackButton\\(\\)(.|[\\n\\r])*?\\{(.|[\\n\\r])*?\\}", Pattern.MULTILINE ); Matcher m = p.matcher( sourceFile ); if ( m.find() == false ) { sourceFile.append( "#\n" ); sourceFile.append( "# This method implements the edge: PressBackButton\n" ); sourceFile.append( "#\n" ); sourceFile.append( "sub PressBackButton()\n" ); sourceFile.append( "{\n" ); sourceFile.append( " print \"Edge: PressBackButton\n\";" ); sourceFile.append( " die \"Not implemented.\";\n" ); sourceFile.append( "}\n\n" ); } } if ( duplicated == false ) { Pattern p = Pattern.compile( "sub " + (String)vertex.getUserDatum( LABEL_KEY ) + "\\(\\)(.|[\\n\\r])*?\\{(.|[\\n\\r])*?\\}", Pattern.MULTILINE ); Matcher m = p.matcher( sourceFile ); if ( m.find() == false ) { sourceFile.append( "#\n" ); sourceFile.append( "# This method implements the verification of the vertex: " + (String)vertex.getUserDatum( LABEL_KEY ) + "\n" ); sourceFile.append( "#\n" ); sourceFile.append( "sub " + (String)vertex.getUserDatum( LABEL_KEY ) + "()\n" ); sourceFile.append( "{\n" ); sourceFile.append( " print \"Vertex: " + (String)vertex.getUserDatum( LABEL_KEY ) + "\n\";" ); sourceFile.append( " die \"Not implemented.\";\n" ); sourceFile.append( "}\n\n" ); } } writtenVertices.add( (String)vertex.getUserDatum( LABEL_KEY ) ); } for ( int i = 0; i < _edges.length; i++ ) { DirectedSparseEdge edge = (DirectedSparseEdge)_edges[ i ]; boolean duplicated = false; for ( Iterator iter = writtenEdges.iterator(); iter.hasNext(); ) { String str = (String) iter.next(); if ( str.equals( (String)edge.getUserDatum( LABEL_KEY ) ) == true ) { duplicated = true; break; } } if ( duplicated == false ) { Pattern p = Pattern.compile( "sub " + (String)edge.getUserDatum( LABEL_KEY ) + "\\(\\)(.|[\\n\\r])*?\\{(.|[\\n\\r])*?\\}", Pattern.MULTILINE ); Matcher m = p.matcher( sourceFile ); if ( m.find() == false ) { sourceFile.append( "#\n" ); sourceFile.append( "# This method implemets the edge: " + (String)edge.getUserDatum( LABEL_KEY ) + "\n" ); sourceFile.append( "#\n" ); sourceFile.append( "sub " + (String)edge.getUserDatum( LABEL_KEY ) + "()\n" ); sourceFile.append( "{\n" ); sourceFile.append( " print \"Edge: " + (String)edge.getUserDatum( LABEL_KEY ) + "\n\";" ); sourceFile.append( " die \"Not implemented.\";\n" ); sourceFile.append( "}\n\n" ); } } writtenEdges.add( (String)edge.getUserDatum( LABEL_KEY ) ); } try { FileWriter file = new FileWriter( fileName ); file.write( sourceFile.toString() ); file.flush(); } catch ( IOException e ) { _logger.error( e.getMessage() ); } }
3,240,502
public void generatePerlCode( String fileName ) { boolean _existBack = false; _vertices = _graph.getVertices().toArray(); _edges = _graph.getEdges().toArray(); ArrayList writtenVertices = new ArrayList(); ArrayList writtenEdges = new ArrayList(); StringBuffer sourceFile = new StringBuffer(); /** * Read the original file first. If the methods already are defined in the file, * leave those methods alone. */ BufferedReader input = null; try { _logger.debug( "Try to open file: " + fileName ); input = new BufferedReader( new FileReader( fileName ) ); String line = null; while ( ( line = input.readLine() ) != null ) { sourceFile.append( line ); sourceFile.append( System.getProperty( "line.separator" ) ); } } catch ( FileNotFoundException e ) { _logger.error( "File not found exception: " + e.getMessage() ); } catch ( IOException e ) { _logger.error( "IO exception: " + e.getMessage() ); } finally { try { if ( input != null ) { input.close(); } } catch ( IOException e ) { _logger.error( "IO exception: " + e.getMessage() ); } } _logger.debug( sourceFile.toString() ); for ( int i = 0; i < _vertices.length; i++ ) { DirectedSparseVertex vertex = (DirectedSparseVertex)_vertices[ i ]; boolean duplicated = false; for ( Iterator iter = writtenVertices.iterator(); iter.hasNext(); ) { String str = (String) iter.next(); if ( str.equals( (String)vertex.getUserDatum( LABEL_KEY ) ) == true ) { duplicated = true; break; } } if ( _existBack == false ) { _existBack = true; Pattern p = Pattern.compile( "sub PressBackButton\\(\\)(.|[\\n\\r])*?\\{(.|[\\n\\r])*?\\}", Pattern.MULTILINE ); Matcher m = p.matcher( sourceFile ); if ( m.find() == false ) { sourceFile.append( "#\n" ); sourceFile.append( "# This method implements the edge: PressBackButton\n" ); sourceFile.append( "#\n" ); sourceFile.append( "sub PressBackButton()\n" ); sourceFile.append( "{\n" ); sourceFile.append( " print \"Edge: PressBackButton\n\";" ); sourceFile.append( " die \"Not implemented.\";\n" ); sourceFile.append( "}\n\n" ); } } if ( duplicated == false ) { Pattern p = Pattern.compile( "sub " + (String)vertex.getUserDatum( LABEL_KEY ) + "\\(\\)(.|[\\n\\r])*?\\{(.|[\\n\\r])*?\\}", Pattern.MULTILINE ); Matcher m = p.matcher( sourceFile ); if ( m.find() == false ) { sourceFile.append( "#\n" ); sourceFile.append( "# This method implements the verification of the vertex: " + (String)vertex.getUserDatum( LABEL_KEY ) + "\n" ); sourceFile.append( "#\n" ); sourceFile.append( "sub " + (String)vertex.getUserDatum( LABEL_KEY ) + "()\n" ); sourceFile.append( "{\n" ); sourceFile.append( " print \"Vertex: " + (String)vertex.getUserDatum( LABEL_KEY ) + "\n\";" ); sourceFile.append( " die \"Not implemented.\";\n" ); sourceFile.append( "}\n\n" ); } } writtenVertices.add( (String)vertex.getUserDatum( LABEL_KEY ) ); } for ( int i = 0; i < _edges.length; i++ ) { DirectedSparseEdge edge = (DirectedSparseEdge)_edges[ i ]; boolean duplicated = false; for ( Iterator iter = writtenEdges.iterator(); iter.hasNext(); ) { String str = (String) iter.next(); if ( str.equals( (String)edge.getUserDatum( LABEL_KEY ) ) == true ) { duplicated = true; break; } } if ( duplicated == false ) { Pattern p = Pattern.compile( "sub " + (String)edge.getUserDatum( LABEL_KEY ) + "\\(\\)(.|[\\n\\r])*?\\{(.|[\\n\\r])*?\\}", Pattern.MULTILINE ); Matcher m = p.matcher( sourceFile ); if ( m.find() == false ) { sourceFile.append( "#\n" ); sourceFile.append( "# This method implemets the edge: " + (String)edge.getUserDatum( LABEL_KEY ) + "\n" ); sourceFile.append( "#\n" ); sourceFile.append( "sub " + (String)edge.getUserDatum( LABEL_KEY ) + "()\n" ); sourceFile.append( "{\n" ); sourceFile.append( " print \"Edge: " + (String)edge.getUserDatum( LABEL_KEY ) + "\n\";" ); sourceFile.append( " die \"Not implemented.\";\n" ); sourceFile.append( "}\n\n" ); } } writtenEdges.add( (String)edge.getUserDatum( LABEL_KEY ) ); } try { FileWriter file = new FileWriter( fileName ); file.write( sourceFile.toString() ); file.flush(); } catch ( IOException e ) { _logger.error( e.getMessage() ); } }
public void generatePerlCode( String fileName ) { boolean _existBack = false; _vertices = _graph.getVertices().toArray(); _edges = _graph.getEdges().toArray(); ArrayList writtenVertices = new ArrayList(); ArrayList writtenEdges = new ArrayList(); StringBuffer sourceFile = new StringBuffer(); /** * Read the original file first. If the methods already are defined in the file, * leave those methods alone. */ BufferedReader input = null; try { _logger.debug( "Try to open file: " + fileName ); input = new BufferedReader( new FileReader( fileName ) ); String line = null; while ( ( line = input.readLine() ) != null ) { sourceFile.append( line ); sourceFile.append( System.getProperty( "line.separator" ) ); } } catch ( FileNotFoundException e ) { _logger.error( "File not found exception: " + e.getMessage() ); } catch ( IOException e ) { _logger.error( "IO exception: " + e.getMessage() ); } finally { try { if ( input != null ) { input.close(); } } catch ( IOException e ) { _logger.error( "IO exception: " + e.getMessage() ); } } _logger.debug( sourceFile.toString() ); for ( int i = 0; i < _vertices.length; i++ ) { DirectedSparseVertex vertex = (DirectedSparseVertex)_vertices[ i ]; boolean duplicated = false; for ( Iterator iter = writtenVertices.iterator(); iter.hasNext(); ) { String str = (String) iter.next(); if ( str.equals( (String)vertex.getUserDatum( LABEL_KEY ) ) == true ) { duplicated = true; break; } } if ( _existBack == false ) { _existBack = true; Pattern p = Pattern.compile( "sub PressBackButton\\(\\)(.|[\\n\\r])*?\\{(.|[\\n\\r])*?\\}", Pattern.MULTILINE ); Matcher m = p.matcher( sourceFile ); if ( m.find() == false ) { sourceFile.append( "#\n" ); sourceFile.append( "# This method implements the edge: PressBackButton\n" ); sourceFile.append( "#\n" ); sourceFile.append( "sub PressBackButton()\n" ); sourceFile.append( "{\n" ); sourceFile.append( " print \"Edge: PressBackButton\n\";" ); sourceFile.append( " die \"Not implemented.\";\n" ); sourceFile.append( "}\n\n" ); } } if ( duplicated == false ) { Pattern p = Pattern.compile( "sub " + (String)vertex.getUserDatum( LABEL_KEY ) + "\\(\\)(.|[\\n\\r])*?\\{(.|[\\n\\r])*?\\}", Pattern.MULTILINE ); Matcher m = p.matcher( sourceFile ); if ( m.find() == false ) { sourceFile.append( "#\n" ); sourceFile.append( "# This method implements the verification of the vertex: " + (String)vertex.getUserDatum( LABEL_KEY ) + "\n" ); sourceFile.append( "#\n" ); sourceFile.append( "sub " + (String)vertex.getUserDatum( LABEL_KEY ) + "()\n" ); sourceFile.append( "{\n" ); sourceFile.append( " print \"Vertex: " + (String)vertex.getUserDatum( LABEL_KEY ) + "\n\";" ); sourceFile.append( " die \"Not implemented.\";\n" ); sourceFile.append( "}\n\n" ); } } writtenVertices.add( (String)vertex.getUserDatum( LABEL_KEY ) ); } for ( int i = 0; i < _edges.length; i++ ) { DirectedSparseEdge edge = (DirectedSparseEdge)_edges[ i ]; boolean duplicated = false; for ( Iterator iter = writtenEdges.iterator(); iter.hasNext(); ) { String str = (String) iter.next(); if ( str.equals( (String)edge.getUserDatum( LABEL_KEY ) ) == true ) { duplicated = true; break; } } if ( duplicated == false ) { Pattern p = Pattern.compile( "sub " + (String)edge.getUserDatum( LABEL_KEY ) + "\\(\\)(.|[\\n\\r])*?\\{(.|[\\n\\r])*?\\}", Pattern.MULTILINE ); Matcher m = p.matcher( sourceFile ); if ( m.find() == false ) { sourceFile.append( "#\n" ); sourceFile.append( "# This method implemets the edge: " + (String)edge.getUserDatum( LABEL_KEY ) + "\n" ); sourceFile.append( "#\n" ); sourceFile.append( "sub " + (String)edge.getUserDatum( LABEL_KEY ) + "()\n" ); sourceFile.append( "{\n" ); sourceFile.append( " print \"Edge: " + (String)edge.getUserDatum( LABEL_KEY ) + "\n\";" ); sourceFile.append( " die \"Not implemented.\";\n" ); sourceFile.append( "}\n\n" ); } } writtenEdges.add( (String)edge.getUserDatum( LABEL_KEY ) ); } try { FileWriter file = new FileWriter( fileName ); file.write( sourceFile.toString() ); file.flush(); } catch ( IOException e ) { _logger.error( e.getMessage() ); } }
3,240,503
public void lookupRenderingDef(long pixelsId) { rwl.writeLock().lock(); try { rendDefObj = pixMetaSrv.retrieveRndSettings(pixelsId); renderer = null; if (rendDefObj == null) { // We've been initialized on a pixels set that has no rendering // definition for the given user. In order to keep the proper // bean state, we initialize the local instance variable and // write out new rendering settings into the database. rendDefObj = Renderer.createNewRenderingDef(pixelsObj); Renderer.resetDefaults(rendDefObj, pixelsObj, pixMetaSrv); pixMetaSrv.saveRndSettings(rendDefObj); iUpdate.flush(); rendDefObj = pixMetaSrv.retrieveRndSettings(pixelsId); } } finally { rwl.writeLock().unlock(); } if (log.isDebugEnabled()) log.debug("lookupRenderingDef for Pixels="+pixelsId+" succeeded: "+this.rendDefObj); }
public void lookupRenderingDef(long pixelsId) { rwl.writeLock().lock(); try { rendDefObj = pixMetaSrv.retrieveRndSettings(pixelsId); renderer = null; if (rendDefObj == null) { // We've been initialized on a pixels set that has no rendering // definition for the given user. In order to keep the proper // bean state, we initialize the local instance variable and // write out new rendering settings into the database. rendDefObj = Renderer.createNewRenderingDef(pixelsObj); Renderer.resetDefaults(rendDefObj, pixelsObj, pixMetaSrv, buffer); pixMetaSrv.saveRndSettings(rendDefObj); iUpdate.flush(); rendDefObj = pixMetaSrv.retrieveRndSettings(pixelsId); } } finally { rwl.writeLock().unlock(); } if (log.isDebugEnabled()) log.debug("lookupRenderingDef for Pixels="+pixelsId+" succeeded: "+this.rendDefObj); }
3,240,504
public Renderer(IPixels iPixels, Pixels pixelsObj, RenderingDef renderingDefObj, PixelBuffer bufferObj) { metadata = pixelsObj; rndDef = renderingDefObj; buffer = bufferObj; this.iPixels = iPixels; if (metadata == null) throw new NullPointerException("Expecting not null metadata"); else if (rndDef == null) throw new NullPointerException("Expecting not null rndDef"); else if (buffer == null) throw new NullPointerException("Expecting not null buffer"); //Create and configure the quantum strategies. QuantumDef qd = rndDef.getQuantization(); quantumManager = new QuantumManager(metadata, iPixels); ChannelBinding[] cBindings= getChannelBindings(); quantumManager.initStrategies(qd, metadata.getPixelsType(), cBindings); //Compute the location stats. computeLocationStats(getDefaultPlaneDef()); //Create and configure the codomain chain. codomainChain = new CodomainChain(qd.getCdStart().intValue(), qd.getCdEnd().intValue(), rndDef.getSpatialDomainEnhancement()); //Create an appropriate rendering strategy. renderingStrategy = RenderingStrategy.makeNew(rndDef.getModel()); }
public Renderer(IPixels iPixels, Pixels pixelsObj, RenderingDef renderingDefObj, PixelBuffer bufferObj) { metadata = pixelsObj; rndDef = renderingDefObj; buffer = bufferObj; this.iPixels = iPixels; if (metadata == null) throw new NullPointerException("Expecting not null metadata"); else if (rndDef == null) throw new NullPointerException("Expecting not null rndDef"); else if (buffer == null) throw new NullPointerException("Expecting not null buffer"); //Create and configure the quantum strategies. QuantumDef qd = rndDef.getQuantization(); quantumManager = new QuantumManager(metadata, iPixels); ChannelBinding[] cBindings= getChannelBindings(); quantumManager.initStrategies(qd, metadata.getPixelsType(), cBindings); //Compute the location stats. //Create and configure the codomain chain. codomainChain = new CodomainChain(qd.getCdStart().intValue(), qd.getCdEnd().intValue(), rndDef.getSpatialDomainEnhancement()); //Create an appropriate rendering strategy. renderingStrategy = RenderingStrategy.makeNew(rndDef.getModel()); }
3,240,505
public void resetDefaults() { // Reset our default rendering definition parameters. resetDefaults(rndDef, getMetadata(), iPixels); // Keep up with rendering engine model state. setModel(rndDef.getModel()); // Remove all the codomainMapCtx except the identity. (Also keeping up // with rendering engine state) if (getCodomainChain() != null) getCodomainChain().remove(); // Save the rendering definition to the database. iPixels.saveRndSettings(rndDef); }
public void resetDefaults() { // Reset our default rendering definition parameters. resetDefaults(rndDef, getMetadata(), iPixels, buffer); // Keep up with rendering engine model state. setModel(rndDef.getModel()); // Remove all the codomainMapCtx except the identity. (Also keeping up // with rendering engine state) if (getCodomainChain() != null) getCodomainChain().remove(); // Save the rendering definition to the database. iPixels.saveRndSettings(rndDef); }
3,240,506
public boolean validate(ProcessingClient client) { InetAddress inet = null; String host = "localhost"; boolean retValue = false; int numfields = client.getNumFields(); for (int i = 0; i < numfields; i++) { String value = client.getFieldContents(i); if ((value == null) || (value.length() == 0)) { return false; } try { inet = InetAddress.getByName(host); ServerSocket socket = new ServerSocket(Integer.parseInt(value), 0, inet); if (socket.getLocalPort() > 0) { retValue = true; } else { retValue = false; } if (!retValue) { break; } socket.close(); } catch (Exception ex) { retValue = false; } } return retValue; }
public boolean validate(ProcessingClient client) { InetAddress inet = null; String host = "localhost"; boolean retValue = false; int numfields = client.getNumFields(); for (int i = 0; i < numfields; i++) { String value = client.getFieldContents(i); if ((value == null) || (value.length() == 0)) { return false; } try { inet = InetAddress.getByName(host); ServerSocket socket = new ServerSocket(Integer.parseInt(value), 0, inet); if (socket.getLocalPort() > 0) { retValue = true; } else { retValue = false; } if (!retValue) { break; } socket.close(); } catch (Exception ex) { retValue = false; } } return retValue; }
3,240,507
public boolean getUser(UserEdit edit) { if (!userExists(edit.getId())) return false; edit.setEmail(edit.getId() + "@" + m_domain); edit.setType("kerberos"); return true; } // getUser
public boolean getUser(UserEdit edit) { if (!userExists(edit.getId())) return false; edit.setEmail(edit.getId() + "@" + m_domain); edit.setType("kerberos"); return true; } // getUser
3,240,508
public boolean getUser(UserEdit edit) { if (!userExists(edit.getId())) return false; edit.setEmail(edit.getId() + "@" + m_domain); edit.setType("kerberos"); return true; } // getUser
public boolean getUser(UserEdit edit) { if (!userExists(edit.getId())) return false; edit.setEmail(edit.getId() + "@" + m_domain); edit.setType("kerberos"); return true; } // getUser
3,240,509
public Unpacker(AutomatedInstallData idata, AbstractUIProgressHandler handler) { super("IzPack - Unpacker thread"); this.idata = idata; this.handler = handler; // Initialize the variable substitutor vs = new VariableSubstitutor(idata.getVariableValueMap()); }
public Unpacker( AutomatedInstallData idata, AbstractUIProgressHandler handler) { super("IzPack - Unpacker thread"); this.idata = idata; this.handler = handler; // Initialize the variable substitutor vs = new VariableSubstitutor(idata.getVariableValueMap()); }
3,240,510
private boolean fileMatchesOnePattern(String filename, ArrayList patterns) { // first check whether any include matches for (Iterator inc_it = patterns.iterator(); inc_it.hasNext();) { RE pattern = (RE)inc_it.next(); if (pattern.match(filename)) { return true; } } return false; }
private boolean fileMatchesOnePattern(String filename, ArrayList patterns) { // first check whether any include matches for (Iterator inc_it = patterns.iterator(); inc_it.hasNext();) { RE pattern = (RE) inc_it.next(); if (pattern.match(filename)) { return true; } } return false; }
3,240,511
private boolean fileMatchesOnePattern(String filename, ArrayList patterns) { // first check whether any include matches for (Iterator inc_it = patterns.iterator(); inc_it.hasNext();) { RE pattern = (RE)inc_it.next(); if (pattern.match(filename)) { return true; } } return false; }
private boolean fileMatchesOnePattern(String filename, ArrayList patterns) { // first check whether any include matches for (Iterator inc_it = patterns.iterator(); inc_it.hasNext();) { RE pattern = (RE)inc_it.next(); if (pattern.match(filename)) { return true; } } return false; }
3,240,512
private InputStream getPackAsStream(int n) throws Exception { InputStream in = null; if (idata.kind.equalsIgnoreCase("standard") || idata.kind.equalsIgnoreCase("standard-kunststoff")) in = getClass().getResourceAsStream("/packs/pack" + n); else if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { URL url = new URL("jar:" + jarLocation + "!/packs/pack" + n); JarURLConnection jarConnection = (JarURLConnection) url.openConnection(); in = jarConnection.getInputStream(); } return in; }
private InputStream getPackAsStream(int n) throws Exception { InputStream in = null; if (idata.kind.equalsIgnoreCase("standard") || idata.kind.equalsIgnoreCase("standard-kunststoff")) in = getClass().getResourceAsStream("/packs/pack" + n); else if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { URL url = new URL("jar:" + jarLocation + "!/packs/pack" + n); JarURLConnection jarConnection = (JarURLConnection) url.openConnection(); in = jarConnection.getInputStream(); } return in; }
3,240,513
private InputStream getPackAsStream(int n) throws Exception { InputStream in = null; if (idata.kind.equalsIgnoreCase("standard") || idata.kind.equalsIgnoreCase("standard-kunststoff")) in = getClass().getResourceAsStream("/packs/pack" + n); else if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { URL url = new URL("jar:" + jarLocation + "!/packs/pack" + n); JarURLConnection jarConnection = (JarURLConnection) url.openConnection(); in = jarConnection.getInputStream(); } return in; }
private InputStream getPackAsStream(int n) throws Exception { InputStream in = null; if (idata.kind.equalsIgnoreCase("standard") || idata.kind.equalsIgnoreCase("standard-kunststoff")) in = getClass().getResourceAsStream("/packs/pack" + n); else if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { URL url = new URL("jar:" + jarLocation + "!/packs/pack" + n); JarURLConnection jarConnection = (JarURLConnection) url.openConnection(); in = jarConnection.getInputStream(); } return in; }
3,240,514
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList(); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,515
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,516
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck) iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,517
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns(uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,518
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns(uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,519
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,520
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,521
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,522
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,523
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,524
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File(this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,525
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,526
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,527
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack(); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,528
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList(); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,529
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,530
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File) scanstack.pop(); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,531
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,532
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath() + "is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,533
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,534
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,535
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath(); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,536
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,537
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add(newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,538
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,539
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push(newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,540
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,541
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,542
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,543
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
private void performUpdateChecks(ArrayList updatechecks) { ArrayList include_patterns = new ArrayList(); ArrayList exclude_patterns = new ArrayList (); RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile(); // at first, collect all patterns for (Iterator iter = updatechecks.iterator(); iter.hasNext();) { UpdateCheck uc = (UpdateCheck)iter.next(); if (uc.includesList != null) include_patterns.addAll(preparePatterns (uc.includesList, recompiler)); if (uc.excludesList != null) exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler)); } // do nothing if no update checks were specified if (include_patterns.size() == 0) return; // now collect all files in the installation directory and figure // out files to check for deletion // use a treeset for fast access TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();) { String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute()) { f = new File (this.absolute_installpath, fname); } installed_files.add(f.getAbsolutePath()); } // now scan installation directory (breadth first), contains Files of directories to scan // (note: we'll recurse infinitely if there are circular links or similar nasty things) Stack scanstack = new Stack (); // contains File objects determined for deletion ArrayList files_to_delete = new ArrayList (); try { scanstack.add (absolute_installpath); while (! scanstack.empty ()) { File f = (File)scanstack.pop (); File[] files = f.listFiles(); if (files == null) { throw new IOException(f.getPath()+"is not a directory!"); } for (int i = 0; i < files.length; i++) { File newf = files[i]; String newfname = newf.getPath (); // skip files we just installed if (installed_files.contains(newfname)) continue; if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns))) { files_to_delete.add (newf); } if (newf.isDirectory()) { scanstack.push (newf); } } } } catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); } for (Iterator f_it = files_to_delete.iterator(); f_it.hasNext();) { File f = (File)f_it.next(); if (! f.isDirectory()) // skip directories - they cannot be removed safely yet { this.handler.emitNotification("deleting "+f.getPath()); f.delete(); } } }
3,240,544
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,545
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,546
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,547
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,548
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File(element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,549
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (!f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,550
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File(this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,551
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,552
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer(); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,553
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,554
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,555
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,556
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,557
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,558
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,559
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append(File.separator); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append(File.separator); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,560
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,561
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,562
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } case '*' : c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } case '*' : { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,563
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { if (pos == element.length()) { element_re.append("[^" + File.separator + "]*"); break; } lookahead = element.charAt(pos++); if (lookahead == '*') { element_re.append(".*"); lookahead = -1; } else { element_re.append("[^" + File.separator + "]*"); } break; break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { if (pos == element.length()) { element_re.append("[^" + File.separator + "]*"); break; } lookahead = element.charAt(pos++); if (lookahead == '*') { element_re.append(".*"); lookahead = -1; } else { element_re.append("[^" + File.separator + "]*"); } break; // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,564
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,565
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,566
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,567
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,568
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add(new RE(recompiler.compile(element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification( "internal error: pattern \"" + element + "\" produced invalid RE \"" + f.getPath() + "\""); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,569
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,570
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
private List preparePatterns(ArrayList list, RECompiler recompiler) { ArrayList result = new ArrayList(); for (Iterator iter = list.iterator(); iter.hasNext();) { String element = (String)iter.next(); if ((element != null) && (element.length()>0)) { // substitute variables in the pattern element = this.vs.substitute(element, "plain"); // check whether the pattern is absolute or relative File f = new File (element); // if it is relative, make it absolute and prepend the installation path // (this is a bit dangerous...) if (! f.isAbsolute()) { element = new File (this.absolute_installpath, element).toString(); } // now parse the element and construct a regular expression from it // (we have to parse it one character after the next because every // character should only be processed once - it's not possible to get this // correct using regular expression replacing) StringBuffer element_re = new StringBuffer (); int lookahead = -1; int pos = 0; while (pos < element.length()) { char c; if (lookahead != -1) { c = (char)lookahead; lookahead = -1; } else c = element.charAt(pos++); switch (c) { case '/': { element_re.append (File.separator); break; } // escape backslash and dot case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length()) { element_re.append ("[^"+File.separator+"]*"); break; } lookahead = element.charAt(pos++); // check for "**" if (lookahead == '*') { element_re.append (".*"); // consume second star lookahead = -1; } else { element_re.append ("[^"+File.separator+"]*"); // lookahead stays there } break; } default: { element_re.append (c); break; } } // switch } // make sure that the whole expression is matched element_re.append ('$'); // replace \ by \\ and create a RE from the result try { result.add (new RE(recompiler.compile (element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); } } } return result; }
3,240,571
private void putUninstaller() throws Exception { // Me make the .uninstaller directory String dest = translatePath("$INSTALL_PATH") + File.separator + "Uninstaller"; String jar = dest + File.separator + "uninstaller.jar"; File pathMaker = new File(dest); pathMaker.mkdirs(); // We log the uninstaller deletion information udata.setUninstallerJarFilename(jar); udata.setUninstallerPath(dest); // We open our final jar file FileOutputStream out = new FileOutputStream(jar); ZipOutputStream outJar = new ZipOutputStream(out); idata.uninstallOutJar = outJar; outJar.setLevel(9); udata.addFile(jar); // We copy the uninstaller InputStream in = getClass().getResourceAsStream("/res/IzPack.uninstaller"); ZipInputStream inRes = new ZipInputStream(in); ZipEntry zentry = inRes.getNextEntry(); while (zentry != null) { // Puts a new entry outJar.putNextEntry(new ZipEntry(zentry.getName())); // Byte to byte copy int unc = inRes.read(); while (unc != -1) { outJar.write(unc); unc = inRes.read(); } // Next one please inRes.closeEntry(); outJar.closeEntry(); zentry = inRes.getNextEntry(); } inRes.close(); // We put the langpack in = getClass().getResourceAsStream("/langpacks/" + idata.localeISO3 + ".xml"); outJar.putNextEntry(new ZipEntry("langpack.xml")); int read = in.read(); while (read != -1) { outJar.write(read); read = in.read(); } outJar.closeEntry(); }
private void putUninstaller() throws Exception { // Me make the .uninstaller directory String dest = translatePath("$INSTALL_PATH") + File.separator + "Uninstaller"; String jar = dest + File.separator + "uninstaller.jar"; File pathMaker = new File(dest); pathMaker.mkdirs(); // We log the uninstaller deletion information udata.setUninstallerJarFilename(jar); udata.setUninstallerPath(dest); // We open our final jar file FileOutputStream out = new FileOutputStream(jar); ZipOutputStream outJar = new ZipOutputStream(out); idata.uninstallOutJar = outJar; outJar.setLevel(9); udata.addFile(jar); // We copy the uninstaller InputStream in = getClass().getResourceAsStream("/res/IzPack.uninstaller"); ZipInputStream inRes = new ZipInputStream(in); ZipEntry zentry = inRes.getNextEntry(); while (zentry != null) { // Puts a new entry outJar.putNextEntry(new ZipEntry(zentry.getName())); // Byte to byte copy int unc = inRes.read(); while (unc != -1) { outJar.write(unc); unc = inRes.read(); } // Next one please inRes.closeEntry(); outJar.closeEntry(); zentry = inRes.getNextEntry(); } inRes.close(); // We put the langpack in = getClass().getResourceAsStream("/langpacks/" + idata.localeISO3 + ".xml"); outJar.putNextEntry(new ZipEntry("langpack.xml")); int read = in.read(); while (read != -1) { outJar.write(read); read = in.read(); } outJar.closeEntry(); }
3,240,572
private void putUninstaller() throws Exception { // Me make the .uninstaller directory String dest = translatePath("$INSTALL_PATH") + File.separator + "Uninstaller"; String jar = dest + File.separator + "uninstaller.jar"; File pathMaker = new File(dest); pathMaker.mkdirs(); // We log the uninstaller deletion information udata.setUninstallerJarFilename(jar); udata.setUninstallerPath(dest); // We open our final jar file FileOutputStream out = new FileOutputStream(jar); ZipOutputStream outJar = new ZipOutputStream(out); idata.uninstallOutJar = outJar; outJar.setLevel(9); udata.addFile(jar); // We copy the uninstaller InputStream in = getClass().getResourceAsStream("/res/IzPack.uninstaller"); ZipInputStream inRes = new ZipInputStream(in); ZipEntry zentry = inRes.getNextEntry(); while (zentry != null) { // Puts a new entry outJar.putNextEntry(new ZipEntry(zentry.getName())); // Byte to byte copy int unc = inRes.read(); while (unc != -1) { outJar.write(unc); unc = inRes.read(); } // Next one please inRes.closeEntry(); outJar.closeEntry(); zentry = inRes.getNextEntry(); } inRes.close(); // We put the langpack in = getClass().getResourceAsStream("/langpacks/" + idata.localeISO3 + ".xml"); outJar.putNextEntry(new ZipEntry("langpack.xml")); int read = in.read(); while (read != -1) { outJar.write(read); read = in.read(); } outJar.closeEntry(); }
private void putUninstaller() throws Exception { // Me make the .uninstaller directory String dest = translatePath("$INSTALL_PATH") + File.separator + "Uninstaller"; String jar = dest + File.separator + "uninstaller.jar"; File pathMaker = new File(dest); pathMaker.mkdirs(); // We log the uninstaller deletion information udata.setUninstallerJarFilename(jar); udata.setUninstallerPath(dest); // We open our final jar file FileOutputStream out = new FileOutputStream(jar); ZipOutputStream outJar = new ZipOutputStream(out); idata.uninstallOutJar = outJar; outJar.setLevel(9); udata.addFile(jar); // We copy the uninstaller InputStream in = getClass().getResourceAsStream("/res/IzPack.uninstaller"); ZipInputStream inRes = new ZipInputStream(in); ZipEntry zentry = inRes.getNextEntry(); while (zentry != null) { // Puts a new entry outJar.putNextEntry(new ZipEntry(zentry.getName())); // Byte to byte copy int unc = inRes.read(); while (unc != -1) { outJar.write(unc); unc = inRes.read(); } // Next one please inRes.closeEntry(); outJar.closeEntry(); zentry = inRes.getNextEntry(); } inRes.close(); // We put the langpack in = getClass().getResourceAsStream("/langpacks/" + idata.localeISO3 + ".xml"); outJar.putNextEntry(new ZipEntry("langpack.xml")); int read = in.read(); while (read != -1) { outJar.write(read); read = in.read(); } outJar.closeEntry(); }
3,240,573
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,574
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,575
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,576
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,577
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,578
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,579
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (!dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,580
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,581
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress(j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,582
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,583
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,584
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,585
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,586
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,587
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,588
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (!overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,589
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,590
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,591
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,592
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,593
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified(pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,594
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,595
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if(ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
public void run() { instances.add(this); try { // // Initialisations FileOutputStream out = null; ArrayList parsables = new ArrayList(); ArrayList executables = new ArrayList(); ArrayList updatechecks = new ArrayList(); List packs = idata.selectedPacks; int npacks = packs.size(); handler.startAction ("Unpacking", npacks); udata = UninstallData.getInstance(); // Specific to the web installers if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff")) { InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url"); BufferedReader kreader = new BufferedReader(new InputStreamReader(kin)); jarLocation = kreader.readLine(); } // We unpack the selected packs for (int i = 0; i < npacks; i++) { // We get the pack stream int n = idata.allPacks.indexOf(packs.get(i)); ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n)); // We unpack the files int nfiles = objIn.readInt(); handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles); for (int j = 0; j < nfiles; j++) { // We read the header PackFile pf = (PackFile) objIn.readObject(); if (OsConstraint.oneMatchesCurrentSystem(pf.osConstraints)) { // We translate & build the path String path = translatePath(pf.targetPath); File pathFile = new File(path); File dest = pathFile.getParentFile(); if (!dest.exists()) { if (! dest.mkdirs()) { handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction (); return; } } // We add the path to the log, udata.addFile(path); handler.progress (j, path); //if this file exists and should not be overwritten, check //what to do if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE)) { boolean overwritefile = false; // don't overwrite file if the user said so if (pf.override != PackFile.OVERRIDE_FALSE) { if (pf.override == PackFile.OVERRIDE_TRUE) { overwritefile = true; } else if (pf.override == PackFile.OVERRIDE_UPDATE) { // check mtime of involved files // (this is not 100% perfect, because the already existing file might // still be modified but the new installed is just a bit newer; we would // need the creation time of the existing file or record with which mtime // it was installed...) overwritefile = (pathFile.lastModified() < pf.mtime); } else { int def_choice = -1; if (pf.override == PackFile.OVERRIDE_ASK_FALSE) def_choice = AbstractUIHandler.ANSWER_NO; if (pf.override == PackFile.OVERRIDE_ASK_TRUE) def_choice = AbstractUIHandler.ANSWER_YES; int answer = handler.askQuestion ( idata.langpack.getString ("InstallPanel.overwrite.title") + pathFile.getName (), idata.langpack.getString ("InstallPanel.overwrite.question") + pathFile.getAbsolutePath(), AbstractUIHandler.CHOICES_YES_NO, def_choice); overwritefile = (answer == AbstractUIHandler.ANSWER_YES); } } if (! overwritefile) { if (!pf.isBackReference()) objIn.skip(pf.length); continue; } } // We copy the file out = new FileOutputStream(pathFile); byte[] buffer = new byte[5120]; long bytesCopied = 0; ObjectInputStream pis = objIn; if (pf.isBackReference()) { InputStream is = getPackAsStream(pf.previousPackNumber); pis = new ObjectInputStream(is);//must wrap for blockdata use by objectstream (otherwise strange result) //skip on underlaying stream (for some reason not possible on ObjectStream) is.skip(pf.offsetInPreviousPack - 4); //but the stream header is now already read (== 4 bytes) } while (bytesCopied < pf.length) { int maxBytes = (pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length); int bytesInBuffer = pis.read(buffer, 0, maxBytes); if (bytesInBuffer == -1) throw new IOException("Unexpected end of stream"); out.write(buffer, 0, bytesInBuffer); bytesCopied += bytesInBuffer; } // Cleanings out.close(); if (pis != objIn) pis.close(); // Set file modification time if specified if (pf.mtime >= 0) pathFile.setLastModified (pf.mtime); // Empty dirs restoring String _n = pathFile.getName(); if (_n.startsWith("izpack-keepme") && _n.endsWith(".tmp")) pathFile.delete(); } else { if (!pf.isBackReference()) objIn.skip(pf.length); } } // Load information about parsable files int numParsables = objIn.readInt(); for (int k = 0; k < numParsables; k++) { ParsableFile pf = (ParsableFile) objIn.readObject(); pf.path = translatePath(pf.path); parsables.add(pf); } // Load information about executable files int numExecutables = objIn.readInt(); for (int k = 0; k < numExecutables; k++) { ExecutableFile ef = (ExecutableFile) objIn.readObject(); ef.path = translatePath(ef.path); if (null != ef.argList && !ef.argList.isEmpty()) { String arg = null; for (int j = 0; j < ef.argList.size(); j++) { arg = (String) ef.argList.get(j); arg = translatePath(arg); ef.argList.set(j, arg); } } executables.add(ef); if (ef.executionStage == ExecutableFile.UNINSTALL) { udata.addExecutable(ef); } } // Load information about updatechecks int numUpdateChecks = objIn.readInt(); for (int k = 0; k < numUpdateChecks; k++) { UpdateCheck uc = (UpdateCheck) objIn.readObject(); updatechecks.add (uc); } objIn.close(); } // We use the scripts parser ScriptParser parser = new ScriptParser(parsables, vs); parser.parseFiles(); // We use the file executor FileExecutor executor = new FileExecutor(executables); if (executor.executeFiles(ExecutableFile.POSTINSTALL, handler) != 0) handler.emitError ("File execution failed", "The installation was not completed"); // We put the uninstaller (it's not yet complete...) if (idata.info.getWriteUninstaller()) putUninstaller(); // update checks _after_ uninstaller was put, so we don't delete it performUpdateChecks (updatechecks); // The end :-) handler.stopAction(); } catch (Exception err) { // TODO: finer grained error handling with useful error messages handler.stopAction(); handler.emitError ("An error occured", err.toString()); err.printStackTrace (); } finally { instances.remove(instances.indexOf(this)); } }
3,240,596