org.apache.commons.codec.DecoderException Java Examples

The following examples show how to use org.apache.commons.codec.DecoderException. 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: SplitFormat.java    From emodb with Apache License 2.0 6 votes vote down vote up
/**
 * Parses a hex string that looks like "commonPrefix:startSuffix-endSuffix".
 */
static ByteBufferRange decode(String string) {
    int prefix = string.indexOf(':');
    int sep = string.indexOf('-', prefix + 1);
    checkArgument(prefix >= 0 && sep >= 0, "Invalid split string: %s", string);

    char[] start = new char[prefix + sep - (prefix + 1)];
    string.getChars(0, prefix, start, 0);
    string.getChars(prefix + 1, sep, start, prefix);

    char[] end = new char[prefix + string.length() - (sep + 1)];
    string.getChars(0, prefix, end, 0);
    string.getChars(sep + 1, string.length(), end, prefix);

    byte[] startBytes, endBytes;
    try {
        startBytes = Hex.decodeHex(start);
        endBytes = Hex.decodeHex(end);
    } catch (DecoderException e) {
        throw new IllegalArgumentException(format("Invalid split string: %s", string));
    }

    return new ByteBufferRangeImpl(ByteBuffer.wrap(startBytes), ByteBuffer.wrap(endBytes), -1, false);
}
 
Example #2
Source File: UnitTestSuiteFlink.java    From df_data_service with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws IOException, DecoderException {

        final String STATIC_USER_SCHEMA = "{"
                + "\"type\":\"record\","
                + "\"name\":\"myrecord\","
                + "\"fields\":["
                + "  { \"name\":\"symbol\", \"type\":\"string\" },"
                + "  { \"name\":\"name\", \"type\":\"string\" },"
                + "  { \"name\":\"exchangecode\", \"type\":\"string\" }"
                + "]}";

        System.out.println(SchemaRegistryClient.getSchemaFromRegistry ("http://localhost:8081", "test-value", "latest"));
        //testFlinkAvroSerDe("http://localhost:18081");
        //testFlinkAvroSerDe("http://localhost:8081");
        testFlinkAvroSQLJson();
        //testFlinkRun();
        //testFlinkSQL();
        //testFlinkAvroSQL();
        //testFlinkAvroSQLWithStaticSchema();
        //testFlinkAvroScriptWithStaticSchema();
    }
 
Example #3
Source File: ScryptCipherProvider.java    From localization_nifi with Apache License 2.0 6 votes vote down vote up
/**
 * Translates a salt from the mcrypt format {@code $n$r$p$salt_hex} to the Java scrypt format {@code $s0$params$saltBase64}.
 *
 * @param mcryptSalt the mcrypt-formatted salt string
 * @return the formatted salt to use with Java Scrypt
 */
public String translateSalt(String mcryptSalt) {
    if (StringUtils.isEmpty(mcryptSalt)) {
        throw new IllegalArgumentException("Cannot translate empty salt");
    }

    // Format should be $n$r$p$saltHex
    Matcher matcher = MCRYPT_SALT_FORMAT.matcher(mcryptSalt);
    if (!matcher.matches()) {
        throw new IllegalArgumentException("Salt is not valid mcrypt format of $n$r$p$saltHex");
    }

    String[] components = mcryptSalt.split("\\$");
    try {
        return Scrypt.formatSalt(Hex.decodeHex(components[4].toCharArray()), Integer.valueOf(components[1]), Integer.valueOf(components[2]), Integer.valueOf(components[3]));
    } catch (DecoderException e) {
        final String msg = "Mcrypt salt was not properly hex-encoded";
        logger.warn(msg);
        throw new IllegalArgumentException(msg);
    }
}
 
Example #4
Source File: User.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public IUser login(String username, char[] password){
	if (isDeleted() || !username.equals(getUsername()) || !isActive()) {
		return null;
	}
	
	try {
		if (!new PasswordEncryptionService().authenticate(password, getHashedPassword(),
			getSalt())) {
			return null;
		}
	} catch (NoSuchAlgorithmException | InvalidKeySpecException | DecoderException e) {
		LoggerFactory.getLogger(IUser.class).error("Error verifying password", e);
	}
	return this;
}
 
