We investigate analytically and numerically a Josephson junction on a finite domain with two -discontinuity points characterized by a jump of in the phase difference of the junction, that is, a 0--0 Josephson junction. The system is described by a modified sine-Gordon equation. We show that there is an instability region in which semifluxons are spontaneously generated. Using a Hamiltonian energy characterization, it is shown that the existence of static semifluxons depends on the length of the junction, the facet length, and the applied bias current. The critical eigenvalue of the semifluxons is discussed as well. Numerical simulations are presented, supporting our analytical results.