auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void confirmCreateWidget(View v){ AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(this); String backgroundColor = opacityToColorStringConvert(opacitySeekbar.getProgress(), "262C31"); RemoteViews views = new RemoteViews(this.getPackageName(), R.layout.player_widget); views.setInt(R.id.widgetLayout,"setBackgroundColor", Color.parseColor(backgroundColor)); appWidgetManager.updateAppWidget(appWidgetId,views); SharedPreferences prefs = getSharedPreferences(WIDGET_PREFS, MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.putString(WIDGET_COLOR + appWidgetId, backgroundColor); editor.apply(); Intent resultValue = new Intent(); resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID,appWidgetId); setResult(RESULT_OK,resultValue); finish(); }

Target:
private void confirmCreateWidget(View v) { int backgroundColor = getColorWithAlpha(PlayerWidget.DEFAULT_COLOR, opacitySeekBar.getProgress()); SharedPreferences prefs = getSharedPreferences(PlayerWidget.PREFS_NAME, MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); editor.putInt(PlayerWidget.KEY_WIDGET_COLOR + appWidgetId, backgroundColor); editor.apply(); Intent resultValue = new Intent(); resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId); setResult(RESULT_OK, resultValue); finish(); PlayerWidgetJobService.updateWidget(this); }
Source:
public final VirtualFile getVirtualFile(final String fileName, final String displayFileName, final String contents) throws IOException, NoSuchAlgorithmException { final String tempDir = System.getProperty(JAVA_IO_TMP_DIR); final String trimmedFileName = FileUtil.sanitizeFileName(StringUtil.trimEnd(fileName, displayFileName)); final String digest = getDigestAsString(trimmedFileName); final String filePath = tempDir + File.separatorChar + digest + File.separatorChar + displayFileName; final File file = new File(filePath); VirtualFile virtualFile; if (file.exists()) { virtualFile = LocalFileSystem.getInstance().findFileByPath(filePath); windowEditorOps.setWriteStatus(virtualFile, true); } else { FileUtil.createIfDoesntExist(file); FileUtil.writeToFile(file, contents); virtualFile = LocalFileSystem.getInstance().findFileByPath(filePath); windowEditorOps.setWriteStatus(virtualFile, false); } return virtualFile; }

Target:
public final VirtualFile getVirtualFile(final String fileName, final String displayFileName, final String contents) throws IOException, NoSuchAlgorithmException { final String tempDir = System.getProperty(JAVA_IO_TMP_DIR); final String trimmedFileName = FileUtil.sanitizeFileName(StringUtil.trimEnd(fileName, displayFileName)); final String digest = Utils.getInstance().getDigestAsString(trimmedFileName); final String fullFilePath = Utils.getInstance() .createFileWithContents(displayFileName, contents, tempDir, digest); return getVirtualFile(fullFilePath, displayFileName, contents, tempDir); }
Source:
public void testOpenSslSecret() throws NoSuchAlgorithmException, IOException, NoSuchProviderException { final byte[] enc = new EncryptionService(new File("src/test/resources/secret").getPath()).encrypt("testje" .getBytes()); Assert.assertEquals("testje", new String(new EncryptionService(new File("src/test/resources/secret").getPath()).decrypt(enc))); }

Target:
public void testOpenSslSecret() throws NoSuchAlgorithmException, IOException, NoSuchProviderException { final byte[] enc = new TestableEncService(new File(SRC_TEST_RESOURCES_SECRET).getPath()).encrypt(TESTJE .getBytes()); Assert.assertEquals(TESTJE, new String(new TestableEncService(new File(SRC_TEST_RESOURCES_SECRET).getPath()).decrypt(enc))); }
Source:
public WorkflowResponse execute(WorkflowDTO workflowDTO) throws WorkflowException { if (log.isDebugEnabled()) { log.debug("Executing Application creation Workflow."); } ApplicationWorkflowDTO appWorkFlowDTO = (ApplicationWorkflowDTO) workflowDTO; Application application = appWorkFlowDTO.getApplication(); String callBackURL = appWorkFlowDTO.getCallbackUrl(); String message = "Approve application [" + application.getName() + "] creation request from application creator -" + appWorkFlowDTO.getUserName() + " with throttling tier - " + application.getTier(); workflowDTO.setWorkflowDescription(message); super.execute(workflowDTO); return new GeneralWorkflowResponse(); }

Target:
public WorkflowResponse execute(WorkflowDTO workflowDTO) throws WorkflowException { if (log.isDebugEnabled()) { log.debug("Executing Application creation Workflow."); } ApplicationWorkflowDTO appWorkFlowDTO = (ApplicationWorkflowDTO) workflowDTO; Application application = appWorkFlowDTO.getApplication(); String message = "Approve application " + application.getName() + " creation request from application creator -" + appWorkFlowDTO.getUserName() + " with throttling tier - " + application.getTier(); workflowDTO.setWorkflowDescription(message); workflowDTO.setProperties("applicationName", application.getName()); workflowDTO.setProperties("userName", appWorkFlowDTO.getUserName()); workflowDTO.setProperties("applicationTier", application.getTier()); super.execute(workflowDTO); return new GeneralWorkflowResponse(); }
Source:
public void updateTimerSubprocessLongerDelayTest() { CountDownProcessEventListener countDownListener = new CountDownProcessEventListener(TIMER_SUBPROCESS_NAME, 1); setProcessScenario(TIMER_SUBPROCESS_FILE); kieSession.addEventListener(countDownListener); final List<Long> list = new ArrayList<Long>(); kieSession.addEventListener(new DefaultProcessEventListener() { @Override public void beforeProcessStarted(ProcessStartedEvent event) { list.add(event.getProcessInstance().getId()); } @Override public void afterNodeLeft(ProcessNodeLeftEvent event) { if (TIMER_SUBPROCESS_NAME.equals(event.getNodeInstance().getNodeName())) { System.setProperty(TIMER_FIRED_TEXT, ""); System.setProperty(TIMER_FIRED_TIME_PROP, System.currentTimeMillis()+""); } } }); Assertions.assertThat(list).isEmpty(); long id = kieSession.startProcess(PROCESS_SUBPROCESS_NAME).getId(); long startTime = System.currentTimeMillis(); Assertions.assertThat(list).isNotEmpty(); kieSession.execute(new UpdateTimerCommand(id, TIMER_SUBPROCESS_NAME, 8)); countDownListener.waitTillCompleted(); Assertions.assertThat(timerHasFired()).isTrue(); long firedTime = timerFiredTime(); long timeDifference = Math.abs(firedTime - startTime - 8000); logger.info("Start time: " + startTime + ", fired time: " + firedTime + ", difference: " + (firedTime-startTime)); Assertions.assertThat(timeDifference).isLessThan(500); Assertions.assertThat(kieSession.getProcessInstance(id)).isNull(); }

