Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consulta y ejercicios de excepciones - Maicol Llano #21

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

slinkstep
Copy link
Contributor

No description provided.

@@ -0,0 +1,24 @@
public class Main {

public static void main(String args[]){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Este ejercicio ya lo subieron 🍂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

¿Debo subir otro, entonces ?

CustomExcep.java Outdated

public static final long SerialVersionUID= 500L; // Este es un ID que JAVA requiere para manejar la excepcion en el Runtime

public CustomExcep(String mensaje){
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mezcla de español e inglés 🤦‍♂️

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

¿ Profe, por qué lo de SerialVersionUID está mal ? Yo lo puse porque en el tutorial que vi explicaban que se debía poner siempre.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Esta mal, porque ya alguien subio un ejemplo con ese mismo código. La idea era inventarse su propio ejemplo. 🚧

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

¿Puedo agregar más cosas al código o entonces subo un ejemplo totalmente diferente ?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lo podes tomar de referencia, pero adaptarlo mucho. La decisión depende de vos, lo que te quede mejor. 🚧

// (?=.*[A-Z]) -> contenga una letra mayúscula
// {6,16} -> tenga una longitud entre 6 y 16 caracteres

String regExp1 = "(.{6,16})";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Todo lo relacionado a miembros datos debe ir en un contructor o en un método, no se recomienda asignar valores a miembros datos, la única excepción son las constantes.

Verifier.java Outdated
if(!pass.equals(passrepeat)){
throw new CustomExcep("Los campos de contraseña no son iguales");
}

if(pass.length() <= 8){
throw new CustomExcep("La contraseña es demasiado corta, ingrese una mayor a 8 caracteres");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Los mensajes de la excepción personalizada deben ser datos constantes definidos en una clase de constantes.

@xaca
Copy link
Owner

xaca commented Apr 24, 2019

Hay conflictos por resolver 🚧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants