rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
meta
stringlengths
141
403
infoLabel = LabelFactory.create(parent.langpack.getString("LicencePanel.info"),
JLabel infoLabel = LabelFactory.create(parent.langpack.getString("LicencePanel.info"),
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); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/HTMLLicencePanel.java/clean/src/lib/com/izforge/izpack/panels/HTMLLicencePanel.java
sourceFile.append( " print \"Edge: PressBackButton\n\";" );
sourceFile.append( " print \"Edge: PressBackButton\";\n" );
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() ); } }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/fd70dd64929aafa0fb4be3d223126bc9bb9d2adc/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
sourceFile.append( " print \"Vertex: " + (String)vertex.getUserDatum( LABEL_KEY ) + "\n\";" );
sourceFile.append( " print \"Vertex: " + (String)vertex.getUserDatum( LABEL_KEY ) + "\";\n" );
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() ); } }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/fd70dd64929aafa0fb4be3d223126bc9bb9d2adc/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
sourceFile.append( " print \"Edge: " + (String)edge.getUserDatum( LABEL_KEY ) + "\n\";" );
sourceFile.append( " print \"Edge: " + (String)edge.getUserDatum( LABEL_KEY ) + "\";\n" );
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() ); } }
54457 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54457/fd70dd64929aafa0fb4be3d223126bc9bb9d2adc/ModelBasedTesting.java/clean/mbt/src/org/tigris/mbt/ModelBasedTesting.java
Renderer.resetDefaults(rendDefObj, pixelsObj, pixMetaSrv);
Renderer.resetDefaults(rendDefObj, pixelsObj, pixMetaSrv, buffer);
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); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/725d5581a5805696002bff1ec2ecb359495503f5/RenderingBean.java/clean/components/server/src/ome/services/RenderingBean.java
computeLocationStats(getDefaultPlaneDef());
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()); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/725d5581a5805696002bff1ec2ecb359495503f5/Renderer.java/buggy/components/rendering/src/omeis/providers/re/Renderer.java
resetDefaults(rndDef, getMetadata(), iPixels);
resetDefaults(rndDef, getMetadata(), iPixels, buffer);
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); }
54698 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54698/725d5581a5805696002bff1ec2ecb359495503f5/Renderer.java/buggy/components/rendering/src/omeis/providers/re/Renderer.java
if (socket.getLocalPort() > 0) { retValue = true; } else { retValue = false; }
retValue = socket.getLocalPort() > 0;
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/9619b3a25f43787dc92011111668210e06c00c71/PortValidator.java/clean/src/lib/com/izforge/izpack/util/PortValidator.java
if (!userExists(edit.getId())) return false;
if (!userExists(edit.getEid())) return false;
public boolean getUser(UserEdit edit) { if (!userExists(edit.getId())) return false; edit.setEmail(edit.getId() + "@" + m_domain); edit.setType("kerberos"); return true; } // getUser
50587 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50587/1566e3af520ecf449232665fb81dc37e4e5ec041/KerberosUserDirectoryProvider.java/clean/kerberos/src/java/org/sakaiproject/component/kerberos/user/KerberosUserDirectoryProvider.java
edit.setEmail(edit.getId() + "@" + m_domain);
edit.setEmail(edit.getEid() + "@" + m_domain);
public boolean getUser(UserEdit edit) { if (!userExists(edit.getId())) return false; edit.setEmail(edit.getId() + "@" + m_domain); edit.setType("kerberos"); return true; } // getUser
50587 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/50587/1566e3af520ecf449232665fb81dc37e4e5ec041/KerberosUserDirectoryProvider.java/clean/kerberos/src/java/org/sakaiproject/component/kerberos/user/KerberosUserDirectoryProvider.java
public Unpacker(AutomatedInstallData idata, AbstractUIProgressHandler handler)
public Unpacker( AutomatedInstallData idata, AbstractUIProgressHandler handler)
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()); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
RE pattern = (RE)inc_it.next();
RE pattern = (RE) inc_it.next();
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
if (idata.kind.equalsIgnoreCase("standard") || idata.kind.equalsIgnoreCase("standard-kunststoff"))
if (idata.kind.equalsIgnoreCase("standard") || idata.kind.equalsIgnoreCase("standard-kunststoff"))
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
else if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff"))
else if ( idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff"))
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
ArrayList exclude_patterns = new ArrayList ();
ArrayList exclude_patterns = new ArrayList();
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
RECompiler recompiler = new RECompiler (); this.absolute_installpath = new File (idata.getInstallPath()).getAbsoluteFile();
RECompiler recompiler = new RECompiler(); this.absolute_installpath = new File(idata.getInstallPath()).getAbsoluteFile();
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
UpdateCheck uc = (UpdateCheck)iter.next();
UpdateCheck uc = (UpdateCheck) iter.next();
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
include_patterns.addAll(preparePatterns (uc.includesList, recompiler));
include_patterns.addAll(preparePatterns(uc.includesList, recompiler));
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
exclude_patterns.addAll(preparePatterns (uc.excludesList, recompiler));
exclude_patterns.addAll(preparePatterns(uc.excludesList, recompiler));
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
TreeSet installed_files = new TreeSet (); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext();)
TreeSet installed_files = new TreeSet(); for (Iterator if_it = this.udata.getFilesList().iterator(); if_it.hasNext(); )
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
String fname = (String)if_it.next(); File f = new File (fname); if (! f.isAbsolute())
String fname = (String) if_it.next(); File f = new File(fname); if (!f.isAbsolute())
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
f = new File (this.absolute_installpath, fname);
f = new File(this.absolute_installpath, fname);
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
Stack scanstack = new Stack ();
Stack scanstack = new Stack();
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
ArrayList files_to_delete = new ArrayList ();
ArrayList files_to_delete = new ArrayList();
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
scanstack.add (absolute_installpath); while (! scanstack.empty ())
scanstack.add(absolute_installpath); while (!scanstack.empty())
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
File f = (File)scanstack.pop ();
File f = (File) scanstack.pop();
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
throw new IOException(f.getPath()+"is not a directory!");
throw new IOException(f.getPath() + "is not a directory!");
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
{
{
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
String newfname = newf.getPath ();
String newfname = newf.getPath();
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
if (fileMatchesOnePattern(newfname, include_patterns) && (! fileMatchesOnePattern(newfname, exclude_patterns)))
if (fileMatchesOnePattern(newfname, include_patterns) && (!fileMatchesOnePattern(newfname, exclude_patterns)))
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
files_to_delete.add (newf);
files_to_delete.add(newf);
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
scanstack.push (newf);
scanstack.push(newf);
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
catch (IOException e) { this.handler.emitError("error while performing update checks", e.toString()); }
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
File f = (File)f_it.next(); if (! f.isDirectory()) { this.handler.emitNotification("deleting "+f.getPath());
File f = (File) f_it.next(); if (!f.isDirectory()) { this.handler.emitNotification("deleting " + f.getPath());
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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(); } } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
private List preparePatterns(ArrayList list, RECompiler recompiler)
private List preparePatterns(ArrayList list, RECompiler recompiler)
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
String element = (String)iter.next(); if ((element != null) && (element.length()>0))
String element = (String) iter.next(); if ((element != null) && (element.length() > 0))
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
File f = new File (element);
File f = new File(element);
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
if (! f.isAbsolute())
if (!f.isAbsolute())
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
element = new File (this.absolute_installpath, element).toString();
element = new File(this.absolute_installpath, element).toString();
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
StringBuffer element_re = new StringBuffer ();
StringBuffer element_re = new StringBuffer();
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
{ c = (char)lookahead;
{ c = (char) lookahead;
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
} else
} else
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
case '/': { element_re.append (File.separator); break; } case '\\': case '.': { element_re.append ("\\"); element_re.append (c); break; } case '*': { if (pos == element.length())
case '/' :
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
element_re.append ("[^"+File.separator+"]*");
element_re.append(File.separator);
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
lookahead = element.charAt(pos++); if (lookahead == '*')
case '\\' : case '.' :
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
element_re.append (".*"); lookahead = -1;
element_re.append("\\"); element_re.append(c); break;
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
else
case '*' :
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
element_re.append ("[^"+File.separator+"]*");
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;
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
break; } default: { element_re.append (c); break; }
default : { element_re.append(c); break; }
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
element_re.append ('$');
element_re.append('$');
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
result.add (new RE(recompiler.compile (element_re.toString())));
result.add(new RE(recompiler.compile(element_re.toString()))); } catch (RESyntaxException e) { this.handler.emitNotification( "internal error: pattern \"" + element + "\" produced invalid RE \"" + f.getPath() + "\"");
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
catch (RESyntaxException e) { this.handler.emitNotification("internal error: pattern \""+element+"\" produced invalid RE \""+f.getPath()+"\""); }
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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; }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
String dest = translatePath("$INSTALL_PATH") + File.separator + "Uninstaller";
String dest = translatePath("$INSTALL_PATH") + File.separator + "Uninstaller";
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(); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
in = getClass().getResourceAsStream("/langpacks/" + idata.localeISO3 + ".xml");
in = getClass().getResourceAsStream("/langpacks/" + idata.localeISO3 + ".xml");
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(); }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
handler.startAction ("Unpacking", npacks);
handler.startAction("Unpacking", npacks);
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff"))
if (idata.kind.equalsIgnoreCase("web") || idata.kind.equalsIgnoreCase("web-kunststoff"))
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url");
InputStream kin = getClass().getResourceAsStream("/res/WebInstallers.url");
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n));
ObjectInputStream objIn = new ObjectInputStream(getPackAsStream(n));
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
handler.nextStep (((Pack) packs.get(i)).name, i+1, nfiles);
handler.nextStep(((Pack) packs.get(i)).name, i + 1, nfiles);
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
if (! dest.mkdirs())
if (!dest.mkdirs())
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
handler.emitError("Error creating directories", "Could not create directory\n"+dest.getPath()); handler.stopAction ();
handler.emitError( "Error creating directories", "Could not create directory\n" + dest.getPath()); handler.stopAction();
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
handler.progress (j, path);
handler.progress(j, path);
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
if ((pathFile.exists ()) && (pf.override != PackFile.OVERRIDE_TRUE))
if ((pathFile.exists()) && (pf.override != PackFile.OVERRIDE_TRUE))
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
} else if (pf.override == PackFile.OVERRIDE_UPDATE)
} else if (pf.override == PackFile.OVERRIDE_UPDATE)
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
} else
} else
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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);
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);
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
if (! overwritefile)
if (!overwritefile)
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
if (!pf.isBackReference()) objIn.skip(pf.length);
if (!pf.isBackReference()) objIn.skip(pf.length);
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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); is.skip(pf.offsetInPreviousPack - 4); }
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); is.skip(pf.offsetInPreviousPack - 4); }
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
(pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length);
(pf.length - bytesCopied < buffer.length ? (int) (pf.length - bytesCopied) : buffer.length);
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
if (pis != objIn) pis.close();
if (pis != objIn) pis.close();
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
pathFile.setLastModified (pf.mtime);
pathFile.setLastModified(pf.mtime);
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
} else { if (!pf.isBackReference()) objIn.skip(pf.length);
} else { if (!pf.isBackReference()) objIn.skip(pf.length);
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
if(ef.executionStage == ExecutableFile.UNINSTALL)
if (ef.executionStage == ExecutableFile.UNINSTALL)
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java
updatechecks.add (uc); }
updatechecks.add(uc); }
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)); } }
54145 /local/tlutelli/issta_data/temp/all_java5context/java/2006_temp/2006/54145/6e8ab3930a21f787bcd0f3cf0b9937f9d50c80c0/Unpacker.java/clean/src/lib/com/izforge/izpack/installer/Unpacker.java