Target:
public void updateTimerSubprocessLongerDelayTest() { CountDownProcessEventListener countDownListener = new CountDownProcessEventListener(TIMER_SUBPROCESS_NAME, 1); setProcessScenario(TIMER_SUBPROCESS_FILE); kieSession.addEventListener(countDownListener); final List<Long> list = new ArrayList<Long>(); kieSession.addEventListener(new DefaultProcessEventListener() { @Override public void beforeProcessStarted(ProcessStartedEvent event) { list.add(event.getProcessInstance().getId()); } @Override public void afterNodeLeft(ProcessNodeLeftEvent event) { if (TIMER_SUBPROCESS_NAME.equals(event.getNodeInstance().getNodeName())) { System.setProperty(TIMER_FIRED_TEXT, ""); System.setProperty(TIMER_FIRED_TIME_PROP, String.valueOf(System.currentTimeMillis())); } } }); Assertions.assertThat(list).isEmpty(); long id = kieSession.startProcess(PROCESS_SUBPROCESS_NAME).getId(); long startTime = System.currentTimeMillis(); Assertions.assertThat(list).isNotEmpty(); kieSession.execute(new UpdateTimerCommand(id, TIMER_SUBPROCESS_NAME, 8)); countDownListener.waitTillCompleted(); Assertions.assertThat(timerHasFired()).isTrue(); long firedTime = timerFiredTime(); long timeDifference = Math.abs(firedTime - startTime - 8000); logger.info("Start time: " + startTime + ", fired time: " + firedTime + ", difference: " + (firedTime-startTime)); Assertions.assertThat(timeDifference).isLessThan(500); Assertions.assertThat(kieSession.getProcessInstance(id)).isNull(); }
Source:
public void deleteServiceComponentHosts(String hostname, DeleteHostComponentStatusMetaData deleteMetaData) throws AmbariException { readWriteLock.writeLock().lock(); try { ServiceComponentHost sch = getServiceComponentHost(hostname); LOG.info("Deleting servicecomponenthost for cluster" + ", clusterName=" + getClusterName() + ", serviceName=" + getServiceName() + ", componentName=" + getName() + ", recoveryEnabled=" + isRecoveryEnabled() + ", hostname=" + sch.getHostName() + ", cuurentState=" + sch.getState()); if (!sch.canBeRemoved()) { throw new AmbariException("Could not delete hostcomponent from cluster, component in undeletable state" + ", clusterName=" + getClusterName() + ", serviceName=" + getServiceName() + ", componentName=" + getName() + ", recoveryEnabled=" + isRecoveryEnabled() + ", hostname=" + sch.getHostName() + ", currentState=" + sch.getState()); } sch.delete(deleteMetaData); hostComponents.remove(hostname); } finally { readWriteLock.writeLock().unlock(); } }

Target:
public void deleteServiceComponentHosts(String hostname, DeleteHostComponentStatusMetaData deleteMetaData) throws AmbariException { readWriteLock.writeLock().lock(); try { ServiceComponentHost sch = getServiceComponentHost(hostname); LOG.info("Deleting servicecomponenthost for cluster" + ", clusterName=" + getClusterName() + ", serviceName=" + getServiceName() + ", componentName=" + getName() + ", recoveryEnabled=" + isRecoveryEnabled() + ", hostname=" + sch.getHostName() + ", state=" + sch.getState()); if (!sch.canBeRemoved()) { throw new AmbariException("Current host component state prohibiting component removal." + ", clusterName=" + getClusterName() + ", serviceName=" + getServiceName() + ", componentName=" + getName() + ", recoveryEnabled=" + isRecoveryEnabled() + ", hostname=" + sch.getHostName() + ", state=" + sch.getState()); } sch.delete(deleteMetaData); hostComponents.remove(hostname); } finally { readWriteLock.writeLock().unlock(); } }
Source:
public void testWriteCommitProcTime() throws Exception { setupProcessors(0, 0); Request req1 = createWriteRequest(1l, 2); processRequestWithWait(req1); commitWithWait(req1); Map<String, Object> values = ServerMetrics.getAllValues(); Assert.assertEquals(1L, values.get("cnt_write_commitproc_time_ms")); checkTimeMetric((long)values.get("max_write_commitproc_time_ms"), 0l, 1000l); Request req2 = createWriteRequest(1l, 2); processRequestWithWait(req2); Thread.sleep(1000); commitWithWait(req2); values = ServerMetrics.getAllValues(); Assert.assertEquals(2L, values.get("cnt_write_commitproc_time_ms")); checkTimeMetric((long)values.get("max_write_commitproc_time_ms"), 1000L, 2000L); }

Target:
public void testWriteCommitProcTime() throws Exception { setupProcessors(0, 0); Request req1 = createWriteRequest(1l, 2); processRequestWithWait(req1); commitWithWait(req1); Map<String, Object> values = MetricsUtils.currentServerMetrics(); Assert.assertEquals(1L, values.get("cnt_write_commitproc_time_ms")); checkTimeMetric((long)values.get("max_write_commitproc_time_ms"), 0l, 1000l); Request req2 = createWriteRequest(1l, 2); processRequestWithWait(req2); Thread.sleep(1000); commitWithWait(req2); values = MetricsUtils.currentServerMetrics(); Assert.assertEquals(2L, values.get("cnt_write_commitproc_time_ms")); checkTimeMetric((long)values.get("max_write_commitproc_time_ms"), 1000L, 2000L); }
Source:
public void deleteFolder(String path) { List<String> objects = getAllObjects(ensureTrailingSlashPresent(path)); for(String objectName : objects) { deleteObject(objectName); } deleteObject(ensureTrailingSlashPresent(path)); }

