关闭。这个问题需要细节或清晰。它目前不接受答案。
**想改进这个问题吗?**通过编辑这个帖子来添加细节并澄清问题。
昨天关门了。
改进这个问题
这是我收到的错误图像[下面是我认为错误的代码][2]
这就是我得到的错误
public void loadCrewData(Path p) throws DataLoadingException {
// TODO Auto-generated method stub
try {
String pathString = p.toString();
Scanner scanner = new Scanner( new File(pathString) );
String jsonString = scanner.useDelimiter("\\A").next();
scanner.close();
//System.out.println("jsonString =" + jsonString);
JSONObject pilotObj = new JSONObject();
JSONObject crewObj = new JSONObject();
JSONObject jsonObject = new JSONObject(jsonString);
JSONArray jsonArray= jsonObject.getJSONArray("pilots");
System.out.println("############# Pilots #################");
for (int j=0; j<jsonArray.length();j++)
{
System.out.println("-------------------------");
pilotObj =jsonArray.getJSONObject(j);
Pilot p1 = new Pilot();
String forename = (String) pilotObj.get("forename");
System.out.println("Forename : "+forename);
String surname = (String) pilotObj.get("surname");
System.out.println("Surname: "+surname);
String rank = (String) pilotObj.get("rank");
System.out.println("Rank: "+rank);
String home_airport = (String) pilotObj.get("home_airport");
System.out.println("Home_airport: "+home_airport);
JSONArray obj.getJSONArray("pilots");
for (int i=0; i<type_ratings.length();i++);
{
System.out.println("Type_ratings: "+type_ratings.get(i));
}
p1.setForename(forename);
p1.setSurname(surname);
Rank rank2 = (JSONObject)pilot.get(j);
String rank1 = Rank.String("rank");
p1.setRank(rank2);
pilot.add(p1);
crew.add(p1);
}
暂无答案!
目前还没有任何答案,快来回答吧!