java.io.FileNotFoundException#printStackTrace ( )源码实例Demo

下面列出了java.io.FileNotFoundException#printStackTrace ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Learning-Resources   文件: UploadFragment.java
private void addImages(Uri uri) {
    try {
        boolean validateImages = imageHelper.isPictureValidForUpload(uri);
        CreateTempImagesFinishedEvent event = new CreateTempImagesFinishedEvent();
        List<Uri> uris = new ArrayList<>(1);
        uris.add(uri);

        CreateTempImagesTask createTempImagesTask = new CreateTempImagesTask(
                getActivity(), uris, event, validateImages, minImageWidth, minImageHeight);

        createTempImagesTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
        dismissProgress();
    }
}
 
源代码2 项目: startup-os   文件: LocalServer.java
@Inject
LocalServer(
    @Named("Server log path") String logPath,
    AuthService authService,
    CodeReviewService codeReviewService) {
  if (logToFile.get()) {
    // TODO: Figure out how to also direct Flogger to log file.
    try {
      PrintStream logStream = new PrintStream(logPath);
      System.setOut(logStream);
      System.setErr(logStream);
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
  }
  server =
      ServerBuilder.forPort(localServerPort.get())
          .addService(authService)
          .addService(codeReviewService)
          .addService(ProtoReflectionService.newInstance())
          .build();
}
 
源代码3 项目: ExamStack   文件: TrainingAction.java
@RequestMapping(value = "/secure/upload-uploadify-file", method = RequestMethod.POST)
public @ResponseBody String uploadFile(HttpServletRequest request, HttpServletResponse response) {
	UserInfo userInfo = (UserInfo) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
	List<String> filePathList = new ArrayList<String>();
	try {
		filePathList = FileUploadUtil.uploadFile(request, response, userInfo.getUsername());
	} catch (FileNotFoundException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (Exception ex) {
		ex.printStackTrace();
	}

	if (filePathList.size() == 0) {
		return "系统错误";
	}

	return filePathList.get(0);
}
 
源代码4 项目: EosCommander   文件: EosWallet.java
public boolean loadFile( File jsonFile ){
    if ( ! jsonFile.exists() ) {
        return false;
    }

    try {
        return loadReader(new FileReader(jsonFile));
    }
    catch ( FileNotFoundException e) {
        e.printStackTrace();
        return false;
    }
}
 
源代码5 项目: jtransc   文件: RAFile.java
public RAFile(File file) {
	try {
		//this.file = new RandomAccessFile(new File(file.getAbsolutePath().replace("%20", " ")), "r");
		this.file = new RandomAccessFile(file, "r");
	} catch (FileNotFoundException e) {
		e.printStackTrace();
	}
}
 
源代码6 项目: Minepacks   文件: Config.java
public void setDatabaseType(String type)
{
	getConfigE().set("Database.Type", type);
	try
	{
		save();
	}
	catch(FileNotFoundException e)
	{
		e.printStackTrace();
	}
}
 
源代码7 项目: jstorm   文件: TestQueryBolt.java
public void prepare(Map stormConf, TopologyContext context,
    OutputCollector collector) {
  collector = this.collector;
  try {
    fos = new FileOutputStream(
        "src/test/resources/test-query.txt");
  } catch (FileNotFoundException e) {
    e.printStackTrace();
  }
}
 
源代码8 项目: RadialFx   文件: RadialGlobalMenu.java
private ImageView getImageView(final String path) {
ImageView imageView = null;
try {
    imageView = ImageViewBuilder.create()
	    .image(new Image(new FileInputStream(path))).build();
} catch (final FileNotFoundException e) {
    e.printStackTrace();
}
assert (imageView != null);
return imageView;

   }
 
源代码9 项目: metanome-algorithms   文件: InputFileProcessor.java
protected void resetReader() {
	try {
		this.inputFileReader = new BufferedReader(new FileReader(this.source));
	} catch (FileNotFoundException e) {
		System.out.println("The reader could not be reset.");
		e.printStackTrace();
	}
}
 
源代码10 项目: ARCHIVE-wildfly-swarm   文件: ArtifactAsset.java
@Override
public InputStream openStream() {
    try {
        return new FileInputStream(spec.file);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
    return null;
}
 
源代码11 项目: APDE   文件: Manifest.java
/**
 * Save to the sketch folder, so that it can be copied in later.
 */
protected void save(File file) {
	try {
		PrintWriter writer = new PrintWriter(file);
		writer.print(xml.toString());
		writer.flush();
		writer.close();
	} catch (FileNotFoundException e) {
		e.printStackTrace();
	}
}
 
public static AnalysisEngineDescription getFastPipeline()
    throws ResourceInitializationException {
  AggregateBuilder builder = new AggregateBuilder();
  builder.add(getTokenProcessingPipeline());
  try {
    builder.add(AnalysisEngineFactory
        .createEngineDescription(
            DefaultJCasTermAnnotator.class,
            AbstractJCasTermAnnotator.PARAM_WINDOW_ANNOT_PRP,
            "org.apache.ctakes.typesystem.type.textspan.Sentence",
            JCasTermAnnotator.DICTIONARY_DESCRIPTOR_KEY,
            ExternalResourceFactory.createExternalResourceDescription(
                FileResourceImpl.class,
                FileLocator
                .locateFile("org/apache/ctakes/dictionary/lookup/fast/cTakesHsql.xml"))));
  } catch (FileNotFoundException e) {
    e.printStackTrace();
    throw new ResourceInitializationException(e);
  }
  builder.add(ClearNLPDependencyParserAE.createAnnotatorDescription());
  builder.add(PolarityCleartkAnalysisEngine.createAnnotatorDescription());
  builder.add(UncertaintyCleartkAnalysisEngine
      .createAnnotatorDescription());
  builder.add(HistoryCleartkAnalysisEngine.createAnnotatorDescription());
  builder.add(ConditionalCleartkAnalysisEngine
      .createAnnotatorDescription());
  builder.add(GenericCleartkAnalysisEngine.createAnnotatorDescription());
  builder.add(SubjectCleartkAnalysisEngine.createAnnotatorDescription());
  return builder.createAggregateDescription();
}
 
源代码13 项目: BigApp_WordPress_Android   文件: FormFile.java
/**
 * @param filname       文件名
 * @param file          上传的文件
 * @param parameterName 参数
 * @param contentType   内容内容类型
 */
public FormFile(String filname, File file, String parameterName, String contentType) {
    this.filname = filname;
    this.parameterName = parameterName;
    this.file = file;
    try {
        this.inStream = new FileInputStream(file);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    }
    if (contentType != null) this.contentType = contentType;
}
 
源代码14 项目: ImageChoose   文件: ShowActivity.java
public static Bitmap getLoacalBitmap(String url) {
    try {
        FileInputStream fis = new FileInputStream(url);
        return BitmapFactory.decodeStream(fis);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
        return null;
    }
}
 
源代码15 项目: FireFiles   文件: DocumentsContractApi21.java
public static Uri renameTo(Context context, Uri self, String displayName) {
    try {
        return DocumentsContract.renameDocument(context.getContentResolver(), self, displayName);
    } catch (FileNotFoundException e) {
        e.printStackTrace();
        return null;
    }
}
 
源代码16 项目: zelixkiller   文件: MappingFactory.java
/**
 * Returns a map of class names to mapped classes given a Proguard mapping
 * file.
 * 
 * @param file
 * @return
 */
public static Map<String, MappedClass> mappingsFromProguard(File file, Map<String, ClassNode> nodes) {
	Map<String, MappedClass> base = mappingsFromNodes(nodes);
	MappingLoader loader = new ProguardLoader(nodes);
	try {
		Map<String, MappedClass> newMappings = loader.read(new FileReader(file));
		for (MappedClass mappedClass : newMappings.values()) {
			newMappings = linkMappings(mappedClass, newMappings);
		}
		base = fixFromMappingsText(base, newMappings);
	} catch (FileNotFoundException e) {
		e.printStackTrace();
	}
	return base;
}
 
源代码17 项目: TableDisentangler   文件: DecompositionRDFWriter.java
public void printToFile(String filename)
{
	outputFileName = filename;
	 try {
			model.write(new FileOutputStream(outputFileName));
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
}
 
源代码18 项目: Flink-CEPplus   文件: GlobalConfigurationTest.java
@Test
public void testConfigurationYAML() {
	File tmpDir = tempFolder.getRoot();
	File confFile = new File(tmpDir, GlobalConfiguration.FLINK_CONF_FILENAME);

	try {
		try (final PrintWriter pw = new PrintWriter(confFile)) {

			pw.println("###########################"); // should be skipped
			pw.println("# Some : comments : to skip"); // should be skipped
			pw.println("###########################"); // should be skipped
			pw.println("mykey1: myvalue1"); // OK, simple correct case
			pw.println("mykey2       : myvalue2"); // OK, whitespace before colon is correct
			pw.println("mykey3:myvalue3"); // SKIP, missing white space after colon
			pw.println(" some nonsense without colon and whitespace separator"); // SKIP
			pw.println(" :  "); // SKIP
			pw.println("   "); // SKIP (silently)
			pw.println(" "); // SKIP (silently)
			pw.println("mykey4: myvalue4# some comments"); // OK, skip comments only
			pw.println("   mykey5    :    myvalue5    "); // OK, trim unnecessary whitespace
			pw.println("mykey6: my: value6"); // OK, only use first ': ' as separator
			pw.println("mykey7: "); // SKIP, no value provided
			pw.println(": myvalue8"); // SKIP, no key provided

			pw.println("mykey9: myvalue9"); // OK
			pw.println("mykey9: myvalue10"); // OK, overwrite last value

		} catch (FileNotFoundException e) {
			e.printStackTrace();
		}

		Configuration conf = GlobalConfiguration.loadConfiguration(tmpDir.getAbsolutePath());

		// all distinct keys from confFile1 + confFile2 key
		assertEquals(6, conf.keySet().size());

		// keys 1, 2, 4, 5, 6, 7, 8 should be OK and match the expected values
		assertEquals("myvalue1", conf.getString("mykey1", null));
		assertEquals("myvalue2", conf.getString("mykey2", null));
		assertEquals("null", conf.getString("mykey3", "null"));
		assertEquals("myvalue4", conf.getString("mykey4", null));
		assertEquals("myvalue5", conf.getString("mykey5", null));
		assertEquals("my: value6", conf.getString("mykey6", null));
		assertEquals("null", conf.getString("mykey7", "null"));
		assertEquals("null", conf.getString("mykey8", "null"));
		assertEquals("myvalue10", conf.getString("mykey9", null));
	} finally {
		confFile.delete();
		tmpDir.delete();
	}
}
 
源代码19 项目: freehealth-connector   文件: StatusMessageQueue.java
private StatusMessageType load(File file) {
   try {
      FileInputStream saveFile = new FileInputStream(file);
      ObjectInputStream save = new ObjectInputStream(saveFile);
      Object var4 = null;

      byte[] sealedObject;
      try {
         sealedObject = (byte[])save.readObject();
      } catch (IOException var7) {
         var7.printStackTrace();
         LOG.error("IOException: the file:" + file.getName() + "will be deleted\n" + var7.getMessage());
         save.close();
         saveFile.close();
         file.delete();
         return null;
      }

      save.close();
      saveFile.close();
      byte[] serializedObject = this.unseal(sealedObject);
      StatusMessageType result = (StatusMessageType)this.jaxContext.toObject(StatusMessageType.class, serializedObject);
      return result;
   } catch (FileNotFoundException var8) {
      var8.printStackTrace();
      return null;
   } catch (IOException var9) {
      var9.printStackTrace();
      LOG.error("IOException: the file:" + file.getName() + "will be deleted\n" + var9.getMessage());
      return null;
   } catch (ClassNotFoundException var10) {
      var10.printStackTrace();
      return null;
   } catch (IntegrationModuleException var11) {
      var11.printStackTrace();
      return null;
   } catch (GFDDPPException var12) {
      var12.printStackTrace();
      return null;
   }
}
 
源代码20 项目: KEEL   文件: Eclat.java
/**
  * It launches the algorithm
  */
 public void execute() {
     if (somethingWrong) { //We do not execute the program
         System.err.println("An error was found");
         System.err.println("Aborting the program");
         //We should not use the statement: System.exit(-1);
     } else {
     	this.proc = new EclatProcess(this.trans, this.minSupport, this.minConfidence);
     	this.proc.run();
     	this.associationRules = this.proc.generateRulesSet();
             	        	
try {
	int r, i;
	ArrayList<Integer> terms;
	AssociationRule a_r;
	
	double[] step_values = this.trans.getSteps();
	
	PrintWriter rules_writer = new PrintWriter(this.rulesFilename);
	PrintWriter values_writer = new PrintWriter(this.valuesFilename);
	PrintWriter valuesOrder_writer = new PrintWriter(this.valuesOrderFilename);
	
	rules_writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
	rules_writer.println("<rules>");
	
	values_writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
	values_writer.println("<values>");
	
	valuesOrder_writer.print("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
	valuesOrder_writer.println("<values>");
	valuesOrder_writer.print("Support\tantecedent_support\tconsequent_support\tConfidence\tLift\tConv\tCF\tNetConf\tYulesQ\tnAttributes\n");
					
	for (r=0; r < this.associationRules.size(); r++) {
		a_r = this.associationRules.get(r);
		
		rules_writer.println("<rule id=\"" + r + "\">");
		values_writer.println("<rule id=\"" + r + "\" rule_support=\"" + EclatProcess.roundDouble(a_r.getRuleSupport(),2) + "\" antecedent_support=\"" + EclatProcess.roundDouble(a_r.getAntecedentSupport(),2) + "\" consequent_support=\"" +  EclatProcess.roundDouble(a_r.getConsequentSupport(),2) + "\" confidence=\"" + 
				 EclatProcess.roundDouble(a_r.getConfidence(),2) +"\" lift=\"" +  EclatProcess.roundDouble(a_r.getLift(),2) + "\" conviction=\"" +  EclatProcess.roundDouble(a_r.getConv(),2) + "\" certainFactor=\"" +  EclatProcess.roundDouble(a_r.getCF(),2) + "\" netConf=\"" +  EclatProcess.roundDouble(a_r.getNetConf(),2) + "\" yulesQ=\"" +  EclatProcess.roundDouble(a_r.getYulesQ(),2) + "\" nAttributes=\"" + (a_r.getAntecedent().size()+ a_r.getConsequent().size()) + "\"/>");
		
		rules_writer.println("<antecedents>");			
		terms = a_r.getAntecedent();
		
		for (i=0; i < terms.size(); i++)
			this.createRule(terms.get(i), step_values, rules_writer);
			
		rules_writer.println("</antecedents>");
		
		rules_writer.println("<consequents>");			
		terms = a_r.getConsequent();
		
		for (i=0; i < terms.size(); i++)
			this.createRule(terms.get(i), step_values, rules_writer);
		
		rules_writer.println("</consequents>");
		
		rules_writer.println("</rule>");
		
		valuesOrder_writer.print(printRule(a_r));
	}
	
	rules_writer.println("</rules>");
	values_writer.println("</values>");
	valuesOrder_writer.print("</values>");
	
	//this.proc.saveReport(this.associationRules, values_writer);
	
	rules_writer.close();
	values_writer.close();
	valuesOrder_writer.close();
	
	totalTime = System.currentTimeMillis() - startTime;
	this.writeTime();
	System.out.println("\nAlgorithm Finished");
}
catch (FileNotFoundException e) {
	e.printStackTrace();
}
     }
 }