Target:
public void deleteFolder(String path) { List<String> objects = getAllObjects(path); Ordering<String> ordering = Ordering .from(Comparator .comparingInt(object -> -PATH_SPLITTER.splitToList(object).size())); ordering.sortedCopy(objects).forEach(o -> deleteObject(o)); deleteObject(ensureTrailingSlashPresent(path)); }
Source:
public FieldNode deepResolveField(@NotNull FieldInfo field) { ClassNode cls = resolveClass(field.getDeclClass()); if (cls == null) { return null; } FieldNode resolved; DexNode declDex = cls.dex(); resolved = declDex.deepResolveField(cls, field); if (resolved != null){ return resolved; } for (DexNode dexNode : dexNodes) { if(dexNodes == declDex) { continue; } resolved = dexNode.deepResolveField(cls, field); if (resolved != null){ return resolved; } } return null; }

Target:
public FieldNode deepResolveField(@NotNull FieldInfo field) { ClassNode cls = resolveClass(field.getDeclClass()); if (cls == null) { return null; } return cls.dex().deepResolveField(cls, field); }
Source:
public void foreach(Processor processor) throws FileNotFoundException, IOException { File myWar = GerritLauncher.getDistributionArchive(); if (myWar.isFile()) { try (ZipFile zf = new ZipFile(myWar)) { Enumeration<? extends ZipEntry> e = zf.entries(); while (e.hasMoreElements()) { ZipEntry ze = e.nextElement(); if (ze.isDirectory()) { continue; } if (ze.getName().startsWith(PLUGIN_DIR) && ze.getName().endsWith(JAR)) { String pluginJarName = new File(ze.getName()).getName(); String pluginName = pluginJarName.substring(0, pluginJarName.length() - JAR.length()); final InputStream in = zf.getInputStream(ze); processor.process(pluginName, in); in.close(); } } } } }

Target:
public void foreach(Processor processor) throws FileNotFoundException, IOException { File myWar = GerritLauncher.getDistributionArchive(); if (myWar.isFile()) { try (ZipFile zf = new ZipFile(myWar)) { Enumeration<? extends ZipEntry> e = zf.entries(); while (e.hasMoreElements()) { ZipEntry ze = e.nextElement(); if (ze.isDirectory()) { continue; } if (ze.getName().startsWith(PLUGIN_DIR) && ze.getName().endsWith(JAR)) { String pluginJarName = new File(ze.getName()).getName(); String pluginName = pluginJarName.substring(0, pluginJarName.length() - JAR.length()); try (InputStream in = zf.getInputStream(ze)) { processor.process(pluginName, in); } } } } } }
Source:
public WirelessDebuggingEnabler(Context context, SwitchWidgetController switchWidget, OnEnabledListener listener) { mContext = context; mSwitchWidget = switchWidget; mSwitchWidget.setListener(this); mListener = listener; setupSwitchController(); }

Target:
public WirelessDebuggingEnabler(Context context, SwitchWidgetController switchWidget, OnEnabledListener listener) { mContext = context; mSwitchWidget = switchWidget; mSwitchWidget.setListener(this); mListener = listener; mContentResolver = context.getContentResolver(); setupSwitchController(); mSettingsObserver = new ContentObserver(mHandler) { @Override public void onChange(boolean selfChange, Uri uri, int userId) { onWirelessDebuggingEnabled(isAdbWifiEnabled()); } }; }
Source:
private void launchPinCreateScreen(LoginMode loginMode) { launchPinCreateScreen(loginMode, null); }

Target:
private void launchPinCreateScreen(LoginMode loginMode) { Intent i = new Intent(this, CreatePinActivity.class); i.putExtra(LoginActivity.LOGIN_MODE, loginMode); startActivityForResult(i, CREATE_PIN); }
Source:
public void resume() { checkRealm(); pauseDepth--; if (dirty && pauseDepth == 0) { scheduleUpdate(); } }

Target:
public void resume() { checkRealm(); pauseDepth--; if (pauseDepth < 0) { throw new IllegalStateException( "Resume has unessesarily been called too often, so that the pauseDepth is below zero."); } else if (dirty && pauseDepth == 0) { scheduleUpdate(); } }
Source:
static <R extends Response> R extractResponseAndNotifyResponseHandler(ResponseHandler responseHandler, NonBlockingRouterMetrics routerMetrics, ResponseInfo responseInfo, Deserializer<R> deserializer, Function<R, ServerErrorCode> errorExtractor, boolean shareMemory) { R response = null; ReplicaId replicaId = responseInfo.getRequestInfo().getReplicaId(); NetworkClientErrorCode networkClientErrorCode = responseInfo.getError(); if (networkClientErrorCode == null) { try { DataInputStream dis = null; if (shareMemory) { dis = new CommonUtils.ByteBufferDataInputStream(responseInfo.getResponse()); } else { dis = new DataInputStream(new ByteBufferInputStream(responseInfo.getResponse())); } response = deserializer.readFrom(dis); responseHandler.onEvent(replicaId, errorExtractor.apply(response)); } catch (Exception e) { logger.error("Response deserialization received unexpected error", e); routerMetrics.responseDeserializationErrorCount.inc(); } } else { responseHandler.onEvent(replicaId, networkClientErrorCode); } return response; }

Target:
static <R extends Response> R extractResponseAndNotifyResponseHandler(ResponseHandler responseHandler, NonBlockingRouterMetrics routerMetrics, ResponseInfo responseInfo, Deserializer<R> deserializer, Function<R, ServerErrorCode> errorExtractor, boolean shareMemory) { R response = null; ReplicaId replicaId = responseInfo.getRequestInfo().getReplicaId(); NetworkClientErrorCode networkClientErrorCode = responseInfo.getError(); if (networkClientErrorCode == null) { try { DataInputStream dis = shareMemory ? new ByteBufferDataInputStream(responseInfo.getResponse()) : new DataInputStream(new ByteBufferInputStream(responseInfo.getResponse())); response = deserializer.readFrom(dis); responseHandler.onEvent(replicaId, errorExtractor.apply(response)); } catch (Exception e) { logger.error("Response deserialization received unexpected error", e); routerMetrics.responseDeserializationErrorCount.inc(); } } else { responseHandler.onEvent(replicaId, networkClientErrorCode); } return response; }
Source:
private List<Disk> getUnregisteredDisks() { Guid storagePoolId = getVds().getStoragePoolId(); Guid storageDomainId = getParameters().getStorageDomainId(); List<Disk> unregisteredDisks = new ArrayList<Disk>(); List<Guid> imagesFromVds = null; try { VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.GetImagesList, new GetImagesListVDSCommandParameters(storageDomainId, storagePoolId)); if (!vdsReturnValue.getSucceeded()) { log.warn("Failed to get a list of images for Storage Domain to register OVF disks."); return unregisteredDisks; } imagesFromVds = (List<Guid>) vdsReturnValue.getReturnValue(); } catch (VdcBLLException e) { log.warnFormat("Failed to get a list of images for Storage Domain to register OVF disks. Error: {0}", e); } for (Guid unregisteredDiskId : imagesFromVds) { populateUnregisteredDisksListWithUnregisteredDisk(storagePoolId, storageDomainId, unregisteredDisks, unregisteredDiskId); } return unregisteredDisks; }