Example #5
Source File: CharacteristicActivity.java    From GizwitsBLE with Apache License 2.0 6 votes vote down vote up
@Override
public void onClick(View v) {
	if (v.getId() == R.id.btn_read) {
		mBle.requestReadCharacteristic(mDeviceAddress, mCharacteristic);
	} else if (v.getId() == R.id.btn_notify) {
		if (mNotifyStarted) {
			mBle.requestStopNotification(mDeviceAddress,
					mCharacteristic);
		} else {
			mBle.requestCharacteristicNotification(mDeviceAddress,
					mCharacteristic);
		}
	} else if (v.getId() == R.id.btn_indicate) {
		mBle.requestIndication(mDeviceAddress, mCharacteristic);
	} else if (v.getId() == R.id.btn_write) {
		String val = et_hex.getText().toString();
		try {
			byte[] data = Hex.decodeHex(val.toCharArray());
			mCharacteristic.setValue(data);
			mBle.requestWriteCharacteristic(mDeviceAddress,
					mCharacteristic, "");
		} catch (DecoderException e) {
			e.printStackTrace();
		}
	}
}
 
Example #6
Source File: BitcoinJSONRPCRetriever.java    From bitcoin-transaction-explorer with MIT License 6 votes vote down vote up
@Override
public BlockInformation getBlockInformationFromHash(final String identifier) throws ApplicationException {
  try (CloseableHttpClient client = getAuthenticatedHttpClientProxy();
      InputStream jsonData = doComplexJSONRPCMethod(client, "getblock", identifier).getContent()) {

    final BlockInformation blockInformation = JSONRPCParser.getBlockInformation(jsonData);

    // Extract the coinbase tx id (TODO: Refactor, shouldn't be using a mock
    // object like this)
    final String coinbaseTxid = blockInformation.getCoinbaseInformation().getRawHex();

    // Retrieve raw coinbase tx and its blockchain information
    final TransactionInformation ti = getTransactionInformation(coinbaseTxid);

    // Stick it in the block info
    blockInformation.setCoinbaseInformation(ti);

    // Return the result
    return blockInformation;
  } catch (IOException | HttpException | DecoderException e) {
    e.printStackTrace();
    throw new ApplicationException(e.getMessage());
  }
}
 
Example #7
Source File: KeyValueTest.java    From JavaSteam with MIT License 6 votes vote down vote up
@Test
public void keyValuesReadsBinaryWithLeftoverData() throws IOException, DecoderException {
    byte[] binary = Hex.decodeHex(TEST_OBJECT_HEX + UUID.randomUUID().toString().replaceAll("-", ""));
    KeyValue kv = new KeyValue();
    boolean success;

    MemoryStream ms = new MemoryStream(binary);
    success = kv.tryReadAsBinary(ms);
    assertEquals(TEST_OBJECT_HEX.length() / 2, ms.getPosition());
    assertEquals(16, ms.getLength() - ms.getPosition());

    assertTrue("Should have read test object.", success);
    assertEquals("TestObject", kv.getName());
    assertEquals(1, kv.getChildren().size());
    assertEquals("key", kv.getChildren().get(0).getName());
    assertEquals("value", kv.getChildren().get(0).getValue());
}
 
Example #8
Source File: DataUrlDecoder.java    From htmlunit with Apache License 2.0 6 votes vote down vote up
private static byte[] decodeUrl(final byte[] bytes) throws DecoderException {
    if (bytes == null) {
        return null;
    }
    final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    for (int i = 0; i < bytes.length; i++) {
        final int b = bytes[i];
        if (b == '%') {
            try {
                final int u = digit16(bytes[++i]);
                final int l = digit16(bytes[++i]);
                buffer.write((char) ((u << 4) + l));
            }
            catch (final ArrayIndexOutOfBoundsException e) {
                throw new DecoderException("Invalid URL encoding: ", e);
            }
        }
        else {
            buffer.write(b);
        }
    }
    return buffer.toByteArray();
}
 
Example #9
Source File: UploadId.java    From tus-java-server with MIT License 6 votes vote down vote up
/**
 * Create a new {@link UploadId} instance based on the provided object using it's toString method.
 * @param inputObject The object to use for constructing the ID
 */
public UploadId(Serializable inputObject) {
    String inputValue = (inputObject == null ? null : inputObject.toString());
    Validate.notBlank(inputValue, "The upload ID value cannot be blank");

    this.originalObject = inputObject;
    URLCodec codec = new URLCodec();
    //Check if value is not encoded already
    try {
        if (inputValue != null && inputValue.equals(codec.decode(inputValue, UPLOAD_ID_CHARSET))) {
            this.urlSafeValue = codec.encode(inputValue, UPLOAD_ID_CHARSET);
        } else {
            //value is already encoded, use as is
            this.urlSafeValue = inputValue;
        }
    } catch (DecoderException | UnsupportedEncodingException e) {
        log.warn("Unable to URL encode upload ID value", e);
        this.urlSafeValue = inputValue;
    }
}
 
