org.joda.time.tz.NameProvider Java Examples

The following examples show how to use org.joda.time.tz.NameProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DateTimeZone.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #2
Source File: Cardumen_0074_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #3
Source File: Time_8_DateTimeZone_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #4
Source File: Time_19_DateTimeZone_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #5
Source File: TestDateTimeZone.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
public void testNameProvider() {
    try {
        assertNotNull(DateTimeZone.getNameProvider());
    
        NameProvider provider = DateTimeZone.getNameProvider();
        DateTimeZone.setNameProvider(null);
        assertEquals(provider.getClass(), DateTimeZone.getNameProvider().getClass());
    
        provider = new MockOKButNullNameProvider();
        DateTimeZone.setNameProvider(provider);
        assertSame(provider, DateTimeZone.getNameProvider());
        
        assertEquals("+00:00", DateTimeZone.UTC.getShortName(TEST_TIME_SUMMER));
        assertEquals("+00:00", DateTimeZone.UTC.getName(TEST_TIME_SUMMER));
    } finally {
        DateTimeZone.setNameProvider(null);
    }
    
    try {
        System.setProperty("org.joda.time.DateTimeZone.NameProvider", "org.joda.time.tz.DefaultNameProvider");
        DateTimeZone.setNameProvider(null);
        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
    } finally {
        System.getProperties().remove("org.joda.time.DateTimeZone.NameProvider");
        DateTimeZone.setNameProvider(null);
        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
    }
}
 
Example #6
Source File: Cardumen_00189_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #7
Source File: Time_9_DateTimeZone_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #8
Source File: Cardumen_00239_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #9
Source File: Cardumen_00189_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #10
Source File: Cardumen_00239_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #11
Source File: Time_9_DateTimeZone_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #12
Source File: Cardumen_0074_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #13
Source File: Time_8_DateTimeZone_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #14
Source File: Cardumen_00282_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #15
Source File: Time_19_DateTimeZone_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #16
Source File: Cardumen_00282_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #17
Source File: Time_23_DateTimeZone_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #18
Source File: Cardumen_0070_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #19
Source File: Time_23_DateTimeZone_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #20
Source File: Cardumen_0070_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #21
Source File: Time_17_DateTimeZone_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #22
Source File: Cardumen_00137_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #23
Source File: Time_17_DateTimeZone_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #24
Source File: Cardumen_00137_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #25
Source File: Time_25_DateTimeZone_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #26
Source File: Nopol2017_0089_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #27
Source File: Time_25_DateTimeZone_t.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #28
Source File: Nopol2017_0089_s.java    From coming with MIT License 5 votes vote down vote up
/**
 * Sets the name provider factory without performing the security check.
 * 
 * @param nameProvider  provider to use, or null for default
 * @throws IllegalArgumentException if the provider is invalid
 */
private static void setNameProvider0(NameProvider nameProvider) {
    if (nameProvider == null) {
        nameProvider = getDefaultNameProvider();
    }
    cNameProvider = nameProvider;
}
 
Example #29
Source File: TestDateTimeZone.java    From joda-time-android with Apache License 2.0 5 votes vote down vote up
@Test
public void testNameProvider() {
    try {
        assertNotNull(DateTimeZone.getNameProvider());
    
        NameProvider provider = DateTimeZone.getNameProvider();
        DateTimeZone.setNameProvider(null);
        assertEquals(provider.getClass(), DateTimeZone.getNameProvider().getClass());
    
        provider = new MockOKButNullNameProvider();
        DateTimeZone.setNameProvider(provider);
        assertSame(provider, DateTimeZone.getNameProvider());
        
        assertEquals("+00:00", DateTimeZone.UTC.getShortName(TEST_TIME_SUMMER));
        assertEquals("+00:00", DateTimeZone.UTC.getName(TEST_TIME_SUMMER));
    } finally {
        DateTimeZone.setNameProvider(null);
    }
    
    try {
        System.setProperty("org.joda.time.DateTimeZone.NameProvider", "org.joda.time.tz.DefaultNameProvider");
        DateTimeZone.setNameProvider(null);
        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
    } finally {
        System.getProperties().remove("org.joda.time.DateTimeZone.NameProvider");
        DateTimeZone.setNameProvider(null);
        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
    }
}
 
Example #30
Source File: TestDateTimeZone.java    From astor with GNU General Public License v2.0 4 votes vote down vote up
public void testNameProvider() {
    try {
        assertNotNull(DateTimeZone.getNameProvider());
    
        NameProvider provider = DateTimeZone.getNameProvider();
        DateTimeZone.setNameProvider(null);
        assertEquals(provider.getClass(), DateTimeZone.getNameProvider().getClass());
    
        provider = new MockOKButNullNameProvider();
        DateTimeZone.setNameProvider(provider);
        assertSame(provider, DateTimeZone.getNameProvider());
        
        assertEquals("+00:00", DateTimeZone.UTC.getShortName(TEST_TIME_SUMMER));
        assertEquals("+00:00", DateTimeZone.UTC.getName(TEST_TIME_SUMMER));
    } finally {
        DateTimeZone.setNameProvider(null);
    }
    
    try {
        System.setProperty("org.joda.time.DateTimeZone.NameProvider", "org.joda.time.tz.DefaultNameProvider");
        DateTimeZone.setNameProvider(null);
        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
    } finally {
        System.getProperties().remove("org.joda.time.DateTimeZone.NameProvider");
        DateTimeZone.setNameProvider(null);
        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
    }
    
    PrintStream syserr = System.err;
    try {
        System.setProperty("org.joda.time.DateTimeZone.NameProvider", "xxx");
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        System.setErr(new PrintStream(baos));
        
        DateTimeZone.setNameProvider(null);
        
        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
        String str = new String(baos.toByteArray());
        assertTrue(str.indexOf("java.lang.ClassNotFoundException") >= 0);
    } finally {
        System.setErr(syserr);
        System.getProperties().remove("org.joda.time.DateTimeZone.NameProvider");
        DateTimeZone.setNameProvider(null);
        assertEquals(DefaultNameProvider.class, DateTimeZone.getNameProvider().getClass());
    }
}