graphql-java: Can't find bundle for base name i18n.Validation, locale en_IN

before we were using graphq-java:15.0 but this version showing one crital vulnerability and suggested to updrade 19.0 and later. After updating 19.2. Our plugin api calls not working and throwing error

{
  "errors": [
    {
      "errorClassification": "DataFetchingException",
      "cause": {
        "className": "i18n.Validation_en_IN",
        "key": "",
        "detailMessage": "Can't find bundle for base name i18n.Validation, locale en_IN",
        "stackTrace": [],
        "suppressedExceptions": []
      },
      "stackTrace": [],
      "suppressedExceptions": []
    }
  ]
}

Any once can help me

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 17 (9 by maintainers)

Most upvoted comments

Can you please try to run this code on your system with graphql-java 19.2 on the class path

package org.example;

import java.util.Locale;
import java.util.ResourceBundle;

public class Main {
    public static void main(String[] args) {

        Locale.setDefault(new Locale("en", "IN"));

        ResourceBundle defaultBundle = getBundle("i18n.Validation", Locale.getDefault());
        printInfo("defaultBundle", defaultBundle);

        ResourceBundle englishBundle = getBundle("i18n.Validation", Locale.ENGLISH);
        printInfo("englishBundle", englishBundle);

        ResourceBundle germanBundle = getBundle("i18n.Validation", Locale.GERMAN);
        printInfo("germanBundle", germanBundle);

        ResourceBundle indianBundle = getBundle("i18n.Validation", new Locale("en", "IN"));
        printInfo("indianBundle", indianBundle);

        ResourceBundle noBundle = getBundle("i18n.ValidationXXX", new Locale("en", "IN"));
        printInfo("noBundle", noBundle);
    }

    private static ResourceBundle getBundle(String baseName, Locale Default) {
        try {
            return ResourceBundle.getBundle(baseName, Default);
        } catch (Exception e) {
            e.printStackTrace(System.out);
            return null;
        }
    }


    private static void printInfo(String name, ResourceBundle bundle) {
        if (bundle!= null) {
            System.out.printf("%s = %s - %d keys\n", name, bundle, bundle.keySet().size());
        } else {
            System.out.printf("%s = null\n", name);
        }
    }
}

When I run this on my system (with 19.2 graphql -java on the class path) I get

defaultBundle = java.util.PropertyResourceBundle@2626b418 - 51 keys
englishBundle = java.util.PropertyResourceBundle@2626b418 - 51 keys
germanBundle = java.util.PropertyResourceBundle@2626b418 - 51 keys
indianBundle = java.util.PropertyResourceBundle@2626b418 - 51 keys
java.util.MissingResourceException: Can't find bundle for base name i18n.ValidationXXX, locale en_IN
	at java.base/java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:2045)
	at java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1683)
	at java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1586)
	at java.base/java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1549)
	at java.base/java.util.ResourceBundle.getBundle(ResourceBundle.java:932)
	at org.example.Main.getBundle(Main.java:26)
	at org.example.Main.main(Main.java:20)
noBundle = null

Can you inspect your graphql-java 19.2 jar and check there is a set of files

i18n\
   Execution.properties
   General.properties
   Validation.properties

These are the fallback property files that should be used during ResourceBundle.getBundle()

I used this gradle file say ( a simple IDEA generated one)

plugins {
    id 'java'
}

group 'org.example'
version '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'com.graphql-java:graphql-java:19.2'
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}

test {
    useJUnitPlatform()
}

I can’t reproduce this - even if I set my Java locale to be en_IN on the command line or inside the program.

I am starting to think this must be something unique on your system. Because 19.x has been out for a while and lots of international (and Indian) developers are using it.

But I have also tried with US timezone and same error give me

Can you please tell us more about how you “tried with US timezone”

What this passing in a new Locale to the ExecutionInput or was this a JVM defaulting to Locale?

We don’t have a way to disable Localisation - its an intended feature and works as far as we can see this end so being able to reproduce the bug is essential to getting a fix

What JVM are you running, what version? What environment are you running this in?

Can you write a simple reproduction program to show this happening?

We will need more reproduction details to help here