Giter Club home page Giter Club logo

java's People

Contributors

arbitur avatar cbhat5 avatar dependabot[bot] avatar frozzare avatar johannestegner avatar rasmusbe avatar renovate-bot avatar renovate[bot] avatar ullenius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

java's Issues

Validation regex accepting more than it should?

Is it intended that the regex used to validate a personnummer should accept | as a separator besides + or -?

regexPattern = Pattern.compile("^(\\d{2})?(\\d{2})(\\d{2})(\\d{2})([-|+]?)?((?!000)\\d{3})(\\d?)$");

If not, then | should be removed from [-|+], since the [] regex notation is already an or by itself, and the | is not interpreted as an or-operation, but as the character |.

Inconsistent validator behaviour

valid(long) returns false for valid personal numbers starting with 0:

valid(001224-4919L) - (long) returns false
valid("001224-4919") (String) returns true

Fixed in #17

Issue candidate for wontfix tag? ๐Ÿ™ƒ

[FEATURE] - support Organization number

Description

If I pass in a Organization number it should be parsed OK as well.

Breaking changes

I suggest a new Factory for creating the PNR and ONR objects to not create breaking changes.

[FEATURE] - Implementing Java-specific methods?

A Modest Proposal

Implementing some Java specific methods might be beneficial, such as:

  1. Overriding equals()

  2. Overriding hashCode()

  3. Overriding toString() - perhaps returning the format()method?

  4. Implementing Comparable<Personnummer> for sorting.

For 1 and 2 behaviour needs to specified.

[FEATURE] - Add `date` get.

Description

To implement v3.1 specification, this package needs to expose a getDate property which returns the number as a date (year, month, date) in a suitable structure.

Breaking changes

No breaking changes expected.

[Q] - In regards to the Personnummer class line 136 the else statement

The line 136 has an else and check the day > 60 in case there is no allowance for coordinatio number as per SKV spec.
} else if(day > 60) { throw new PersonnummerException("Invalid personal identity number."); }

The check is not needed since there will be a check at line 150 where the day , month and year semantic will be checked from DateTimeFormatter

In Case you want to keep the else statement, it would be nice to check against day > 31 ( max day in a month )
Not sure why the day > 60 exist in the else statement.
Thanks
Alan

bug?

Hi guys,
This might be a bug. Using one of the ssn:s in your tests (701063-2391) and then prepending it with a '9' still returns true.
This test fails:
assertFalse(Personnummer.valid("9701063-2391"));

br Svante

[BUG] - Parse personnummer is broken if you enter an Organisationsnummer

Context

Personnummer.parse() does not throw PersonnummerException if you enter a Organisationnummer.

Expected outcome

Get a PersonnnummerException
Actual outcome

Got a Personnummer object. Only to fail once one calls toString().

Description

Minimal reproducible test case

    val invalidPin = "556748-7862"
    try {
        val pin = Personnummer.parse(invalidPin)
    } catch (e: Exception) {
        println("We got a error: $e")
    }
    println("Everything is fine")

If you however call toString() on the object you will get a DateTimeException

java.time.DateTimeException: Invalid value for MonthOfYear (valid values 1 - 12): 67

Publish to Maven Central

First of all - stor tack for the library!

Would it be possible for you to publish it to Maven Central to avoid hassle of dealing with GitHub packages?

Travis fails using OracleJDK

Travis build fails using Oracle JDK. Oracle has changed the licence for Oracle JDK.

The Oracle JDK License has changed for releases starting April 16, 2019.
The new Oracle Technology Network License Agreement for Oracle Java SE is substantially different from prior Oracle JDK licenses.

I suggest removing it entirely in favour of OpenJDK. OpenJDK is the reference implementation of Java, and is licensed under GPL v2 with classpath exception.

Reference links:
https://launchpad.net/~webupd8team/+archive/ubuntu/java
https://travis-ci.community/t/java-8-failing-download-failed-oracle-jdk-8-is-not-installed/1894

[BUG] - test numbers not usable

Context
If we are using test numbers that have a correct checksum but the last 4 digits start with 000 we cannot parse them.

Expected outcome
Parsable but some signal available that shows this is not real data

Actual outcome
Constructor fails

Description

I suggest that parse should work but valid() should fail - and there could be a valid(boolean allowZeros) method that wouldn't fail.

If this seems like a valid solution, I would be willing to code it.

Minimal reproducible test case

Personnummer.parse("187303140003");

[FEATURE] - Lombok

Description

Gets rid of boilerplate getters and setters

Breaking changes

[Q] - Incorrect valid examples in the README

In the README under the section Validation it seems that the last two examples have misplaced separators, but the text imply that they are correct.

import dev.personnummer.*;

class Test 
{
  public void TestValidation() 
  {
    Personnummer.valid("191212121212");    // => True
    Personnummer.valid("12121+21212");     // => True
    Personnummer.valid("2012121-21212");   // => True
  }
}

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/codeql-analysis.yml
  • actions/checkout v4
  • github/codeql-action v3
  • github/codeql-action v3
  • github/codeql-action v3
.github/workflows/release.yml
  • actions/checkout v4
  • actions/setup-java v4
.github/workflows/test.yml
  • actions/checkout v4
  • actions/setup-java v4
  • ubuntu 22.04
gradle
settings.gradle
build.gradle
  • org.junit.jupiter:junit-jupiter 5.10.2
  • org.json:json 20240205
gradle-wrapper
gradle/wrapper/gradle-wrapper.properties
  • gradle 8.7

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.