Browse Source

fixed a nullpointerexception in record details, which was thrown by a byte formatter in the hostage v1 code

Alexander Brakowski 10 years ago
parent
commit
60e43a6a4c

+ 8 - 0
res/layout/fragment_record_overview.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:orientation="vertical"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent">
+
+</LinearLayout>

+ 1 - 1
src/de/tudarmstadt/informatik/hostage/logging/formatter/DefaultFormatter.java

@@ -22,7 +22,7 @@ public class DefaultFormatter extends Formatter {
 				record.getAttack_id(), record.getType().name(),
 				record.getTimestamp(), record.getLocalIP(),
 				record.getLocalPort(), record.getRemoteIP(),
-				record.getRemotePort(), formatter.format(record.getPacket()));
+				record.getRemotePort(), (record.getPacket() == null ? "" : formatter.format(record.getPacket())));
 	}
 
 }

+ 3 - 3
src/de/tudarmstadt/informatik/hostage/ui2/activity/MainActivity.java

@@ -299,7 +299,7 @@ public class MainActivity extends Activity {
 
 		if(action != null && action.equals("SHOW_HOME")){
 			if(this.mDisplayedFragment != null && !this.mDisplayedFragment.getClass().equals(HomeFragment.class)){
-				getFragmentManager().popBackStackImmediate(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
+				getFragmentManager().popBackStackImmediate(HomeFragment.class.getName(), FragmentManager.POP_BACK_STACK_INCLUSIVE);
 				displayView(MainMenuItem.HOME.getValue());
 
 				getIntent().setAction(null);
@@ -434,9 +434,9 @@ public class MainActivity extends Activity {
 
 		FragmentManager fragmentManager = getFragmentManager();
 		FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
-		fragmentTransaction.replace(R.id.content_frame, fragment, null);
+		fragmentTransaction.replace(R.id.content_frame, fragment, fragment.getClass().getName());
 
-		fragmentTransaction.addToBackStack(null);
+		fragmentTransaction.addToBackStack(fragment.getClass().getName());
 
 		fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
 		fragmentTransaction.commit();

+ 1 - 1
src/de/tudarmstadt/informatik/hostage/ui2/fragment/RecordDetailFragment.java

@@ -87,7 +87,7 @@ public class RecordDetailFragment extends UpNavigatibleFragment {
 
         this.rootView = inflater.inflate(this.getLayoutId(), container, false);
         this.configurateRootView(rootView);
-
+	    System.out.println("ATT: " + dbh.getConversationForAttackID(record.getAttack_id()));
 
         return rootView;
     }