Example #10
Source File: ParamSupply.java    From onedev with MIT License 6 votes vote down vote up
@SuppressWarnings("unchecked")
@Nullable
public static Class<? extends Serializable> loadBeanClass(String className) {
	if (className.startsWith(PARAM_BEAN_PREFIX)) {
		byte[] bytes;
		try {
			bytes = Hex.decodeHex(className.substring(PARAM_BEAN_PREFIX.length()+1).toCharArray());
		} catch (DecoderException e) {
			throw new RuntimeException(e);
		}
		List<ParamSpec> paramSpecs = (List<ParamSpec>) SerializationUtils.deserialize(bytes);
		return defineBeanClass(paramSpecs);
	} else {
		return null;
	}
}
 
Example #11
Source File: UserService.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public boolean verifyPassword(IUser user, char[] attemptedPassword){
	boolean ret = false;
	
	if (user != null) {
		PasswordEncryptionService pes = new PasswordEncryptionService();
		try {
			ret = pes.authenticate(attemptedPassword, user.getHashedPassword(), user.getSalt());
		} catch (NoSuchAlgorithmException | InvalidKeySpecException | DecoderException e) {
			LoggerFactory.getLogger(getClass()).warn("Error verifying password for user [{}].",
				user.getLabel(), e);
		}
	}
	
	return ret;
}
 
Example #12
Source File: UserService.java    From elexis-3-core with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void setPasswordForUser(IUser user, String password){
	if (user != null) {
		PasswordEncryptionService pes = new PasswordEncryptionService();
		try {
			String salt = pes.generateSaltAsHexString();
			String hashed_pw = pes.getEncryptedPasswordAsHexString(password, salt);
			user.setSalt(salt);
			user.setHashedPassword(hashed_pw);
			modelService.save(user);
		} catch (NoSuchAlgorithmException | InvalidKeySpecException | DecoderException e) {
			LoggerFactory.getLogger(getClass()).warn("Error setting password for user [{}].",
				user.getLabel(), e);
		}
	}
	
}
 
Example #13
Source File: Split.java    From hbase-tools with Apache License 2.0 6 votes vote down vote up
@Override
public Map<String, List<byte[]>> split(Set<String> tableSet, Args args) throws IOException, DecoderException {
    Map<String, List<byte[]>> splitMap = new HashMap<>();

    for (String tableName : tableSet) {
        String ruleArg = ((String) args.getOptionSet().nonOptionArguments().get(3)).toLowerCase();
        SplitRule splitRule = SplitRule.valueOf(ruleArg);

        String numRegionsArg = (String) args.getOptionSet().nonOptionArguments().get(4);
        int numCardinality = 0;
        if (args.getOptionSet().nonOptionArguments().size() >= 6)
            numCardinality = Integer.valueOf((String) args.getOptionSet().nonOptionArguments().get(5));
        List<byte[]> splitList = splitRule.split(Integer.valueOf(numRegionsArg), numCardinality);
        splitMap.put(tableName, splitList);

        System.out.println("Table \"" + tableName + "\" on \"" + args.getZookeeperQuorum() + "\" will be split into " + (splitList.size() + 1) + " regions by " + splitRule.name() + " rule.");
    }

    return splitMap;
}
 
Example #14
Source File: LoggingTestBase.java    From appengine-tck with Apache License 2.0 6 votes vote down vote up
protected static WebArchive getDefaultDeployment(TestContext context) {
    context.setAppEngineWebXmlFile("appengine-web-with-logging-properties.xml");
    WebArchive war = getTckDeployment(context);
    war.addClasses(LoggingTestBase.class, TestBase.class)
        // classes for Base64.isBase64()
        .addClasses(Base64.class, BaseNCodec.class)
        .addClasses(BinaryEncoder.class, Encoder.class)
        .addClasses(BinaryDecoder.class, Decoder.class)
        .addClasses(EncoderException.class, DecoderException.class)
        .addAsWebInfResource("currentTimeUsec.jsp")
        .addAsWebInfResource("doNothing.jsp")
        .addAsWebInfResource("storeTestData.jsp")
        .addAsWebInfResource("throwException.jsp")
        .addAsWebInfResource("log4j-test.properties")
        .addAsWebInfResource("logging-all.properties");
    return war;
}
 
