private void doCreateArtifact(File file) { Main.logger.info("Creating artifact " + file.getName()); try { FileInputStream fis = new FileInputStream(file); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; for (int readNum; (readNum = fis.read(buf)) != -1; ) { bos.write(buf, 0, readNum); } Artifact artifact = new Artifact(); artifact.setName(file.getName()); getArtifactService().create(artifact, bos.toByteArray()); fis.close(); } catch (FileNotFoundException e) { throw new RuntimeException( MessageFormat.format(Main.bundle.getString("error.access.read"), file.getAbsolutePath()), e); } catch (IOException e) { throw new RuntimeException( MessageFormat.format(Main.bundle.getString("error.access.read"), file.getAbsolutePath()), e); } }