@Test( expected = IllegalArgumentException.class ) public void testLoadNullProjectFail() throws IOException { this.projectManager.loadProject( null ); }
@Override public void loadProject( final InputStream aInput ) throws IOException { if ( aInput == null ) { throw new IllegalArgumentException( "Input stream cannot be null!" ); } final BufferedInputStream in = new BufferedInputStream( aInput ); final ZipInputStream zipIS = new ZipInputStream( in ); final ProjectImpl newProject = new ProjectImpl(); copyPropertyChangeListeners( this.project, newProject ); List<String> labels = null; try { ZipEntry ze = null; boolean entriesSeen = false; while ( ( ze = zipIS.getNextEntry() ) != null ) { final String name = ze.getName(); if ( FILENAME_PROJECT_METADATA.equals( name ) ) { loadProjectMetadata( newProject, zipIS ); entriesSeen = true; } else if ( FILENAME_CHANNEL_LABELS.equals( name ) ) { labels = loadChannelLabels( zipIS ); entriesSeen = true; } else if ( FILENAME_CAPTURE_RESULTS.equals( name ) ) { loadCapturedResults( newProject, zipIS ); entriesSeen = true; } else if ( name.startsWith( FILENAME_PROJECT_SETTINGS ) ) { final String userSettingsName = name.substring( FILENAME_PROJECT_SETTINGS.length() ); loadProjectSettings( newProject, userSettingsName, zipIS ); entriesSeen = true; } zipIS.closeEntry(); } if ( !entriesSeen ) { throw new IOException( "Invalid project file!" ); } newProject.getDataSet().mergeChannelLabels( labels ); newProject.setChanged( false ); setProject( newProject ); } finally { HostUtils.closeResource( zipIS ); } }
ProjectManagerImpl implements PropertyChangeListener, ProjectManager, ProjectProperties { @Override public void loadProject( final InputStream aInput ) throws IOException { if ( aInput == null ) { throw new IllegalArgumentException( "Input stream cannot be null!" ); } final BufferedInputStream in = new BufferedInputStream( aInput ); final ZipInputStream zipIS = new ZipInputStream( in ); final ProjectImpl newProject = new ProjectImpl(); copyPropertyChangeListeners( this.project, newProject ); List<String> labels = null; try { ZipEntry ze = null; boolean entriesSeen = false; while ( ( ze = zipIS.getNextEntry() ) != null ) { final String name = ze.getName(); if ( FILENAME_PROJECT_METADATA.equals( name ) ) { loadProjectMetadata( newProject, zipIS ); entriesSeen = true; } else if ( FILENAME_CHANNEL_LABELS.equals( name ) ) { labels = loadChannelLabels( zipIS ); entriesSeen = true; } else if ( FILENAME_CAPTURE_RESULTS.equals( name ) ) { loadCapturedResults( newProject, zipIS ); entriesSeen = true; } else if ( name.startsWith( FILENAME_PROJECT_SETTINGS ) ) { final String userSettingsName = name.substring( FILENAME_PROJECT_SETTINGS.length() ); loadProjectSettings( newProject, userSettingsName, zipIS ); entriesSeen = true; } zipIS.closeEntry(); } if ( !entriesSeen ) { throw new IOException( "Invalid project file!" ); } newProject.getDataSet().mergeChannelLabels( labels ); newProject.setChanged( false ); setProject( newProject ); } finally { HostUtils.closeResource( zipIS ); } } }
ProjectManagerImpl implements PropertyChangeListener, ProjectManager, ProjectProperties { @Override public void loadProject( final InputStream aInput ) throws IOException { if ( aInput == null ) { throw new IllegalArgumentException( "Input stream cannot be null!" ); } final BufferedInputStream in = new BufferedInputStream( aInput ); final ZipInputStream zipIS = new ZipInputStream( in ); final ProjectImpl newProject = new ProjectImpl(); copyPropertyChangeListeners( this.project, newProject ); List<String> labels = null; try { ZipEntry ze = null; boolean entriesSeen = false; while ( ( ze = zipIS.getNextEntry() ) != null ) { final String name = ze.getName(); if ( FILENAME_PROJECT_METADATA.equals( name ) ) { loadProjectMetadata( newProject, zipIS ); entriesSeen = true; } else if ( FILENAME_CHANNEL_LABELS.equals( name ) ) { labels = loadChannelLabels( zipIS ); entriesSeen = true; } else if ( FILENAME_CAPTURE_RESULTS.equals( name ) ) { loadCapturedResults( newProject, zipIS ); entriesSeen = true; } else if ( name.startsWith( FILENAME_PROJECT_SETTINGS ) ) { final String userSettingsName = name.substring( FILENAME_PROJECT_SETTINGS.length() ); loadProjectSettings( newProject, userSettingsName, zipIS ); entriesSeen = true; } zipIS.closeEntry(); } if ( !entriesSeen ) { throw new IOException( "Invalid project file!" ); } newProject.getDataSet().mergeChannelLabels( labels ); newProject.setChanged( false ); setProject( newProject ); } finally { HostUtils.closeResource( zipIS ); } } ProjectManagerImpl(); }
ProjectManagerImpl implements PropertyChangeListener, ProjectManager, ProjectProperties { @Override public void loadProject( final InputStream aInput ) throws IOException { if ( aInput == null ) { throw new IllegalArgumentException( "Input stream cannot be null!" ); } final BufferedInputStream in = new BufferedInputStream( aInput ); final ZipInputStream zipIS = new ZipInputStream( in ); final ProjectImpl newProject = new ProjectImpl(); copyPropertyChangeListeners( this.project, newProject ); List<String> labels = null; try { ZipEntry ze = null; boolean entriesSeen = false; while ( ( ze = zipIS.getNextEntry() ) != null ) { final String name = ze.getName(); if ( FILENAME_PROJECT_METADATA.equals( name ) ) { loadProjectMetadata( newProject, zipIS ); entriesSeen = true; } else if ( FILENAME_CHANNEL_LABELS.equals( name ) ) { labels = loadChannelLabels( zipIS ); entriesSeen = true; } else if ( FILENAME_CAPTURE_RESULTS.equals( name ) ) { loadCapturedResults( newProject, zipIS ); entriesSeen = true; } else if ( name.startsWith( FILENAME_PROJECT_SETTINGS ) ) { final String userSettingsName = name.substring( FILENAME_PROJECT_SETTINGS.length() ); loadProjectSettings( newProject, userSettingsName, zipIS ); entriesSeen = true; } zipIS.closeEntry(); } if ( !entriesSeen ) { throw new IOException( "Invalid project file!" ); } newProject.getDataSet().mergeChannelLabels( labels ); newProject.setChanged( false ); setProject( newProject ); } finally { HostUtils.closeResource( zipIS ); } } ProjectManagerImpl(); void addPropertyChangeListener( final PropertyChangeListener aListener ); Project createNewProject(); Project createTemporaryProject(); @Override Project getCurrentProject(); @Override void loadProject( final InputStream aInput ); @Override void propertyChange( final PropertyChangeEvent aEvent ); void removePropertyChangeListener( final PropertyChangeListener aListener ); @Override void saveProject( final OutputStream aOutput ); void setHostProperties( final HostProperties aHostProperties ); }
ProjectManagerImpl implements PropertyChangeListener, ProjectManager, ProjectProperties { @Override public void loadProject( final InputStream aInput ) throws IOException { if ( aInput == null ) { throw new IllegalArgumentException( "Input stream cannot be null!" ); } final BufferedInputStream in = new BufferedInputStream( aInput ); final ZipInputStream zipIS = new ZipInputStream( in ); final ProjectImpl newProject = new ProjectImpl(); copyPropertyChangeListeners( this.project, newProject ); List<String> labels = null; try { ZipEntry ze = null; boolean entriesSeen = false; while ( ( ze = zipIS.getNextEntry() ) != null ) { final String name = ze.getName(); if ( FILENAME_PROJECT_METADATA.equals( name ) ) { loadProjectMetadata( newProject, zipIS ); entriesSeen = true; } else if ( FILENAME_CHANNEL_LABELS.equals( name ) ) { labels = loadChannelLabels( zipIS ); entriesSeen = true; } else if ( FILENAME_CAPTURE_RESULTS.equals( name ) ) { loadCapturedResults( newProject, zipIS ); entriesSeen = true; } else if ( name.startsWith( FILENAME_PROJECT_SETTINGS ) ) { final String userSettingsName = name.substring( FILENAME_PROJECT_SETTINGS.length() ); loadProjectSettings( newProject, userSettingsName, zipIS ); entriesSeen = true; } zipIS.closeEntry(); } if ( !entriesSeen ) { throw new IOException( "Invalid project file!" ); } newProject.getDataSet().mergeChannelLabels( labels ); newProject.setChanged( false ); setProject( newProject ); } finally { HostUtils.closeResource( zipIS ); } } ProjectManagerImpl(); void addPropertyChangeListener( final PropertyChangeListener aListener ); Project createNewProject(); Project createTemporaryProject(); @Override Project getCurrentProject(); @Override void loadProject( final InputStream aInput ); @Override void propertyChange( final PropertyChangeEvent aEvent ); void removePropertyChangeListener( final PropertyChangeListener aListener ); @Override void saveProject( final OutputStream aOutput ); void setHostProperties( final HostProperties aHostProperties );  }