Example #15
Source File: DataUrlDecoder.java    From HtmlUnit-Android with Apache License 2.0 6 votes vote down vote up
private static byte[] decodeUrl(final byte[] bytes) throws DecoderException {
    if (bytes == null) {
        return null;
    }
    final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    for (int i = 0; i < bytes.length; i++) {
        final int b = bytes[i];
        if (b == '%') {
            try {
                final int u = digit16(bytes[++i]);
                final int l = digit16(bytes[++i]);
                buffer.write((char) ((u << 4) + l));
            }
            catch (final ArrayIndexOutOfBoundsException e) {
                throw new DecoderException("Invalid URL encoding: ", e);
            }
        }
        else {
            buffer.write(b);
        }
    }
    return buffer.toByteArray();
}
 
Example #16
Source File: WebClient.java    From HtmlUnit-Android with Apache License 2.0 6 votes vote down vote up
private WebResponse makeWebResponseForDataUrl(final WebRequest webRequest) throws IOException {
    final URL url = webRequest.getUrl();
    final List<NameValuePair> responseHeaders = new ArrayList<>();
    final DataURLConnection connection;
    try {
        connection = new DataURLConnection(url);
    }
    catch (final DecoderException e) {
        throw new IOException(e.getMessage());
    }
    responseHeaders.add(new NameValuePair(HttpHeader.CONTENT_TYPE_LC,
        connection.getMediaType() + ";charset=" + connection.getCharset()));

    try (InputStream is = connection.getInputStream()) {
        final DownloadedContent downloadedContent =
                HttpWebConnection.downloadContent(is, getOptions().getMaxInMemory());
        final WebResponseData data = new WebResponseData(downloadedContent, 200, "OK", responseHeaders);
        return new WebResponse(data, url, webRequest.getHttpMethod(), 0);
    }
}
 
Example #17
Source File: FHex.java    From text_converter with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Converts a String or an array of character bytes representing hexadecimal values into an array of bytes of those
 * same values. The returned array will be half the length of the passed String or array, as it takes two characters
 * to represent any given byte. An exception is thrown if the passed char array has an odd number of elements.
 *
 * @param object
 *            A String, ByteBuffer, byte[], or an array of character bytes containing hexadecimal digits
 * @return A byte array containing binary data decoded from the supplied byte array (representing characters).
 * @throws DecoderException
 *             Thrown if an odd number of characters is supplied to this function or the object is not a String or
 *             char[]
 * @see #decodeHex(char[])
 */
@Override
public Object decode(final Object object) throws DecoderException {
    if (object instanceof String) {
        return decode(((String) object).toCharArray());
    } else if (object instanceof byte[]) {
        return decode((byte[]) object);
    } else if (object instanceof ByteBuffer) {
        return decode((ByteBuffer) object);
    } else {
        try {
            return decodeHex((char[]) object);
        } catch (final ClassCastException e) {
            throw new DecoderException(e.getMessage(), e);
        }
    }
}
 
Example #18
Source File: DatabaseUtils.java    From Zom-Android-XMPP with GNU General Public License v3.0 6 votes vote down vote up
public static byte[] getAvatarBytesFromAddress(ContentResolver cr, String address) throws DecoderException {

        String[] projection =  {Imps.Avatars.DATA};
        String[] args = {address};
        String query = Imps.Avatars.CONTACT + " LIKE ?";
        Cursor cursor = cr.query(Imps.Avatars.CONTENT_URI, projection,
                query, args, Imps.Avatars.DEFAULT_SORT_ORDER);

        byte[] data = null;

        if (cursor != null) {
            if (cursor.moveToFirst())
                data = cursor.getBlob(0);

            cursor.close();
        }

        return data;

    }
 
Example #19
Source File: SHA1Utils.java    From Online_Study_System with Apache License 2.0 5 votes vote down vote up
/**
 * Hex解码
 * @author jitwxs
 * @version 创建时间:2017年10月18日 下午9:12:54 
 * @param input
 * @return
 */
public static byte[] decodeHex(String input) {
	try {
		return Hex.decodeHex(input.toCharArray());
	} catch (DecoderException e) {
		return null;
	}
}
 