Target:
private List<Disk> getUnregisteredDisks() { Guid storagePoolId = getVds().getStoragePoolId(); Guid storageDomainId = getParameters().getStorageDomainId(); List<Disk> unregisteredDisks = new ArrayList<Disk>(); List<Guid> imagesFromVds = null; try { VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.GetImagesList, new GetImagesListVDSCommandParameters(storageDomainId, storagePoolId)); if (!vdsReturnValue.getSucceeded()) { log.warn("Failed to get a list of images for Storage Domain to register OVF disks."); return unregisteredDisks; } imagesFromVds = (List<Guid>) vdsReturnValue.getReturnValue(); } catch (VdcBLLException e) { log.warnFormat("Failed to get a list of images for Storage Domain to register OVF disks. Error: {0}", e); return unregisteredDisks; } for (Guid unregisteredDiskId : imagesFromVds) { populateUnregisteredDisksListWithUnregisteredDisk(storagePoolId, storageDomainId, unregisteredDisks, unregisteredDiskId); } return unregisteredDisks; }
Source:
public CachedSchemaRegistryClientBuilder addSchemaParser(Codec codec) { if (CoreUtils.isNullOrEmpty(codec.schemaType())) { throw logger.logExceptionAsError( new IllegalArgumentException("Serialization type cannot be null or empty.")); } if (this.typeParserMap.containsKey(codec.schemaType())) { throw logger.logExceptionAsError( new IllegalArgumentException("Multiple parse methods for single serialization type may not be added.")); } this.typeParserMap.put(codec.schemaType(), codec::parseSchemaString); return this; }

Target:
public CachedSchemaRegistryClientBuilder addSchemaParser(Codec codec) { Objects.requireNonNull(codec, "'codec' cannot be null."); if (CoreUtils.isNullOrEmpty(codec.schemaType())) { throw logger.logExceptionAsError( new IllegalArgumentException("Serialization type cannot be null or empty.")); } if (this.typeParserMap.containsKey(codec.schemaType())) { throw logger.logExceptionAsError( new IllegalArgumentException("Multiple parse methods for single serialization type may not be added.")); } this.typeParserMap.put(codec.schemaType(), codec::parseSchemaString); return this; }
Source:
protected void onUpdateElement(Rule oldElement, Rule element) throws IllegalArgumentException { try { validateModuleIDs(element, element.getModules(Module.class)); resolveConfigurations(element); } catch (Exception e) { logger.debug("The new version of updated rule '{}' is invalid", element.getUID(), e); } }

Target:
protected void onUpdateElement(Rule oldElement, Rule element) throws IllegalArgumentException { String uid = element.getUID(); try { resolveConfigurations(element); } catch (IllegalArgumentException e) { logger.debug("The new version of updated rule '{}' is invalid", uid, e); } }
Source:
public void handleCommand(ChannelUID channelUID, Command command) { logger.trace("Command '{}' received for channel '{}'", command, channelUID); if (channelUID.getId().equals(CHANNEL_STATE)) { if (command instanceof OnOffType) { try { String binaryState = null; if (command.equals(OnOffType.ON)) { binaryState = "1"; } else if (command.equals(OnOffType.OFF)) { binaryState = "0"; } String soapHeader = "\"urn:Belkin:service:basicevent:1#SetBinaryState\""; String content = "<?xml version=\"1.0\"?>" + "<s:Envelope xmlns:s=\"<LINK_1>\" s:encodingStyle=\"<LINK_0>\">" + "<s:Body>" + "<u:SetBinaryState xmlns:u=\"urn:Belkin:service:basicevent:1\">" + "<BinaryState>" + binaryState + "</BinaryState>" + "</u:SetBinaryState>" + "</s:Body>" + "</s:Envelope>"; String wemoURL = getWemoURL("basicevent"); if (wemoURL != null) { String wemoCallResponse = WemoHttpCall.executeCall(wemoURL, soapHeader, content); } } catch (Exception e) { logger.error("Failed to send command '{}' for device '{}' ", command, getThing().getUID(), e); } } } }

Target:
public void handleCommand(ChannelUID channelUID, Command command) { logger.trace("Command '{}' received for channel '{}'", command, channelUID); if (channelUID.getId().equals(CHANNEL_STATE)) { if (command instanceof OnOffType) { try { String binaryState = null; if (command.equals(OnOffType.ON)) { binaryState = "1"; } else if (command.equals(OnOffType.OFF)) { binaryState = "0"; } String soapHeader = "\"urn:Belkin:service:basicevent:1#SetBinaryState\""; String content = "<?xml version=\"1.0\"?>" + "<s:Envelope xmlns:s=\"<LINK_1>\" s:encodingStyle=\"<LINK_0>\">" + "<s:Body>" + "<u:SetBinaryState xmlns:u=\"urn:Belkin:service:basicevent:1\">" + "<BinaryState>" + binaryState + "</BinaryState>" + "</u:SetBinaryState>" + "</s:Body>" + "</s:Envelope>"; String wemoURL = getWemoURL("basicevent"); if (wemoURL != null) { WemoHttpCall.executeCall(wemoURL, soapHeader, content); } } catch (Exception e) { logger.error("Failed to send command '{}' for device '{}' ", command, getThing().getUID(), e); } } } }
Source:
public void currentWithError() throws SystemException { doThrow(new SystemException()).when(mgr).getTransaction(); TransactionSupport.current(); }

Target:
public void currentWithError() throws SystemException { getTransactionThrowsSystemException(); TransactionSupport.current(); }
Source:
private IPersonAttributesGroupStoreDefinition getOrCreateStore() { List<IPersonAttributesGroupStoreDefinition> stores = personAttributesGroupStoreDefinitionDao.getPersonAttributesGroupStoreDefinitions(); if (stores.size() == 0) { return personAttributesGroupStoreDefinitionDao.createPersonAttributesGroupStoreDefinition("Default", "Default Person Attribute Group Store"); } else { return stores.get(0); } }