Example #20
Source File: AbstractChecksumCompute.java    From cyberduck with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Checksum compute(final String data, final TransferStatus status) throws ChecksumException {
    try {
        return this.compute(new ByteArrayInputStream(Hex.decodeHex(data.toCharArray())), status);
    }
    catch(DecoderException e) {
        throw new ChecksumException(LocaleFactory.localizedString("Checksum failure", "Error"), e.getMessage(), e);
    }
}
 
Example #21
Source File: ExportKeys.java    From hbase-tools with Apache License 2.0 5 votes vote down vote up
private boolean export(PrintWriter writer, HRegionInfo regionInfo) throws DecoderException {
    String tableName = CommandAdapter.getTableName(regionInfo);
    String startKeyHexStr = Bytes.toStringBinary(regionInfo.getStartKey());
    String endKeyHexStr = Bytes.toStringBinary(regionInfo.getEndKey());

    if (startKeyHexStr.length() > 0 || endKeyHexStr.length() > 0) {
        writer.println(tableName + DELIMITER + " " + startKeyHexStr + DELIMITER + " " + endKeyHexStr);
        return true;
    } else {
        return false;
    }
}
 
Example #22
Source File: HexUtil.java    From nuls-v2 with MIT License 5 votes vote down vote up
/**
 * 对16进制编码的字符串进行解码。
 *
 * @param hexString 源字串
 * @return byte[] 解码后的字节数组
 */
public static byte[] decode(String hexString) {
    try {
        return Hex.decodeHex(hexString);
    } catch (DecoderException e) {
        byte[] bts = new byte[hexString.length() / 2];
        for (int i = 0; i < bts.length; i++) {
            bts[i] = (byte) Integer.parseInt(hexString.substring(2 * i, 2 * i + 2), 16);
        }
        return bts;
    }
}
 
Example #23
Source File: Encodes.java    From spring-boot-quickstart with Apache License 2.0 5 votes vote down vote up
/**
 * Hex解码.
 */
public static byte[] decodeHex(String input) {
	try {
		return Hex.decodeHex(input.toCharArray());
	} catch (DecoderException e) {
		throw Exceptions.unchecked(e);
	}
}
 
Example #24
Source File: ListProfilesWorker.java    From LPAd_SM-DPPlus_Connector with Apache License 2.0 5 votes vote down vote up
List<Map<String, String>> run() {
    String profilesInfo = getProfileInfoListResponse();
    ProfileInfoListResponse profiles = new ProfileInfoListResponse();
    List<Map<String, String>> profileList = new ArrayList<>();

    try {
        decodeProfiles(profilesInfo, profiles);

        for (ProfileInfo info : profiles.getProfileInfoListOk().getProfileInfo()) {
            Map<String, String> profileMap = new HashMap<>();

            profileMap.put(ProfileKey.STATE.name(), LocalProfileAssistantImpl.DISABLED_STATE.equals(info.getProfileState().toString()) ? "Disabled" : "Enabled");
            profileMap.put(ProfileKey.ICCID.name(), info.getIccid().toString());
            profileMap.put(ProfileKey.NAME.name(), info.getProfileName().toString());
            profileMap.put(ProfileKey.PROVIDER_NAME.name(), info.getServiceProviderName().toString());

            profileList.add(profileMap);
        }

        if (LogStub.getInstance().isDebugEnabled()) {
            LogStub.getInstance().logDebug (LOG, LogStub.getInstance().getTag() + " - getProfiles - returning: " + profileList.toString());
        }

        return profileList;

    } catch (DecoderException e) {
        LOG.log(Level.SEVERE, LogStub.getInstance().getTag() + " - " + e.getMessage(), e);
        LOG.log(Level.SEVERE, LogStub.getInstance().getTag() + " -  Unable to retrieve profiles. Exception in Decoder:" + e.getMessage());

        throw new RuntimeException("Unable to retrieve profiles");
    } catch (IOException ioe) {
        LOG.log(Level.SEVERE, LogStub.getInstance().getTag() + " - " + ioe.getMessage(), ioe);

        throw new RuntimeException("Unable to retrieve profiles");
    }
}
 
Example #25
Source File: EncodeUtils.java    From base-framework with Apache License 2.0 5 votes vote down vote up
/**
 * Hex解码, String->byte[].
 */
public static byte[] decodeHex(String input) {
	try {
		return Hex.decodeHex(input.toCharArray());
	} catch (DecoderException e) {
		throw new IllegalStateException("Hex Decoder exception", e);
	}
}
 