Target:
private IPersonAttributesGroupStoreDefinition getOrCreateStore() { Set<IPersonAttributesGroupStoreDefinition> stores = personAttributesGroupStoreDefinitionDao.getPersonAttributesGroupStoreDefinitions(); if (stores.size() == 0) { return personAttributesGroupStoreDefinitionDao.createPersonAttributesGroupStoreDefinition("Default", "Default Person Attribute Group Store"); } else { return stores.iterator().next(); } }
Source:
private static void writeBytesIntoSmooshedChannel( long numBytesToPutInFile, final byte[] buffer, final SmooshedWriter smooshChannel, final InputStream is ) throws IOException { while (numBytesToPutInFile > 0) { int bytesRead = is.read(buffer, 0, Math.min(buffer.length, (int) numBytesToPutInFile)); smooshChannel.write((ByteBuffer) ByteBuffer.wrap(buffer).limit(bytesRead)); numBytesToPutInFile -= bytesRead; } }

Target:
private static void writeBytesIntoSmooshedChannel( long numBytesToPutInFile, final byte[] buffer, final SmooshedWriter smooshChannel, final InputStream is ) throws IOException { ByteBuffer holderBuffer = ByteBuffer.wrap(buffer); while (numBytesToPutInFile > 0) { int bytesRead = is.read(buffer, 0, Math.min(buffer.length, Ints.saturatedCast(numBytesToPutInFile))); if (bytesRead != -1) { smooshChannel.write((ByteBuffer) holderBuffer.clear().limit(bytesRead)); numBytesToPutInFile -= bytesRead; } else { throw new ISE("Could not write [%d] bytes into smooshChannel.", numBytesToPutInFile); } } }
Source:
public void beforeAll(final ExtensionContext context) { if (!started) { started = true; try { support.before(); } catch (final RuntimeException e) { } context.getRoot().getStore(GLOBAL).put("dropwizard-startup", this); } }

Target:
public void beforeAll(final ExtensionContext context) { if (started.compareAndSet(false, true)) { try { support.before(); } catch (final RuntimeException e) { } context.getRoot().getStore(GLOBAL).put("dropwizard-startup", this); } }
Source:
public Options getOptions() { return new Options() .addOption(MEMORY_OPTION) .addOption(READABLE_OPTION) .addOption(SUMMARIZE_OPTION) .addOption(GROUP_BY_WORKER_OPTION); }

Target:
public Options getOptions() { return new Options() .addOption(GROUP_BY_WORKER_OPTION) .addOption(MEMORY_OPTION) .addOption(READABLE_OPTION) .addOption(SUMMARIZE_OPTION); }
Source:
public Map<Map.Entry<Long, Long>, Void> apply(Set<Map.Entry<Long, Long>> request) { CacheDescriptor cacheDescriptor = offHeapTimestampCache.cacheDescriptor.get(); if (cacheDescriptor.currentSize().get() >= offHeapTimestampCache.maxSize.getAsLong()) { offHeapTimestampCache.taggedMetricRegistry.counter(CACHE_NUKE).inc(); offHeapTimestampCache.clear(); } cacheDescriptor = offHeapTimestampCache.cacheDescriptor.get(); try { List<Long> toWrite = request.stream().map(Map.Entry::getKey).collect(Collectors.toList()); Map<Long, Long> response = offHeapTimestampCache.timestampStore.get( cacheDescriptor.entryFamily(), toWrite); int sizeIncrease = Sets.difference(request, response.entrySet()).size(); offHeapTimestampCache.timestampStore.put(cacheDescriptor.entryFamily(), ImmutableMap.copyOf(request)); cacheDescriptor.currentSize().addAndGet(sizeIncrease); } catch (SafeIllegalArgumentException exception) { log.warn("Clear called concurrently, writing failed", exception); } finally { offHeapTimestampCache.inflightRequests.clear(); } return KeyedStream.of(request.stream()).map(value -> (Void) null).collectToMap(); }

Target:
public Map<Map.Entry<Long, Long>, Void> apply(Set<Map.Entry<Long, Long>> request) { CacheDescriptor cacheDescriptor = offHeapTimestampCache.cacheDescriptor.get(); if (cacheDescriptor.currentSize().get() >= offHeapTimestampCache.maxSize.getAsLong()) { offHeapTimestampCache.taggedMetricRegistry.counter(CACHE_NUKE).inc(); offHeapTimestampCache.clear(); } cacheDescriptor = offHeapTimestampCache.cacheDescriptor.get(); Set<Map.Entry<ByteString, ByteString>> serializedRequest = request.stream() .map(this::serializeEntry) .collect(Collectors.toSet()); try { List<ByteString> toWrite = serializedRequest.stream() .map(Map.Entry::getKey) .collect(Collectors.toList()); Map<ByteString, ByteString> response = offHeapTimestampCache.persistentStore.get(cacheDescriptor.handle(), toWrite); int sizeIncrease = Sets.difference(request, response.entrySet()).size(); cacheDescriptor.currentSize().addAndGet(sizeIncrease); offHeapTimestampCache.persistentStore.put( cacheDescriptor.handle(), ImmutableMap.copyOf(serializedRequest)); } catch (SafeIllegalArgumentException exception) { log.warn("Clear called concurrently, writing failed", exception); } return KeyedStream.of(request.stream()).<Void>map(value -> null).collectToMap(); }
Source:
private void checkForChangedCCZ() { Intent i = new Intent(getApplicationContext(), UpdateActivity.class); startActivity(i); }

Target:
private void checkForChangedCCZ() { alreadyCheckedForAppFilesChange = true; Intent i = new Intent(getApplicationContext(), UpdateActivity.class); startActivity(i); }
Source:
private boolean deleteCertificate(String hashToken) { boolean deleteStatus = false; try { SimpleCertificateResponseMessageType response = service .deleteCertificateFromTrustStore(selectedTSCertificate.getAlias(), hashToken); deleteStatus = response.isStatus(); if (deleteStatus) { refreshCerts(); selectedTSCertificate = null; } else { HelperUtil.addMessageError("deletePassKeyErrorMsg", response.getMessage()); } } catch (CertificateManagerException ex) { LOG.error("Unable to delete certificate {}", ex.getLocalizedMessage(), ex); HelperUtil.addMessageError("deletePassKeyErrorMsg", ex.getLocalizedMessage()); } return deleteStatus; }

Target:
private boolean deleteCertificate(String hashToken) { boolean deleteStatus = false; try { SimpleCertificateResponseMessageType response = service .deleteCertificateFromTrustStore(selectedTSCertificate.getAlias(), hashToken); deleteStatus = response.isStatus(); if (deleteStatus) { refreshCerts(); selectedTSCertificate = null; } else { HelperUtil.addMessageError(DELETE_PASS_ERR_MSG_ID, response.getMessage()); } } catch (CertificateManagerException ex) { LOG.error("Unable to delete certificate {}", ex.getLocalizedMessage(), ex); HelperUtil.addMessageError(DELETE_PASS_ERR_MSG_ID, ex.getLocalizedMessage()); } return deleteStatus; }
Source:
public Optional<Decorrelated> decorrelate(PlanNode reference) { checkArgument(reference instanceof GroupReference); return lookup.resolve(reference).accept(this, reference); }

Target:
public Optional<Decorrelated> decorrelate(PlanNode reference) { return lookup.resolve(reference).accept(this, reference); }
Source:
public List<String> getActiveProcessorsIDs(List<String> znodeIds) { String processorPath = keyBuilder.getProcessorsPath(); List<String> processorIds = new ArrayList<>(znodeIds.size()); if (znodeIds.size() > 0) { for (String child : znodeIds) { String fullPath = String.format("%s/%s", processorPath, child); processorIds.add(new ProcessorData(readProcessorData(fullPath)).getProcessorId()); } Collections.sort(processorIds, new Comparator<String>() { @Override public int compare(String o1, String o2) { return Integer.valueOf(o1) - Integer.valueOf(o2); } }); LOG.info("Found these children - " + znodeIds); LOG.info("Found these processorIds - " + processorIds); } return processorIds; }

Target:
public List<String> getActiveProcessorsIDs(List<String> znodeIds) { String processorPath = keyBuilder.getProcessorsPath(); List<String> processorIds = new ArrayList<>(znodeIds.size()); if (znodeIds.size() > 0) { for (String child : znodeIds) { String fullPath = String.format("%s/%s", processorPath, child); processorIds.add(new ProcessorData(readProcessorData(fullPath)).getProcessorId()); } Collections.sort(processorIds); LOG.info("Found these children - " + znodeIds); LOG.info("Found these processorIds - " + processorIds); } return processorIds; }
Source:
public List<CohortMembership> getMemberships(Date asOf) { return getMembers().stream() .filter(m -> m.getStartDate().after(asOf)).collect(Collectors.toList()); }

Target:
public List<CohortMembership> getMemberships(Date asOf) { return getMembers().stream() .filter(m -> !m.getStartDate().before(asOf)).collect(Collectors.toList()); }
Source:
public void prerender() { AdapterAuthenticationProxyObjectFactory factory = new AdapterAuthenticationProxyObjectFactory(); AdapterAuthenticationProxy adapterAuthenticationProxy = factory.getAdapterAuthenticationProxy(); AuthenticateUserRequestType authRequest = new AuthenticateUserRequestType(); authRequest.setUserName("Default"); authRequest.setPassword("Default"); AuthenticateUserResponseType authResp = adapterAuthenticationProxy.authenticateUser(authRequest); if (authResp != null) { LOG.debug("UserLogin.prerender Authentication Service Avail: {}", adapterAuthenticationProxy, authResp.isIsAuthenticationAvailable()); if (!authResp.isIsAuthenticationAvailable()) { try { getUserSession().setAuthToken("NoOpToken"); FacesContext context = FacesContext.getCurrentInstance(); context.getExternalContext().redirect("faces/SearchPatient.jsp"); } catch (IOException ex) { LOG.error("CPP GUI can not prerender UserLogin: ", ex); } } } try { String agencyName = PropertyAccessor.getInstance().getProperty(PROPERTY_FILE_NAME_ADAPTER, PROPERTY_FILE_KEY_AGENCY); agencyLogo.setText(agencyName); } catch (PropertyAccessException ex) { LOG.error("CPP GUI can not access property: ", PROPERTY_FILE_KEY_AGENCY, ex.getLocalizedMessage(), ex); } }

Target:
public void prerender() { AdapterAuthenticationProxyObjectFactory factory = new AdapterAuthenticationProxyObjectFactory(); AdapterAuthenticationProxy adapterAuthenticationProxy = factory.getAdapterAuthenticationProxy(); AuthenticateUserRequestType authRequest = new AuthenticateUserRequestType(); authRequest.setUserName("Default"); authRequest.setPassword("Default"); AuthenticateUserResponseType authResp = adapterAuthenticationProxy.authenticateUser(authRequest); if (authResp != null) { LOG.debug("UserLogin.prerender Authentication Service Avail: {}", adapterAuthenticationProxy, authResp.isIsAuthenticationAvailable()); if (!authResp.isIsAuthenticationAvailable()) { try { getUserSession().setAuthToken("NoOpToken"); FacesContext context = FacesContext.getCurrentInstance(); context.getExternalContext().redirect("faces/SearchPatient.jsp"); } catch (IOException ex) { LOG.error("CPP GUI can not prerender UserLogin: ", ex.getLocalizedMessage(), ex); } } } try { String agencyName = PropertyAccessor.getInstance().getProperty(PROPERTY_FILE_NAME_ADAPTER, PROPERTY_FILE_KEY_AGENCY); agencyLogo.setText(agencyName); } catch (PropertyAccessException ex) { LOG.error("CPP GUI can not access property: ", PROPERTY_FILE_KEY_AGENCY, ex.getLocalizedMessage(), ex); } }
Source:
public DelegatingResourceDescription getRepresentationDescription(Representation rep) { RefRepresentation refRep = new RefRepresentation(); DelegatingResourceDescription description = new DelegatingResourceDescription(); description.addProperty("allergenType"); description.addProperty("codedAllergen"); description.addProperty("nonCodedAllergen"); return description; }

Target:
public DelegatingResourceDescription getRepresentationDescription(Representation rep) { DelegatingResourceDescription description = new DelegatingResourceDescription(); if (rep instanceof DefaultRepresentation) { description.addProperty("allergenType", Representation.REF); description.addProperty("codedAllergen", Representation.REF); description.addProperty("nonCodedAllergen"); } else if (rep instanceof FullRepresentation) { description.addProperty("allergenType", Representation.DEFAULT); description.addProperty("codedAllergen", Representation.DEFAULT); description.addProperty("nonCodedAllergen"); } return description; }
Source:
public void copyFolder(File src, File dest) throws IOException { if (src.isDirectory()) { if (!dest.exists()) { dest.mkdir(); log.info("Directory copied from " + src + " to " + dest); } String files[] = src.list(); for (String file : files) { File srcFile = new File(src, file); File destFile = new File(dest, file); copyFolder(srcFile, destFile); } } else { InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dest); byte[] buffer = new byte[1024]; int length; while ((length = in.read(buffer)) > 0) { out.write(buffer, 0, length); } in.close(); out.close(); log.info("File copied from " + src + " to " + dest); } }