Example #26
Source File: SplitContent.java    From nifi with Apache License 2.0 5 votes vote down vote up
@OnScheduled
public void initializeByteSequence(final ProcessContext context) throws DecoderException {
    final String bytePattern = context.getProperty(BYTE_SEQUENCE).getValue();

    final String format = context.getProperty(FORMAT).getValue();
    if (HEX_FORMAT.getValue().equals(format)) {
        this.byteSequence.set(Hex.decodeHex(bytePattern.toCharArray()));
    } else {
        this.byteSequence.set(bytePattern.getBytes(StandardCharsets.UTF_8));
    }
}
 
Example #27
Source File: DeltaJournalTest.java    From secure-data-service with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("rawtypes")
private List<Map> buildSecondBatch() throws DecoderException {
    Map<String, Object> c = new HashMap<String, Object>();
    c.put("_id", Hex.decodeHex("cc".toCharArray()));
    c.put("t", 2L);
    Map<String, Object> d = new HashMap<String, Object>();
    d.put("_id", Hex.decodeHex("dd".toCharArray()));
    d.put("t", 2L);

    List<Map> res = new LinkedList<Map>();
    res.add(c);
    res.add(d);

    return res;
}
 
Example #28
Source File: InstallationPhaseWorker.java    From LPAd_SM-DPPlus_Connector with Apache License 2.0 5 votes vote down vote up
private void checkProfileInstallationResult(String profileInstallationResultRaw) {
    boolean success = false;
    String errorMessage = "";

    try {
        ProfileInstallationResult profileInstallationResult = getProfileInstallationResult(profileInstallationResultRaw);

        if (profileInstallationResult.getProfileInstallationResultData() != null &&
                profileInstallationResult.getProfileInstallationResultData().getFinalResult() != null) {

            ProfileInstallationResultData.FinalResult finalResult = profileInstallationResult.getProfileInstallationResultData().getFinalResult();

            if (finalResult.getSuccessResult() != null) {
                LOG.info(LogStub.getInstance().getTag() + " - Decoded Success Result: " + finalResult.getSuccessResult().toString());

                success = true;

            } else {
                errorMessage = invalidFinalResult(finalResult);
            }
        } else {
            errorMessage = invalidProfileInstallationData();
        }

        if (!success) {
            throw new RuntimeException(errorMessage);
        }

    } catch (DecoderException e) {
        LOG.log(Level.SEVERE, LogStub.getInstance().getTag() + " - " + e.getMessage(), e);
        LOG.severe(LogStub.getInstance().getTag() + " -  Unable to retrieve Profile Installation Result. Exception in Decoder:" + e.getMessage());

        throw new RuntimeException("Unable to retrieve Profile Installation Result.");
    } catch (IOException ioe) {
        LOG.log(Level.SEVERE, LogStub.getInstance().getTag() + " - " + ioe.getMessage(), ioe);
        LOG.severe(LogStub.getInstance().getTag() + " -  Unable to retrieve Profile Installation Result. IOException:" + ioe.getMessage());

        throw new RuntimeException("Unable to retrieve Profile Installation Result.");
    }
}
 
Example #29
Source File: UserService.java    From app-engine with Apache License 2.0 5 votes vote down vote up
private String entryptPassword(String saltStr, String password) {

        byte[] salt = new byte[0];
        try {
            salt = Hex.decodeHex(saltStr.toCharArray());
        } catch (DecoderException ignored) {
        }
        byte[] hashPassword = Digests.sha1(password.getBytes(), salt, HASH_INTERATIONS);
        return Hex.encodeHexString(hashPassword);
    }
 
Example #30
Source File: HandleNotificationsWorker.java    From LPAd_SM-DPPlus_Connector with Apache License 2.0 5 votes vote down vote up
private void decodeRemoveNotification(String removeNotificationResponse) throws DecoderException, IOException {
    InputStream is2 = new ByteArrayInputStream(Hex.decodeHex(removeNotificationResponse.toCharArray()));
    NotificationSentResponse notificationSentResponse = new NotificationSentResponse();

    notificationSentResponse.decode(is2, true);

    if (LogStub.getInstance().isDebugEnabled()) {
        LogStub.getInstance().logDebug(LOG, LogStub.getInstance().getTag() + " - Notification removal response: " + notificationSentResponse.toString());
    }
}