Target:
public void copyFolder(File src, File dest) throws CarbonToolsIntegrationTestException { if (src.isDirectory()) { if (!dest.exists()) { dest.mkdir(); log.info("Directory copied from " + src + " to " + dest); } String files[] = src.list(); for (String file : files) { File srcFile = new File(src, file); File destFile = new File(dest, file); copyFolder(srcFile, destFile); } } else { try { InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dest); byte[] buffer = new byte[1024]; int length; while ((length = in.read(buffer)) > 0) { out.write(buffer, 0, length); } in.close(); out.close(); }catch (IOException ex){ log.error("Error while copying folder " + ex.getMessage()); throw new CarbonToolsIntegrationTestException("Error while copying folder ", ex); } log.info("File copied from " + src + " to " + dest); } }
Source:
protected HttpClient createHttpClient() throws Error { int port = getPort(); Credentials credentials = null; AuthSchemeRegistry schemeRegistry = new AuthSchemeRegistry(); AuthScope authScope = new AuthScope(getHost(), port, AuthScope.ANY_REALM, AuthScope.ANY_SCHEME); if (timeout != -1) { HttpParams httpParams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParams, timeout); DefaultHttpClient.setDefaultHttpParams(httpParams); } if (user != null && user.length() > 0) { schemeRegistry.register(AuthPolicy.BASIC, new BasicSchemeFactory()); credentials = new UsernamePasswordCredentials(user, password); } else if (kerberos) { schemeRegistry.register(AuthPolicy.SPNEGO, new SPNegoSchemeFactory(true)); credentials = new Credentials() { @Override public Principal getUserPrincipal() { return null; } @Override public String getPassword() { return null; } }; } DefaultHttpClient client = new DefaultHttpClient( new BasicClientConnectionManager(createConnectionSocketFactoryRegistry()) ); client.setAuthSchemes(schemeRegistry); client.getCredentialsProvider().setCredentials(authScope, credentials); client.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.IGNORE_COOKIES); if (compress) { return new HttpClient42(new DecompressingHttpClient(client)); } return new HttpClient42(client); }

Target:
protected HttpClient createHttpClient() { int port = getPort(); Credentials credentials = null; AuthSchemeRegistry schemeRegistry = new AuthSchemeRegistry(); AuthScope authScope = new AuthScope(getHost(), port, AuthScope.ANY_REALM, AuthScope.ANY_SCHEME); if (timeout != -1) { HttpParams httpParams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParams, timeout); DefaultHttpClient.setDefaultHttpParams(httpParams); } if (user != null && user.length() > 0) { schemeRegistry.register(AuthPolicy.BASIC, new BasicSchemeFactory()); credentials = new UsernamePasswordCredentials(user, password); } else if (kerberos) { schemeRegistry.register(AuthPolicy.SPNEGO, new SPNegoSchemeFactory(true)); credentials = new Credentials() { @Override public Principal getUserPrincipal() { return null; } @Override public String getPassword() { return null; } }; } DefaultHttpClient client = new DefaultHttpClient( new BasicClientConnectionManager(createConnectionSocketFactoryRegistry()) ); client.setAuthSchemes(schemeRegistry); client.getCredentialsProvider().setCredentials(authScope, credentials); client.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.IGNORE_COOKIES); if (compress) { return new HttpClient42(new DecompressingHttpClient(client)); } return new HttpClient42(client); }
Source:
public PrivateKey parsePrivateKey(final String key) throws IOException { try (final PemReader pemReader = new PemReader(new StringReader(key));) { final PemObject pemObject = pemReader.readPemObject(); final byte[] content = pemObject.getContent(); final PKCS8EncodedKeySpec privKeySpec = new PKCS8EncodedKeySpec(content); final KeyFactory factory = KeyFactory.getInstance("RSA", "BC"); return factory.generatePrivate(privKeySpec); } catch (NoSuchAlgorithmException | NoSuchProviderException e) { throw new IOException("No encryption provider available.", e); } catch (final InvalidKeySpecException e) { throw new IOException("Invalid Key format or invalid password.", e); } }

Target:
public PrivateKey parsePrivateKey(final String key) throws IOException { try (final PemReader pemReader = new PemReader(new StringReader(key));) { final PemObject pemObject = pemReader.readPemObject(); final byte[] content = pemObject.getContent(); final PKCS8EncodedKeySpec privKeySpec = new PKCS8EncodedKeySpec(content); final KeyFactory factory = KeyFactory.getInstance("RSA", "BC"); return factory.generatePrivate(privKeySpec); } catch (NoSuchAlgorithmException | NoSuchProviderException e) { throw new IOException("No encryption provider available.", e); } catch (final InvalidKeySpecException e) { throw new IOException("Invalid Key format.", e); } }
Source:
protected boolean sieveMessage(MailAddress recipient, Mail aMail) throws MessagingException { try { ResourceLocator.UserSieveInformation userSieveInformation = resourceLocator.get(recipient); sieveMessageEvaluate(recipient, aMail, userSieveInformation); return true; } catch (ScriptNotFoundException e) { if (LOGGER.isInfoEnabled()) { LOGGER.info("Can not locate SIEVE script for user " + recipient.asPrettyString()); } return false; } catch (Exception ex) { if (LOGGER.isErrorEnabled()) { LOGGER.error("Cannot evaluate Sieve script for user " + recipient.asPrettyString(), ex); } return false; } }

Target:
protected boolean sieveMessage(MailAddress recipient, Mail aMail) throws MessagingException { try { ResourceLocator.UserSieveInformation userSieveInformation = resourceLocator.get(recipient); sieveMessageEvaluate(recipient, aMail, userSieveInformation); return true; } catch (ScriptNotFoundException e) { LOGGER.info("Can not locate SIEVE script for user {}", recipient.asPrettyString()); return false; } catch (Exception ex) { LOGGER.error("Cannot evaluate Sieve script for user {}", recipient.asPrettyString(), ex); return false; } }
Source:
private boolean handleSpecialTTEFunctions( JSType type, String propName, boolean isStatic, Set<String> classTemplateTypeNames) { FunctionType ftype = type.toMaybeFunctionType(); if (ftype == null) return false; boolean hasTTE = false; for (TemplateType templateKey : ftype.getTemplateTypeMap().getTemplateKeys()) { if (templateKey.getTypeTransformation() != null) { hasTTE = true; break; } } boolean horribleAsyncHack = false; JSDocInfo info = type.getJSDocInfo(); if (info != null) { boolean isUntypedOverride = info.isOverride() && info.getParameterCount() == 0 && info.getReturnType() == null; if (opts.partialInput && info != null && isUntypedOverride && propName.equals("then")) { horribleAsyncHack = true; } } if (!horribleAsyncHack && !hasTTE) return false; String templateTypeSig = isStatic ? getSignatureForStaticTTEFn(propName, ftype) : getSignatureForInstanceTTEFn(propName, classTemplateTypeNames, ftype); if (templateTypeSig == null) { emit(" "); emitBreak(); return false; } emit(templateTypeSig); emitBreak(); return true; }

Target:
private boolean handleSpecialTTEFunctions( JSType type, String propName, boolean isStatic, Set<String> classTemplateTypeNames) { FunctionType ftype = type.toMaybeFunctionType(); if (ftype == null) return false; boolean hasTTE = false; for (TemplateType templateKey : ftype.getTemplateTypeMap().getTemplateKeys()) { if (templateKey.getTypeTransformation() != null) { hasTTE = true; break; } } boolean horribleHackForPartialModeWithOverrides = false; JSDocInfo info = type.getJSDocInfo(); if (info != null) { boolean isUntypedOverride = info.isOverride() && info.getParameterCount() == 0 && info.getReturnType() == null; if (opts.partialInput && isUntypedOverride && propName.equals("then")) { horribleHackForPartialModeWithOverrides = true; } } if (!horribleHackForPartialModeWithOverrides && !hasTTE) return false; String templateTypeSig = isStatic ? getSignatureForStaticTTEFn(propName, ftype) : getSignatureForInstanceTTEFn(propName, classTemplateTypeNames, ftype); if (templateTypeSig == null) { emit(" "); emitBreak(); return false; } emit(templateTypeSig); emitBreak(); return true; }
Source:
public void refreshJobInfo(JobInfo info) { GroupInfo group = info.getGroupInfo(); if (group != null) { refreshGroup(group); } Object[] listenersArray = listeners.getListeners(); for (Object element : listenersArray) { IJobProgressManagerListener listener = (IJobProgressManagerListener) element; if (!isCurrentDisplaying(info.getJob(), listener.showsDebug())) { listener.refreshJobInfo(info); } } }

Target:
public void refreshJobInfo(JobInfo info) { GroupInfo group = info.getGroupInfo(); if (group != null) { refreshGroup(group); } for (Object element : listeners.getListeners()) { IJobProgressManagerListener listener = (IJobProgressManagerListener) element; if (!isCurrentDisplaying(info.getJob(), listener.showsDebug())) { listener.refreshJobInfo(info); } } }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { ISelection selection = HandlerUtil.getCurrentSelection(event); TmfExperimentElement experiment = (TmfExperimentElement) ((StructuredSelection) selection).getFirstElement(); Shell shell = HandlerUtil.getActiveShellChecked(event); CopyExperimentDialog dialog = new CopyExperimentDialog(shell, experiment); dialog.open(); return null; }

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { ISelection selection = HandlerUtil.getCurrentSelectionChecked(event); if (!(selection instanceof IStructuredSelection)) { return null; } TmfExperimentElement experiment = (TmfExperimentElement) ((IStructuredSelection) selection).getFirstElement(); Shell shell = HandlerUtil.getActiveShellChecked(event); CopyExperimentDialog dialog = new CopyExperimentDialog(shell, experiment); dialog.open(); return null; }
Source:
public Object[][] provideKeys() { return new Object[][] { new Object[] {0, 3, 0, 3, 0, 0}, new Object[] {3, 0, 3, 0, 0, 0}, new Object[] {1, 1, 1, 1, 0, 0}, new Object[] {0, 0, 0, 0, 0, 0}, new Object[] {0, 3, 0, 0, 0, 1}, new Object[] {3, 0, 0, 0, 0, 1}, new Object[] {1, 1, 0, 0, 0, 2}, new Object[] {0, 0, 0, 0, 0, 1}, new Object[] {0, 3, 0, 3, 1, 1}, new Object[] {3, 0, 3, 0, 1, 1}, new Object[] {1, 1, 1, 1, 2, 2}, new Object[] {0, 0, 0, 0, 1, 1} }; }

Target:
public Object[][] provideKeys() { return new Object[][] { {0, 3, 0, 3, 0, 0}, {3, 0, 3, 0, 0, 0}, {1, 1, 1, 1, 0, 0}, {0, 0, 0, 0, 0, 0}, {0, 3, 0, 0, 0, 1}, {3, 0, 0, 0, 0, 1}, {1, 1, 0, 0, 0, 2}, {0, 0, 0, 0, 0, 1}, {0, 3, 0, 3, 1, 1}, {3, 0, 3, 0, 1, 1}, {1, 1, 1, 1, 2, 2}, {0, 0, 0, 0, 1, 1} }; }
Source:
private Map<String, AttributeValue> getAttributeMapFromCalibration(final Calibration calibration) { final Map<String, AttributeValue> attributes = new HashMap<>(); attributes.put(SENSE_ATTRIBUTE_NAME, new AttributeValue().withS(calibration.senseId)); attributes.put(DUST_OFFSET_ATTRIBUTE_NAME, new AttributeValue().withN(String.valueOf(calibration.dustOffset))); attributes.put(TESTED_AT_ATTRIBUTE_NAME, new AttributeValue().withN(String.valueOf(calibration.testedAt))); return attributes; }

Target:
private Map<String, AttributeValue> getAttributeMapFromCalibration(final Calibration calibration) { final Map<String, AttributeValue> attributes = Maps.newHashMap(); attributes.put(SENSE_ATTRIBUTE_NAME, new AttributeValue().withS(calibration.senseId)); attributes.put(DUST_OFFSET_ATTRIBUTE_NAME, new AttributeValue().withN(String.valueOf(calibration.dustOffset))); attributes.put(TESTED_AT_ATTRIBUTE_NAME, new AttributeValue().withN(String.valueOf(calibration.testedAt))); return attributes; }